restic/backend/interface.go

40 lines
576 B
Go
Raw Normal View History

2014-09-23 20:39:12 +00:00
package backend
2014-10-07 21:19:26 +00:00
import "errors"
2014-09-23 20:39:12 +00:00
type Type string
const (
Data Type = "data"
2014-09-23 20:39:12 +00:00
Key = "key"
Lock = "lock"
Snapshot = "snapshot"
Tree = "tree"
2014-11-23 21:26:01 +00:00
Map = "map"
2014-09-23 20:39:12 +00:00
)
2014-10-04 14:49:39 +00:00
const (
BackendVersion = 1
)
2014-10-07 21:19:26 +00:00
var (
ErrAlreadyPresent = errors.New("blob is already present in backend")
)
type Lister interface {
List(Type) (IDs, error)
}
2014-09-23 20:39:12 +00:00
type Server interface {
Create(Type, []byte) (ID, error)
Get(Type, ID) ([]byte, error)
Lister
2014-09-23 20:39:12 +00:00
Test(Type, ID) (bool, error)
Remove(Type, ID) error
2014-10-04 14:49:39 +00:00
Version() uint
2014-09-23 20:39:12 +00:00
2014-10-04 17:20:15 +00:00
Close() error
2014-09-23 20:39:12 +00:00
Location() string
}