Documentation ¶
Index ¶
- Constants
- Variables
- func BackupNameFromCreate(output string) string
- func BackupNamesFromListing(output string) []string
- func BuildImage(ctx context.Context, tag string, path string) error
- func ContainerWithPrefix(containers []types.Container, name string) (*types.Container, error)
- func CreateNet(ctx context.Context, netName string) error
- func DockerContainer(ctx context.Context, prefix string) (*types.Container, error)
- func ExposedHostPort(ctx context.Context, fqdn string, port int) (string, int, error)
- func ExposedPort(container types.Container, port int) (string, int, error)
- func FetchAllDocs(ctx context.Context, cur *mongo.Cursor) ([]bson.M, error)
- func FetchNsDocs(ctx context.Context, conn *mongo.Client, database, table string) ([]bson.M, error)
- func LessTS(ots1, ots2 OpTimestamp) bool
- func ListCollections(ctx context.Context, conn *mongo.Client, database string) ([]bson.M, error)
- func ListNets(ctx context.Context, name string) ([]types.NetworkResource, error)
- func ListNsIndexes(ctx context.Context, conn *mongo.Client, database, table string) ([]bson.M, error)
- func Retry(ctx context.Context, maxRetries uint64, op func() error) error
- func TimeInContainer(ctx context.Context, container string) (time.Time, error)
- type Archive
- type AuthCreds
- type AuthPolicy
- type BackupMeta
- type BaseImage
- type CmdResponse
- type DatabaseRecord
- type ExecResult
- type Infra
- type IsMaster
- type IsMasterLastWrite
- type MongoCtl
- func (mc *MongoCtl) AdminConnect() (*mongo.Client, error)
- func (mc *MongoCtl) ChownDBPath() error
- func (mc *MongoCtl) Connect(creds *AuthCreds) (*mongo.Client, error)
- func (mc *MongoCtl) EnableAuth() error
- func (mc *MongoCtl) GetConfigPath() (string, error)
- func (mc *MongoCtl) GetMongodPort() int
- func (mc *MongoCtl) GetVersion() (version string, err error)
- func (mc *MongoCtl) InitReplSet() error
- func (mc *MongoCtl) IsMaster() (bool, error)
- func (mc *MongoCtl) LastMajTS() (OpTimestamp, error)
- func (mc *MongoCtl) LastTS() (OpTimestamp, error)
- func (mc *MongoCtl) PurgeDatadir() error
- func (mc *MongoCtl) Snapshot() ([]NsSnapshot, error)
- func (mc *MongoCtl) StartMongod() error
- func (mc *MongoCtl) StopMongod() error
- func (mc *MongoCtl) WriteTestData(mark string, dbCount, tablesCount, docsCount int) error
- type MongoCtlOpt
- type NodeMeta
- type NsSnapshot
- type OpTime
- type OpTimestamp
- type RedisCtl
- type RunOption
- type RunOptions
- type S3Client
- type S3Storage
- type Sentinel
- type Strings
- type WalgUtil
- func (w *WalgUtil) BackupMeta(backupNum int) (Sentinel, error)
- func (w *WalgUtil) Backups() ([]string, error)
- func (w *WalgUtil) DeleteBackup(backupName string) error
- func (w *WalgUtil) FetchBackupByNum(backupNum int) error
- func (w *WalgUtil) FetchBinaryBackup(backup, mongodConfigPath, mongodbVersion, rsName, rsMembers string) error
- func (w *WalgUtil) GetBackupByNumber(backupNumber int) (string, error)
- func (w *WalgUtil) OplogPurge() error
- func (w *WalgUtil) OplogPush() error
- func (w *WalgUtil) OplogReplay(from, until OpTimestamp) error
- func (w *WalgUtil) PurgeRetain(keepNumber int) error
- func (w *WalgUtil) PushBackup() (string, error)
- func (w *WalgUtil) PushBinaryBackup() error
Constants ¶
View Source
const ( LocalDB = "local" OplogColl = "oplog.rs" AdminDB = "admin" MongodPort = 27018 )
View Source
const (
S3PORT = 9000
)
Variables ¶
View Source
var Docker *client.Client
View Source
var (
SystemDatabases = []string{"local", "config", "admin"}
)
Functions ¶
func BackupNameFromCreate ¶
func BackupNamesFromListing ¶
func ContainerWithPrefix ¶
func DockerContainer ¶
func ExposedHostPort ¶
func FetchNsDocs ¶
func LessTS ¶
func LessTS(ots1, ots2 OpTimestamp) bool
func ListCollections ¶
func ListNsIndexes ¶
Types ¶
type Archive ¶
type Archive struct { StartTS OpTimestamp EndTS OpTimestamp }
type AuthPolicy ¶
type AuthPolicy int64
const ( NoneAuth AuthPolicy = iota AdminAuth AutoDetectAuth )
type BackupMeta ¶
type BackupMeta struct { Before NodeMeta `json:"Before,omitempty"` After NodeMeta `json:"After,omitempty"` BackupLastTS primitive.Timestamp `json:"BackupLastTS,omitempty"` // for binary backup }
func (BackupMeta) GetBackupLastTS ¶
func (backupMeta BackupMeta) GetBackupLastTS() OpTimestamp
type CmdResponse ¶
type DatabaseRecord ¶
type ExecResult ¶
type ExecResult struct { ExitCode int // contains filtered or unexported fields }
func RunCommand ¶
func RunCommandStrict ¶
func (*ExecResult) Combined ¶
func (res *ExecResult) Combined() string
func (*ExecResult) Stderr ¶
func (res *ExecResult) Stderr() string
func (*ExecResult) Stdout ¶
func (res *ExecResult) Stdout() string
func (*ExecResult) String ¶
func (res *ExecResult) String() string
type Infra ¶
type Infra struct {
// contains filtered or unexported fields
}
func (*Infra) RecreateContainers ¶
type IsMaster ¶
type IsMaster struct { IsMaster bool `bson:"ismaster"` LastWrite IsMasterLastWrite `bson:"lastWrite"` SetName string `bson:"setName"` }
IsMaster ...
type IsMasterLastWrite ¶
type IsMasterLastWrite struct { OpTime OpTime `bson:"opTime"` MajorityOpTime OpTime `bson:"majorityOpTime"` }
IsMasterLastWrite ...
type MongoCtl ¶
type MongoCtl struct {
// contains filtered or unexported fields
}
func NewMongoCtl ¶
func (*MongoCtl) ChownDBPath ¶
func (*MongoCtl) EnableAuth ¶
func (*MongoCtl) GetConfigPath ¶
func (*MongoCtl) GetMongodPort ¶
func (*MongoCtl) GetVersion ¶
func (*MongoCtl) InitReplSet ¶
func (*MongoCtl) LastMajTS ¶
func (mc *MongoCtl) LastMajTS() (OpTimestamp, error)
func (*MongoCtl) LastTS ¶
func (mc *MongoCtl) LastTS() (OpTimestamp, error)
func (*MongoCtl) PurgeDatadir ¶
func (*MongoCtl) Snapshot ¶
func (mc *MongoCtl) Snapshot() ([]NsSnapshot, error)
func (*MongoCtl) StartMongod ¶
func (*MongoCtl) StopMongod ¶
type MongoCtlOpt ¶
type MongoCtlOpt func(*MongoCtl)
func AdminCreds ¶
func AdminCreds(creds AuthCreds) MongoCtlOpt
type NodeMeta ¶
type NodeMeta struct { LastTS OpTimestamp `json:"LastTS,omitempty"` LastMajTS OpTimestamp `json:"LastMajTS,omitempty"` }
type NsSnapshot ¶
type OpTimestamp ¶
func TimestampFromStr ¶
func TimestampFromStr(s string) (OpTimestamp, error)
func ToOpTimestamp ¶
func ToOpTimestamp(ts primitive.Timestamp) OpTimestamp
func (OpTimestamp) String ¶
func (ots OpTimestamp) String() string
type RunOption ¶
type RunOption func(*RunOptions)
type RunOptions ¶
type RunOptions struct {
// contains filtered or unexported fields
}
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
func NewS3Storage ¶
func (*S3Storage) ArchTsExists ¶
func (s *S3Storage) ArchTsExists(ts OpTimestamp) (bool, error)
type Sentinel ¶
type Sentinel struct { StartLocalTime time.Time `json:"StartLocalTime,omitempty"` FinishLocalTime time.Time `json:"FinishLocalTime,omitempty"` UserData interface{} `json:"UserData,omitempty"` MongoMeta BackupMeta `json:"MongoMeta,omitempty"` }
type WalgUtil ¶
type WalgUtil struct {
// contains filtered or unexported fields
}
func NewWalgUtil ¶
func (*WalgUtil) DeleteBackup ¶
func (*WalgUtil) FetchBackupByNum ¶
func (*WalgUtil) FetchBinaryBackup ¶
func (*WalgUtil) GetBackupByNumber ¶
func (*WalgUtil) OplogPurge ¶
func (*WalgUtil) OplogReplay ¶
func (w *WalgUtil) OplogReplay(from, until OpTimestamp) error
func (*WalgUtil) PurgeRetain ¶
func (*WalgUtil) PushBackup ¶
func (*WalgUtil) PushBinaryBackup ¶
Click to show internal directories.
Click to hide internal directories.