mongocompare

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Usage = `` /* 325-byte string literal not displayed */

Functions

This section is empty.

Types

type DstAuthOptions

type DstAuthOptions struct {
	DstUsername  string `value-name:"<dstUsername>" long:"dstUsername" description:"dst username for authentication"`
	DstPassword  string `value-name:"<dstPassword>" long:"dstPassword" description:"dst password for authentication"`
	DstSource    string `` /* 126-byte string literal not displayed */
	DstMechanism string `long:"dstAuthenticationMechanism" value-name:"<dst-mechanism>" description:"dst authentication mechanism to use"`
}

func (*DstAuthOptions) Name

func (*DstAuthOptions) Name() string

Name returns a human-readable group name for output options.

type DstConnectionOptions

type DstConnectionOptions struct {
	DstHost string `` /* 126-byte string literal not displayed */
	DstPort string `long:"dstPort" value-name:"<dst-port>" description:"server port (can also use --host hostname:port)"`

	Timeout                int    `long:"dialTimeout" default:"3" hidden:"true" description:"dial timeout in seconds"`
	SocketTimeout          int    `long:"socketTimeout" default:"0" hidden:"true" description:"socket timeout in seconds (0 for no timeout)"`
	TCPKeepAliveSeconds    int    `long:"TCPKeepAliveSeconds" default:"30" hidden:"true" description:"seconds between TCP keep alives"`
	ServerSelectionTimeout int    `long:"serverSelectionTimeout" hidden:"true" description:"seconds to wait for server selection; 0 means driver default"`
	Compressors            string `` /* 157-byte string literal not displayed */
}

func (*DstConnectionOptions) Name

func (*DstConnectionOptions) Name() string

type InputOptions

type InputOptions struct {
	Query          string `long:"query" short:"q" description:"query filter, as a v2 Extended JSON string, e.g., '{\"x\":{\"$gt\":1}}'"`
	Sort           string `long:"sort" value-name:"<json>" description:"sort order, as a JSON string, e.g. '{x:1}'"`
	CheckAllDoc    bool   `` /* 185-byte string literal not displayed */
	Mode           string `` /* 173-byte string literal not displayed */
	Skip           int64  `long:"skip" value-name:"<count>" description:"number of documents to skip, only be used in someData mode"`
	Limit          int64  `long:"limit" value-name:"<count>" description:"limit the number of documents query, only be used in someData and random mode"`
	ReadPreference string `` /* 220-byte string literal not displayed */
	TableScan      bool   `` /* 146-byte string literal not displayed */
}

InputOptions defines the set of options to use in retrieving data from the server.

func (*InputOptions) GetQuery

func (inputOptions *InputOptions) GetQuery() ([]byte, error)

func (*InputOptions) HasQuery

func (inputOptions *InputOptions) HasQuery() bool

func (*InputOptions) Name

func (*InputOptions) Name() string

Name returns a human-readable group name for input options.

type MongoCompare

type MongoCompare struct {
	// basic mongo tool options
	ToolOptions     *options.ToolOptions
	InputOptions    *InputOptions
	OutputOptions   *OutputOptions
	SrcAuthOptions  *SrcAuthOptions
	SrcConnection   *SrcConnectionOptions
	DstAuthOptions  *DstAuthOptions
	DstConnection   *DstConnectionOptions
	ProgressManager progress.Manager

	// useful internals that we don't directly expose as options
	SrcSessionProvider *db.SessionProvider
	DstSessionProvider *db.SessionProvider

	// Writer to take care of BSON output when not writing to the local filesystem.
	// This is initialized to os.Stdout if unset.
	OutputWriter io.Writer
	// contains filtered or unexported fields
}

MongoDump is a container for the user-specified options and internal state used for running mongodump.

func (*MongoCompare) Compare

func (compare *MongoCompare) Compare() (err error)

Dump handles some final options checking and executes MongoDump.

func (*MongoCompare) CompareIntent

func (compare *MongoCompare) CompareIntent(intent *intents.Intent) error

DumpIntent dumps the specified database's collection.

