Documentation ¶
Overview ¶
Package backend proides the backends used by fake-gcs-server.
Index ¶
Constants ¶
View Source
const ( BucketNotFound = Error("bucket not found") BucketNotEmpty = Error("bucket must be empty prior to deletion") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Object ¶
type Object struct { ObjectAttrs Content []byte }
Object represents the object that is stored within the fake server.
type ObjectAttrs ¶ added in v1.30.0
type ObjectAttrs struct { BucketName string `json:"-"` Name string `json:"-"` Size int64 `json:"-"` ContentType string ContentEncoding string Crc32c string Md5Hash string Etag string ACL []storage.ACLRule Metadata map[string]string Created string Deleted string Updated string Generation int64 }
ObjectAttrs represents the meta-data without its contents.
func (*ObjectAttrs) ID ¶ added in v1.30.0
func (o *ObjectAttrs) ID() string
ID is used for comparing objects.
func (*ObjectAttrs) IDNoGen ¶ added in v1.30.0
func (o *ObjectAttrs) IDNoGen() string
IDNoGen does not consider the generation field.
type Storage ¶
type Storage interface { CreateBucket(name string, versioningEnabled bool) error ListBuckets() ([]Bucket, error) GetBucket(name string) (Bucket, error) DeleteBucket(name string) error CreateObject(obj Object) (Object, error) ListObjects(bucketName string, prefix string, versions bool) ([]ObjectAttrs, error) GetObject(bucketName, objectName string) (Object, error) GetObjectWithGeneration(bucketName, objectName string, generation int64) (Object, error) DeleteObject(bucketName, objectName string) error PatchObject(bucketName, objectName string, metadata map[string]string) (Object, error) UpdateObject(bucketName, objectName string, metadata map[string]string) (Object, error) ComposeObject(bucketName string, objectNames []string, destinationName string, metadata map[string]string, contentType string) (Object, error) }
Storage is the generic interface for implementing the backend storage of the server.
func NewStorageFS ¶
NewStorageFS creates an instance of the filesystem-backed storage backend.
func NewStorageMemory ¶
NewStorageMemory creates an instance of StorageMemory.
Click to show internal directories.
Click to hide internal directories.