Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultConfig() *config
- func DefaultCopyOptions() *copyOptions
- func DefaultGetOptions() *getOptions
- func DefaultPutOptions() *putOptions
- func DefaultSignOptions() *signOptions
- func GetReaderLength(reader io.ReadSeeker) (int64, error)
- func Register(comp Compressor)
- type BuildOption
- func WithAccessKeyID(ak string) BuildOption
- func WithAccessKeySecret(sk string) BuildOption
- func WithBucket(bucket string) BuildOption
- func WithBucketKey(bucketKey string) BuildOption
- func WithEndpoint(endpoint string) BuildOption
- func WithRegion(region string) BuildOption
- func WithS3ForcePathStyle(s3ForcePathStyle bool) BuildOption
- func WithS3HttpTimeoutSecs(s3HttpTimeoutSecs int64) BuildOption
- func WithSSL(ssl bool) BuildOption
- func WithShards(shards []string) BuildOption
- func WithStorageType(storageType string) BuildOption
- type CombinedReadCloser
- type Component
- type Compressor
- type Container
- type CopyOption
- type GetOptions
- type GzipCompressor
- type HeadGetObjectOutputWrapper
- type OSS
- func (ossClient *OSS) CompressAndPut(key string, reader io.ReadSeeker, meta map[string]string, ...) error
- func (ossClient *OSS) Copy(srcKey, dstKey string, options ...CopyOption) error
- func (ossClient *OSS) Del(key string) error
- func (ossClient *OSS) DelMulti(keys []string) error
- func (ossClient *OSS) Exists(key string) (bool, error)
- func (ossClient *OSS) Get(key string, options ...GetOptions) (string, error)
- func (ossClient *OSS) GetAndDecompress(key string) (string, error)
- func (ossClient *OSS) GetAndDecompressAsReader(key string) (io.ReadCloser, error)
- func (ossClient *OSS) GetAsReader(key string, options ...GetOptions) (io.ReadCloser, error)
- func (ossClient *OSS) GetBucketName(key string) (string, error)
- func (ossClient *OSS) GetBytes(key string, options ...GetOptions) ([]byte, error)
- func (ossClient *OSS) GetWithMeta(key string, attributes []string, options ...GetOptions) (io.ReadCloser, map[string]string, error)
- func (ossClient *OSS) Head(key string, attributes []string) (map[string]string, error)
- func (ossClient *OSS) ListObject(key string, prefix string, marker string, maxKeys int, delimiter string) ([]string, error)
- func (ossClient *OSS) Put(key string, reader io.ReadSeeker, meta map[string]string, ...) error
- func (ossClient *OSS) Range(key string, offset int64, length int64) (io.ReadCloser, error)
- func (ossClient *OSS) SignURL(key string, expired int64, options ...SignOptions) (string, error)
- func (ossClient *OSS) WithContext(context.Context) Component
- type PutOptions
- type S3
- func (a *S3) CompressAndPut(key string, reader io.ReadSeeker, meta map[string]string, ...) error
- func (a *S3) Copy(srcKey, dstKey string, options ...CopyOption) error
- func (a *S3) Del(key string) error
- func (a *S3) DelMulti(keys []string) error
- func (a *S3) Exists(key string) (bool, error)
- func (a *S3) Get(key string, options ...GetOptions) (string, error)
- func (a *S3) GetAndDecompress(key string) (string, error)
- func (a *S3) GetAndDecompressAsReader(key string) (io.ReadCloser, error)
- func (a *S3) GetAsReader(key string, options ...GetOptions) (io.ReadCloser, error)
- func (a *S3) GetBucketName(key string) (string, error)
- func (a *S3) GetBytes(key string, options ...GetOptions) ([]byte, error)
- func (a *S3) GetWithMeta(key string, attributes []string, options ...GetOptions) (io.ReadCloser, map[string]string, error)
- func (a *S3) Head(key string, attributes []string) (map[string]string, error)
- func (a *S3) ListObject(key string, prefix string, marker string, maxKeys int, delimiter string) ([]string, error)
- func (a *S3) Put(key string, reader io.ReadSeeker, meta map[string]string, ...) error
- func (a *S3) Range(key string, offset int64, length int64) (io.ReadCloser, error)
- func (a *S3) SignURL(key string, expired int64, options ...SignOptions) (string, error)
- func (a *S3) WithContext(ctx context.Context) Component
- type SignOptions
Constants ¶
View Source
const ( StorageTypeOSS = "oss" StorageTypeS3 = "s3" MetaCompressor = "compressor" )
View Source
const PackageName = "component.eoss"
Variables ¶
View Source
var DefaultGzipCompressor = &GzipCompressor{}
Functions ¶
func DefaultCopyOptions ¶
func DefaultCopyOptions() *copyOptions
func DefaultGetOptions ¶
func DefaultGetOptions() *getOptions
func DefaultPutOptions ¶
func DefaultPutOptions() *putOptions
func DefaultSignOptions ¶ added in v1.0.4
func DefaultSignOptions() *signOptions
func GetReaderLength ¶ added in v1.0.5
func GetReaderLength(reader io.ReadSeeker) (int64, error)
func Register ¶ added in v1.0.5
func Register(comp Compressor)
Types ¶
type BuildOption ¶
type BuildOption func(c *Container)
func WithAccessKeyID ¶
func WithAccessKeyID(ak string) BuildOption
func WithAccessKeySecret ¶
func WithAccessKeySecret(sk string) BuildOption
func WithBucket ¶
func WithBucket(bucket string) BuildOption
func WithBucketKey ¶
func WithBucketKey(bucketKey string) BuildOption
func WithEndpoint ¶
func WithEndpoint(endpoint string) BuildOption
func WithRegion ¶
func WithRegion(region string) BuildOption
func WithS3ForcePathStyle ¶
func WithS3ForcePathStyle(s3ForcePathStyle bool) BuildOption
func WithS3HttpTimeoutSecs ¶
func WithS3HttpTimeoutSecs(s3HttpTimeoutSecs int64) BuildOption
func WithSSL ¶
func WithSSL(ssl bool) BuildOption
func WithShards ¶
func WithShards(shards []string) BuildOption
func WithStorageType ¶
func WithStorageType(storageType string) BuildOption
type CombinedReadCloser ¶
type CombinedReadCloser struct { ReadCloser io.ReadCloser Reader io.Reader }
CombinedReadCloser combined a ReadCloser and a Readers to a new ReaderCloser which will read from reader and close origin closer
func (CombinedReadCloser) Close ¶
func (combined CombinedReadCloser) Close() error
Close origin ReaderCloser
type Component ¶
type Component interface { GetBucketName(key string) (string, error) WithContext(ctx context.Context) Component Get(key string, options ...GetOptions) (string, error) GetBytes(key string, options ...GetOptions) ([]byte, error) GetAsReader(key string, options ...GetOptions) (io.ReadCloser, error) GetWithMeta(key string, attributes []string, options ...GetOptions) (io.ReadCloser, map[string]string, error) Put(key string, reader io.ReadSeeker, meta map[string]string, options ...PutOptions) error Del(key string) error DelMulti(keys []string) error Head(key string, meta []string) (map[string]string, error) ListObject(key string, prefix string, marker string, maxKeys int, delimiter string) ([]string, error) SignURL(key string, expired int64, options ...SignOptions) (string, error) GetAndDecompress(key string) (string, error) GetAndDecompressAsReader(key string) (io.ReadCloser, error) CompressAndPut(key string, reader io.ReadSeeker, meta map[string]string, options ...PutOptions) error Range(key string, offset int64, length int64) (io.ReadCloser, error) Exists(key string) (bool, error) Copy(srcKey, dstKey string, options ...CopyOption) error }
Component interface
type Compressor ¶ added in v1.0.5
type Compressor interface { Compress(reader io.ReadSeeker) (gzipReader io.ReadSeeker, err error) ContentEncoding() string }
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func DefaultContainer ¶
func DefaultContainer() *Container
func (*Container) Build ¶
func (c *Container) Build(options ...BuildOption) Component
type CopyOption ¶
type CopyOption func(options *copyOptions)
func CopyWithAttributes ¶
func CopyWithAttributes(meta []string) CopyOption
CopyWithAttributes specify metadata keys to copy
func CopyWithNewAttributes ¶ added in v1.0.5
func CopyWithNewAttributes(meta map[string]string) CopyOption
CopyWithNewAttributes append new attributes(meta) to new object
NOTE: if this option was specified, the metadata(s) of source object would be dropped expect specifying keys to copy using CopyWithAttributes() option.
func CopyWithRawSrcKey ¶
func CopyWithRawSrcKey() CopyOption
type GetOptions ¶
type GetOptions func(options *getOptions)
func EnableCRCValidation ¶
func EnableCRCValidation() GetOptions
func GetWithContentEncoding ¶
func GetWithContentEncoding(contentEncoding string) GetOptions
func GetWithContentType ¶
func GetWithContentType(contentType string) GetOptions
type GzipCompressor ¶ added in v1.0.5
type GzipCompressor struct { }
func (*GzipCompressor) Compress ¶ added in v1.0.5
func (g *GzipCompressor) Compress(reader io.ReadSeeker) (gzipReader io.ReadSeeker, err error)
func (*GzipCompressor) ContentEncoding ¶ added in v1.0.5
func (g *GzipCompressor) ContentEncoding() string
type HeadGetObjectOutputWrapper ¶
type HeadGetObjectOutputWrapper struct {
// contains filtered or unexported fields
}
type OSS ¶
type OSS struct { Bucket *oss.Bucket Shards map[string]*oss.Bucket // contains filtered or unexported fields }
func (*OSS) CompressAndPut ¶
func (ossClient *OSS) CompressAndPut(key string, reader io.ReadSeeker, meta map[string]string, options ...PutOptions) error
func (*OSS) GetAndDecompressAsReader ¶
func (ossClient *OSS) GetAndDecompressAsReader(key string) (io.ReadCloser, error)
func (*OSS) GetAsReader ¶
func (ossClient *OSS) GetAsReader(key string, options ...GetOptions) (io.ReadCloser, error)
don't forget to call the close() method of the io.ReadCloser
func (*OSS) GetBytes ¶
func (ossClient *OSS) GetBytes(key string, options ...GetOptions) ([]byte, error)
func (*OSS) GetWithMeta ¶
func (ossClient *OSS) GetWithMeta(key string, attributes []string, options ...GetOptions) (io.ReadCloser, map[string]string, error)
don't forget to call the close() method of the io.ReadCloser
func (*OSS) ListObject ¶
func (*OSS) Put ¶
func (ossClient *OSS) Put(key string, reader io.ReadSeeker, meta map[string]string, options ...PutOptions) error
type PutOptions ¶
type PutOptions func(options *putOptions)
func PutWithCacheControl ¶
func PutWithCacheControl(cacheControl string) PutOptions
func PutWithContentDisposition ¶
func PutWithContentDisposition(contentDisposition string) PutOptions
func PutWithContentEncoding ¶
func PutWithContentEncoding(contentEncoding string) PutOptions
func PutWithContentType ¶
func PutWithContentType(contentType string) PutOptions
func PutWithExpireTime ¶
func PutWithExpireTime(expires time.Time) PutOptions
type S3 ¶
type S3 struct { ShardsBucket map[string]string BucketName string Client *s3.S3 // contains filtered or unexported fields }
func (*S3) CompressAndPut ¶
func (a *S3) CompressAndPut(key string, reader io.ReadSeeker, meta map[string]string, options ...PutOptions) error
func (*S3) GetAndDecompressAsReader ¶
func (a *S3) GetAndDecompressAsReader(key string) (io.ReadCloser, error)
func (*S3) GetAsReader ¶
func (a *S3) GetAsReader(key string, options ...GetOptions) (io.ReadCloser, error)
don't forget to call the close() method of the io.ReadCloser
func (*S3) GetWithMeta ¶
func (a *S3) GetWithMeta(key string, attributes []string, options ...GetOptions) (io.ReadCloser, map[string]string, error)
don't forget to call the close() method of the io.ReadCloser
func (*S3) ListObject ¶
func (*S3) Put ¶
func (a *S3) Put(key string, reader io.ReadSeeker, meta map[string]string, options ...PutOptions) error
type SignOptions ¶ added in v1.0.4
type SignOptions func(options *signOptions)
func SignWithProcess ¶ added in v1.0.4
func SignWithProcess(process string) SignOptions
Click to show internal directories.
Click to hide internal directories.