pitreos

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2018 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestSparseExtents added in v1.0.0

func TestSparseExtents(t *testing.T)

Types

type BackupIndex

type BackupIndex struct {
	Version   string                 `json:"version"`
	Date      time.Time              `json:"date"`
	Tag       string                 `json:"tag"`
	Meta      map[string]interface{} `json:"meta"`
	Files     []*FileIndex           `json:"files"`
	ChunkSize int64                  `json:"chunk_size"`
}

type ChunkDef

type ChunkDef struct {
	Start      int64  `json:"start"`
	End        int64  `json:"end"`
	IsEmpty    bool   `json:"empty,omitempty"`
	ContentSHA string `json:"contentSHA,omitempty"`
}

type FSStorage

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

func NewFSStorage

func NewFSStorage(baseURL *url.URL) (out *FSStorage, err error)

func (*FSStorage) ChunkExists

func (s *FSStorage) ChunkExists(hash string) (bool, error)

func (*FSStorage) ListBackups

func (s *FSStorage) ListBackups(limit int, offset int, prefix string) (out []string, err error)

func (*FSStorage) OpenBackupIndex

func (s *FSStorage) OpenBackupIndex(name string) (out io.ReadCloser, err error)

func (*FSStorage) OpenChunk

func (s *FSStorage) OpenChunk(hash string) (out io.ReadCloser, err error)

func (*FSStorage) WriteBackupIndex

func (s *FSStorage) WriteBackupIndex(name string, content []byte) (err error)

func (*FSStorage) WriteChunk

func (s *FSStorage) WriteChunk(hash string, content []byte) (err error)

type FileIndex

type FileIndex struct {
	FileName  string      `json:"filename"`
	Date      time.Time   `json:"date"`
	TotalSize int64       `json:"size"`
	Chunks    []*ChunkDef `json:"chunks"`
}

type FileOps

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

func NewFileOps

func NewFileOps(filePath string, readWrite bool) *FileOps

func (*FileOps) Close

func (f *FileOps) Close() error

func (*FileOps) Open

func (f *FileOps) Open() error

func (*FileOps) Truncate

func (f *FileOps) Truncate(size int64) error

type GSStorage

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

func NewGSStorage

func NewGSStorage(baseURL *url.URL) (*GSStorage, error)

func (*GSStorage) ChunkExists

func (s *GSStorage) ChunkExists(hash string) (bool, error)

func (*GSStorage) ListBackups

func (s *GSStorage) ListBackups(limit int, offset int, prefix string) (out []string, err error)

func (*GSStorage) OpenBackupIndex

func (s *GSStorage) OpenBackupIndex(name string) (out io.ReadCloser, err error)

func (*GSStorage) OpenChunk

func (s *GSStorage) OpenChunk(hash string) (out io.ReadCloser, err error)

func (*GSStorage) WriteBackupIndex

func (s *GSStorage) WriteBackupIndex(name string, content []byte) (err error)

func (*GSStorage) WriteChunk

func (s *GSStorage) WriteChunk(hash string, content []byte) (err error)

type GZipReadCloser

type GZipReadCloser struct {
	*gzip.Reader
	// contains filtered or unexported fields
}

func NewGZipReadCloser

func NewGZipReadCloser(src io.ReadCloser) (*GZipReadCloser, error)

func (*GZipReadCloser) Close

func (g *GZipReadCloser) Close() error

type HTTPStorage added in v1.0.0

type HTTPStorage struct {
	Client *http.Client
	// contains filtered or unexported fields
}

func NewHTTPStorage added in v1.0.0

func NewHTTPStorage(baseURL *url.URL) (out *HTTPStorage, err error)

func (*HTTPStorage) ChunkExists added in v1.0.0

func (s *HTTPStorage) ChunkExists(hash string) (bool, error)

func (*HTTPStorage) ListBackups added in v1.0.0

func (s *HTTPStorage) ListBackups(limit int, offset int, prefix string) (out []string, err error)

func (*HTTPStorage) OpenBackupIndex added in v1.0.0

func (s *HTTPStorage) OpenBackupIndex(name string) (out io.ReadCloser, err error)

func (*HTTPStorage) OpenChunk added in v1.0.0

func (s *HTTPStorage) OpenChunk(hash string) (out io.ReadCloser, err error)

func (*HTTPStorage) WriteBackupIndex added in v1.0.0

func (s *HTTPStorage) WriteBackupIndex(name string, content []byte) (err error)

func (*HTTPStorage) WriteChunk added in v1.0.0

func (s *HTTPStorage) WriteChunk(hash string, content []byte) (err error)

type ListableBackup

type ListableBackup struct {
	Name string
	Meta map[string]interface{}
}

type PITR

type PITR struct {
	AppendonlyFiles []string
	// contains filtered or unexported fields
}

func New

func New(chunkSizeMiB int64, threads int, transferTimeout time.Duration, storage Storage) *PITR

func NewDefaultPITR

func NewDefaultPITR(storage Storage) *PITR

func (*PITR) GenerateBackup

func (p *PITR) GenerateBackup(source string, tag string, metadata map[string]interface{}) error

func (*PITR) GetLatestBackup

func (p *PITR) GetLatestBackup(tag string) (string, error)

func (*PITR) ListBackups

func (p *PITR) ListBackups(limit, offset int, prefix string, withMeta bool) (out []*ListableBackup, err error)

func (*PITR) RestoreFromBackup

func (p *PITR) RestoreFromBackup(dest string, backupName string) error

func (*PITR) SetCacheStorage

func (p *PITR) SetCacheStorage(storage Storage)

SetCachingStorage enables caching through the provided Storage object.

type Storage

type Storage interface {
	ListBackups(limit int, offset int, prefix string) ([]string, error)
	OpenBackupIndex(name string) (io.ReadCloser, error)
	WriteBackupIndex(name string, content []byte) error

	OpenChunk(hash string) (io.ReadCloser, error)
	WriteChunk(hash string, content []byte) error
	ChunkExists(hash string) (bool, error)
}

func SetupStorage

func SetupStorage(baseURL string) (Storage, error)

Jump to

Keyboard shortcuts

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