aboutsummaryrefslogtreecommitdiffstats
path: root/store.go
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2012-04-18 20:33:49 -0400
committerbnewbold <bnewbold@robocracy.org>2012-04-18 20:34:05 -0400
commitb5bb57d8dd052ca1e61287d17467cb67ca8f4a73 (patch)
tree684134b39ba07d3b5c181ecbc55de4c8173bccb3 /store.go
parent7c688a91233dedb6c526d2c8cb3263774667158a (diff)
downloadbommom-b5bb57d8dd052ca1e61287d17467cb67ca8f4a73.tar.gz
bommom-b5bb57d8dd052ca1e61287d17467cb67ca8f4a73.zip
minor cleanup
Diffstat (limited to 'store.go')
-rw-r--r--store.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/store.go b/store.go
index 182f97d..d08deaa 100644
--- a/store.go
+++ b/store.go
@@ -7,15 +7,13 @@ import (
"path"
)
-var bomstore BomStore
-
// TODO: who owns returned BOMs? Caller? need "free" methods?
type BomStore interface {
GetStub(user, name ShortName) (*BomStub, error)
- GetHead(user, name ShortName) (*Bom, error)
+ GetHead(user, name ShortName) (*BomStub, *Bom, error)
GetBom(user, name, version ShortName) (*Bom, error)
Persist(bs *BomStub, b *Bom, version ShortName) error
- ListBoms(user ShortName) (*Bom, error)
+ ListBoms(user ShortName) ([]BomStub, error)
}
// Basic BomStore backend using a directory structure of JSON files saved to
@@ -24,12 +22,12 @@ type JSONFileBomStore struct {
Rootfpath string
}
-func NewJSONFileBomStore(fpath string) (*JSONFileBomStore, error) {
+func NewJSONFileBomStore(fpath string) error {
err := os.MkdirAll(fpath, os.ModePerm|os.ModeDir)
if err != nil && !os.IsExist(err) {
- return nil, err
+ return err
}
- return &JSONFileBomStore{Rootfpath: fpath}, nil
+ return nil
}
func OpenJSONFileBomStore(fpath string) (*JSONFileBomStore, error) {