Documentation ¶
Overview ¶
Package backend proides the backends used by fake-gcs-server.
Index ¶
- type Bucket
- type Object
- type Storage
- type StorageFS
- func (s *StorageFS) CreateBucket(name string, versioningEnabled bool) error
- func (s *StorageFS) CreateObject(obj Object) error
- func (s *StorageFS) DeleteObject(bucketName, objectName string) error
- func (s *StorageFS) GetBucket(name string) (Bucket, error)
- func (s *StorageFS) GetObject(bucketName, objectName string) (Object, error)
- func (s *StorageFS) GetObjectWithGeneration(bucketName, objectName string, generation int64) (Object, error)
- func (s *StorageFS) ListBuckets() ([]Bucket, error)
- func (s *StorageFS) ListObjects(bucketName string, versions bool) ([]Object, error)
- type StorageMemory
- func (s *StorageMemory) CreateBucket(name string, versioningEnabled bool) error
- func (s *StorageMemory) CreateObject(obj Object) error
- func (s *StorageMemory) DeleteObject(bucketName, objectName string) error
- func (s *StorageMemory) GetBucket(name string) (Bucket, error)
- func (s *StorageMemory) GetObject(bucketName, objectName string) (Object, error)
- func (s *StorageMemory) GetObjectWithGeneration(bucketName, objectName string, generation int64) (Object, error)
- func (s *StorageMemory) ListBuckets() ([]Bucket, error)
- func (s *StorageMemory) ListObjects(bucketName string, versions bool) ([]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:"-"` ContentType string ContentEncoding string Content []byte Crc32c string Md5Hash string ACL []storage.ACLRule Metadata map[string]string Created string Deleted string Updated string Generation int64 }
Object represents the object that is stored within the fake server.
type Storage ¶
type Storage interface { CreateBucket(name string, versioningEnabled bool) error ListBuckets() ([]Bucket, error) GetBucket(name string) (Bucket, error) CreateObject(obj Object) error ListObjects(bucketName string, versions bool) ([]Object, error) GetObject(bucketName, objectName string) (Object, error) GetObjectWithGeneration(bucketName, objectName string, generation int64) (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) GetObjectWithGeneration ¶ added in v1.16.0
func (s *StorageFS) GetObjectWithGeneration(bucketName, objectName string, generation int64) (Object, error)
GetObjectWithGeneration retrieves an specific version of the object. Not implemented
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, versioningEnabled bool) 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) (Bucket, 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) GetObjectWithGeneration ¶ added in v1.16.0
func (s *StorageMemory) GetObjectWithGeneration(bucketName, objectName string, generation int64) (Object, error)
GetObjectWithGeneration retrieves an specific version of the object
func (*StorageMemory) ListBuckets ¶
func (s *StorageMemory) ListBuckets() ([]Bucket, error)
ListBuckets lists buckets
func (*StorageMemory) ListObjects ¶
func (s *StorageMemory) ListObjects(bucketName string, versions bool) ([]Object, error)
ListObjects lists the objects in a given bucket with a given prefix and delimeter