diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2017-10-03 14:59:45 +0200 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2017-10-03 15:01:38 +0200 |
commit | 4de510778b6e55a2238374834d00b03726da76d4 (patch) | |
tree | 7b2d8b8f4db5d0bc2b81c8dfb31921fa59d45c6d /storage | |
parent | db0c023fd0d756912c3f575c6ac65e99fda573cc (diff) | |
download | petrific-4de510778b6e55a2238374834d00b03726da76d4.tar.gz petrific-4de510778b6e55a2238374834d00b03726da76d4.tar.bz2 petrific-4de510778b6e55a2238374834d00b03726da76d4.zip |
Documentation
Diffstat (limited to 'storage')
-rw-r--r-- | storage/cloud/swift.go | 2 | ||||
-rw-r--r-- | storage/filter/filter.go | 15 | ||||
-rw-r--r-- | storage/local/local.go | 7 | ||||
-rw-r--r-- | storage/memory/memory.go | 3 |
4 files changed, 27 insertions, 0 deletions
diff --git a/storage/cloud/swift.go b/storage/cloud/swift.go index a721f67..f08b1cc 100644 --- a/storage/cloud/swift.go +++ b/storage/cloud/swift.go @@ -35,6 +35,8 @@ type SwiftConfig struct { Timeout string `toml:"timeout,omitempty"` } +// SwiftStorageCreator creates an object storage that saves the objects to an openstack swift storage. +// Use the method "openstack-swift" in your config and refer to the `SwiftConfig` structure for additional config keys. func SwiftStorageCreator() storage.CreateStorageFromConfig { return cloudStorageCreator(func(conf config.Config, name string) (CloudStorage, error) { var storage_conf SwiftConfig diff --git a/storage/filter/filter.go b/storage/filter/filter.go index 52ecbfd..1628c1e 100644 --- a/storage/filter/filter.go +++ b/storage/filter/filter.go @@ -34,6 +34,21 @@ func (pf PipeFilter) Transform(b []byte) ([]byte, error) { return buf.Bytes(), nil } +// FilterSorage is a storage implementation wrapping around another storage, sending each raw object through an extrenal +// binary for custom de/encoding (think encryption, compression, ...). +// +// It is used in a configuration by using the method "filter". It needs the config key "base" referencing the name of +// another configured storage. Also needed are the string lists "decode" and "encode", describing which binary to call +// with which parameters. +// +// For example, here is a configuration for a filter storage wrapping a storage "foo", +// encrypting the content with gpg for the key "foobar" +// +// [storage.foo_encrypted] +// method="filter" +// base="foo" +// encode=["gpg", "--encrypt", "--recipient", "foobar"] +// decode=["gpg", "--decrypt"] type FilterStorage struct { Base storage.Storage Decode, Encode Filter diff --git a/storage/local/local.go b/storage/local/local.go index 7dc59cb..ae39eb5 100644 --- a/storage/local/local.go +++ b/storage/local/local.go @@ -20,6 +20,13 @@ func objectDir(id objects.ObjectId) string { return joinPath(string(id.Algo), hex.EncodeToString(id.Sum[0:1])) } +// LocalStorage is a storage implementation that saves your objects on your local filesystem. +// +// Example config: +// +// [storage.local_test] +// method="local" +// path="~/.local/share/petrific" # Save the objects here type LocalStorage struct { Path string index storage.Index diff --git a/storage/memory/memory.go b/storage/memory/memory.go index e73c51a..dc72f70 100644 --- a/storage/memory/memory.go +++ b/storage/memory/memory.go @@ -6,6 +6,9 @@ import ( "code.laria.me/petrific/storage" ) +// Memory storage is an in-memory storage. It is rather useless when using petrific, it is mostly used for internal testing. +// But if you want to use the memory storage anyway, you can do that by putting a storage section with the method +// "memory" in your config file type MemoryStorage struct { objects map[string][]byte bytype map[objects.ObjectType][]objects.ObjectId |