MCPcopy Create free account
hub / github.com/actiontech/dtle / GetBinlogFilePosForJob

Method GetBinlogFilePosForJob

driver/common/store.go:67–91  ·  view source on GitHub ↗
(jobName string)

Source from the content-addressed store, hash-verified

65 return err
66}
67func (sm *StoreManager) GetBinlogFilePosForJob(jobName string) (*mysql.Position, error) {
68 key := fmt.Sprintf("dtle/%v/BinlogFilePos", jobName)
69 p, err := sm.consulStore.Get(key)
70 if err == store.ErrKeyNotFound {
71 return &mysql.Position{
72 Name: "",
73 Pos: 0,
74 }, nil
75 } else if err != nil {
76 return nil, err
77 }
78 s := string(p.Value)
79 ss := strings.Split(s, binlogFilePosSeparator)
80 if len(ss) != 2 {
81 return nil, fmt.Errorf("Unexpected BinlogFilePos format. value %v", s)
82 }
83 pos, err := strconv.Atoi(ss[1])
84 if err != nil {
85 return nil, errors.Wrap(err, "Atoi")
86 }
87 return &mysql.Position{
88 Name: ss[0],
89 Pos: uint32(pos),
90 }, nil
91}
92func (sm *StoreManager) GetGtidForJob(jobName string) (string, error) {
93 key := fmt.Sprintf("dtle/%v/Gtid", jobName)
94 p, err := sm.consulStore.Get(key)

Callers 2

RunMethod · 0.80
GetGtidFromConsulFunction · 0.80

Calls 1

GetMethod · 0.80

Tested by

no test coverage detected