file

package
v0.0.0-...-f0d1bbf Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package file provides file management API handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

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

File implementation of the File APIs operations.

func New

func New(
	logger *slog.Logger,
	objStore ObjectStoreManager,
) *File

New factory to create a new instance.

func (*File) DeleteFileByName

DeleteFileByName delete a file from the Object Store.

func (*File) GetFileByName

GetFileByName get metadata for a specific file in the Object Store.

func (*File) GetFiles

GetFiles list all files stored in the Object Store.

func (*File) PostFile

func (f *File) PostFile(
	ctx context.Context,
	request gen.PostFileRequestObject,
) (gen.PostFileResponseObject, error)

PostFile upload a file to the Object Store via multipart/form-data.

type ObjectStoreManager

type ObjectStoreManager interface {
	// Put stores data from a reader under the given metadata.
	Put(
		ctx context.Context,
		meta jetstream.ObjectMeta,
		reader io.Reader,
	) (*jetstream.ObjectInfo, error)

	// PutBytes stores data under the given name.
	PutBytes(ctx context.Context, name string, data []byte) (*jetstream.ObjectInfo, error)

	// GetBytes retrieves the content stored under the given name.
	GetBytes(ctx context.Context, name string, opts ...jetstream.GetObjectOpt) ([]byte, error)

	// GetInfo retrieves metadata for the named object.
	GetInfo(
		ctx context.Context,
		name string,
		opts ...jetstream.GetObjectInfoOpt,
	) (*jetstream.ObjectInfo, error)

	// Delete removes the named object.
	Delete(ctx context.Context, name string) error

	// List returns metadata for all objects in the store.
	List(ctx context.Context, opts ...jetstream.ListObjectsOpt) ([]*jetstream.ObjectInfo, error)
}

ObjectStoreManager wraps the subset of jetstream.ObjectStore methods needed by the file API handlers. This minimal interface enables straightforward mocking in tests.

Directories

Path Synopsis
Package gen provides primitives to interact with the openapi HTTP API.
Package gen provides primitives to interact with the openapi HTTP API.
Package mocks provides mock implementations for testing.
Package mocks provides mock implementations for testing.

Jump to

Keyboard shortcuts

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