2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-23 03:18:55 +00:00

repository: Rename Save() -> SaveAndEncrypt()

This commit is contained in:
Alexander Neumann 2015-07-02 23:00:54 +02:00
parent 03983f0907
commit 9a02148daf
2 changed files with 5 additions and 5 deletions

View File

@ -270,9 +270,9 @@ func (r *Repository) countPacker() int {
return len(r.packs)
}
// Save encrypts data and stores it to the backend as type t. If data is small
// SaveAndEncrypt encrypts data and stores it to the backend as type t. If data is small
// enough, it will be packed together with other small blobs.
func (r *Repository) Save(t pack.BlobType, data []byte, id backend.ID) (backend.ID, error) {
func (r *Repository) SaveAndEncrypt(t pack.BlobType, data []byte, id backend.ID) (backend.ID, error) {
if id == nil {
// compute plaintext hash
id = backend.Hash(data)
@ -328,7 +328,7 @@ func (r *Repository) SaveFrom(t pack.BlobType, id backend.ID, length uint, rd io
return err
}
_, err = r.Save(t, buf, id)
_, err = r.SaveAndEncrypt(t, buf, id)
if err != nil {
return err
}
@ -352,7 +352,7 @@ func (r *Repository) SaveJSON(t pack.BlobType, item interface{}) (backend.ID, er
}
buf = wr.Bytes()
return r.Save(t, buf, nil)
return r.SaveAndEncrypt(t, buf, nil)
}
// SaveJSONUnpacked serialises item as JSON and encrypts and saves it in the

View File

@ -80,7 +80,7 @@ func TestSave(t *testing.T) {
id := backend.Hash(data)
// save
sid, err := repo.Save(pack.Data, data, nil)
sid, err := repo.SaveAndEncrypt(pack.Data, data, nil)
OK(t, err)
Equals(t, id, sid)