Documentation
¶
Index ¶
- Constants
- func SynchronizeCollection(ctx context.Context, batchSize int, sourceReader ItemReader, ...) error
- type DeltaReplication
- type DocumentReader
- type DocumentWriter
- type ItemReader
- type MongoItemReader
- type MongoSynchronizer
- type QpsLimit
- type Snapshot
- type SyncProgress
- type Synchronizer
- type WriteResult
Constants ¶
View Source
const (
MAX_BUFFER_BYTE_SIZE = 12 * 1024 * 1024
)
Variables ¶
This section is empty.
Functions ¶
func SynchronizeCollection ¶
func SynchronizeCollection(ctx context.Context, batchSize int, sourceReader ItemReader, targetReader ItemReader, synchronizer Synchronizer, database string, collection string) error
Types ¶
type DeltaReplication ¶
type DeltaReplication struct { }
type DocumentReader ¶
type DocumentReader struct { // The database name Database string // The name of the collection Collection string // The batch size Batch int // The source database Source *mdb.MDB // The document writer Writer *DocumentWriter // Progression state Progress *SyncProgress }
func NewDocumentReader ¶
func NewDocumentReader(database string, collection string, source *mdb.MDB, batch int, writer *DocumentWriter) *DocumentReader
func (*DocumentReader) Replicate ¶
func (r *DocumentReader) Replicate(ctx context.Context) error
Read a batch of documents from the source
func (*DocumentReader) ReportResult ¶
func (r *DocumentReader) ReportResult(result WriteResult)
Report the result of the write operation
func (*DocumentReader) SetProgress ¶
func (r *DocumentReader) SetProgress(progress *SyncProgress)
Set the total count of documents to sync
type DocumentWriter ¶
type DocumentWriter struct { // The database name Database string // The name of the collection Collection string // The source database Target *mdb.MDB // Progression state Progress *SyncProgress }
func NewDocumentWriter ¶
func NewDocumentWriter(database string, collection string, target *mdb.MDB) *DocumentWriter
func (*DocumentWriter) SetProgress ¶
func (r *DocumentWriter) SetProgress(progress *SyncProgress)
Set the total count of documents to sync
func (*DocumentWriter) WriteDocuments ¶
func (r *DocumentWriter) WriteDocuments(docs []*bson.Raw) (WriteResult, error)
Sync the documents to the target
type ItemReader ¶
type MongoItemReader ¶
func NewMongoItemReader ¶
func NewMongoItemReader(source *mdb.MDB, database string, collection string) *MongoItemReader
type MongoSynchronizer ¶
func NewMongoSynchronizer ¶
func NewMongoSynchronizer(target *mdb.MDB, database string, collection string) *MongoSynchronizer
type QpsLimit ¶
func NewQpsLimit ¶
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
func NewSnapshot ¶
func NewSnapshot(ckpt checkpoint.CheckpointManager) *Snapshot
func (*Snapshot) ReplicateIndexes ¶
Replicates the indexes from the source to the target
func (*Snapshot) RunSnapshot ¶
type SyncProgress ¶
type SyncProgress struct { Database string Collection string // contains filtered or unexported fields }
func NewSyncProgress ¶
func NewSyncProgress(database string, collection string) *SyncProgress
func (*SyncProgress) Increment ¶
func (f *SyncProgress) Increment(incr int)
func (*SyncProgress) Progress ¶
func (f *SyncProgress) Progress() float64
func (*SyncProgress) SetTotal ¶
func (f *SyncProgress) SetTotal(total uint64)
type Synchronizer ¶
Click to show internal directories.
Click to hide internal directories.