Skip to content

Commit cb479a1

Browse files
committed
Remove unused functions in binlog_file.go
1 parent 1b7933a commit cb479a1

File tree

1 file changed

+0
-53
lines changed

1 file changed

+0
-53
lines changed

go/mysql/binlog_file.go

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,11 @@
77
package mysql
88

99
import (
10-
"errors"
1110
"fmt"
12-
"regexp"
1311
"strconv"
1412
"strings"
1513
)
1614

17-
var detachPattern *regexp.Regexp
18-
19-
func init() {
20-
detachPattern, _ = regexp.Compile(`//([^/:]+):([\d]+)`) // e.g. `//binlog.01234:567890`
21-
}
22-
2315
// FileBinlogCoordinates described binary log coordinates in the form of a binlog file & log position.
2416
type FileBinlogCoordinates struct {
2517
LogFile string
@@ -120,51 +112,6 @@ func (this *FileBinlogCoordinates) FileNumber() (int, int) {
120112
return fileNum, numLen
121113
}
122114

123-
// PreviousFileCoordinatesBy guesses the filename of the previous binlog/relaylog, by given offset (number of files back)
124-
func (this *FileBinlogCoordinates) PreviousFileCoordinatesBy(offset int) (BinlogCoordinates, error) {
125-
result := &FileBinlogCoordinates{}
126-
127-
fileNum, numLen := this.FileNumber()
128-
if fileNum == 0 {
129-
return result, errors.New("Log file number is zero, cannot detect previous file")
130-
}
131-
newNumStr := fmt.Sprintf("%d", (fileNum - offset))
132-
newNumStr = strings.Repeat("0", numLen-len(newNumStr)) + newNumStr
133-
134-
tokens := strings.Split(this.LogFile, ".")
135-
tokens[len(tokens)-1] = newNumStr
136-
result.LogFile = strings.Join(tokens, ".")
137-
return result, nil
138-
}
139-
140-
// PreviousFileCoordinates guesses the filename of the previous binlog/relaylog
141-
func (this *FileBinlogCoordinates) PreviousFileCoordinates() (BinlogCoordinates, error) {
142-
return this.PreviousFileCoordinatesBy(1)
143-
}
144-
145-
// PreviousFileCoordinates guesses the filename of the previous binlog/relaylog
146-
func (this *FileBinlogCoordinates) NextFileCoordinates() (BinlogCoordinates, error) {
147-
result := &FileBinlogCoordinates{}
148-
149-
fileNum, numLen := this.FileNumber()
150-
newNumStr := fmt.Sprintf("%d", (fileNum + 1))
151-
newNumStr = strings.Repeat("0", numLen-len(newNumStr)) + newNumStr
152-
153-
tokens := strings.Split(this.LogFile, ".")
154-
tokens[len(tokens)-1] = newNumStr
155-
result.LogFile = strings.Join(tokens, ".")
156-
return result, nil
157-
}
158-
159-
// FileSmallerThan returns true if this coordinate's file is strictly smaller than the other's.
160-
func (this *FileBinlogCoordinates) DetachedCoordinates() (isDetached bool, detachedLogFile string, detachedLogPos string) {
161-
detachedCoordinatesSubmatch := detachPattern.FindStringSubmatch(this.LogFile)
162-
if len(detachedCoordinatesSubmatch) == 0 {
163-
return false, "", ""
164-
}
165-
return true, detachedCoordinatesSubmatch[1], detachedCoordinatesSubmatch[2]
166-
}
167-
168115
func (this *FileBinlogCoordinates) Clone() BinlogCoordinates {
169116
return &FileBinlogCoordinates{
170117
LogPos: this.LogPos,

0 commit comments

Comments
 (0)