renamed 'blob.Storage' to 'storage.Storage'

This commit is contained in:
Jarek Kowalski committed 2017-10-14 16:38:09 -07:00
1 parent cc3e590136
commit f33ae14573
39 files changed
+142 -142

No files matched your search

+9 -9
View File
@@ -12,7 +12,7 @@
"sync/atomic"
"time"
"github.com/kopia/kopia/blob"
"github.com/kopia/kopia/storage"
)
const parallelFetches = 5
@@ -46,7 +46,7 @@ type Info struct {
// Manager manages storage blocks at a low level with encryption, deduplication and packaging.
type Manager struct {
storage blob.Storage
storage storage.Storage
stats Stats
mu sync.Mutex
@@ -75,7 +75,7 @@ func (bm *Manager) BlockSize(blockID string) (int64, error) {
ndx := pi[blockID]
if ndx == nil {
return 0, blob.ErrBlockNotFound
return 0, storage.ErrBlockNotFound
}
return int64(ndx.Items[blockID].size), nil
@@ -644,7 +644,7 @@ func (bm *Manager) writeUnpackedBlock(data []byte, prefix string, force bool) (s
return blockID, nil
}
if err != nil && err != blob.ErrBlockNotFound {
if err != nil && err != storage.ErrBlockNotFound {
// Don't know whether block exists in storage.
return "", err
}
@@ -685,7 +685,7 @@ func (bm *Manager) getPendingBlockLocked(blockID string) ([]byte, error) {
}
}
}
return nil, blob.ErrBlockNotFound
return nil, storage.ErrBlockNotFound
}
// GetBlock gets the contents of a given block. If the block is not found returns blob.ErrBlockNotFound.
@@ -721,7 +721,7 @@ func (bm *Manager) BlockInfo(blockID string) (Info, error) {
func (bm *Manager) blockInfoLocked(blockID string) (Info, error) {
ndx := bm.blockToIndex[blockID]
if ndx == nil {
return Info{}, blob.ErrBlockNotFound
return Info{}, storage.ErrBlockNotFound
}
return Info{
@@ -737,7 +737,7 @@ func (bm *Manager) blockInfoLocked(blockID string) (Info, error) {
func (bm *Manager) getBlockInternal(blockID string) ([]byte, error) {
s, err := bm.blockInfoLocked(blockID)
if err != nil {
if err != blob.ErrBlockNotFound {
if err != storage.ErrBlockNotFound {
return nil, err
}
}
@@ -788,9 +788,9 @@ func (bm *Manager) verifyChecksum(data []byte, blockID string) error {
}
// NewManager creates new block manager with given packing options and a formatter.
func NewManager(storage blob.Storage, maxPackedContentLength, maxPackSize int, formatter Formatter) *Manager {
func NewManager(st storage.Storage, maxPackedContentLength, maxPackSize int, formatter Formatter) *Manager {
return &Manager{
storage: storage,
storage: st,
openPackGroups: make(map[string]*packInfo),
timeNow: time.Now,
flushPackIndexesAfter: time.Now().Add(flushPackIndexTimeout),
+5 -5
View File
@@ -14,7 +14,7 @@
"testing"
"time"
"github.com/kopia/kopia/blob"
"github.com/kopia/kopia/storage"
"github.com/kopia/kopia/internal/storagetesting"
)
@@ -146,12 +146,12 @@ func TestBlockManagerEmpty(t *testing.T) {
noSuchBlockID := md5hash([]byte("foo"))
b, err := bm.GetBlock(noSuchBlockID)
if err != blob.ErrBlockNotFound {
if err != storage.ErrBlockNotFound {
t.Errorf("unexpected error when getting non-existent block: %v, %v", b, err)
}
bs, err := bm.BlockSize(noSuchBlockID)
if err != blob.ErrBlockNotFound {
if err != storage.ErrBlockNotFound {
t.Errorf("unexpected error when getting non-existent block size: %v, %v", bs, err)
}
@@ -432,8 +432,8 @@ func verifyBlockNotFound(t *testing.T, bm *Manager, blockID string) {
t.Helper()
b, err := bm.GetBlock(blockID)
if err != blob.ErrBlockNotFound {
t.Errorf("unexpected response from GetBlock(%q), got %v,%v, expected %v", blockID, b, err, blob.ErrBlockNotFound)
if err != storage.ErrBlockNotFound {
t.Errorf("unexpected response from GetBlock(%q), got %v,%v, expected %v", blockID, b, err, storage.ErrBlockNotFound)
}
}