storage

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2017 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupStorage

type BackupStorage interface {
	GetStorageType() string

	GetLatestToLSN(db string) (string, error)

	SearchStaringPointByLSN(db, lsn string) (string, error)

	TransferTempFullBackup(tempDir string, key string) error

	TransferTempIncBackup(tempDir string, key string) error

	SearchConsecutiveIncBackups(db string, from time.Time) ([]*storagepb.BackupFileInfo, error)

	GetFileStream(key string) (io.Reader, error)

	PostFile(key string, name string, r io.Reader) error

	RemoveBackups(cli *clientv3.Client, key string) error

	GetKPastBackupKey(db string, k int) (string, error)

	RestoreBackupInfo(cli *clientv3.Client) error
}

type LocalBackupStorage

type LocalBackupStorage struct {
	*base.Config
	// contains filtered or unexported fields
}

LocalBackupStorage represents local directory backup.

func NewLocalBackupStorage

func NewLocalBackupStorage(cfg *LocalStorageConfig) (*LocalBackupStorage, error)

NewLocalBackupStorage returns LocalBackupStorage based on the configuration.

func (*LocalBackupStorage) GetFileStream

func (s *LocalBackupStorage) GetFileStream(key string) (io.Reader, error)

func (*LocalBackupStorage) GetKPastBackupKey

func (s *LocalBackupStorage) GetKPastBackupKey(db string, k int) (string, error)

func (*LocalBackupStorage) GetLatestToLSN

func (s *LocalBackupStorage) GetLatestToLSN(db string) (string, error)

GetLatestToLSN fetches `to_lsn` from most recent backup.

func (*LocalBackupStorage) GetStorageType

func (s *LocalBackupStorage) GetStorageType() string

GetStorageType returns storage type

func (*LocalBackupStorage) PostFile

func (s *LocalBackupStorage) PostFile(key string, name string, r io.Reader) error

func (*LocalBackupStorage) RemoveBackups

func (s *LocalBackupStorage) RemoveBackups(cli *clientv3.Client, key string) error

func (*LocalBackupStorage) RestoreBackupInfo

func (s *LocalBackupStorage) RestoreBackupInfo(cli *clientv3.Client) error

func (*LocalBackupStorage) SearchConsecutiveIncBackups

func (s *LocalBackupStorage) SearchConsecutiveIncBackups(
	db string,
	from time.Time,
) ([]*storagepb.BackupFileInfo, error)

func (*LocalBackupStorage) SearchStaringPointByLSN

func (s *LocalBackupStorage) SearchStaringPointByLSN(db, lsn string) (string, error)

SearchStartingPointByLSN returns a starting point containing `to_lsn` equals lsn.

func (*LocalBackupStorage) TransferTempFullBackup

func (s *LocalBackupStorage) TransferTempFullBackup(tempDir string, key string) error

func (*LocalBackupStorage) TransferTempIncBackup

func (s *LocalBackupStorage) TransferTempIncBackup(tempDir string, key string) error

type LocalStorageConfig

type LocalStorageConfig struct {
	*base.Config

	BackupsDir string

	ServeRateLimit uint64

	NodeName string
}

type MockBackupStorage

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

Mock of BackupStorage interface

func NewMockBackupStorage

func NewMockBackupStorage(ctrl *gomock.Controller) *MockBackupStorage

func (*MockBackupStorage) EXPECT

func (_m *MockBackupStorage) EXPECT() *_MockBackupStorageRecorder

func (*MockBackupStorage) GetFileStream

func (_m *MockBackupStorage) GetFileStream(key string) (io.Reader, error)

func (*MockBackupStorage) GetKPastBackupKey

func (_m *MockBackupStorage) GetKPastBackupKey(db string, k int) (string, error)

func (*MockBackupStorage) GetLatestToLSN

func (_m *MockBackupStorage) GetLatestToLSN(db string) (string, error)

func (*MockBackupStorage) GetStorageType

func (_m *MockBackupStorage) GetStorageType() string

func (*MockBackupStorage) PostFile

func (_m *MockBackupStorage) PostFile(key string, name string, r io.Reader) error

func (*MockBackupStorage) RemoveBackups

func (_m *MockBackupStorage) RemoveBackups(cli *clientv3.Client, key string) error

func (*MockBackupStorage) RestoreBackupInfo

func (_m *MockBackupStorage) RestoreBackupInfo(cli *clientv3.Client) error

func (*MockBackupStorage) SearchConsecutiveIncBackups

func (_m *MockBackupStorage) SearchConsecutiveIncBackups(db string, from time.Time) ([]*storagepb.BackupFileInfo, error)

func (*MockBackupStorage) SearchStaringPointByLSN

func (_m *MockBackupStorage) SearchStaringPointByLSN(db string, lsn string) (string, error)

func (*MockBackupStorage) TransferTempFullBackup

func (_m *MockBackupStorage) TransferTempFullBackup(tempDir string, key string) error

func (*MockBackupStorage) TransferTempIncBackup

func (_m *MockBackupStorage) TransferTempIncBackup(tempDir string, key string) error

type StorageService

type StorageService struct {
	EtcdCli *clientv3.Client
	// contains filtered or unexported fields
}

func NewStorageService

func NewStorageService(
	storage BackupStorage,
	rateLimit uint64,
	aggregator *status.WeeklyBackupAggregator,
) *StorageService

func (*StorageService) GetBestStartTime

func (*StorageService) GetFileByKey

func (*StorageService) GetKeysAtPoint

func (*StorageService) GetLatestToLSN

func (*StorageService) PurgePrevBackup

Directories

Path Synopsis
Package storagepb is a generated protocol buffer package.
Package storagepb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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