Documentation ¶
Index ¶
- func ConnectDb(uri string) *mongo.Client
- func Copy(cfg *RootConfig, dbc *DBConnector, cmd *cobra.Command)
- func CopyHandler(cmd *cobra.Command, args []string)
- func DocExistsAndMatch(dst *mongo.Collection, doc bson.D) (bool, bool)
- func Execute()
- func GenerateConfig(cmd *cobra.Command, sourceUri string, destinationUri string)
- func SaveConfig(cfg RootConfig)
- func StatusWorker(c *Counters, quit chan bool, refresh_rate int, state *WorkerState, ...)
- type ColConfig
- type ColCopyWorker
- func (cw *ColCopyWorker) ColCopyWorker()
- func (cw *ColCopyWorker) Copy(c *Counters)
- func (cw *ColCopyWorker) CopyMultiThread(c *Counters, cur *mongo.Cursor)
- func (cw *ColCopyWorker) CopyMultiWorker(c *Counters, q *goconcurrentqueue.FixedFIFO, done chan bool, ...)
- func (cw *ColCopyWorker) CopySingleThread(c *Counters, cur *mongo.Cursor)
- func (cw *ColCopyWorker) GetDocCount(db *mongo.Database) int64
- type Counters
- type DBConfig
- type DBConnector
- type RootConfig
- type WorkerQueue
- type WorkerState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶
func Copy(cfg *RootConfig, dbc *DBConnector, cmd *cobra.Command)
func CopyHandler ¶
func DocExistsAndMatch ¶
func GenerateConfig ¶
func SaveConfig ¶
func SaveConfig(cfg RootConfig)
func StatusWorker ¶
func StatusWorker(c *Counters, quit chan bool, refresh_rate int, state *WorkerState, cfg *RootConfig)
Types ¶
type ColConfig ¶
type ColConfig struct { Name string `yaml:"name"` RenameTo string `yaml:"rename_to"` BatchSize int `yaml:"batch_size"` Enabled bool `yaml:"enabled"` SourceBatchSize int `yaml:"source_batch_size"` UseSeparateConnection bool `yaml:"use_separate_connection"` UseMultipleWorkers bool `yaml:"use_multiple_workers"` WorkerCount int `yaml:"worker_count"` MaxDocsInMemory int `yaml:"max_docs_in_memory"` NoFind bool `yaml:"no_find"` DateFilterField string `yaml:"filter_field"` DateFilterFrom string `yaml:"filter_from"` // format: 2006-01-02 15:04:05 DateFilterEnabled bool `yaml:"filter_enabled"` }
func GenerateColConfig ¶
func GetBaseColConfig ¶
func GetBaseColConfig() ColConfig
type ColCopyWorker ¶
type ColCopyWorker struct { SRC *mongo.Collection Clients []*mongo.Client SRCDocCount int64 DST *mongo.Collection DBName string ColName string Done bool Logs []string Config *ColConfig BatchSize int Errors []interface{} }
func (*ColCopyWorker) ColCopyWorker ¶
func (cw *ColCopyWorker) ColCopyWorker()
func (*ColCopyWorker) Copy ¶
func (cw *ColCopyWorker) Copy(c *Counters)
func (*ColCopyWorker) CopyMultiThread ¶
func (cw *ColCopyWorker) CopyMultiThread(c *Counters, cur *mongo.Cursor)
func (*ColCopyWorker) CopyMultiWorker ¶
func (cw *ColCopyWorker) CopyMultiWorker(c *Counters, q *goconcurrentqueue.FixedFIFO, done chan bool, processingContext context.Context)
func (*ColCopyWorker) CopySingleThread ¶
func (cw *ColCopyWorker) CopySingleThread(c *Counters, cur *mongo.Cursor)
Copy but, only the one slow thread. Fast enough for most small DBs
func (*ColCopyWorker) GetDocCount ¶
func (cw *ColCopyWorker) GetDocCount(db *mongo.Database) int64
GetDocCount is bugged and not really working
type DBConfig ¶
type DBConfig struct { Name string `yaml:"name"` RenameTo string `yaml:"rename_to"` BatchSize int `yaml:"batch_size"` Enabled bool `yaml:"enabled"` NoFind bool `yaml:"no_find"` UseSeparateConnection bool `yaml:"use_separate_connection"` Collections []*ColConfig `yaml:"collections"` }
func GetBaseDBConfig ¶
func GetBaseDBConfig() DBConfig
type DBConnector ¶
type RootConfig ¶
type RootConfig struct { Source string `yaml:"source"` Destination string `yaml:"destination"` ParalellCollectionCount int `yaml:"parallel_collection_count"` BatchSize int `yaml:"batch_size"` RefreshRate int `yaml:"refresh_rate"` NoFind bool `yaml:"no_find"` Databases []*DBConfig `yaml:"databases"` }
func GenerateAllConfig ¶
func GenerateAllConfig(cmd *cobra.Command, sourceUri string, destinationUri string) RootConfig
func GetBaseConfig ¶
func GetBaseConfig() RootConfig
func ReadAndParseConfig ¶
func ReadAndParseConfig(path string) RootConfig
type WorkerQueue ¶
type WorkerQueue struct { Workers []*ColCopyWorker Current int // index of current worker State *WorkerState Counters *Counters Done chan bool }
func (*WorkerQueue) GetNextWorker ¶
func (wq *WorkerQueue) GetNextWorker() *ColCopyWorker
func (*WorkerQueue) Run ¶
func (wq *WorkerQueue) Run(cfg *RootConfig)
func (*WorkerQueue) RunWorker ¶
func (wq *WorkerQueue) RunWorker(w *ColCopyWorker, c *Counters)
type WorkerState ¶
type WorkerState struct { Active int // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.