replica

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProgressStateInProgress = ProgressState("in_progress")
	ProgressStateComplete   = ProgressState("complete")
	ProgressStateError      = ProgressState("error")
)
View Source
const (
	OpCoalesce = "coalesce" // Source is parent, target is child
	OpRemove   = "remove"
	OpReplace  = "replace"
)
View Source
const (
	Initial    = State("initial")
	Open       = State("open")
	Closed     = State("closed")
	Dirty      = State("dirty")
	Rebuilding = State("rebuilding")
	Error      = State("error")
)

Variables

This section is empty.

Functions

func GenerateDeltaFileName

func GenerateDeltaFileName(name string) string

func GenerateExpansionSnapshotLabels

func GenerateExpansionSnapshotLabels(size int64) map[string]string

func GenerateExpansionSnapshotName

func GenerateExpansionSnapshotName(size int64) string

func GenerateSnapTempFileName

func GenerateSnapTempFileName(fileName string) string

func GenerateSnapshotDiskMetaName

func GenerateSnapshotDiskMetaName(diskName string) string

func GenerateSnapshotDiskName

func GenerateSnapshotDiskName(name string) string

func GetSnapshotNameFromDiskName

func GetSnapshotNameFromDiskName(diskName string) (string, error)

func GetSnapshotNameFromTempFileName

func GetSnapshotNameFromTempFileName(tmpFileName string) (string, error)

func IsHeadDisk

func IsHeadDisk(diskName string) bool

Types

type BackingFile

type BackingFile struct {
	Size       int64
	SectorSize int64
	Name       string
	Disk       types.DiffDisk
}

type BackupStatus

type BackupStatus struct {
	SnapshotID    string
	Error         string
	Progress      int
	BackupURL     string
	State         ProgressState
	IsIncremental bool
	// contains filtered or unexported fields
}

func NewBackup

func NewBackup(backingFile *BackingFile) *BackupStatus

func (*BackupStatus) CloseSnapshot

func (rb *BackupStatus) CloseSnapshot(snapID, volumeID string) error

func (*BackupStatus) CompareSnapshot

func (rb *BackupStatus) CompareSnapshot(snapID, compareSnapID, volumeID string) (*backupstore.Mappings, error)

func (*BackupStatus) HasSnapshot

func (rb *BackupStatus) HasSnapshot(snapID, volumeID string) bool

func (*BackupStatus) OpenSnapshot

func (rb *BackupStatus) OpenSnapshot(snapID, volumeID string) error

func (*BackupStatus) ReadSnapshot

func (rb *BackupStatus) ReadSnapshot(snapID, volumeID string, start int64, data []byte) error

func (*BackupStatus) UpdateBackupStatus

func (rb *BackupStatus) UpdateBackupStatus(snapID, volumeID string, progress int, url string, errString string) error

type DiskInfo

type DiskInfo struct {
	Name        string            `json:"name"`
	Parent      string            `json:"parent"`
	Children    map[string]bool   `json:"children"`
	Removed     bool              `json:"removed"`
	UserCreated bool              `json:"usercreated"`
	Created     string            `json:"created"`
	Size        string            `json:"size"`
	Labels      map[string]string `json:"labels"`
}

type Info

type Info struct {
	Size            int64
	Head            string
	Dirty           bool
	Rebuilding      bool
	Parent          string
	SectorSize      int64
	BackingFileName string
	BackingFile     *BackingFile `json:"-"`
}

func ReadInfo

func ReadInfo(dir string) (Info, error)

type PrepareRemoveAction

type PrepareRemoveAction struct {
	Action string `json:"action"`
	Source string `json:"source"`
	Target string `json:"target"`
}

type ProgressState

type ProgressState string

type Replica

type Replica struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New(size, sectorSize int64, dir string, backingFile *BackingFile) (*Replica, error)

func NewReadOnly

func NewReadOnly(dir, head string, backingFile *BackingFile) (*Replica, error)

func (*Replica) Chain

func (r *Replica) Chain() ([]string, error)

func (*Replica) Close

func (r *Replica) Close() error

func (*Replica) Delete

func (r *Replica) Delete() error

func (*Replica) DisplayChain

func (r *Replica) DisplayChain() ([]string, error)

func (*Replica) Expand

