mirror of
https://github.com/restic/restic.git
synced 2026-11-28 23:27:49 +00:00
Add a lot of comments
This commit is contained in:
1 parent
c34aa72538
commit
eb1669a061
2 files changed
+12
-2
No files matched your search
@@ -16,6 +16,7 @@ type MockBackend struct {
|
||||
LocationFn func() string
|
||||
}
|
||||
|
||||
// Close the backend.
|
||||
func (m *MockBackend) Close() error {
|
||||
if m.CloseFn == nil {
|
||||
return nil
|
||||
@@ -24,6 +25,7 @@ func (m *MockBackend) Close() error {
|
||||
return m.CloseFn()
|
||||
}
|
||||
|
||||
// Location returns a location string.
|
||||
func (m *MockBackend) Location() string {
|
||||
if m.LocationFn == nil {
|
||||
return ""
|
||||
@@ -32,6 +34,7 @@ func (m *MockBackend) Location() string {
|
||||
return m.LocationFn()
|
||||
}
|
||||
|
||||
// Load loads data from the backend.
|
||||
func (m *MockBackend) Load(h Handle, p []byte, off int64) (int, error) {
|
||||
if m.LoadFn == nil {
|
||||
return 0, errors.New("not implemented")
|
||||
@@ -40,6 +43,7 @@ func (m *MockBackend) Load(h Handle, p []byte, off int64) (int, error) {
|
||||
return m.LoadFn(h, p, off)
|
||||
}
|
||||
|
||||
// Save data in the backend.
|
||||
func (m *MockBackend) Save(h Handle, p []byte) error {
|
||||
if m.SaveFn == nil {
|
||||
return errors.New("not implemented")
|
||||
@@ -48,6 +52,7 @@ func (m *MockBackend) Save(h Handle, p []byte) error {
|
||||
return m.SaveFn(h, p)
|
||||
}
|
||||
|
||||
// Stat an object in the backend.
|
||||
func (m *MockBackend) Stat(h Handle) (BlobInfo, error) {
|
||||
if m.StatFn == nil {
|
||||
return BlobInfo{}, errors.New("not implemented")
|
||||
@@ -56,6 +61,7 @@ func (m *MockBackend) Stat(h Handle) (BlobInfo, error) {
|
||||
return m.StatFn(h)
|
||||
}
|
||||
|
||||
// List items of type t.
|
||||
func (m *MockBackend) List(t Type, done <-chan struct{}) <-chan string {
|
||||
if m.ListFn == nil {
|
||||
ch := make(chan string)
|
||||
@@ -66,6 +72,7 @@ func (m *MockBackend) List(t Type, done <-chan struct{}) <-chan string {
|
||||
return m.ListFn(t, done)
|
||||
}
|
||||
|
||||
// Remove data from the backend.
|
||||
func (m *MockBackend) Remove(t Type, name string) error {
|
||||
if m.RemoveFn == nil {
|
||||
return errors.New("not implemented")
|
||||
@@ -74,6 +81,7 @@ func (m *MockBackend) Remove(t Type, name string) error {
|
||||
return m.RemoveFn(t, name)
|
||||
}
|
||||
|
||||
// Test for the existence of a specific item.
|
||||
func (m *MockBackend) Test(t Type, name string) (bool, error) {
|
||||
if m.TestFn == nil {
|
||||
return false, errors.New("not implemented")
|
||||
@@ -82,6 +90,7 @@ func (m *MockBackend) Test(t Type, name string) (bool, error) {
|
||||
return m.TestFn(t, name)
|
||||
}
|
||||
|
||||
// Delete all data.
|
||||
func (m *MockBackend) Delete() error {
|
||||
if m.DeleteFn == nil {
|
||||
return errors.New("not implemented")
|
||||
|
||||
Reference in new issue
Block a user