store

package
v0.0.0-...-322828a Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoChecksums = errors.New("no checksums found")

Functions

func CreateUploadSession

func CreateUploadSession(ctx context.Context, token string) error

CreateUploadSession creates a new pending upload session for the given token in the sessions KV namespace.

func DeleteDataObject

func DeleteDataObject(ctx context.Context, key string) error

DeleteDataObject deletes the object with the given key from the configured S3 bucket.

func DeleteFileMetadata

func DeleteFileMetadata(ctx context.Context, fileId string) error

func DeleteKvData

func DeleteKvData(ctx context.Context, namespaceId string, key string) error

DeleteKvData deletes the KV data stored under the given key.

func HasFileMetadata

func HasFileMetadata(ctx context.Context, fileId string) bool

HasFileMetadata checks if a file with the given file ID exists in the KV store.

func InitKvClient

func InitKvClient()

func InitS3Client

func InitS3Client()

func InitUploadSessionsNamespaceId

func InitUploadSessionsNamespaceId()

func ListDataObjects

func ListDataObjects(ctx context.Context) (map[string]types.Object, error)

func ListFileMetadata

func ListFileMetadata(ctx context.Context) (map[string]FileMetadata, error)

ListFileMetadata returns a map with file IDs and their metadata.

func ListKvKeys

func ListKvKeys(ctx context.Context, namespaceId string) ([]string, error)

ListKvKeys returns a list of all keys in the KV store.

func ReadKvData

func ReadKvData(ctx context.Context, namespaceId string, key string) ([]byte, error)

ReadKvData reads the value stored under the given key from the KV store.

func UploadData

func UploadData(ctx context.Context, key string, reader io.Reader, fileSize int64) error

UploadData uploads the data from the given reader to the configured S3 bucket.

func WriteFileMetadata

func WriteFileMetadata(ctx context.Context, fileId string, metadata FileMetadata) error

func WriteKvData

func WriteKvData(ctx context.Context, namespaceId string, key string, value []byte) error

WriteKvData writes the given value to the KV store under the given key.

Types

type DecryptedMetadata

type DecryptedMetadata struct {
	Name      string
	Checksums map[string][]byte
	Key       []byte
	Iv        []byte
	Size      int64
}

type FileMetadata

type FileMetadata struct {
	Name      crypto.EncryptedValue            `json:"name"`
	Checksum  *crypto.EncryptedValue           `json:"checksum,omitempty"`
	Checksums map[string]crypto.EncryptedValue `json:"checksums,omitempty"`
	Iv        string                           `json:"iv"`
	Size      int64                            `json:"size"`
}

func ReadFileMetadata

func ReadFileMetadata(ctx context.Context, fileId string) (FileMetadata, error)

ReadFileMetadata returns the metadata stored for a file with the given file ID.

func (*FileMetadata) Decrypt

func (metadata *FileMetadata) Decrypt(keyString string) (*DecryptedMetadata, error)

Jump to

Keyboard shortcuts

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