sss

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 25 Imported by: 9

README

sss

SSS (S3 Simple Storage), which is wrapped around s3

License

Licensed under the MIT License. See LICENSE for the full license text.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFilledBuffer = errors.New("we have enough entries")

ErrFilledBuffer is used as a return value from onFileFunc to indicate that the requested number of entries has been reached and the walk can stop.

View Source
var ErrSkipDir = errors.New("skip this directory")

ErrSkipDir is used as a return value from onFileFunc to indicate that the directory named in the call is to be skipped. It is not returned as an error by any function.

Functions

func WithStartAfterHint

func WithStartAfterHint(startAfterHint string) func(*walkOptions)

Types

type FileInfo

type FileInfo interface {
	// Path provides the full path of the target of this file info.
	Path() string

	fs.FileInfo
}

FileInfo returns information about a given path.

type FileInfoExpansion added in v0.2.1

type FileInfoExpansion struct {
	ContentType  *string
	AcceptRanges *string
	ETag         *string
	Expires      *string
}

type FileWriter

type FileWriter interface {
	io.WriteCloser
	Size() int64
	Cancel(ctx context.Context) error
	Commit(ctx context.Context) error
}

type Multipart

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

func (*Multipart) AllParts

func (m *Multipart) AllParts(ctx context.Context) (*Parts, error)

func (*Multipart) Cancel

func (m *Multipart) Cancel(ctx context.Context) error

func (*Multipart) Commit

func (m *Multipart) Commit(ctx context.Context) error

func (*Multipart) Key

func (m *Multipart) Key() string

func (*Multipart) OrderParts

func (m *Multipart) OrderParts(ctx context.Context) (*Parts, error)

func (*Multipart) Resume

func (m *Multipart) Resume(ctx context.Context) error

func (*Multipart) SetParts

func (m *Multipart) SetParts(parts []*s3.Part)

func (*Multipart) SignUploadPart

func (m *Multipart) SignUploadPart(partNumber int64, expires time.Duration) (string, error)

func (*Multipart) UploadID

func (m *Multipart) UploadID() string

func (*Multipart) UploadPart

func (m *Multipart) UploadPart(ctx context.Context, partNumber int64, body io.ReadSeeker) error

type Option

type Option func(*sssOption) error

func WithAccelerate

func WithAccelerate(enable bool) Option

func WithAccessKey

func WithAccessKey(key string) Option

func WithBucket

func WithBucket(bucket string) Option

func WithChunkSize

func WithChunkSize(size int) Option

func WithDriverName

func WithDriverName(name string) Option

func WithDualStack

func WithDualStack(enable bool) Option

func WithEncryption

func WithEncryption(enable bool) Option

func WithForcePathStyle

func WithForcePathStyle(enable bool) Option

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

func WithKMSKeyID

func WithKMSKeyID(id string) Option

func WithLogLevel

func WithLogLevel(level aws.LogLevelType) Option

func WithObjectACL

func WithObjectACL(acl string) Option

func WithRegion

func WithRegion(region string) Option

func WithRegionEndpoint

func WithRegionEndpoint(endpoint string) Option

func WithRootDirectory

func WithRootDirectory(dir string) Option

func WithSecretKey

func WithSecretKey(key string) Option

func WithSecure

func WithSecure(enable bool) Option

func WithSessionToken

func WithSessionToken(token string) Option

func WithStorageClass

func WithStorageClass(class string) Option

func WithURL

func WithURL(uri string) Option

func WithUserAgent

func WithUserAgent(ua string) Option

type Parts

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

func (*Parts) Count

func (m *Parts) Count() int

func (*Parts) Items

func (m *Parts) Items() []*s3.Part

func (*Parts) LastModified

func (p *Parts) LastModified() time.Time

func (*Parts) Size

func (m *Parts) Size() int64

type SSS

type SSS struct {
	Name string
	// contains filtered or unexported fields
}

func NewSSS

func NewSSS(opts ...Option) (*SSS, error)

func (*SSS) ChunkSize

func (s *SSS) ChunkSize() int

func (*SSS) Copy

func (s *SSS) Copy(ctx context.Context, sourcePath, destPath string) error

func (*SSS) Delete

func (s *SSS) Delete(ctx context.Context, path string) error

func (*SSS) DeleteAll

func (s *SSS) DeleteAll(ctx context.Context, path string) error

DeleteAll recursively deletes all objects stored at "path" and its subpaths. We must be careful since S3 does not guarantee read after delete consistency

func (*SSS) GetContent

func (s *SSS) GetContent(ctx context.Context, path string) ([]byte, error)

