drivers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalStorage

type LocalStorage struct {
	// Path defines the root directory of the local storage.
	Path string
	// Permissions defines the file permissions for the files in the local storage.
	// If not specified, the default value 0644 is used.
	Permissions *int
}

func NewLocalStorage

func NewLocalStorage(path string) *LocalStorage

NewLocalStorage creates a new LocalStorage instance. The path defines the root directory of the local storage.

func (LocalStorage) Delete

func (d LocalStorage) Delete(key string) error

func (LocalStorage) Exists

func (d LocalStorage) Exists(key string) (bool, error)

func (LocalStorage) List

func (d LocalStorage) List() ([]string, error)

func (LocalStorage) Read

func (d LocalStorage) Read(key string) (io.Reader, error)

Read returns the value of the file identified by key. If the file does not exist, an error is returned.

func (LocalStorage) Write

func (d LocalStorage) Write(key string, value io.Reader) error

type S3

type S3 struct {
	Bucket     string
	PathPrefix string
	// contains filtered or unexported fields
}

S3 defines the interface "Driver" implementation for the s3 protocol.

func NewS3

func NewS3(bucket, pathPrefix string, conn *s3.S3, session *session.Session) *S3

NewS3 creates a new S3 instance.

func NewS3FromConfig

func NewS3FromConfig(config S3Config) (*S3, error)

NewS3FromConfig creates a new S3 instance from the given configuration.

func (S3) Delete

func (s3def S3) Delete(key string) error

func (S3) Exists

func (s3def S3) Exists(key string) (bool, error)

func (S3) List

func (s3def S3) List() ([]string, error)

func (S3) Read

func (s3def S3) Read(key string) (io.Reader, error)

Read reads the file/object and returns the content.

func (S3) Write

func (s3def S3) Write(key string, value io.Reader) error

type S3Config

type S3Config struct {
	// Endpoint is the endpoint of the S3 service.
	Endpoint string
	// Region is the region of the S3 service.
	Region string
	// AccessKeyID is the access key ID of the S3 service.
	AccessKeyID string
	// SecretAccessKey is the secret access key of the S3 service.
	SecretAccessKey string
	// Bucket is the bucket name of the S3 service.
	Bucket string
	// PathPrefix is the path prefix of the S3 service.
	PathPrefix string
	// DisableSSL defines whether to disable SSL or not.
	DisableSSL bool
}

S3Config defines a wrapper for the s3 configuration

Jump to

Keyboard shortcuts

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