mirror of
https://github.com/octoleo/restic.git
synced 2025-01-09 17:33:56 +00:00
Fix mock.Repository
This commit is contained in:
parent
ea073f58cf
commit
f5b9ee53a3
@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
// Repository implements a mock Repository.
|
// Repository implements a mock Repository.
|
||||||
type Repository struct {
|
type Repository struct {
|
||||||
BackendFn func() Backend
|
BackendFn func() restic.Backend
|
||||||
|
|
||||||
KeyFn func() *crypto.Key
|
KeyFn func() *crypto.Key
|
||||||
|
|
||||||
@ -41,101 +41,101 @@ type Repository struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Backend is a stub method.
|
// Backend is a stub method.
|
||||||
func (repo *Repository) Backend() Backend {
|
func (repo Repository) Backend() restic.Backend {
|
||||||
return repo.BackendFn()
|
return repo.BackendFn()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Key is a stub method.
|
// Key is a stub method.
|
||||||
func (repo *Repository) Key() *crypto.Key {
|
func (repo Repository) Key() *crypto.Key {
|
||||||
return repo.KeyFn()
|
return repo.KeyFn()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetIndex is a stub method.
|
// SetIndex is a stub method.
|
||||||
func (repo *Repository) SetIndex(idx restic.Index) {
|
func (repo Repository) SetIndex(idx restic.Index) {
|
||||||
repo.SetIndexFn(idx)
|
repo.SetIndexFn(idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Index is a stub method.
|
// Index is a stub method.
|
||||||
func (repo *Repository) Index() restic.Index {
|
func (repo Repository) Index() restic.Index {
|
||||||
return repo.IndexFn()
|
return repo.IndexFn()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SaveFullIndex is a stub method.
|
// SaveFullIndex is a stub method.
|
||||||
func (repo *Repository) SaveFullIndex() error {
|
func (repo Repository) SaveFullIndex() error {
|
||||||
return repo.SaveFullIndexFn()
|
return repo.SaveFullIndexFn()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SaveIndex is a stub method.
|
// SaveIndex is a stub method.
|
||||||
func (repo *Repository) SaveIndex() error {
|
func (repo Repository) SaveIndex() error {
|
||||||
return repo.SaveIndexFn()
|
return repo.SaveIndexFn()
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadIndex is a stub method.
|
// LoadIndex is a stub method.
|
||||||
func (repo *Repository) LoadIndex() error {
|
func (repo Repository) LoadIndex() error {
|
||||||
return repo.LoadIndexFn()
|
return repo.LoadIndexFn()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config is a stub method.
|
// Config is a stub method.
|
||||||
func (repo *Repository) Config() restic.Config {
|
func (repo Repository) Config() restic.Config {
|
||||||
return repo.ConfigFn()
|
return repo.ConfigFn()
|
||||||
}
|
}
|
||||||
|
|
||||||
// LookupBlobSize is a stub method.
|
// LookupBlobSize is a stub method.
|
||||||
func (repo *Repository) LookupBlobSize(id restic.ID, t restic.BlobType) (uint, error) {
|
func (repo Repository) LookupBlobSize(id restic.ID, t restic.BlobType) (uint, error) {
|
||||||
return repo.LookupBlobSizeFn(id, t)
|
return repo.LookupBlobSizeFn(id, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
// List is a stub method.
|
// List is a stub method.
|
||||||
func (repo *Repository) List(t restic.FileType, done <-chan struct{}) <-chan restic.ID {
|
func (repo Repository) List(t restic.FileType, done <-chan struct{}) <-chan restic.ID {
|
||||||
return repo.ListFn(t, done)
|
return repo.ListFn(t, done)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListPack is a stub method.
|
// ListPack is a stub method.
|
||||||
func (repo *Repository) ListPack(id restic.ID) ([]restic.Blob, int64, error) {
|
func (repo Repository) ListPack(id restic.ID) ([]restic.Blob, int64, error) {
|
||||||
return repo.ListPackFn(id)
|
return repo.ListPackFn(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush is a stub method.
|
// Flush is a stub method.
|
||||||
func (repo *Repository) Flush() error {
|
func (repo Repository) Flush() error {
|
||||||
return repo.FlushFn()
|
return repo.FlushFn()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SaveUnpacked is a stub method.
|
// SaveUnpacked is a stub method.
|
||||||
func (repo *Repository) SaveUnpacked(t restic.FileType, buf []byte) (restic.ID, error) {
|
func (repo Repository) SaveUnpacked(t restic.FileType, buf []byte) (restic.ID, error) {
|
||||||
return repo.SaveUnpackedFn(t, buf)
|
return repo.SaveUnpackedFn(t, buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SaveJSONUnpacked is a stub method.
|
// SaveJSONUnpacked is a stub method.
|
||||||
func (repo *Repository) SaveJSONUnpacked(t restic.FileType, item interface{}) (restic.ID, error) {
|
func (repo Repository) SaveJSONUnpacked(t restic.FileType, item interface{}) (restic.ID, error) {
|
||||||
return repo.SaveJSONUnpackedFn(t, item)
|
return repo.SaveJSONUnpackedFn(t, item)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadJSONUnpacked is a stub method.
|
// LoadJSONUnpacked is a stub method.
|
||||||
func (repo *Repository) LoadJSONUnpacked(t restic.FileType, id restic.ID, item interface{}) error {
|
func (repo Repository) LoadJSONUnpacked(t restic.FileType, id restic.ID, item interface{}) error {
|
||||||
return repo.LoadJSONUnpackedFn(t, id, item)
|
return repo.LoadJSONUnpackedFn(t, id, item)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadAndDecrypt is a stub method.
|
// LoadAndDecrypt is a stub method.
|
||||||
func (repo *Repository) LoadAndDecrypt(t restic.FileType, id restic.ID) ([]byte, error) {
|
func (repo Repository) LoadAndDecrypt(t restic.FileType, id restic.ID) ([]byte, error) {
|
||||||
return repo.LoadAndDecryptFn(t, id)
|
return repo.LoadAndDecryptFn(t, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadBlob is a stub method.
|
// LoadBlob is a stub method.
|
||||||
func (repo *Repository) LoadBlob(t restic.BlobType, id restic.ID, buf []byte) (int, error) {
|
func (repo Repository) LoadBlob(t restic.BlobType, id restic.ID, buf []byte) (int, error) {
|
||||||
return repo.LoadBlobFn(t, id, buf)
|
return repo.LoadBlobFn(t, id, buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SaveBlob is a stub method.
|
// SaveBlob is a stub method.
|
||||||
func (repo *Repository) SaveBlob(t restic.BlobType, buf []byte, id restic.ID) (restic.ID, error) {
|
func (repo Repository) SaveBlob(t restic.BlobType, buf []byte, id restic.ID) (restic.ID, error) {
|
||||||
return repo.SaveBlobFn(t, buf, id)
|
return repo.SaveBlobFn(t, buf, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadTree is a stub method.
|
// LoadTree is a stub method.
|
||||||
func (repo *Repository) LoadTree(id restic.ID) (*restic.Tree, error) {
|
func (repo Repository) LoadTree(id restic.ID) (*restic.Tree, error) {
|
||||||
return repo.LoadTreeFn(id)
|
return repo.LoadTreeFn(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SaveTree is a stub method.
|
// SaveTree is a stub method.
|
||||||
func (repo *Repository) SaveTree(t *restic.Tree) (restic.ID, error) {
|
func (repo Repository) SaveTree(t *restic.Tree) (restic.ID, error) {
|
||||||
return repo.SaveTreeFn(t)
|
return repo.SaveTreeFn(t)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user