Documentation ¶
Index ¶
- type Object
- type Storage
- type StorageFS
- func (s *StorageFS) CreateBucket(name string) error
- func (s *StorageFS) CreateObject(obj Object) error
- func (s *StorageFS) DeleteObject(bucketName, objectName string) error
- func (s *StorageFS) GetBucket(name string) error
- func (s *StorageFS) GetObject(bucketName, objectName string) (Object, error)
- func (s *StorageFS) ListBuckets() ([]string, error)
- func (s *StorageFS) ListObjects(bucketName string) ([]Object, error)
- type StorageMemory
- func (s *StorageMemory) CreateBucket(name string) error
- func (s *StorageMemory) CreateObject(obj Object) error
- func (s *StorageMemory) DeleteObject(bucketName, objectName string) error
- func (s *StorageMemory) GetBucket(name string) error
- func (s *StorageMemory) GetObject(bucketName, objectName string) (Object, error)
- func (s *StorageMemory) ListBuckets() ([]string, error)
- func (s *StorageMemory) ListObjects(bucketName string) ([]Object, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Object ¶
type Object struct { BucketName string `json:"-"` Name string `json:"-"` Content []byte Crc32c string }
Object represents the object that is stored within the fake server.
type Storage ¶
type Storage interface { CreateBucket(name string) error ListBuckets() ([]string, error) GetBucket(name string) error CreateObject(obj Object) error ListObjects(bucketName string) ([]Object, error) GetObject(bucketName, objectName string) (Object, error) DeleteObject(bucketName, objectName string) error }
Storage is the generic interface for implementing the backend storage of the server
func NewStorageFS ¶
NewStorageFS creates an instance of StorageMemory
func NewStorageMemory ¶
NewStorageMemory creates an instance of StorageMemory
type StorageFS ¶
type StorageFS struct {
// contains filtered or unexported fields
}
StorageFS is an implementation of the backend storage that stores data on disk The layout is the following:
- rootDir |- bucket1 \- bucket2 |- object1 \- object2
Bucket and object names are url path escaped, so there's no special meaning of forward slashes.
func (*StorageFS) CreateBucket ¶
CreateBucket creates a bucket
func (*StorageFS) CreateObject ¶
CreateObject stores an object
func (*StorageFS) DeleteObject ¶
DeleteObject deletes an object by bucket and name
func (*StorageFS) ListBuckets ¶
ListBuckets lists buckets
type StorageMemory ¶
type StorageMemory struct {
// contains filtered or unexported fields
}
StorageMemory is an implementation of the backend storage that stores data in memory
func (*StorageMemory) CreateBucket ¶
func (s *StorageMemory) CreateBucket(name string) error
CreateBucket creates a bucket
func (*StorageMemory) CreateObject ¶
func (s *StorageMemory) CreateObject(obj Object) error
CreateObject stores an object
func (*StorageMemory) DeleteObject ¶
func (s *StorageMemory) DeleteObject(bucketName, objectName string) error
DeleteObject deletes an object by bucket and name
func (*StorageMemory) GetBucket ¶
func (s *StorageMemory) GetBucket(name string) error
GetBucket checks if a bucket exists
func (*StorageMemory) GetObject ¶
func (s *StorageMemory) GetObject(bucketName, objectName string) (Object, error)
GetObject get an object by bucket and name
func (*StorageMemory) ListBuckets ¶
func (s *StorageMemory) ListBuckets() ([]string, error)
ListBuckets lists buckets
func (*StorageMemory) ListObjects ¶
func (s *StorageMemory) ListObjects(bucketName string) ([]Object, error)
ListObjects lists the objects in a given bucket with a given prefix and delimeter