Documentation ¶
Index ¶
- Variables
- type BucketLookupType
- type Config
- type Credentials
- type Storage
- func (s *Storage) CheckBucket() error
- func (s *Storage) Close() error
- func (s *Storage) Conn() *minio.Client
- func (s *Storage) CreateBucket() error
- func (s *Storage) Delete(key string) error
- func (s *Storage) Get(key string) ([]byte, error)
- func (s *Storage) MustGet(key string) []byte
- func (s *Storage) RemoveBucket() error
- func (s *Storage) Reset() error
- func (s *Storage) Set(key string, val []byte, exp time.Duration) error
Constants ¶
This section is empty.
Variables ¶
var ConfigDefault = Config{ Bucket: "goe-bucket", Endpoint: "", Region: "", BucketLookup: BucketLookupAuto, Token: "", Secure: false, Reset: false, Credentials: Credentials{}, GetObjectOptions: minio.GetObjectOptions{}, PutObjectOptions: minio.PutObjectOptions{}, ListObjectsOptions: minio.ListObjectsOptions{}, RemoveObjectOptions: minio.RemoveObjectOptions{}, }
ConfigDefault is the default config
Functions ¶
This section is empty.
Types ¶
type BucketLookupType ¶
type BucketLookupType int
BucketLookupType is type of url lookup supported by server.
const ( BucketLookupAuto BucketLookupType = iota BucketLookupDNS BucketLookupPath )
Different types of url lookup supported by the server.Initialized to BucketLookupAuto
type Config ¶
type Config struct { // Bucket // Default fiber-bucket Bucket string // Endpoint is a host name or an IP address Endpoint string // Region Set this value to override region cache // Optional Region string // BucketLookup Set this value to BucketLookupDNS or BucketLookupPath to override the default bucket lookup // Optional, Default is BucketLookupAuto BucketLookup BucketLookupType // Token Set this value to provide x-amz-security-token (AWS S3 specific) // Optional, Default is false Token string // Secure If set to true, https is used instead of http. // Default is false Secure bool // Reset clears any existing keys in existing Bucket // Optional. Default is false Reset bool // Credentials Minio access key and Minio secret key. // Need to be defined Credentials Credentials // GetObjectOptions Options for GET requests specifying additional options like encryption, If-Match GetObjectOptions minio.GetObjectOptions // PutObjectOptions // Allows user to set optional custom metadata, content headers, encryption keys and number of threads for multipart upload operation. PutObjectOptions minio.PutObjectOptions // ListObjectsOptions Options per to list objects ListObjectsOptions minio.ListObjectsOptions // RemoveObjectOptions Allows user to set options RemoveObjectOptions minio.RemoveObjectOptions }
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) CheckBucket ¶
CheckBucket Check to see if bucket already exists
func (*Storage) CreateBucket ¶
CreateBucket creates a new bucket if it does not exist
func (*Storage) RemoveBucket ¶
RemoveBucket removes the bucket if it is empty.
func (*Storage) Reset ¶
Reset all entries, including unexpired This method resets all entries in the storage, including unexpired entries. It deletes all objects in the storage bucket. The method achieves this by listing all the objects in the bucket and sending their names to a channel. A separate goroutine listens to the channel and removes the objects one by one using the minio client's RemoveObjects method. The method also logs any errors encountered during the deletion process. DANGER ZONE!!!!!!: This method is dangerous and should be used with caution. It deletes all objects in the storage bucket.
func (*Storage) Set ¶
Set key with value The method `Set` sets the value for a given key in the storage. It creates a Reader from the value byte slice, sets the content type in the storage configuration, and then puts the object in the bucket using the Minio client. It acquires a lock on the storage mutex to ensure thread safety when setting the configuration options. Finally, it returns any errors encountered while putting the object.