Documentation ¶
Index ¶
- func GetDBLock(dbpath string) (*os.File, error)
- type LocalReplica
- func (r *LocalReplica) CreateSnapshot(replicaID, snapshotID string) (*strata.Snapshot, error)
- func (r *LocalReplica) Delete(path string) error
- func (r *LocalReplica) DeleteSnapshot(lz strata.LazySnapshotMetadata) error
- func (r *LocalReplica) GetSnapshot(metadata strata.SnapshotMetadata) (*strata.Snapshot, error)
- func (r *LocalReplica) List(path string, n int) ([]string, error)
- func (r *LocalReplica) MaxBackgroundCopies() int
- func (r *LocalReplica) PrepareToRestoreSnapshot(replicaID string, targetPath string, s *strata.Snapshot) (string, error)
- func (r *LocalReplica) PutReader(path string, reader io.Reader) error
- func (r *LocalReplica) PutSoftlink(pointingTo, path string) error
- func (r *LocalReplica) Same(path string, file strata.File) (bool, error)
- type MockLocalReplica
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LocalReplica ¶
type LocalReplica struct {
// contains filtered or unexported fields
}
LocalReplica is a replica where all methods that take a ReplicaID must be run on the host corresponding to ReplicaID
func NewLocalReplica ¶
func NewLocalReplica(maxBackgroundCopies int, port, username, password string) (*LocalReplica, error)
NewLocalReplica constructs a LocalReplica
func (*LocalReplica) CreateSnapshot ¶
func (r *LocalReplica) CreateSnapshot(replicaID, snapshotID string) (*strata.Snapshot, error)
CreateSnapshot is called to trigger snapshot creation on the target source. It should run on the host that corresponds to replicaID unless you know what you're doing. CreateSnapshot replaces DBPATH/backup/latest with the snapshot that it creates. No other snapshots are kept locally. TODO(agf): Have a way to pass in tags
func (*LocalReplica) Delete ¶
func (r *LocalReplica) Delete(path string) error
Delete removes the file at |path|
func (*LocalReplica) DeleteSnapshot ¶
func (r *LocalReplica) DeleteSnapshot(lz strata.LazySnapshotMetadata) error
DeleteSnapshot just returns nil. See CreateSnapshot() for more about how snapshots are kept locally.
func (*LocalReplica) GetSnapshot ¶
func (r *LocalReplica) GetSnapshot(metadata strata.SnapshotMetadata) (*strata.Snapshot, error)
GetSnapshot returns a Snapshot given the specified SnapshotMetadata
func (*LocalReplica) List ¶
func (r *LocalReplica) List(path string, n int) ([]string, error)
List returns up to |n| files on |path| This list does not include any directories
func (*LocalReplica) MaxBackgroundCopies ¶
func (r *LocalReplica) MaxBackgroundCopies() int
MaxBackgroundCopies returns the maximum number of copies that CreateSnapshot() and RestoreSnapshot() should perform in the background.
func (*LocalReplica) PrepareToRestoreSnapshot ¶
func (r *LocalReplica) PrepareToRestoreSnapshot(replicaID string, targetPath string, s *strata.Snapshot) (string, error)
PrepareToRestoreSnapshot checks that the necessary directories exist and are not being used
func (*LocalReplica) PutReader ¶
func (r *LocalReplica) PutReader(path string, reader io.Reader) error
PutReader writes a file to |path|
func (*LocalReplica) PutSoftlink ¶
func (r *LocalReplica) PutSoftlink(pointingTo, path string) error
PutSoftlink creates a softlink
type MockLocalReplica ¶
type MockLocalReplica struct {
LocalReplica
}
MockLocalReplica mocks LocalReplica
func NewMockLocalReplica ¶
func NewMockLocalReplica(mongo *mgotest.Server, maxBackgroundCopies int) *MockLocalReplica
NewMockLocalReplica constructs a MockLocalReplica