Documentation
¶
Overview ¶
sss package stays for Simple Storage Service which provides an interface to the cloud services like AWS S3
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsKeyValid ¶
IsKeyValid checks whether the key is valid: <path><keysuffix> where the keysuffix is a string without '/'
func IsPathValid ¶
IsPathValid checks whether the path is valid: it should start and end on '/'
func TestSimpleStorage ¶
TestSimpleStorage a bunch of tests run against a kvs instance
Types ¶
type Storage ¶
type Storage interface {
// Get allows to read a value by its key. If key is not found the
// ErrNotExist should be returned
Get(ctx context.Context, key string) (io.ReadCloser, error)
// Put allows to store value represented by reader r by the key
Put(ctx context.Context, key string, r io.Reader) error
// List returns a list of keys and sub-paths (part of an existing path which
// is a path itself), which have the prefix of the path argument
//
// Example:
// for the keys list: "/abc", "/def/abc", "/def/aa1"
// List("/") -> "/abc", "/def/"
// List("/def/") -> "/def/abc", "/def/aa1"
List(ctx context.Context, path string) ([]string, error)
// Delete allows to delete a value by key. If the key doesn't exist, the operation
// will return no error
Delete(ctx context.Context, key string) error
}
Storage interface provides access to the Key-Value Simple service. "Simple" means consistency model like "eventual" or stronger one. The purpose of the key-value storage is persisting values (may be BLOBs), which could be found by the keys.
The key represents a file-system alike path and ID to the value. The following conventions are applied:
- any key starts from '/' which is called delimiter
- a key cannot end on '/' delimiter
- the prefix of key, which starts from '/' and ends on '/' called path
- any key consists of 2 parts <path><valId>, where valId is a value identifier within the path. valId cannot contain delimiters
Examples: "/abc" - the key with path="/" and valId="abc" "/abc/def/ms.js" - the key with path="/abc/def/" and valId="ms.js" "abc.js", "", "/", "/abc/" - are not keys
A Value is an object (may be big one), the limitations can be applied by the implementation