backup

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCancelled = errors.New("backup canceled")

ErrCancelled means backup was canceled

Functions

func Compress added in v1.1.0

func Compress(w io.Writer, compression pbm.CompressionType, level *int) (io.WriteCloser, error)

Compress makes a compressed writer from the given one

func NodeSuits

func NodeSuits(node *pbm.Node, inf *pbm.NodeInfo) (bool, error)

NodeSuits checks if node can perform backup

func Upload added in v1.2.0

func Upload(ctx context.Context, src Source, dst storage.Storage, compression pbm.CompressionType, compressLevel *int, fname string, sizeb int) (int64, error)

Upload writes data to dst from given src and returns an amount of written bytes

Types

type BCoplogTS added in v1.7.0

type BCoplogTS struct {
	TS primitive.Timestamp `bson:"ts"`
	T  int64               `bson:"t"`
}

type Backup

type Backup struct {
	// contains filtered or unexported fields
}

func New

func New(cn *pbm.PBM, node *pbm.Node) *Backup

func NewPhysical added in v1.7.0

func NewPhysical(cn *pbm.PBM, node *pbm.Node) *Backup

func (*Backup) Init added in v1.5.0

func (b *Backup) Init(bcp pbm.BackupCmd, opid pbm.OPID, balancer pbm.BalancerMode) error

func (*Backup) Run

func (b *Backup) Run(ctx context.Context, bcp pbm.BackupCmd, opid pbm.OPID, l *plog.Event) (err error)

Run runs backup. TODO: describe flow

type BackupCursor added in v1.7.0

type BackupCursor struct {
	// contains filtered or unexported fields
}

func NewBackupCursor added in v1.7.0

func NewBackupCursor(n *pbm.Node, l *plog.Event) *BackupCursor

func (*BackupCursor) Close added in v1.7.0

func (bc *BackupCursor) Close()

func (*BackupCursor) Data added in v1.7.0

func (bc *BackupCursor) Data(ctx context.Context) (bcp *BackupCursorData, err error)

func (*BackupCursor) Journals added in v1.7.0

func (bc *BackupCursor) Journals(upto primitive.Timestamp) ([]pbm.File, error)

type Canceller added in v1.8.0

type Canceller interface {
	Cancel()
}

type ErrInsuffRange added in v1.3.2

type ErrInsuffRange struct {
	primitive.Timestamp
}

func (ErrInsuffRange) Error added in v1.3.2

func (e ErrInsuffRange) Error() string

type Meta added in v1.7.0

type Meta struct {
	ID           UUID                `bson:"backupId"`
	DBpath       string              `bson:"dbpath"`
	OplogStart   BCoplogTS           `bson:"oplogStart"`
	OplogEnd     BCoplogTS           `bson:"oplogEnd"`
	CheckpointTS primitive.Timestamp `bson:"checkpointTimestamp"`
}

type NopCloser added in v1.1.0

type NopCloser struct {
	io.Writer
}

NopCloser wraps an io.Witer as io.WriteCloser with noop Close

func (NopCloser) Close added in v1.1.0

func (NopCloser) Close() error

Close to satisfy io.WriteCloser interface

type Oplog added in v1.1.0

type Oplog struct {
	// contains filtered or unexported fields
}

Oplog is used for reading the Mongodb oplog

func NewOplog added in v1.1.0

func NewOplog(node *pbm.Node) *Oplog

NewOplog creates a new Oplog instance

func (*Oplog) Cancel added in v1.8.0

func (ot *Oplog) Cancel()

func (*Oplog) IsSufficient added in v1.6.0

func (ot *Oplog) IsSufficient(from primitive.Timestamp) (bool, error)

IsSufficient check is oplog is sufficient back from the given date

func (*Oplog) LastWrite added in v1.1.0

func (ot *Oplog) LastWrite() (primitive.Timestamp, error)

LastWrite returns a timestamp of the last write operation readable by majority reads

func (*Oplog) SetTailingSpan added in v1.2.0

func (ot *Oplog) SetTailingSpan(start, end primitive.Timestamp)

SetTailingSpan sets oplog tailing window

func (*Oplog) WriteTo added in v1.2.0

func (ot *Oplog) WriteTo(w io.Writer) (int64, error)

WriteTo writes an oplog slice between start and end timestamps into the given io.Writer

To be sure we have read ALL records up to the specified cluster time. Specifically, to be sure that no operations from the past gonna came after we finished the slicing, we have to tail until some record with ts > endTS. And it might be a noop.

type Source added in v1.2.0

type Source interface {
	io.WriterTo
}

type UUID added in v1.7.0

type UUID struct{ uuid.UUID }

UUID represents a UUID as saved in MongoDB

func (*UUID) IsZero added in v1.7.0

func (id *UUID) IsZero() bool

IsZero implements the bson.Zeroer interface.

func (UUID) MarshalBSONValue added in v1.7.0

func (id UUID) MarshalBSONValue() (bsontype.Type, []byte, error)

MarshalBSONValue implements the bson.ValueMarshaler interface.

func (*UUID) UnmarshalBSONValue added in v1.7.0

func (id *UUID) UnmarshalBSONValue(t bsontype.Type, raw []byte) error

UnmarshalBSONValue implements the bson.ValueUnmarshaler interface.

Jump to

Keyboard shortcuts

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