object

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure()

func Count

func Count(ctx context.Context, bucketName, startAfter string) (int, error)

func Delete

func Delete(ctx context.Context, o *Object) error

func Exists

func Exists(ctx context.Context, bucketName, key string) (bool, error)

func JoinPath added in v0.2.0

func JoinPath(parts []string, delimiter string) string

func PathPrefix added in v0.2.0

func PathPrefix(key string, delimiter string) string

func SplitPath added in v0.2.0

func SplitPath(key, delimiter string) []string

func Write

func Write(ctx context.Context, o *Object, w io.Writer) error

Types

type CreateCommand

type CreateCommand struct {
	Key         string
	ContentType string
	Data        []byte
	Size        int64
}

type Object

type Object struct {
	ID             string
	Bucket         string
	Key            string
	ETag           string
	ContentType    string
	Size           int64
	CreatedAt      time.Time
	Deleted        bool
	CurrentVersion string
}

func Copy added in v0.2.0

func Copy(ctx context.Context, src *Object, destKey string) (*Object, error)

Copy creates a new object by copying src to destKey.

func Create

func Create(ctx context.Context, bucketId string, cmd CreateCommand) (*Object, error)

func CreateWithChunk

func CreateWithChunk(ctx context.Context, bucketId, chunkId string, cmd CreateCommand) (*Object, error)

CreateWithChunk Creates an object from an existing chunk. This operation does not increase the chunk's reference count.

func FindMany

func FindMany(ctx context.Context, bucketName string, keys []string, deleted bool) ([]*Object, error)

func FindOne

func FindOne(ctx context.Context, bucketName, key string, deleted bool) (*Object, error)

FindOne finds an object. Returns ec.NoSuchKey if the object cannot be found

func List

func List(ctx context.Context, bucketName, startAfter string, limit int) ([]*Object, error)

func Update added in v0.2.0

func Update(ctx context.Context, o *Object, cmd UpdateCommand) (*Object, error)

func UpdateFromCopy added in v0.2.0

func UpdateFromCopy(ctx context.Context, src, dest *Object) (*Object, error)

type PrefixIndex

type PrefixIndex struct {
	CommonPrefixes []string
	// contains filtered or unexported fields
}

func NewPrefixIndex

func NewPrefixIndex(delimiter, prefix string) *PrefixIndex

func (*PrefixIndex) AddKey

func (i *PrefixIndex) AddKey(key string) bool

AddKey adds a key to the index. The method returns true if this is a key match

type Stats

type Stats struct {
	ObjectCount int64
	TotalSize   int64
}

func StatsForBucket

func StatsForBucket(ctx context.Context, bucketName string) (*Stats, error)

type UpdateCommand added in v0.2.0

type UpdateCommand struct {
	ContentType string
	Data        []byte
	Size        int64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL