backup

package
v0.0.0-...-1b76716 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collection

func Collection(ctx context.Context, client *mongo.Client, opts Options) error

Collection creates a backup of a collection using the options to describe how to filter or constrain the backup. The option's Target value allows you to produce a writer where the backup will be collected.

Types

type Options

type Options struct {
	NS            model.Namespace `bson:"ns" json:"ns" yaml:"ns"`
	Target        WriterCreator   `bson:"-" json:"-" yaml:"-"`
	Query         interface{}     `bson:"query" json:"query" yaml:"query"`
	Sort          interface{}     `bson:"sort" json:"sort" yaml:"sort"`
	Limit         int64           `bson:"limit" json:"limit" yaml:"limit"`
	IndexesOnly   bool            `bson:"indexes_only" json:"indexes_only" yaml:"indexes_only"`
	EnableLogging bool            `bson:"enable_logging" json:"enable_logging" yaml:"enable_logging"`
}

Options describes the configuration of the backup, for a single collection. Query, Sort, and Limit are optional, but allow you to constrain the backup.

type WriterCreator

type WriterCreator func(context.Context, string) (io.WriteCloser, error)

WriterCreator provides a way to create writers (e.g. for file or similar,) to support writing backup payloads without requiring this implementation to manage files or file interfaces.

Jump to

Keyboard shortcuts

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