backend

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Config() *config.BackendConfig
	Delete(filename string) error
	Init() error
	List() ([]string, error)
	Read(filename string) ([]byte, error)
	Write(filename string, data io.Reader) error
}

Backend is an interface that abstracts operations on a data store

type Local

type Local struct {
	BackendConfig *config.BackendConfig
	Opts          *LocalOpts
}

Local implements the Backend interface

func (*Local) Config

func (b *Local) Config() *config.BackendConfig

Config returns the backend's config

func (*Local) Delete

func (b *Local) Delete(filename string) error

Delete deletes the specified file from the backend

func (*Local) Init

func (b *Local) Init() error

Init the backend

func (*Local) List

func (b *Local) List() (ret []string, err error)

List lists all files in the specified path on the backend

func (*Local) Read

func (b *Local) Read(filename string) ([]byte, error)

Read reads the specified file from the backend

func (*Local) Write

func (b *Local) Write(filename string, data io.Reader) error

Writes the contents to the specified path on the backend

type LocalOpts

type LocalOpts struct {
}

LocalOpts represents the local backend configuration options

type S3

type S3 struct {
	BackendConfig *config.BackendConfig
	Opts          *S3Opts
	// contains filtered or unexported fields
}

S3 implements the Backend interface

func (*S3) Config

func (b *S3) Config() *config.BackendConfig

Config returns the backend's config

func (*S3) Delete

func (b *S3) Delete(filename string) error

Delete deletes the specified file from the backend

func (*S3) Init

func (b *S3) Init() error

Init the backend

func (*S3) List

func (b *S3) List() (ret []string, err error)

List lists all files in the specified path on the backend

func (*S3) Read

func (b *S3) Read(filename string) ([]byte, error)

Read reads the specified file from the backend

func (*S3) Write

func (b *S3) Write(filename string, data io.Reader) error

Writes the contents to the specified path on the backend

type S3Auth

type S3Auth struct {
	AccessKeyID     string
	SecretAccessKey string
	SessionToken    string
}

S3Auth represents the S3 backend authentication configuration options

type S3Opts

type S3Opts struct {
	Auth   *S3Auth
	Bucket string
	Region string
}

S3Opts represents the S3 backend configuration options

Jump to

Keyboard shortcuts

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