diff options
author | 2025-03-09 17:47:56 +0100 | |
---|---|---|
committer | 2025-03-10 01:59:49 +0100 | |
commit | 3ac1ee16f377d31a0fb80c8dae28b6239ac4229e (patch) | |
tree | f61faa581feaaeaba2542b9f2b8234a590684413 /vendor/codeberg.org/gruf/go-storage/storage.go | |
parent | [chore] update URLs to forked source (diff) | |
download | gotosocial-3ac1ee16f377d31a0fb80c8dae28b6239ac4229e.tar.xz |
[chore] remove vendor
Diffstat (limited to 'vendor/codeberg.org/gruf/go-storage/storage.go')
-rw-r--r-- | vendor/codeberg.org/gruf/go-storage/storage.go | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/vendor/codeberg.org/gruf/go-storage/storage.go b/vendor/codeberg.org/gruf/go-storage/storage.go deleted file mode 100644 index b13f2d387..000000000 --- a/vendor/codeberg.org/gruf/go-storage/storage.go +++ /dev/null @@ -1,73 +0,0 @@ -package storage - -import ( - "context" - "io" -) - -// Storage defines a means of accessing and storing -// data to some abstracted underlying mechanism. Whether -// that be in-memory, an on-disk filesystem or S3 bucket. -type Storage interface { - - // ReadBytes returns the data located at key (e.g. filepath) in storage. - ReadBytes(ctx context.Context, key string) ([]byte, error) - - // ReadStream returns an io.ReadCloser for the data at key (e.g. filepath) in storage. - ReadStream(ctx context.Context, key string) (io.ReadCloser, error) - - // WriteBytes writes the supplied data at key (e.g. filepath) in storage. - WriteBytes(ctx context.Context, key string, data []byte) (int, error) - - // WriteStream writes the supplied data stream at key (e.g. filepath) in storage. - WriteStream(ctx context.Context, key string, stream io.Reader) (int64, error) - - // Stat returns details about key (e.g. filepath) in storage, nil indicates not found. - Stat(ctx context.Context, key string) (*Entry, error) - - // Remove will remove data at key from storage. - Remove(ctx context.Context, key string) error - - // Clean in simple terms performs a clean of underlying - // storage mechanism. For memory implementations this may - // compact the underlying hashmap, for disk filesystems - // this may remove now-unused directories. - Clean(ctx context.Context) error - - // WalkKeys walks available keys using opts in storage. - WalkKeys(ctx context.Context, opts WalkKeysOpts) error -} - -// Entry represents a key in a Storage{} implementation, -// with any associated metadata that may have been set. -type Entry struct { - - // Key is this entry's - // unique storage key. - Key string - - // Size is the size of - // this entry in storage. - Size int64 -} - -// WalkKeysOpts are arguments provided -// to a storage WalkKeys() implementation. -type WalkKeysOpts struct { - - // Prefix can be used to filter entries - // by the given key prefix, for example - // only those under a subdirectory. This - // is preferred over Filter() function. - Prefix string - - // Filter can be used to filter entries - // by any custom metric before before they - // are passed to Step() function. E.g. - // filter storage entries by regexp. - Filter func(string) bool - - // Step is called for each entry during - // WalkKeys, error triggers early return. - Step func(Entry) error -} |