func (*MongoCompare) CompareIntents

func (compare *MongoCompare) CompareIntents() error

DumpIntents iterates through the previously-created intents and dumps all of the found collections.

func (*MongoCompare) CreateAllIntents

func (compare *MongoCompare) CreateAllIntents() error

CreateAllIntents iterates through all dbs and collections and builds dump intents for each collection.

func (*MongoCompare) CreateCollectionIntent

func (compare *MongoCompare) CreateCollectionIntent(dbName, colName string) error

CreateCollectionIntent builds an intent for a given collection and puts it into the intent manager.

func (*MongoCompare) CreateIntentsForDatabase

func (compare *MongoCompare) CreateIntentsForDatabase(dbName string) error

CreateIntentsForDatabase iterates through collections in a db and builds dump intents for each collection.

func (*MongoCompare) HandleInterrupt

func (compare *MongoCompare) HandleInterrupt()

func (*MongoCompare) Init

func (compare *MongoCompare) Init() error

Init performs preliminary setup operations for MongoDump.

func (*MongoCompare) NewIntentFromOptions

func (compare *MongoCompare) NewIntentFromOptions(dbName string, ci *db.CollectionInfo) (*intents.Intent, error)

func (*MongoCompare) ValidateOptions

func (compare *MongoCompare) ValidateOptions() error

ValidateOptions checks for any incompatible sets of options.

type NilPos

type NilPos struct{}

func (NilPos) Pos

func (NilPos) Pos() int64

type Options

func ParseOptions

func ParseOptions(rawArgs []string, versionStr, gitCommit string) (Options, error)

type OutputOptions

type OutputOptions struct {
	Out                        string   `long:"out" value-name:"<directory-path>" short:"o" description:"output directory, or '-' for stdout (default: 'dump')"`
	ExcludedCollections        []string `` /* 173-byte string literal not displayed */
	ExcludedCollectionPrefixes []string `` /* 212-byte string literal not displayed */
	NumParallelCollections     int      `long:"numParallelCollections" short:"j" description:"number of collections to dump in parallel" default:"4" default-mask:"-"`
	NumComparisonWorkers       int      `` /* 146-byte string literal not displayed */
}

OutputOptions defines the set of options for writing dump data.

func (*OutputOptions) Name

func (*OutputOptions) Name() string

Name returns a human-readable group name for output options.

type Result

type Result struct {
	Successes int64
	Failures  int64
	Err       error
}

type SrcAuthOptions

type SrcAuthOptions struct {
	SrcUsername  string `value-name:"<srcUsername>" long:"srcUsername" description:"src username for authentication"`
	SrcPassword  string `value-name:"<srcPassword>" long:"srcPassword" description:"src password for authentication"`
	SrcSource    string `` /* 126-byte string literal not displayed */
	SrcMechanism string `long:"srcAuthenticationMechanism" value-name:"<src-mechanism>" description:"authentication mechanism to use"`
}

func (*SrcAuthOptions) Name

func (*SrcAuthOptions) Name() string

Name returns a human-readable group name for output options.

type SrcConnectionOptions

type SrcConnectionOptions struct {
	SrcHost string `` /* 126-byte string literal not displayed */
	SrcPort string `long:"srcPort" value-name:"<src-port>" description:"server port (can also use --host hostname:port)"`

	Timeout                int    `long:"dialTimeout" default:"3" hidden:"true" description:"dial timeout in seconds"`
	SocketTimeout          int    `long:"socketTimeout" default:"0" hidden:"true" description:"socket timeout in seconds (0 for no timeout)"`
	TCPKeepAliveSeconds    int    `long:"TCPKeepAliveSeconds" default:"30" hidden:"true" description:"seconds between TCP keep alives"`
	ServerSelectionTimeout int    `long:"serverSelectionTimeout" hidden:"true" description:"seconds to wait for server selection; 0 means driver default"`
	Compressors            string `` /* 157-byte string literal not displayed */
}

func (*SrcConnectionOptions) Name

func (*SrcConnectionOptions) Name() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL