Documentation ¶
Overview ¶
Package storage provides interface for working with different storage's like local FS and Amazon S3.
Index ¶
- Variables
- func GetInsecureRandString(n int) string
- func IsAwsContextCanceled(err error) bool
- func IsErrNotExist(err error) bool
- func IsErrPermission(err error) bool
- func StrongEtag(s *string) *string
- func ToPtr[K any](val K) *K
- func ToValue[K any](val *K) K
- type ErrHandlingMask
- type Object
- type Storage
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var Log = logrus.New()
Log implement Logrus logger for debug logging.
Functions ¶
func GetInsecureRandString ¶
func IsAwsContextCanceled ¶
func IsErrNotExist ¶
func IsErrPermission ¶
func StrongEtag ¶
StrongEtag remove "W/" prefix from ETag. In some cases S3 return ETag with "W/" prefix which mean that it not strong ETag. For easier compare we remove this prefix.
Types ¶
type ErrHandlingMask ¶
type ErrHandlingMask uint8
ErrHandlingMask is is a bitmask for storing error handling settings.
const ( HandleErrNotExist ErrHandlingMask = 1 << iota HandleErrPermission HandleErrOther = 64 )
func (*ErrHandlingMask) Add ¶
func (f *ErrHandlingMask) Add(flag ErrHandlingMask)
Add the flag to the bitmask.
func (ErrHandlingMask) Has ¶
func (f ErrHandlingMask) Has(flag ErrHandlingMask) bool
Has checks if the flag is set in the bitmask.
type Object ¶
type Object struct { Key *string `json:"-"` ETag *string `json:"e_tag"` Mtime *time.Time `json:"mtime"` Content *[]byte `json:"-"` ContentStream io.ReadCloser `json:"-"` ContentLength *int64 `json:"-"` ContentType *string `json:"content_type"` ContentDisposition *string `json:"content_disposition"` ContentEncoding *string `json:"content_encoding"` ContentLanguage *string `json:"content_language"` Metadata map[string]*string `json:"metadata"` ACL *string `json:"acl"` CacheControl *string `json:"cache_control"` VersionId *string `json:"version_id"` IsLatest *bool `json:"-"` StorageClass *string `json:"storage_class"` AccessControlPolicy *s3.AccessControlPolicy `json:"access_control_policy"` ServerSideEncryption *string `json:"server_side_encryption"` }
Object contain content and metadata of S3 object.
type Storage ¶
type Storage interface { WithContext(ctx context.Context) WithRateLimit(limit int) error List(ch chan<- *Object) error PutObject(object *Object) error GetObjectContent(obj *Object) error GetObjectMeta(obj *Object) error GetObjectACL(obj *Object) error DeleteObject(obj *Object) error }
Storage interface.
Click to show internal directories.
Click to hide internal directories.