diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2017-08-02 08:04:28 +0200 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2017-09-26 21:35:40 +0200 |
commit | 03890a8b501475240b343664bdfc3bacebae1cbe (patch) | |
tree | 9944d740bf217fe46db07e72954639c7ef240d75 /storage/storage.go | |
parent | 8c43d2969eaa4404675252480befa0642fca5dc4 (diff) | |
download | petrific-03890a8b501475240b343664bdfc3bacebae1cbe.tar.gz petrific-03890a8b501475240b343664bdfc3bacebae1cbe.tar.bz2 petrific-03890a8b501475240b343664bdfc3bacebae1cbe.zip |
Add config
Diffstat (limited to 'storage/storage.go')
-rw-r--r-- | storage/storage.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/storage/storage.go b/storage/storage.go index 45b1973..0729fe1 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -2,6 +2,7 @@ package storage import ( "bytes" + "code.laria.me/petrific/config" "code.laria.me/petrific/objects" "errors" "fmt" @@ -17,6 +18,14 @@ type Storage interface { Has(id objects.ObjectId) (bool, error) Set(id objects.ObjectId, typ objects.ObjectType, raw []byte) error List(typ objects.ObjectType) ([]objects.ObjectId, error) + + Close() error +} + +type CreateStorageFromConfig func(conf config.Config, name string) (Storage, error) + +var StorageTypes = map[string]CreateStorageFromConfig{ + "memory": MemoryStorageFromConfig, } func SetObject(s Storage, o objects.RawObject) (id objects.ObjectId, err error) { |