(jobName string)
| 65 | return err |
| 66 | } |
| 67 | func (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 | } |
| 92 | func (sm *StoreManager) GetGtidForJob(jobName string) (string, error) { |
| 93 | key := fmt.Sprintf("dtle/%v/Gtid", jobName) |
| 94 | p, err := sm.consulStore.Get(key) |
no test coverage detected