Documentation ¶
Index ¶
- Constants
- Variables
- func ArchInBackup(arch Archive, backup *Backup) bool
- func BsonTimestampFromOplogTS(ots Timestamp) primitive.Timestamp
- func LessTS(ots1, ots2 Timestamp) bool
- func NewError(code ErrorCode, msg string) error
- func PutOplogEntry(oplog *Oplog)
- func TimestampInInterval(ts, begin, end Timestamp) bool
- type Archive
- type Backup
- type BackupMeta
- type Error
- type ErrorCode
- type IsMaster
- type IsMasterLastWrite
- type MongoMeta
- type NodeMeta
- type OpTime
- type Oplog
- type Timestamp
Constants ¶
const ( OplogArchBasePath = "oplog_" + utility.VersionStr + "/" ArchNameTSDelimiter = "_" ArchiveTypeOplog = "oplog" ArchiveTypeGap = "gap" )
Archive path constants.
const (
MaxDocumentSize = 16 * 1024 * 1024
)
Variables ¶
var (
ArchRegexp = regexp.MustCompile(`^(oplog|gap)_(?P<startTS>[0-9]+\.[0-9]+)_(?P<endTS>[0-9]+\.[0-9]+)\.(?P<Ext>[^$]+)$`)
)
var ErrorDescriptions = map[ErrorCode]string{ SplitFound: "last known document was not found", VersionChanged: "schema version of the user credential documents changed", CollectionRenamed: "collection renamed", }
ErrorDescriptions maps error codes to messages
Functions ¶
func ArchInBackup ¶
ArchInBackup checks if archive and given backup overlaps each over.
func BsonTimestampFromOplogTS ¶
BsonTimestampFromOplogTS builds BSON primitive from Timestamp
func PutOplogEntry ¶
func PutOplogEntry(oplog *Oplog)
PutOplogEntry zeroes fields of Oplog struct and it to pool
func TimestampInInterval ¶
TimestampInInterval checks if timestamp is in given interval.
Types ¶
type Archive ¶
Archive defines oplog archive representation.
func ArchFromFilename ¶
ArchFromFilename builds Arch from given path. TODO: support empty extension
func NewArchive ¶
NewArchive builds Archive struct with given arguments.
type Backup ¶
type Backup struct { BackupName string `json:"BackupName,omitempty"` BackupType string `json:"BackupType,omitempty"` Hostname string `json:"Hostname,omitempty"` StartLocalTime time.Time `json:"StartLocalTime,omitempty"` FinishLocalTime time.Time `json:"FinishLocalTime,omitempty"` UserData interface{} `json:"UserData,omitempty"` MongoMeta MongoMeta `json:"MongoMeta,omitempty"` Permanent bool `json:"Permanent"` UncompressedSize int64 `json:"UncompressedSize,omitempty"` CompressedSize int64 `json:"DataSize,omitempty"` }
Backup represents backup sentinel data todo: use `internal.GenericMetadata` as base
func FirstOverlappingBackupForArch ¶
FirstOverlappingBackupForArch checks if archive overlaps any backup from given list. TODO: build btree to fix ugly complexity here
func (*Backup) IsPermanent ¶
type BackupMeta ¶
type BackupMeta struct { BackupName string Hostname string Mongo MongoMeta CompressedSize int64 Permanent bool User interface{} StartTime time.Time FinishTime time.Time }
BackupMeta includes mongodb and storage metadata
type IsMasterLastWrite ¶
IsMasterLastWrite ...
type MongoMeta ¶
type MongoMeta struct { Before NodeMeta `json:"Before,omitempty"` After NodeMeta `json:"After,omitempty"` Version string `json:"Version,omitempty"` BackupLastTS primitive.Timestamp `json:"BackupLastTS,omitempty"` }
MongoMeta includes NodeMeta Before and after backup
type NodeMeta ¶
type NodeMeta struct { LastTS Timestamp `json:"LastTS,omitempty"` LastMajTS Timestamp `json:"LastMajTS,omitempty"` }
NodeMeta represents MongoDB node metadata
type Timestamp ¶
Timestamp represents oplog record uniq id.
func TimestampFromBson ¶
TimestampFromBson builds Timestamp from BSON primitive
func TimestampFromStr ¶
TimestampFromStr builds Timestamp from string