Documentation ¶
Index ¶
- Variables
- type Config
- type Credentials
- type Storage
- func (s *Storage) Close() error
- func (s *Storage) Conn() *s3.Client
- func (s *Storage) CreateBucket(bucket string) error
- func (s *Storage) Delete(key string) error
- func (s *Storage) DeleteBucket(bucket string) error
- func (s *Storage) DeleteMany(keys ...string) error
- func (s *Storage) Get(key string) ([]byte, error)
- func (s *Storage) Reset() error
- func (s *Storage) Set(key string, val []byte, exp time.Duration) error
- func (s *Storage) SetWithChecksum(key string, val []byte, checksum map[types.ChecksumAlgorithm][]byte) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigDefault = Config{ Bucket: "", Region: "", Endpoint: "", Credentials: Credentials{}, MaxAttempts: 3, RequestTimeout: 0, Reset: false, }
ConfigDefault is the default config
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // S3 bucket name Bucket string // AWS endpoint Endpoint string // AWS region Region string // Request timeout // // Optional. Default is 0 (no timeout) RequestTimeout time.Duration // Reset clears any existing keys in existing Bucket // // Optional. Default is false Reset bool // Credentials overrides AWS access key and AWS secret access key. Not recommended. // // Optional. Default is Credentials{} Credentials Credentials // The maximum number of times requests that encounter retryable failures should be attempted. // // Optional. Default is 3 MaxAttempts int }
Config defines the config for storage.
type Credentials ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage interface that is implemented by storage providers
func (*Storage) CreateBucket ¶
CreateBucket creates a new bucket.
func (*Storage) DeleteBucket ¶
DeleteBucket deletes a bucket.
func (*Storage) DeleteMany ¶ added in v2.2.0
DeleteMany entries by keys.
func (*Storage) SetWithChecksum ¶
func (s *Storage) SetWithChecksum(key string, val []byte, checksum map[types.ChecksumAlgorithm][]byte) error
SetWithChecksum sets key with value and checksum.
Currently 4 algorithms are supported:
- types.ChecksumAlgorithmCrc32 (`CRC32`)
- types.ChecksumAlgorithmCrc32c (`CRC32C`)
- types.ChecksumAlgorithmSha1 (`SHA1`)
- types.ChecksumAlgorithmSha256 (`SHA256`)
For more information, see [PutObjectInput](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/s3#PutObjectInput).
Click to show internal directories.
Click to hide internal directories.