Documentation ¶
Index ¶
- Constants
- type AbortRequest
- type AbortResponse
- type BackupBackendProvider
- type BackupRequest
- type CanCommitResponse
- type Manager
- func (m *Manager) Backup(ctx context.Context, pr *models.Principal, req *BackupRequest) (*models.BackupCreateResponse, error)
- func (m *Manager) BackupStatus(ctx context.Context, principal *models.Principal, backend, backupID string) (*models.BackupCreateStatusResponse, error)
- func (m *Manager) OnAbort(ctx context.Context, req *AbortRequest) error
- func (m *Manager) OnCanCommit(ctx context.Context, req *Request) *CanCommitResponse
- func (m *Manager) OnCommit(ctx context.Context, req *StatusRequest) (err error)
- func (m *Manager) OnStatus(ctx context.Context, req *StatusRequest) *StatusResponse
- func (m *Manager) RestorationStatus(ctx context.Context, principal *models.Principal, backend, ID string) (_ Status, err error)
- func (m *Manager) Restore(ctx context.Context, pr *models.Principal, req *BackupRequest) (*models.BackupRestoreResponse, error)
- type Op
- type Request
- type Scheduler
- func (s *Scheduler) Backup(ctx context.Context, pr *models.Principal, req *BackupRequest) (_ *models.BackupCreateResponse, err error)
- func (s *Scheduler) BackupStatus(ctx context.Context, principal *models.Principal, backend, backupID string) (_ *Status, err error)
- func (s *Scheduler) RestorationStatus(ctx context.Context, principal *models.Principal, backend, backupID string) (_ *Status, err error)
- func (s *Scheduler) Restore(ctx context.Context, pr *models.Principal, req *BackupRequest) (_ *models.BackupRestoreResponse, err error)
- type Sourcer
- type Status
- type StatusRequest
- type StatusResponse
Constants ¶
View Source
const ( // BackupFile used by a node to store its metadata BackupFile = "backup.json" // GlobalBackupFile used by coordinator to store its metadata GlobalBackupFile = "backup_config.json" GlobalRestoreFile = "restore_config.json" )
View Source
const Version = "1.0"
Version of backup structure
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbortRequest ¶
type AbortRequest StatusRequest
type AbortResponse ¶
type AbortResponse StatusResponse
type BackupBackendProvider ¶
type BackupBackendProvider interface {
BackupBackend(backend string) (modulecapabilities.BackupBackend, error)
}
type BackupRequest ¶
type BackupRequest struct { // ID is the backup ID ID string // Backend specify on which backend to store backups (gcs, s3, ..) Backend string // Include is list of class which need to be backed up // The same class cannot appear in both Include and Exclude in the same request Include []string // Exclude means include all classes but those specified in Exclude // The same class cannot appear in both Include and Exclude in the same request Exclude []string }
type CanCommitResponse ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager( logger logrus.FieldLogger, authorizer authorizer, schema schemaManger, sourcer Sourcer, backends BackupBackendProvider, ) *Manager
func (*Manager) Backup ¶
func (m *Manager) Backup(ctx context.Context, pr *models.Principal, req *BackupRequest, ) (*models.BackupCreateResponse, error)
func (*Manager) BackupStatus ¶
func (*Manager) OnAbort ¶
func (m *Manager) OnAbort(ctx context.Context, req *AbortRequest) error
OnAbort will be triggered when the coordinator abort the execution of a previous operation
func (*Manager) OnCanCommit ¶
func (m *Manager) OnCanCommit(ctx context.Context, req *Request) *CanCommitResponse
OnCanCommit will be triggered when coordinator asks the node to participate in a distributed backup operation
func (*Manager) OnCommit ¶
func (m *Manager) OnCommit(ctx context.Context, req *StatusRequest) (err error)
OnCommit will be triggered when the coordinator confirms the execution of a previous operation
func (*Manager) OnStatus ¶
func (m *Manager) OnStatus(ctx context.Context, req *StatusRequest) *StatusResponse
func (*Manager) RestorationStatus ¶
type Request ¶
type Request struct { // Method is the backup operation (create, restore) Method Op // ID is the backup ID ID string // Backend specify on which backend to store backups (gcs, s3, ..) Backend string // Classes is list of class which need to be backed up Classes []string // Duration Duration time.Duration }
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler assigns backup operations to coordinators.
func NewScheduler ¶
func NewScheduler( authorizer authorizer, client client, sourcer selector, backends BackupBackendProvider, nodeResolver nodeResolver, logger logrus.FieldLogger, ) *Scheduler
NewScheduler creates a new scheduler with two coordinators
func (*Scheduler) Backup ¶
func (s *Scheduler) Backup(ctx context.Context, pr *models.Principal, req *BackupRequest, ) (_ *models.BackupCreateResponse, err error)
func (*Scheduler) BackupStatus ¶
func (*Scheduler) RestorationStatus ¶
type Sourcer ¶
type Sourcer interface { // ReleaseBackup signals to the underlying index that the files have been // copied (or the operation aborted), and that it is safe for the index to // change the files, such as start compactions. ReleaseBackup(_ context.Context, id, class string) error // Backupable returns whether all given class can be backed up. Backupable(_ context.Context, classes []string) error // BackupDescriptors returns a channel of class descriptors. // Class descriptor records everything needed to restore a class // If an error happens a descriptor with an error will be written to the channel just before closing it. // // BackupDescriptors acquires resources so that a call to ReleaseBackup() is mandatory to free acquired resources. BackupDescriptors(_ context.Context, bakid string, classes []string, ) <-chan backup.ClassDescriptor // ClassExists checks whether a class exits or not ClassExists(name string) bool // ListBackupable returns a list of all classes which can be backed up. // // A class cannot be backed up either if it doesn't exist or if it has more than one physical shard. ListBackupable() []string }
Sourcer represents the source of artifacts used in the backup
type StatusRequest ¶
Click to show internal directories.
Click to hide internal directories.