MCPcopy
hub / github.com/alibaba/MongoShake / NewWriteController

Function NewWriteController

collector/write_controller.go:51–69  ·  view source on GitHub ↗
(worker *Worker)

Source from the content-addressed store, hash-verified

49}
50
51func NewWriteController(worker *Worker) *WriteController {
52 writeController := &WriteController{worker: worker}
53 if !writeController.installModules() {
54 return nil
55 }
56
57 // create t by options
58 factory := tunnel.WriterFactory{Name: conf.Options.Tunnel}
59 if writeController.tunnel = factory.Create(conf.Options.TunnelAddress, worker.id); writeController.tunnel != nil {
60 if writeController.tunnel.Prepare() {
61 if writeController.tunnel.Name() == "direct" {
62 dw := writeController.tunnel.(*tunnel.DirectWriter)
63 dw.BatchExecutor.MetricName = worker.syncer.Replset
64 }
65 return writeController
66 }
67 }
68 return nil
69}
70
71// set init sync finish timestamp if tunnel is direct
72func (controller *WriteController) SetInitSyncFinishTs(fullSyncFinishPosition int64) {

Callers 1

InitMethod · 0.85

Calls 4

installModulesMethod · 0.95
CreateMethod · 0.95
PrepareMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected