s3fs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package s3fs inclues a file system for reading from AWS S3

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(source string, destination string) error

Check returns an error if there is a cycle error.

func Dir

func Dir(p string) string

Dir returns all but the last element of path

func Split

func Split(p string) []string

Split splits the s3 path using "/"

Types

type Downloader

type Downloader func(ctx context.Context, w io.WriterAt) (int64, error)

type ReadSeeker

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

func NewReadSeeker

func NewReadSeeker(offset int64, size int64, read func(offset int64, p []byte) (int, error)) *ReadSeeker

func (*ReadSeeker) Read

func (rs *ReadSeeker) Read(p []byte) (int, error)

func (*ReadSeeker) Seek

func (rs *ReadSeeker) Seek(offset int64, whence int) (int64, error)

type S3DirectoryEntry

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

func (*S3DirectoryEntry) IsDir

func (de *S3DirectoryEntry) IsDir() bool

func (*S3DirectoryEntry) MarshalJSON

func (de *S3DirectoryEntry) MarshalJSON() ([]byte, error)

func (*S3DirectoryEntry) ModTime

func (de *S3DirectoryEntry) ModTime() time.Time

func (*S3DirectoryEntry) Name

func (de *S3DirectoryEntry) Name() string

func (*S3DirectoryEntry) Size

func (de *S3DirectoryEntry) Size() int64

func (*S3DirectoryEntry) String

func (de *S3DirectoryEntry) String() string

type S3File

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

func NewS3File

func NewS3File(name string, readSeeker io.ReadSeeker, downloader Downloader, writeCloser io.WriteCloser) *S3File

func (*S3File) Close

func (f *S3File) Close() error

func (*S3File) Name

func (f *S3File) Name() string

func (*S3File) Read

func (f *S3File) Read(p []byte) (int, error)

func (*S3File) Seek

func (f *S3File) Seek(offset int64, whence int) (int64, error)

func (*S3File) Write

func (f *S3File) Write(p []byte) (n int, err error)

func (*S3File) WriteTo

func (f *S3File) WriteTo(ctx context.Context, w fs.Writer) (int64, error)

type S3FileInfo

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

func NewS3FileInfo

func NewS3FileInfo(name string, modTime time.Time, dir bool, size int64) *S3FileInfo

func (*S3FileInfo) IsDir

func (fi *S3FileInfo) IsDir() bool

func (*S3FileInfo) ModTime

func (fi *S3FileInfo) ModTime() time.Time

func (*S3FileInfo) Name

func (fi *S3FileInfo) Name() string

func (*S3FileInfo) Size

func (fi *S3FileInfo) Size() int64

func (*S3FileInfo) String

func (fi *S3FileInfo) String() string

type S3FileSystem

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

func NewS3FileSystem

func NewS3FileSystem(
	defaultRegion string,
	bucket string,
	prefix string,
	clients map[string]*s3.Client,
	bucketRegions map[string]string,
	bucketCreationDates map[string]time.Time,
	maxEntries int,
	maxPages int,
	bucketKeyEnabled bool,
	partSize int) *S3FileSystem

func (*S3FileSystem) Chtimes

func (s3fs *S3FileSystem) Chtimes(ctx context.Context, name string, atime time.Time, mtime time.Time) error

func (*S3FileSystem) Copy

func (s3fs *S3FileSystem) Copy(ctx context.Context, input *fs.CopyInput) error

func (*S3FileSystem) CopyObject

func (s3fs *S3FileSystem) CopyObject(ctx context.Context, source string, destination string) error

CopyObject uses the CopyObject API to copy an object.

func (*S3FileSystem) DeleteObject

func (s3fs *S3FileSystem) DeleteObject(ctx context.Context, name string) error

DeleteObject uses the DeleteObject API to delete an object.

func (*S3FileSystem) DeleteObjects

func (s3fs *S3FileSystem) DeleteObjects(ctx context.Context, names []string) error

DeleteObjects uses the DeleteObjects API to delete multiple objects.

func (*S3FileSystem) Dir

func (s3fs *S3FileSystem) Dir(name string) string

