Documentation ¶
Index ¶
- Variables
- func IsPathExists(path string) bool
- type HmacAlgType
- func (v HmacAlgType) Base64Sum(content []byte) string
- func (v HmacAlgType) ConstValues() []enum.IntStringerEnum
- func (v HmacAlgType) HexSum(content []byte) string
- func (v HmacAlgType) Int() int
- func (v HmacAlgType) Label() string
- func (v HmacAlgType) MarshalText() ([]byte, error)
- func (v *HmacAlgType) Scan(src interface{}) error
- func (v HmacAlgType) String() string
- func (v HmacAlgType) Sum(content []byte) []byte
- func (v HmacAlgType) Type() string
- func (v HmacAlgType) TypeName() string
- func (v *HmacAlgType) UnmarshalText(data []byte) error
- func (v HmacAlgType) Value() (driver.Value, error)
- type LocalFs
- func (l *LocalFs) Delete(key string) error
- func (l *LocalFs) Init() error
- func (l *LocalFs) Read(key string, chk ...HmacAlgType) (data []byte, sum []byte, err error)
- func (l *LocalFs) SetDefault()
- func (l *LocalFs) Type() StorageType
- func (l *LocalFs) Upload(key string, data []byte, chk ...HmacAlgType) error
- type S3
- func (s *S3) Delete(key string) error
- func (s *S3) DownloadUrl(key string) (string, error)
- func (s *S3) Init() error
- func (s *S3) IsZero() bool
- func (s *S3) Name() string
- func (s *S3) Read(key string, chk ...HmacAlgType) (data []byte, sum []byte, err error)
- func (s *S3) SetDefault()
- func (s *S3) Type() StorageType
- func (s *S3) Upload(key string, data []byte, chk ...HmacAlgType) error
- type Storage
- func (s *Storage) Delete(key string) error
- func (s *Storage) Init() error
- func (s *Storage) IsZero() bool
- func (s *Storage) Name() string
- func (s *Storage) Read(key string, chk ...HmacAlgType) ([]byte, []byte, error)
- func (s *Storage) SetDefault()
- func (s *Storage) Type() StorageType
- func (s *Storage) Upload(key string, content []byte, chk ...HmacAlgType) error
- func (s *Storage) Validate(data []byte, sum string, chk ...HmacAlgType) bool
- func (s *Storage) WithOperation(op StorageOperations)
- type StorageOperations
- type StorageOperationsWithValidation
- type StorageType
- func (v StorageType) ConstValues() []enum.IntStringerEnum
- func (v StorageType) Int() int
- func (v StorageType) Label() string
- func (v StorageType) MarshalText() ([]byte, error)
- func (v *StorageType) Scan(src interface{}) error
- func (v StorageType) String() string
- func (v StorageType) TypeName() string
- func (v *StorageType) UnmarshalText(data []byte) error
- func (v StorageType) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingConfigS3 = errors.New("missing config: s3") ErrMissingConfigFS = errors.New("missing config: fs") ErrMissingConfigIPFS = errors.New("missing config: ipfs") ErrUnsupprtedStorageType = errors.New("unsupported storage type") ErrEmptyContent = errors.New("content empty") ErrContentSizeExceeded = errors.New("content size exceeded") ErrDiskReservationLimit = errors.New("disk reservation limit") )
View Source
var InvalidHmacAlgType = errors.New("invalid HmacAlgType type")
View Source
var InvalidStorageType = errors.New("invalid StorageType type")
Functions ¶
func IsPathExists ¶
Types ¶
type HmacAlgType ¶
type HmacAlgType uint8
const ( HMAC_ALG_TYPE_UNKNOWN HmacAlgType = iota HMAC_ALG_TYPE__MD5 HMAC_ALG_TYPE__SHA1 HMAC_ALG_TYPE__SHA256 )
func ParseHmacAlgTypeFromLabel ¶
func ParseHmacAlgTypeFromLabel(s string) (HmacAlgType, error)
func ParseHmacAlgTypeFromString ¶
func ParseHmacAlgTypeFromString(s string) (HmacAlgType, error)
func (HmacAlgType) Base64Sum ¶
func (v HmacAlgType) Base64Sum(content []byte) string
func (HmacAlgType) ConstValues ¶
func (v HmacAlgType) ConstValues() []enum.IntStringerEnum
func (HmacAlgType) HexSum ¶
func (v HmacAlgType) HexSum(content []byte) string
func (HmacAlgType) Int ¶
func (v HmacAlgType) Int() int
func (HmacAlgType) Label ¶
func (v HmacAlgType) Label() string
func (HmacAlgType) MarshalText ¶
func (v HmacAlgType) MarshalText() ([]byte, error)
func (*HmacAlgType) Scan ¶
func (v *HmacAlgType) Scan(src interface{}) error
func (HmacAlgType) String ¶
func (v HmacAlgType) String() string
func (HmacAlgType) Sum ¶
func (v HmacAlgType) Sum(content []byte) []byte
func (HmacAlgType) Type ¶
func (v HmacAlgType) Type() string
func (HmacAlgType) TypeName ¶
func (v HmacAlgType) TypeName() string
func (*HmacAlgType) UnmarshalText ¶
func (v *HmacAlgType) UnmarshalText(data []byte) error
type LocalFs ¶
type LocalFs struct {
Root string `env:""`
}
func (*LocalFs) SetDefault ¶
func (l *LocalFs) SetDefault()
func (*LocalFs) Type ¶
func (l *LocalFs) Type() StorageType
type S3 ¶
type S3 struct { Endpoint string `env:""` Region string `env:""` AccessKeyID string `env:""` SecretAccessKey types.Password `env:""` SessionToken string `env:""` BucketName string `env:""` UrlExpire types.Duration `env:""` S3ForcePathStyle bool `env:""` // contains filtered or unexported fields }
func (*S3) SetDefault ¶
func (s *S3) SetDefault()
func (*S3) Type ¶
func (s *S3) Type() StorageType
type Storage ¶
type Storage struct { Typ StorageType FilesizeLimit int64 DiskReserve int64 PromiscuousMode bool // PromiscuousMode if support multi storage type TempDir string *S3 `env:"S3"` *LocalFs `env:"Fs"` // contains filtered or unexported fields }
func (*Storage) SetDefault ¶
func (s *Storage) SetDefault()
func (*Storage) Type ¶
func (s *Storage) Type() StorageType
func (*Storage) Upload ¶
func (s *Storage) Upload(key string, content []byte, chk ...HmacAlgType) error
func (*Storage) Validate ¶
func (s *Storage) Validate(data []byte, sum string, chk ...HmacAlgType) bool
func (*Storage) WithOperation ¶
func (s *Storage) WithOperation(op StorageOperations)
type StorageOperations ¶
type StorageOperations interface { Type() StorageType Upload(key string, file []byte, chk ...HmacAlgType) error Read(key string, chk ...HmacAlgType) (data []byte, sum []byte, err error) Delete(key string) error }
type StorageOperationsWithValidation ¶
type StorageOperationsWithValidation interface {
Validate(data []byte, sum string, chk ...HmacAlgType) bool
}
type StorageType ¶
type StorageType uint8
const ( STORAGE_TYPE_UNKNOWN StorageType = iota STORAGE_TYPE__S3 STORAGE_TYPE__FILESYSTEM STORAGE_TYPE__IPFS )
func ParseStorageTypeFromLabel ¶
func ParseStorageTypeFromLabel(s string) (StorageType, error)
func ParseStorageTypeFromString ¶
func ParseStorageTypeFromString(s string) (StorageType, error)
func (StorageType) ConstValues ¶
func (v StorageType) ConstValues() []enum.IntStringerEnum
func (StorageType) Int ¶
func (v StorageType) Int() int
func (StorageType) Label ¶
func (v StorageType) Label() string
func (StorageType) MarshalText ¶
func (v StorageType) MarshalText() ([]byte, error)
func (*StorageType) Scan ¶
func (v *StorageType) Scan(src interface{}) error
func (StorageType) String ¶
func (v StorageType) String() string
func (StorageType) TypeName ¶
func (v StorageType) TypeName() string
func (*StorageType) UnmarshalText ¶
func (v *StorageType) UnmarshalText(data []byte) error
Click to show internal directories.
Click to hide internal directories.