files

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFilesAPIDuplicateFile    = errors.New("files API already contains a file with this path")
	ErrFilesAPINotFound         = errors.New("cannot find a file with this path")
	ErrFileAPICreateInvalidData = errors.New("invalid data sent to Files API")
	ErrS3Upload                 = errors.New("uploading part failed")
	ErrS3Download               = errors.New("downloading file failed")
	ErrS3Head                   = errors.New("getting file info failed")
	ErrChunkTooSmall            = errors.New("chunk size below minimum 5MB")
	ErrFilesServer              = errors.New("file api returning internal server errors")
	ErrFilesUnauthorised        = errors.New("access unauthorised")
)

Functions

This section is empty.

Types

type FilesClienter added in v1.3.0

type FilesClienter interface {
	GetFile(ctx context.Context, path string, authToken string) (files.FileMetaData, error)
	RegisterFile(ctx context.Context, metadata files.FileMetaData) error
	MarkFileUploaded(ctx context.Context, path string, etag string) error
}

type Resumable

type Resumable struct {
	FileName     string `schema:"resumableFilename"`
	Type         string `schema:"resumableType"`
	CurrentChunk int64  `schema:"resumableChunkNumber"`
	TotalChunks  int    `schema:"resumableTotalChunks"`
}

type Status added in v1.3.0

type Status struct {
	Metadata    files.FileMetaData `json:"metadata"`
	FileContent StatusMessage      `json:"file_content"`
}

type StatusMessage added in v1.3.0

type StatusMessage struct {
	Value bool   `json:"valid"`
	Err   string `json:"error,omitempty"`
}

type Store

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

func NewStore

func NewStore(files FilesClienter, bucket *aws.Bucket, cfg *config.Config) Store

func (Store) Status added in v1.3.0

func (s Store) Status(ctx context.Context, path string) (*Status, error)

func (Store) UploadFile

func (s Store) UploadFile(ctx context.Context, metadata files.FileMetaData, resumable Resumable, content []byte) (bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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