func (*S3FileSystem) GetBucketRegion

func (s3fs *S3FileSystem) GetBucketRegion(bucket string) string

GetBucketRegion returns the region for the bucket. If the bucket is not known, then returns the default region

func (*S3FileSystem) HeadObject

func (s3fs *S3FileSystem) HeadObject(ctx context.Context, name string) (*S3FileInfo, error)

func (*S3FileSystem) IsNotExist

func (s3fs *S3FileSystem) IsNotExist(err error) bool

func (*S3FileSystem) Join

func (s3fs *S3FileSystem) Join(name ...string) string

func (*S3FileSystem) MagicNumber

func (s3fs *S3FileSystem) MagicNumber(ctx context.Context, name string) ([]byte, error)

func (*S3FileSystem) MagicNumbers

func (s3fs *S3FileSystem) MagicNumbers(ctx context.Context, names []string, threads int) ([][]byte, error)

func (*S3FileSystem) MkdirAll

func (s3fs *S3FileSystem) MkdirAll(ctx context.Context, name string, mode os.FileMode) error

func (*S3FileSystem) MultipartCopyObject

func (s3fs *S3FileSystem) MultipartCopyObject(ctx context.Context, source string, destination string, size int64) error

MultipartCopyObject copies an object using a multipart upload, which is required for objects greater than or equal to 5 GB.

func (*S3FileSystem) MustRelative

func (s3fs *S3FileSystem) MustRelative(ctx context.Context, base string, target string) string

func (*S3FileSystem) Open

func (s3fs *S3FileSystem) Open(ctx context.Context, name string) (fs.Object, error)

func (*S3FileSystem) OpenObject

func (s3fs *S3FileSystem) OpenObject(ctx context.Context, name string, flag int, perm os.FileMode) (fs.Object, error)

func (*S3FileSystem) ReadDir

func (s3fs *S3FileSystem) ReadDir(ctx context.Context, name string, recursive bool) ([]fs.DirectoryEntryInterface, error)

func (*S3FileSystem) ReadFile

func (s3fs *S3FileSystem) ReadFile(ctx context.Context, name string, data []byte) (int, error)

func (*S3FileSystem) Relative

func (s3fs *S3FileSystem) Relative(ctx context.Context, base string, target string) (string, error)

func (*S3FileSystem) RemoveDirectories

func (s3fs *S3FileSystem) RemoveDirectories(ctx context.Context, names []string, recursive bool) error

func (*S3FileSystem) RemoveDirectory

func (s3fs *S3FileSystem) RemoveDirectory(ctx context.Context, name string, recursive bool) error

func (*S3FileSystem) RemoveFile

func (s3fs *S3FileSystem) RemoveFile(ctx context.Context, name string) error

func (*S3FileSystem) RemoveFiles

func (s3fs *S3FileSystem) RemoveFiles(ctx context.Context, names []string) error

func (*S3FileSystem) Root

func (s3fs *S3FileSystem) Root() string

func (*S3FileSystem) Size

func (s3fs *S3FileSystem) Size(ctx context.Context, name string) (int64, error)

func (*S3FileSystem) Stat

func (s3fs *S3FileSystem) Stat(ctx context.Context, name string) (fs.FileInfo, error)

func (*S3FileSystem) Sync

func (s3fs *S3FileSystem) Sync(ctx context.Context, input *fs.SyncInput) (int, error)

func (*S3FileSystem) SyncDirectory

func (s3fs *S3FileSystem) SyncDirectory(ctx context.Context, input *fs.SyncDirectoryInput) (int, error)

type Uploader

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

func NewUploader

func NewUploader(ctx context.Context, input *UploaderInput) *Uploader

func (*Uploader) Close

func (u *Uploader) Close() error

func (*Uploader) Write

func (u *Uploader) Write(p []byte) (int, error)

type UploaderInput

type UploaderInput struct {
	ACL              types.ObjectCannedACL
	Client           *s3.Client
	Bucket           string
	BucketKeyEnabled bool
	Key              string
	PartSize         int
}

Jump to

Keyboard shortcuts

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