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

Method GetDumpProgress

driver/common/store.go:651–670  ·  view source on GitHub ↗

return: ExecRowCount, TotalRowCount

(jobName string)

Source from the content-addressed store, hash-verified

649
650// return: ExecRowCount, TotalRowCount
651func (sm *StoreManager) GetDumpProgress(jobName string) (int64, int64, error) {
652 key := fmt.Sprintf("dtle/%v/DumpProgress", jobName)
653 kv, err:= sm.consulStore.Get(key)
654 if err == store.ErrKeyNotFound {
655 return 0, 0, nil
656 } else if err != nil {
657 return 0, 0, err
658 }
659
660 var r []int64
661 err = json.Unmarshal(kv.Value, &r)
662 if err != nil {
663 return 0, 0, err
664 }
665 if len(r) != 2 {
666 return 0, 0, fmt.Errorf("unexpected len for %v. found %v", key, len(r))
667 }
668
669 return r[0], r[1], nil
670}
671
672// consul store item
673

Callers 1

getTaskProgressFunction · 0.95

Calls 2

GetMethod · 0.80
UnmarshalMethod · 0.65

Tested by

no test coverage detected