mirror of https://github.com/perkeep/perkeep.git
blobserver/localdisk: be sure to implement SubFetcher for blobpacked
My fault for not running the (slow) integration tests before I broke
things in a4d0cc6ab7
.
Fixes #1136
Change-Id: Ia30051da02974d0c3e79e0b220ff86dcab5771e4
This commit is contained in:
parent
2f933f83af
commit
b1c1d1be68
|
@ -48,10 +48,13 @@ import (
|
||||||
"go4.org/syncutil"
|
"go4.org/syncutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TODO: rename DiskStorage to Storage.
|
||||||
|
|
||||||
// DiskStorage implements the blobserver.Storage interface using the
|
// DiskStorage implements the blobserver.Storage interface using the
|
||||||
// local filesystem.
|
// local filesystem.
|
||||||
type DiskStorage struct {
|
type DiskStorage struct {
|
||||||
blobserver.Storage
|
blobserver.Storage
|
||||||
|
blob.SubFetcher
|
||||||
|
|
||||||
root string
|
root string
|
||||||
|
|
||||||
|
@ -59,6 +62,12 @@ type DiskStorage struct {
|
||||||
gen *local.Generationer
|
gen *local.Generationer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate we implement expected interfaces.
|
||||||
|
var (
|
||||||
|
_ blobserver.Storage = (*DiskStorage)(nil)
|
||||||
|
_ blob.SubFetcher = (*DiskStorage)(nil) // for blobpacked; Issue 1136
|
||||||
|
)
|
||||||
|
|
||||||
func (ds *DiskStorage) String() string {
|
func (ds *DiskStorage) String() string {
|
||||||
return fmt.Sprintf("\"filesystem\" file-per-blob at %s", ds.root)
|
return fmt.Sprintf("\"filesystem\" file-per-blob at %s", ds.root)
|
||||||
}
|
}
|
||||||
|
@ -106,9 +115,10 @@ func New(root string) (*DiskStorage, error) {
|
||||||
}
|
}
|
||||||
fileSto := files.NewStorage(files.OSFS(), root)
|
fileSto := files.NewStorage(files.OSFS(), root)
|
||||||
ds := &DiskStorage{
|
ds := &DiskStorage{
|
||||||
Storage: fileSto,
|
Storage: fileSto,
|
||||||
root: root,
|
SubFetcher: fileSto,
|
||||||
gen: local.NewGenerationer(root),
|
root: root,
|
||||||
|
gen: local.NewGenerationer(root),
|
||||||
}
|
}
|
||||||
if _, _, err := ds.StorageGeneration(); err != nil {
|
if _, _, err := ds.StorageGeneration(); err != nil {
|
||||||
return nil, fmt.Errorf("Error initialization generation for %q: %v", root, err)
|
return nil, fmt.Errorf("Error initialization generation for %q: %v", root, err)
|
||||||
|
|
Loading…
Reference in New Issue