-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathplugin_demo.go
More file actions
56 lines (49 loc) · 1.26 KB
/
plugin_demo.go
File metadata and controls
56 lines (49 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package sync
import (
"fmt"
"github.com/pingcap/log"
"github.com/pingcap/tidb-binlog/drainer/loopbacksync"
"github.com/pingcap/tidb-binlog/drainer/relay"
"github.com/pingcap/tidb-binlog/drainer/translator"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/zap"
)
//SyncerDemo is a syncer demo
type SyncerDemo struct {
*baseSyncer
}
//Sync is the method that interface must implement
func (sd *SyncerDemo) Sync(item *Item) error {
//demo
log.Info("item", zap.String("%s", fmt.Sprintf("%v", item)))
sd.success <- item
return nil
}
//Close is the method that interface must implement
func (sd *SyncerDemo) Close() error {
return nil
}
//SetSafeMode is the method that interface must implement
func (sd *SyncerDemo) SetSafeMode(mode bool) bool {
return false
}
//NewSyncerDemo is a syncer demo
func NewSyncerDemo(
cfg *DBConfig,
file string,
tableInfoGetter translator.TableInfoGetter,
worker int,
batchSize int,
queryHistogramVec *prometheus.HistogramVec,
sqlMode *string,
destDBType string,
relayer relay.Relayer,
info *loopbacksync.LoopBackSync,
enableDispatch bool,
enableCausility bool,
) (Syncer, error) {
log.Info("call NewSyncerDemo()")
executor := &SyncerDemo{}
executor.baseSyncer = newBaseSyncer(tableInfoGetter)
return executor, nil
}