s3minio

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigDefault = Config{
	Bucket:              "goe-bucket",
	Endpoint:            "",
	Region:              "",
	BucketLookup:        BucketLookupAuto,
	Token:               "",
	Secure:              false,
	Reset:               false,
	MaxRetry:            minio.MaxRetry,
	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

	// The maximum number of times requests that encounter retryable failures should be attempted.
	// Optional. Default is 10, same as the MinIO client.
	MaxRetry int

	// 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 Credentials struct {
	// AccessKeyID is like user-id that uniquely identifies your account.
	AccessKeyID string
	// SecretAccessKey is the password to your account.
	SecretAccessKey string
}

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

Storage interface that is implemented by storage providers

func New

func New(config ...Config) *Storage

New creates a new storage

func (*Storage) CheckBucket

func (s *Storage) CheckBucket() error

CheckBucket Check to see if bucket already exists

func (*Storage) Close

func (s *Storage) Close() error

Close the storage

func (*Storage) Conn

func (s *Storage) Conn() *minio.Client

Conn Return minio client

func (*Storage) CreateBucket

func (s *Storage) CreateBucket() error

CreateBucket Bucket not found so Make a new bucket

func (*Storage) Delete

func (s *Storage) Delete(key string) error

Delete entry by key

func (*Storage) Get

func (s *Storage) Get(key string) ([]byte, error)

Get value by key

func (*Storage) RemoveBucket

func (s *Storage) RemoveBucket() error

RemoveBucket Bucket remove if bucket is empty

func (*Storage) Reset

func (s *Storage) Reset() error

Reset all entries, including unexpired

func (*Storage) Set

func (s *Storage) Set(key string, val []byte, exp time.Duration) error

Set key with value

Jump to

Keyboard shortcuts

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