Documentation
¶
Index ¶
- type CachedErrorResponse
- type CachedObjectInfo
- type Config
- type EntryCache
- 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 CachedErrorResponse ¶ added in v0.4.0
CachedErrorResponse can be returned when an S3 is configured with caching, and the basic details of an error response have been stored in the cache.
func (*CachedErrorResponse) Error ¶ added in v0.4.0
func (err *CachedErrorResponse) Error() string
func (*CachedErrorResponse) Is ¶ added in v0.4.0
func (err *CachedErrorResponse) Is(other error) bool
type CachedObjectInfo ¶ added in v0.4.0
type CachedObjectInfo struct {
Key string
ETag string
Size int64
ContentType string
LastModified time.Time
VersionID string
}
CachedObjectInfo provides the minimum cacheable set of S3 object information that may be returned from a Get() or Stat() operation, or on Put().
func (*CachedObjectInfo) ToObjectInfo ¶ added in v0.4.0
func (info *CachedObjectInfo) ToObjectInfo() minio.ObjectInfo
ToObjectInfo converts CachedObjectInfo to returnable minio.ObjectInfo.
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
// Cache is an optional type that may be
// provided to store simple entry information
// to speed up Get() / Stat() operations.
Cache EntryCache
}
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 EntryCache ¶ added in v0.4.0
type EntryCache interface {
// Get should return 'found' = true when information is cached,
// with 'info' optionally being nilable to allow caching errors.
Get(key string) (info *CachedObjectInfo, found bool)
// Put should cache the given information under key, with
// nil CachedObjectInfo{} meaning a 'not found' response.
Put(key string, info *CachedObjectInfo)
}
EntryCache should provide a cache of S3 object information for speeding up Get(), Stat() and Remove() operations.
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) 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().