backup_util

package
v1.7.9 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: MIT Imports: 13 Imported by: 0

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, error)

Types

type CountingWriter

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

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
Package backup_util is a generated protocol buffer package.
Package backup_util is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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