Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Blobs ¶
type Blobs interface { // Write copies all the data from r to a blob, that is addressable by the returned id. Write(ctx context.Context, r io.Reader) (id string, size int64, err error) // Delete removes a blob by id. Delete(ctx context.Context, id string) error // OffsetReader returns a reader to a blob with an initial offset to be skipped. // The responsibiltiy to close the reader is on the caller. OffsetReader(id string, offset int64) (io.ReadCloser, error) // Reader is a shorthand for OffsetReader(id, 0) Reader(id string) (io.ReadCloser, error) }
Blobs is a persistent storage for blobs of data.
func NewBlobs ¶
func NewBlobs(fs afero.Fs, idGen crypto.IDGenerator, opts BlobsOptions) (Blobs, error)
NewBlobs creates a new blob store.
type BlobsOptions ¶
type BlobsOptions struct {
Foldername string
}
BlobsOptions are the configuration properties for the blob store.
func BlobsOptionsFromViper ¶
func BlobsOptionsFromViper() BlobsOptions
BlobsOptionsFromViper fills BlobsOptions using viper.
type Cache ¶
type Cache interface { // Write copies all data from the reader into temporary storage. If the total size exceeds the // configured limit, the data will be written to disk. Write(context.Context, io.Reader) (CacheEntry, error) }
Cache is a temporary storage for blobs of data.
func NewCache ¶
func NewCache(fs afero.Fs, idGen crypto.IDGenerator, opts CacheOptions) (Cache, error)
NewCache creates a new cache.
type CacheEntry ¶
type CacheEntry interface { // Release deletes data on disk, that may have been written. If the size of the cache entry is // smaller than the memory limit, this is a noop. Release(context.Context) error // Reader returns a new reader to the full blob of data. This essentially seeks the start of the // file and is therefore not safe for concurrent use. Reader() (io.Reader, error) }
CacheEntry is a single blob of data kept in temporary storage.
type CacheOptions ¶
type CacheOptions struct { // Foldername is the folder to store temporary files in. Foldername string // MemoryLimit is the maximum size of files in bytes to be kept in memory. MemoryLimit uint }
CacheOptions are the configuration properties for the cache.
func CacheOptionsFromViper ¶
func CacheOptionsFromViper() CacheOptions
CacheOptionsFromViper fills CacheOptions using viper.
Click to show internal directories.
Click to hide internal directories.