sdk

package module
v2.5.99 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	CmdBackup       = ctrl.CmdBackup
	CmdRestore      = ctrl.CmdRestore
	CmdReplay       = ctrl.CmdReplay
	CmdCancelBackup = ctrl.CmdCancelBackup
	CmdResync       = ctrl.CmdResync
	CmdPITR         = ctrl.CmdPITR
	CmdDeleteBackup = ctrl.CmdDeleteBackup
	CmdDeletePITR   = ctrl.CmdDeletePITR
	CmdCleanup      = ctrl.CmdCleanup
)
View Source
const (
	LogicalBackup     = defs.LogicalBackup
	PhysicalBackup    = defs.PhysicalBackup
	IncrementalBackup = defs.IncrementalBackup
	ExternalBackup    = defs.ExternalBackup
	SelectiveBackup   = backup.SelectiveBackup
)
View Source
const (
	CompressionTypeNone      = compress.CompressionTypeNone
	CompressionTypeGZIP      = compress.CompressionTypeGZIP
	CompressionTypePGZIP     = compress.CompressionTypePGZIP
	CompressionTypeSNAPPY    = compress.CompressionTypeSNAPPY
	CompressionTypeLZ4       = compress.CompressionTypeLZ4
	CompressionTypeS2        = compress.CompressionTypeS2
	CompressionTypeZstandard = compress.CompressionTypeZstandard
)

Variables

View Source
var (
	ErrBackupInProgress     = backup.ErrBackupInProgress
	ErrIncrementalBackup    = backup.ErrIncrementalBackup
	ErrNonIncrementalBackup = backup.ErrNonIncrementalBackup
	ErrNotBaseIncrement     = backup.ErrNotBaseIncrement
	ErrBaseForPITR          = backup.ErrBaseForPITR
)
View Source
var (
	ErrUnsupported      = errors.New("unsupported")
	ErrInvalidCommandID = errors.New("invalid command id")
	ErrNotFound         = errors.New("not found")
)
View Source
var (
	ErrMissedClusterTime       = errors.New("missed cluster time")
	ErrInvalidDeleteBackupType = backup.ErrInvalidDeleteBackupType
)
View Source
var ErrNotImplemented = errors.New("not implemented")
View Source
var ErrStaleHearbeat = errors.New("stale heartbeat")
View Source
var NoOpID = CommandID(ctrl.NilOPID.String())

Functions

func CanDeleteBackup

func CanDeleteBackup(ctx context.Context, client *Client, bcp *BackupMetadata) error

func CanDeleteIncrementalBackup

func CanDeleteIncrementalBackup(
	ctx context.Context,
	client *Client,
	bcp *BackupMetadata,
	increments [][]*BackupMetadata,
) error

func IsHeartbeatStale

func IsHeartbeatStale(clusterTime, other Timestamp) bool

func WaitForCleanup

func WaitForCleanup(ctx context.Context, client *Client) error

func WaitForDeleteBackup

func WaitForDeleteBackup(ctx context.Context, client *Client) error

func WaitForDeleteOplogRange

func WaitForDeleteOplogRange(ctx context.Context, client *Client) error

func WaitForErrorLog

func WaitForErrorLog(ctx context.Context, client *Client, cmd *Command) (string, error)

func WaitForResync

func WaitForResync(ctx context.Context, c *Client, cid CommandID) error

Types

type AgentStatus

type AgentStatus = topo.AgentStat

func AgentStatuses

func AgentStatuses(ctx context.Context, client *Client) ([]AgentStatus, error)

AgentStatuses returns list of all PBM Agents statuses.

type BackupMetadata

type BackupMetadata = backup.BackupMeta

func ListDeleteBackupBefore

func ListDeleteBackupBefore(
	ctx context.Context,
	client *Client,
	ts primitive.Timestamp,
	bcpType BackupType,
) ([]BackupMetadata, error)

type BackupType

type BackupType = defs.BackupType

func ParseDeleteBackupType

func ParseDeleteBackupType(s string) (BackupType, error)

type CleanupReport

type CleanupReport = backup.CleanupInfo

type Client

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

func NewClient

func NewClient(ctx context.Context, uri string) (*Client, error)

func (*Client) CancelBackup

func (c *Client) CancelBackup(ctx context.Context) (CommandID, error)

func (*Client) CleanupReport

func (c *Client) CleanupReport(ctx context.Context, beforeTS Timestamp) (CleanupReport, error)

func (*Client) Close

func (c *Client) Close(ctx context.Context) error

func (*Client) CommandInfo

func (c *Client) CommandInfo(ctx context.Context, id CommandID) (*Command, error)

func (*Client) DeleteBackupBefore

func (c *Client) DeleteBackupBefore(
	ctx context.Context,
	beforeTS Timestamp,
	options DeleteBackupBeforeOptions,
) (CommandID, error)

func (*Client) DeleteBackupByName

func (c *Client) DeleteBackupByName(ctx context.Context, name string) (CommandID, error)

func (*Client) DeleteOplogRange

