backup_util

package
v1.10.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 14 Imported by: 9

Documentation

Index

Constants

View Source
const (
	// Suffix is a suffix added to the backup while it's in-process.
	Suffix = ".pending"

	// Metafile is the base name given to the metastore backups.
	Metafile = "meta"

	// BackupFilePattern is the beginning of the pattern for a backup
	// file. They follow the scheme <database>.<retention>.<shardID>.<increment>
	BackupFilePattern = "%s.%s.%05d"

	PortableFileNamePattern = "20060102T150405Z"
)

Variables

This section is empty.

Functions

func DBRetentionAndShardFromPath

func DBRetentionAndShardFromPath(path string) (db, retention, shard string, err error)

retentionAndShardFromPath will take the shard relative path and split it into the retention policy name and shard ID. The first part of the path should be the database name.

func GetMetaBytes

func GetMetaBytes(fname string) (_ []byte, retErr error)

Types

type CountingWriter

type CountingWriter struct {
	io.Writer
	Total int64 // Total # of bytes transferred
}

func (*CountingWriter) BytesWritten added in v1.9.6

func (w *CountingWriter) BytesWritten() int64

func (*CountingWriter) Write

func (w *CountingWriter) Write(p []byte) (n int, err error)

type Entry

type Entry struct {
	Database     string `json:"database"`
	Policy       string `json:"policy"`
	ShardID      uint64 `json:"shardID"`
	FileName     string `json:"fileName"`
	Size         int64  `json:"size"`
	LastModified int64  `json:"lastModified"`
}

Entry contains the data information for a backed up shard.

func (*Entry) SizeOrZero

func (e *Entry) SizeOrZero() int64

type Manifest

type Manifest struct {
	Meta    MetaEntry `json:"meta"`
	Limited bool      `json:"limited"`
	Files   []Entry   `json:"files"`

	Database string `json:"database,omitempty"`
	Policy   string `json:"policy,omitempty"`
	ShardID  uint64 `json:"shard_id,omitempty"`
}

Manifest lists the meta and shard file information contained in the backup. If Limited is false, the manifest contains a full backup, otherwise it is a partial backup.

func (*Manifest) Save

func (manifest *Manifest) Save(filename string) error

func (*Manifest) Size

func (m *Manifest) Size() int64

Size returns the size of the manifest.

type MetaEntry

type MetaEntry struct {
	FileName string `json:"fileName"`
	Size     int64  `json:"size"`
}

MetaEntry contains the meta store information for a backup.

func LoadIncremental

func LoadIncremental(dir string) (*MetaEntry, map[uint64]*Entry, error)

LoadIncremental loads multiple manifest files from a given directory.

type PortablePacker

type PortablePacker struct {
	Data      []byte
	MaxNodeID uint64
}

func (PortablePacker) MarshalBinary

func (ep PortablePacker) MarshalBinary() ([]byte, error)

func (*PortablePacker) UnmarshalBinary

func (ep *PortablePacker) UnmarshalBinary(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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