func (r *Replica) Expand(size int64) error

func (*Replica) GetRemainSnapshotCounts

func (r *Replica) GetRemainSnapshotCounts() int

func (*Replica) GetRevisionCounter

func (r *Replica) GetRevisionCounter() int64

func (*Replica) Info

func (r *Replica) Info() Info

func (*Replica) ListDisks

func (r *Replica) ListDisks() map[string]DiskInfo

func (*Replica) MarkDiskAsRemoved

func (r *Replica) MarkDiskAsRemoved(name string) error

func (*Replica) PrepareRemoveDisk

func (r *Replica) PrepareRemoveDisk(name string) ([]PrepareRemoveAction, error)

func (*Replica) ReadAt

func (r *Replica) ReadAt(buf []byte, offset int64) (int, error)

func (*Replica) Reload

func (r *Replica) Reload() (*Replica, error)

func (*Replica) RemoveDiffDisk

func (r *Replica) RemoveDiffDisk(name string, force bool) error

func (*Replica) ReplaceDisk

func (r *Replica) ReplaceDisk(target, source string) error

func (*Replica) Revert

func (r *Replica) Revert(name, created string) (*Replica, error)

func (*Replica) SetRebuilding

func (r *Replica) SetRebuilding(rebuilding bool) error

func (*Replica) SetRevisionCounter

func (r *Replica) SetRevisionCounter(counter int64) error

func (*Replica) Snapshot

func (r *Replica) Snapshot(name string, userCreated bool, created string, labels map[string]string) error

func (*Replica) WriteAt

func (r *Replica) WriteAt(buf []byte, offset int64) (int, error)

type RestoreStatus

type RestoreStatus struct {
	sync.Mutex

	SnapshotName string //This will be deltaFileName in case of Incremental Restore
	Progress     int
	Error        string
	BackupURL    string
	State        ProgressState

	//Incremental Restore fields
	LastRestored     string
	SnapshotDiskName string
	// contains filtered or unexported fields
}

func NewRestore

func NewRestore(snapshotName, replicaAddress string) *RestoreStatus

func (*RestoreStatus) FinishRestore

func (rr *RestoreStatus) FinishRestore()

func (*RestoreStatus) UpdateRestoreStatus

func (rr *RestoreStatus) UpdateRestoreStatus(snapshot string, rp int, re error)

type Server

type Server struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewServer

func NewServer(dir string, backing *BackingFile, sectorSize int64) *Server

func (*Server) Close

func (s *Server) Close() error

func (*Server) Create

func (s *Server) Create(size int64) error

func (*Server) Delete

func (s *Server) Delete() error

func (*Server) Expand

func (s *Server) Expand(size int64) error

func (*Server) MarkDiskAsRemoved

func (s *Server) MarkDiskAsRemoved(name string) error

func (*Server) Open

func (s *Server) Open() error

func (*Server) PingResponse

func (s *Server) PingResponse() error

func (*Server) PrepareRemoveDisk

func (s *Server) PrepareRemoveDisk(name string) ([]PrepareRemoveAction, error)

func (*Server) ReadAt

func (s *Server) ReadAt(buf []byte, offset int64) (int, error)

func (*Server) Reload

func (s *Server) Reload() error

func (*Server) RemoveDiffDisk

func (s *Server) RemoveDiffDisk(name string, force bool) error

func (*Server) ReplaceDisk

func (s *Server) ReplaceDisk(target, source string) error

func (*Server) Replica

func (s *Server) Replica() *Replica

func (*Server) Revert

func (s *Server) Revert(name, created string) error

func (*Server) SetRebuilding

func (s *Server) SetRebuilding(rebuilding bool) error

func (*Server) SetRevisionCounter

func (s *Server) SetRevisionCounter(counter int64) error

func (*Server) Snapshot

func (s *Server) Snapshot(name string, userCreated bool, createdTime string, labels map[string]string) error

func (*Server) Status

func (s *Server) Status() (State, Info)

func (*Server) WriteAt

func (s *Server) WriteAt(buf []byte, offset int64) (int, error)

type State

type State string

type UsedGenerator

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

func (*UsedGenerator) Err

func (u *UsedGenerator) Err() error

func (*UsedGenerator) Generate

func (u *UsedGenerator) Generate() <-chan int64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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