Documentation
¶
Index ¶
- type Config
- type ReaderSize
- type S3Storage
- func (st *S3Storage) Clean(ctx context.Context) error
- func (st *S3Storage) Client() *minio.Core
- func (st *S3Storage) GetObject(ctx context.Context, key string, opts minio.GetObjectOptions) (io.ReadCloser, minio.ObjectInfo, http.Header, error)
- func (st *S3Storage) PutObject(ctx context.Context, key string, r io.Reader, opts minio.PutObjectOptions) (minio.UploadInfo, error)
- func (st *S3Storage) ReadBytes(ctx context.Context, key string) ([]byte, error)
- func (st *S3Storage) ReadStream(ctx context.Context, key string) (io.ReadCloser, error)
- func (st *S3Storage) Remove(ctx context.Context, key string) error
- func (st *S3Storage) RemoveObject(ctx context.Context, key string, opts minio.RemoveObjectOptions) error
- func (st *S3Storage) Stat(ctx context.Context, key string) (*storage.Entry, error)
- func (st *S3Storage) StatObject(ctx context.Context, key string, opts minio.StatObjectOptions) (minio.ObjectInfo, error)
- func (st *S3Storage) WalkKeys(ctx context.Context, opts storage.WalkKeysOpts) error
- func (st *S3Storage) WriteBytes(ctx context.Context, key string, value []byte) (int, error)
- func (st *S3Storage) WriteStream(ctx context.Context, key string, r io.Reader) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // KeyPrefix allows specifying a // prefix applied to all S3 object // requests, e.g. allowing you to // partition a bucket by key prefix. KeyPrefix string // CoreOpts are S3 client options // passed during initialization. CoreOpts minio.Options // PutChunkSize is the chunk size (in bytes) // to use when sending a byte stream reader // of unknown size as a multi-part object. PutChunkSize int64 // ListSize determines how many items // to include in each list request, made // during calls to .WalkKeys(). ListSize int }
Config defines options to be used when opening an S3Storage, mostly options for underlying S3 client library.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default S3Storage configuration.
type ReaderSize ¶
ReaderSize is an extension of the io.Reader interface that may be implemented by callers of WriteStream() in order to improve performance. When the size is known it is passed onto the underlying minio S3 library.
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
S3Storage is a storage implementation that stores key-value pairs in an S3 instance at given endpoint with bucket name.
func Open ¶
Open opens a new S3Storage instance with given S3 endpoint URL, bucket name and configuration.
func (*S3Storage) Client ¶
func (st *S3Storage) Client() *minio.Core
Client: returns access to the underlying S3 client.
func (*S3Storage) GetObject ¶ added in v0.2.0
func (st *S3Storage) GetObject(ctx context.Context, key string, opts minio.GetObjectOptions) (io.ReadCloser, minio.ObjectInfo, http.Header, error)
GetObject wraps minio.Core{}.GetObject() to handle wrapping with our own storage library error types.
func (*S3Storage) PutObject ¶ added in v0.2.0
func (st *S3Storage) PutObject(ctx context.Context, key string, r io.Reader, opts minio.PutObjectOptions) (minio.UploadInfo, error)
PutObject wraps minio.Core{}.PutObject() to handle wrapping with our own storage library error types, and in the case of an io.Reader that does not implement ReaderSize{}, it will instead handle upload by using minio.Core{}.NewMultipartUpload() in chunks of PutChunkSize.
func (*S3Storage) ReadStream ¶
ReadStream: implements Storage.ReadStream().
func (*S3Storage) RemoveObject ¶ added in v0.2.0
func (st *S3Storage) RemoveObject(ctx context.Context, key string, opts minio.RemoveObjectOptions) error
RemoveObject wraps minio.Core{}.RemoveObject() to handle wrapping with our own storage library error types.
func (*S3Storage) StatObject ¶ added in v0.2.0
func (st *S3Storage) StatObject(ctx context.Context, key string, opts minio.StatObjectOptions) (minio.ObjectInfo, error)
StatObject wraps minio.Core{}.StatObject() to handle wrapping with our own storage library error types.
func (*S3Storage) WriteBytes ¶
WriteBytes: implements Storage.WriteBytes().