2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-07 03:20:49 +00:00
restic/src/restic/repository.go
2016-09-03 21:10:25 +02:00

57 lines
1.3 KiB
Go

package restic
import "restic/crypto"
// Repository stores data in a backend. It provides high-level functions and
// transparently encrypts/decrypts data.
type Repository interface {
// Backend returns the backend used by the repository
Backend() Backend
Key() *crypto.Key
SetIndex(Index)
Index() Index
SaveFullIndex() error
SaveIndex() error
Config() Config
LookupBlobSize(ID, BlobType) (uint, error)
List(FileType, <-chan struct{}) <-chan ID
ListPack(ID) ([]Blob, int64, error)
Flush() error
SaveJSON(BlobType, interface{}) (ID, error)
SaveUnpacked(FileType, []byte) (ID, error)
SaveAndEncrypt(BlobType, []byte, *ID) (ID, error)
SaveJSONUnpacked(FileType, interface{}) (ID, error)
LoadJSONUnpacked(FileType, ID, interface{}) error
LoadAndDecrypt(FileType, ID) ([]byte, error)
LoadTree(id ID) (*Tree, error)
LoadDataBlob(id ID, buf []byte) (int, error)
}
// Deleter removes all data stored in a backend/repo.
type Deleter interface {
Delete() error
}
// Lister allows listing files in a backend.
type Lister interface {
List(FileType, <-chan struct{}) <-chan string
}
// Index keeps track of the blobs are stored within files.
type Index interface {
Has(ID, BlobType) bool
Lookup(ID, BlobType) ([]PackedBlob, error)
Count(BlobType) uint
}