(worker *Worker)
| 49 | } |
| 50 | |
| 51 | func 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 |
| 72 | func (controller *WriteController) SetInitSyncFinishTs(fullSyncFinishPosition int64) { |
no test coverage detected