func (*SSS) GetContentAndInfo added in v0.2.1

func (s *SSS) GetContentAndInfo(ctx context.Context, path string) ([]byte, FileInfo, error)

func (*SSS) GetMultipart

func (s *SSS) GetMultipart(ctx context.Context, path string) (*Multipart, error)

func (*SSS) GetMultipartByUploadID

func (s *SSS) GetMultipartByUploadID(ctx context.Context, path, uploadID string) (*Multipart, error)

func (*SSS) GetMultipartWithUploadID

func (s *SSS) GetMultipartWithUploadID(path, uploadID string) *Multipart

func (*SSS) List

func (s *SSS) List(ctx context.Context, opath string, fun func(fileInfo FileInfo) bool) error

func (*SSS) ListMultipart

func (s *SSS) ListMultipart(ctx context.Context, path string, fun func(mp *Multipart) bool) error

func (*SSS) NewMultipart

func (s *SSS) NewMultipart(ctx context.Context, path string) (*Multipart, error)

func (*SSS) PutContent

func (s *SSS) PutContent(ctx context.Context, path string, contents []byte, opts ...WriterOptions) error

func (*SSS) Reader

func (s *SSS) Reader(ctx context.Context, path string) (io.ReadCloser, error)

func (*SSS) ReaderAndInfo added in v0.2.1

func (s *SSS) ReaderAndInfo(ctx context.Context, path string) (io.ReadCloser, FileInfo, error)

func (*SSS) ReaderWithOffset

func (s *SSS) ReaderWithOffset(ctx context.Context, path string, offset int64) (io.ReadCloser, error)

func (*SSS) ReaderWithOffsetAndInfo added in v0.2.1

func (s *SSS) ReaderWithOffsetAndInfo(ctx context.Context, path string, offset int64) (io.ReadCloser, FileInfo, error)

func (*SSS) ReaderWithOffsetAndLimit

func (s *SSS) ReaderWithOffsetAndLimit(ctx context.Context, path string, offset, limit int64) (io.ReadCloser, error)

func (*SSS) ReaderWithOffsetAndLimitAndInfo added in v0.2.1

func (s *SSS) ReaderWithOffsetAndLimitAndInfo(ctx context.Context, path string, offset, limit int64) (io.ReadCloser, FileInfo, error)

func (*SSS) S3

func (s *SSS) S3() *s3.S3

func (*SSS) SignCopy

func (s *SSS) SignCopy(ctx context.Context, sourcePath, destPath string, expires time.Duration) (string, error)

func (*SSS) SignDelete

func (s *SSS) SignDelete(path string, expires time.Duration) (string, error)

func (*SSS) SignGet

func (s *SSS) SignGet(path string, expires time.Duration) (string, error)

func (*SSS) SignHead

func (s *SSS) SignHead(path string, expires time.Duration) (string, error)

func (*SSS) SignList

func (s *SSS) SignList(path string, expires time.Duration) (string, error)

func (*SSS) SignPut

func (s *SSS) SignPut(path string, expires time.Duration) (string, error)

func (*SSS) Stat

func (s *SSS) Stat(ctx context.Context, path string) (FileInfo, error)

Stat retrieves the FileInfo for the given path, including the current size in bytes and the creation time.

func (*SSS) StatHead

func (s *SSS) StatHead(ctx context.Context, path string) (FileInfo, error)

func (*SSS) StatHeadList

func (s *SSS) StatHeadList(ctx context.Context, path string) (FileInfo, error)

func (*SSS) Walk

func (s *SSS) Walk(ctx context.Context, from string, f WalkFn, options ...func(*walkOptions)) error

Walk traverses a filesystem defined within driver, starting from the given path, calling f on each file

func (*SSS) Writer

func (s *SSS) Writer(ctx context.Context, path string, opts ...WriterOptions) (FileWriter, error)

func (*SSS) WriterWithAppend

func (s *SSS) WriterWithAppend(ctx context.Context, path string, opts ...WriterOptions) (FileWriter, error)

func (*SSS) WriterWithAppendByUploadID

func (s *SSS) WriterWithAppendByUploadID(ctx context.Context, path, uploadID string, opts ...WriterOptions) (FileWriter, error)

type WalkFn

type WalkFn func(fileInfo FileInfo) error

WalkFn is called once per file by Walk

type WriterOptions

type WriterOptions func(*writerOption)

func WithContentType added in v0.2.1

func WithContentType(contentType string) WriterOptions

WithContentType sets the content type for the object being written

func WithSHA256

func WithSHA256(sha256 string) WriterOptions

Jump to

Keyboard shortcuts

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