files

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 11 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("authentication required")
	ErrFilesForbidden           = errors.New("access forbidden")
)

Functions

This section is empty.

Types

type ContentItem added in v1.14.0

type ContentItem struct {
	DatasetID string `json:"dataset_id"`
	Edition   string `json:"edition"`
	Version   string `json:"version"`
}

type FileMetadataWithContentItem added in v1.14.0

type FileMetadataWithContentItem struct {
	filesAPI.FileMetaData
	ContentItem *ContentItem `json:"content_item,omitempty"`
}

FileMetadataWithContentItem extends the files API metadata with content_item

type FilesClienter added in v1.3.0

type FilesClienter interface {
	GetFile(ctx context.Context, path string, headers filesSDK.Headers) (*filesAPITypes.StoredRegisteredMetaData, error)
	RegisterFile(ctx context.Context, metadata filesAPITypes.StoredRegisteredMetaData, headers filesSDK.Headers) error
	MarkFilePublished(ctx context.Context, path string, headers filesSDK.Headers) error
	MarkFileUploaded(ctx context.Context, path string, etag string, headers filesSDK.Headers) error
}

type Resumable

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

type Status added in v1.3.0

type Status struct {
	Metadata    filesAPITypes.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 FileMetadataWithContentItem, 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