Documentation
¶
Overview ¶
Package s3 implements file storage collection with S3 driver support
Index ¶
- Variables
- type Options
- type Storage
- func (c *Storage) Clean(ctx context.Context, id npio.ObjectID) error
- func (c *Storage) Create(ctx context.Context, bucket string, id npio.ObjectID, overwrite bool, ...) (npio.Object, error)
- func (c *Storage) Open(ctx context.Context, id npio.ObjectID) (_ npio.Object, err error)
- func (c *Storage) Read(ctx context.Context, id npio.ObjectID, name string) (io.ReadCloser, error)
- func (c *Storage) ReadManifest(ctx context.Context, bucket string) (*models.Manifest, error)
- func (c *Storage) Remove(ctx context.Context, id npio.ObjectID, names ...string) error
- func (c *Storage) Scan(ctx context.Context, pattern string, walkf npio.WalkStorageFnk) error
- func (c *Storage) Update(ctx context.Context, id npio.ObjectID, name string, reader io.Reader, ...) error
- func (c *Storage) UpdateManifest(ctx context.Context, bucket string, manifest *models.Manifest) error
- func (c *Storage) UpdateMeta(ctx context.Context, id npio.ObjectID, name string, meta *models.ItemMeta) error
- func (c *Storage) UpdatePatams(ctx context.Context, id npio.ObjectID, params url.Values) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidCredentials = errors.New("[s3] you need to set BOTH AccessKeyID AND SecretAccessKey") ErrInvalidBucketManifest = errors.New("[s3] back manifest object is invalid") )
Errors list
View Source
var ( ErrUnsupportedContentType = errors.New("content-type is not supported") ErrCustomObjectIDIsNotValid = errors.New("invalid custom object ID or taken") )
Errors list...
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options func(conf *optionConfig) error
Options configuration type
func WithFilepathGenerator ¶
WithFilepathGenerator updates path generator option
func WithMainBucket ¶
WithMainBucket which makes that all objects will be stored in the subdirectory {bucketName}.server.com/{objectPath}
func WithS3Config ¶
WithS3Config custom configurator
func WithS3Credentionals ¶
WithS3Credentionals to the server
func WithS3FromURL ¶
WithS3FromURL parse URL and fill the S3 config
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage to manage S3 type
func NewStorage ¶
NewStorage object returns storage according to options
func (*Storage) Create ¶
func (c *Storage) Create(ctx context.Context, bucket string, id npio.ObjectID, overwrite bool, params url.Values) (npio.Object, error)
Create new file object
func (*Storage) ReadManifest ¶
ReadManifest information method
func (*Storage) Scan ¶
Scan storage by pattern
pattern: search type equals to glob https://golang.org/pkg/path/filepath/#Glob
func (*Storage) Update ¶
func (c *Storage) Update(ctx context.Context, id npio.ObjectID, name string, reader io.Reader, meta *models.ItemMeta) error
Upload data as file
func (*Storage) UpdateManifest ¶
func (c *Storage) UpdateManifest(ctx context.Context, bucket string, manifest *models.Manifest) error
UpdateManifest information method
Click to show internal directories.
Click to hide internal directories.