files

package
v0.0.0-...-b9360c4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoPrefix = ""
)
View Source
const (
	Path = ".fs"
)

Variables

This section is empty.

Functions

func Logger

func Logger(ctx context.Context) *zap.Logger

func NewLocalFilesArchive

func NewLocalFilesArchive() (a *localFilesArchive)

func NewNopFilesArchive

func NewNopFilesArchive() (a *nopFilesArchive)

Types

type ArchivedFile

type ArchivedFile struct {
	Key       string
	URL       string
	BytesRead int
}

type FileArchive

type FileArchive interface {
	Archive(ctx context.Context, contentType string, meta map[string]string, read io.Reader) (*ArchivedFile, error)
	OpenByURL(ctx context.Context, url string) (f *OpenedFile, err error)
	DeleteByURL(ctx context.Context, url string) (err error)
	Opened(ctx context.Context, url string, opened *OpenedFile) (reopened *OpenedFile, err error)
	Info(ctx context.Context, key string) (info *FileInfo, err error)
	String() string
}

func NewPrioritizedFilesArchive

func NewPrioritizedFilesArchive(reading []FileArchive, writing []FileArchive) (a FileArchive)

type FileInfo

type FileInfo struct {
	Key         string
	Size        int64
	ContentType string
	Meta        map[string]string
}

type FileMeta

type FileMeta struct {
	ContentType  string
	DeviceID     []byte
	GenerationID []byte
	Blocks       []int64
	Flags        []int64
}

type OpenedFile

type OpenedFile struct {
	FileInfo
	Body io.ReadCloser
}

type S3FileArchive

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

func NewS3FileArchive

func NewS3FileArchive(session *session.Session, metrics *logging.Metrics, bucket string, prefix string) (files *S3FileArchive, err error)

func (*S3FileArchive) Archive

func (a *S3FileArchive) Archive(ctx context.Context, contentType string, meta map[string]string, reader io.Reader) (*ArchivedFile, error)

func (*S3FileArchive) DeleteByURL

func (a *S3FileArchive) DeleteByURL(ctx context.Context, url string) (err error)

func (*S3FileArchive) Info

func (a *S3FileArchive) Info(ctx context.Context, key string) (info *FileInfo, err error)

func (*S3FileArchive) OpenByURL

func (a *S3FileArchive) OpenByURL(ctx context.Context, url string) (of *OpenedFile, err error)

func (*S3FileArchive) Opened

func (a *S3FileArchive) Opened(ctx context.Context, url string, opened *OpenedFile) (reopened *OpenedFile, err error)

func (*S3FileArchive) String

func (a *S3FileArchive) String() string

Jump to

Keyboard shortcuts

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