mirror of
https://github.com/restic/restic.git
synced 2025-12-03 23:21:47 +00:00
backend: Remove Get()
This is the first commit that removes the (redundant) Get() method of the backend interface. Get(x, y) is equivalent to GetReader(x, y, 0, 0).
This commit is contained in:
@@ -120,7 +120,7 @@ func SearchKey(s *Repository, password string) (*Key, error) {
|
||||
// LoadKey loads a key from the backend.
|
||||
func LoadKey(s *Repository, name string) (k *Key, err error) {
|
||||
// extract data from repo
|
||||
rd, err := s.be.Get(backend.Key, name)
|
||||
rd, err := s.be.GetReader(backend.Key, name, 0, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ func (r *Repository) PrefixLength(t backend.Type) (int, error) {
|
||||
func (r *Repository) LoadAndDecrypt(t backend.Type, id backend.ID) ([]byte, error) {
|
||||
debug.Log("Repo.Load", "load %v with id %v", t, id.Str())
|
||||
|
||||
rd, err := r.be.Get(t, id.String())
|
||||
rd, err := r.be.GetReader(t, id.String(), 0, 0)
|
||||
if err != nil {
|
||||
debug.Log("Repo.Load", "error loading %v: %v", id.Str(), err)
|
||||
return nil, err
|
||||
@@ -157,7 +157,7 @@ func closeOrErr(cl io.Closer, err *error) {
|
||||
// the item.
|
||||
func (r *Repository) LoadJSONUnpacked(t backend.Type, id backend.ID, item interface{}) (err error) {
|
||||
// load blob from backend
|
||||
rd, err := r.be.Get(t, id.String())
|
||||
rd, err := r.be.GetReader(t, id.String(), 0, 0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -548,7 +548,7 @@ func LoadIndex(repo *Repository, id string) (*Index, error) {
|
||||
// GetDecryptReader opens the file id stored in the backend and returns a
|
||||
// reader that yields the decrypted content. The reader must be closed.
|
||||
func (r *Repository) GetDecryptReader(t backend.Type, id string) (io.ReadCloser, error) {
|
||||
rd, err := r.be.Get(t, id)
|
||||
rd, err := r.be.GetReader(t, id, 0, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user