storage_base

package
v0.0.0-...-5a94a59 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

type Storage interface {
	BeginBlobUpload(blobID []byte) StorageUpload
	BeginDatabaseUpload(filename string) StorageUpload
	DownloadSection(path string, offset int64, length int64) io.ReadCloser

	// it is like always faster to get a large list of path, checksum, size than to do it one file at a time
	ListBlobs() []UploadedBlob

	Metadata(path string) (string, int64) // checksum (can be empty) and size

	GetID() []byte

	String() string
}

a place where blobs can be stored

type StorageUpload

type StorageUpload interface {
	// simply calling BeginBlobUpload has already created the writer, this simply retrieves it
	Writer() io.Writer

	// flush and close the upload, **verify integrity by comparing the checksum**, then return the data
	End() UploadedBlob
}

an upload in progress

type UploadedBlob

type UploadedBlob struct {
	StorageID []byte
	BlobID    []byte // nil if fetched from a list operation, has data if fetched from database
	Path      string
	Checksum  string
	Size      int64
}

metadata about a blob that has been successfully uploaded can be either immediately after an upload, or later on while listing therefore: should not rely on data that is only provided on a completed upload

Jump to

Keyboard shortcuts

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