func (c *Client) DeleteOplogRange(ctx context.Context, until Timestamp) (CommandID, error)

func (*Client) GetAllBackups

func (c *Client) GetAllBackups(ctx context.Context) ([]BackupMetadata, error)

func (*Client) GetAllRestores

func (c *Client) GetAllRestores(
	ctx context.Context,
	m connect.Client,
	options GetAllRestoresOptions,
) ([]RestoreMetadata, error)

func (*Client) GetBackupByName

func (c *Client) GetBackupByName(
	ctx context.Context,
	name string,
	options GetBackupByNameOptions,
) (*BackupMetadata, error)

func (*Client) GetBackupByOpID

func (c *Client) GetBackupByOpID(
	ctx context.Context,
	opid string,
	options GetBackupByNameOptions,
) (*BackupMetadata, error)

func (*Client) GetConfig

func (c *Client) GetConfig(ctx context.Context) (*Config, error)

func (*Client) GetRestoreByName

func (c *Client) GetRestoreByName(ctx context.Context, name string) (*RestoreMetadata, error)

func (*Client) GetRestoreByOpID

func (c *Client) GetRestoreByOpID(ctx context.Context, opid string) (*RestoreMetadata, error)

func (*Client) OpLocks

func (c *Client) OpLocks(ctx context.Context) ([]OpLock, error)

func (*Client) Restore

func (c *Client) Restore(ctx context.Context, backupName string, clusterTS Timestamp) (CommandID, error)

func (*Client) RunCleanup

func (c *Client) RunCleanup(ctx context.Context, beforeTS Timestamp) (CommandID, error)

func (*Client) RunIncrementalBackup

func (c *Client) RunIncrementalBackup(ctx context.Context, options IncrementalBackupOptions) (CommandID, error)

func (*Client) RunLogicalBackup

func (c *Client) RunLogicalBackup(ctx context.Context, options LogicalBackupOptions) (CommandID, error)

func (*Client) RunPhysicalBackup

func (c *Client) RunPhysicalBackup(ctx context.Context, options PhysicalBackupOptions) (CommandID, error)

func (*Client) SetConfig

func (c *Client) SetConfig(ctx context.Context, cfg Config) (CommandID, error)

func (*Client) SyncFromStorage

func (c *Client) SyncFromStorage(ctx context.Context) (CommandID, error)

type Command

type Command = ctrl.Cmd

type CommandID

type CommandID string

type CommandType

type CommandType = ctrl.Command

type CompressionLevel

type CompressionLevel *int

type CompressionType

type CompressionType = compress.CompressionType

type Config

type Config = config.Config

type DeleteBackupBeforeOptions

type DeleteBackupBeforeOptions struct {
	Type BackupType
}

type GetAllRestoresOptions

type GetAllRestoresOptions struct {
	Limit int64
}

type GetBackupByNameOptions

type GetBackupByNameOptions struct {
	FetchIncrements bool
	FetchFilelist   bool
}

type IncrementalBackupOptions

type IncrementalBackupOptions struct {
	NewBase          bool
	CompressionType  CompressionType
	CompressionLevel CompressionLevel
}

type LogicalBackupOptions

type LogicalBackupOptions struct {
	CompressionType  CompressionType
	CompressionLevel CompressionLevel
	Namespaces       []string
}

type OpLock

type OpLock struct {
	// OpID is its command id.
	OpID CommandID `json:"opid,omitempty"`
	// Cmd is the type of command
	Cmd CommandType `json:"cmd,omitempty"`
	// Replset is name of a replset that acquired the lock.
	Replset string `json:"rs,omitempty"`
	// Node is `host:port` pair of an agent that acquired the lock.
	Node string `json:"node,omitempty"`
	// Heartbeat is the last cluster time seen by an agent that acquired the lock.
	Heartbeat primitive.Timestamp `json:"hb"`
	// contains filtered or unexported fields
}

OpLock represents internal PBM lock.

Some commands can have many locks (one lock per replset).

func (*OpLock) Err

func (l *OpLock) Err() error

type OplogChunk

type OplogChunk = oplog.OplogChunk

func ListDeleteChunksBefore

func ListDeleteChunksBefore(
	ctx context.Context,
	client *Client,
	ts primitive.Timestamp,
) ([]OplogChunk, error)

type PhysicalBackupOptions

type PhysicalBackupOptions struct {
	CompressionType  CompressionType
	CompressionLevel CompressionLevel
}

type ReplsetInfo

type ReplsetInfo = topo.Shard

func ClusterMembers

func ClusterMembers(ctx context.Context, client *Client) ([]ReplsetInfo, error)

ClusterMembers returns list of replsets in the cluster.

For sharded cluster: the configsvr (with ID `config`) and all shards. For non-sharded cluster: the replset.

type RestoreMetadata

type RestoreMetadata = restore.RestoreMeta

type Timestamp

type Timestamp = primitive.Timestamp

func ClusterTime

func ClusterTime(ctx context.Context, client *Client) (Timestamp, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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