store

package
v0.0.0-...-d502b9d Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureStorage

type AzureStorage struct {
	// contains filtered or unexported fields
}

AzureStorage stores files on Azure Blob Storage

func (*AzureStorage) Delete

func (f *AzureStorage) Delete(name string, tag interface{}) (err error)

func (*AzureStorage) Get

func (f *AzureStorage) Get(name string, out io.Writer) (found bool, tag interface{}, err error)

func (*AzureStorage) Init

func (f *AzureStorage) Init(connection string) error

func (*AzureStorage) Set

func (f *AzureStorage) Set(name string, in io.Reader, tag interface{}) (tagOut interface{}, err error)

type Local

type Local struct {
	// contains filtered or unexported fields
}

Local is the local file system This implementation does not rely on tags, as it's assumed that concurrency isn't an issue on a single machine

func (*Local) Delete

func (f *Local) Delete(name string, tag interface{}) (err error)

func (*Local) Get

func (f *Local) Get(name string, out io.Writer) (found bool, tag interface{}, err error)

func (*Local) Init

func (f *Local) Init(connection string) error

func (*Local) Set

func (f *Local) Set(name string, in io.Reader, tag interface{}) (tagOut interface{}, err error)

type Store

type Store interface {
	// Init the object, by passing a connection string
	Init(connection string) error

	// Get returns a stream to a file in the filesystem
	// It also returns a tag (which might be empty) that should be passed to the Set method if you want to subsequentially update the contents of the file
	Get(name string, out io.Writer) (found bool, tag interface{}, err error)

	// Set writes a stream to the file in the filesystem
	// If you pass a tag, the implementation might use that to ensure that the file on the filesystem hasn't been changed since it was read (optional)
	Set(name string, in io.Reader, tag interface{}) (tagOut interface{}, err error)

	// Delete a file from the filesystem
	// If you pass a tag, the implementation might use that to ensure that the file on the filesystem hasn't been changed since it was read (optional)
	Delete(name string, tag interface{}) (err error)
}

Store is the interface for the store

func Get

func Get(connection string) (store Store, err error)

Get returns a store for the given connection string

Jump to

Keyboard shortcuts

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