Documentation
¶
Overview ¶
Package file provides file management API handlers.
Index ¶
- type File
- func (f *File) DeleteFileByName(ctx context.Context, request gen.DeleteFileByNameRequestObject) (gen.DeleteFileByNameResponseObject, error)
- func (f *File) GetFileByName(ctx context.Context, request gen.GetFileByNameRequestObject) (gen.GetFileByNameResponseObject, error)
- func (f *File) GetFiles(ctx context.Context, _ gen.GetFilesRequestObject) (gen.GetFilesResponseObject, error)
- func (f *File) PostFile(ctx context.Context, request gen.PostFileRequestObject) (gen.PostFileResponseObject, error)
- type ObjectStoreManager
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 ¶
func (f *File) DeleteFileByName( ctx context.Context, request gen.DeleteFileByNameRequestObject, ) (gen.DeleteFileByNameResponseObject, error)
DeleteFileByName delete a file from the Object Store.
func (*File) GetFileByName ¶
func (f *File) GetFileByName( ctx context.Context, request gen.GetFileByNameRequestObject, ) (gen.GetFileByNameResponseObject, error)
GetFileByName get metadata for a specific file in the Object Store.
func (*File) GetFiles ¶
func (f *File) GetFiles( ctx context.Context, _ gen.GetFilesRequestObject, ) (gen.GetFilesResponseObject, error)
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.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.