Documentation
¶
Index ¶
- Variables
- type Builder
- type Option
- type Provider
- func (p *Provider) Close() error
- func (p *Provider) Delete(ctx context.Context, fileRef *storagetypes.File, ...) error
- func (p *Provider) Download(ctx context.Context, fileRef *storagetypes.File, ...) (*storagetypes.DownloadedFileMetadata, error)
- func (p *Provider) Exists(ctx context.Context, fileRef *storagetypes.File) (bool, error)
- func (p *Provider) GetPresignedURL(ctx context.Context, fileRef *storagetypes.File, ...) (string, error)
- func (p *Provider) GetScheme() *string
- func (p *Provider) ListBuckets() ([]string, error)
- func (p *Provider) ProviderType() storagetypes.ProviderType
- func (p *Provider) Upload(ctx context.Context, reader io.Reader, opts *storagetypes.UploadFileOptions) (*storagetypes.UploadedFileMetadata, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMissingEntClient indicates that no ent client was available in context when required. ErrMissingEntClient = errors.New("database storage requires ent client in context") // ErrMissingFileIdentifier indicates neither file ID nor key was supplied for an operation. ErrMissingFileIdentifier = errors.New("file identifier required for database storage operation") // ErrTokenManagerRequired indicates presigned URL generation attempted without a token manager. ErrTokenManagerRequired = errors.New("token manager required for database presigned urls") // ErrFileNotFound is returned when the requested file does not exist or has no stored bytes. ErrFileNotFound = errors.New("file not found in database storage") // ErrDatabaseProviderRequiresProxyPresign indicates that the database storage provider requires proxy presigning to be enabled. ErrDatabaseProviderRequiresProxyPresign = errors.New("database storage provider requires proxy presign to be enabled") )
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder creates database providers for the client pool.
func (*Builder) Build ¶
func (b *Builder) Build(_ context.Context, _ storage.ProviderCredentials, config *storage.ProviderOptions) (storagetypes.Provider, error)
Build implements eddy.Builder.
func (*Builder) ProviderType ¶
ProviderType implements eddy.Builder.
func (*Builder) WithOptions ¶
WithOptions allows applying builder-specific options.
type Option ¶
type Option func(*Builder)
Option configures the database provider builder.
func WithTokenClaims ¶
WithTokenClaims configures issuer and audience values for presigned tokens.
func WithTokenManager ¶
func WithTokenManager(tm *tokens.TokenManager) Option
WithTokenManager supplies the token manager used for presigned URL generation.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider persists file bytes directly into the database.
func (*Provider) Delete ¶
func (p *Provider) Delete(ctx context.Context, fileRef *storagetypes.File, _ *storagetypes.DeleteFileOptions) error
Delete removes file bytes from the database while retaining metadata.
func (*Provider) Download ¶
func (p *Provider) Download(ctx context.Context, fileRef *storagetypes.File, _ *storagetypes.DownloadFileOptions) (*storagetypes.DownloadedFileMetadata, error)
Download retrieves file contents from the database.
func (*Provider) GetPresignedURL ¶
func (p *Provider) GetPresignedURL(ctx context.Context, fileRef *storagetypes.File, opts *storagetypes.PresignedURLOptions) (string, error)
GetPresignedURL returns a signed URL that proxies through the application for download.
func (*Provider) ListBuckets ¶
ListBuckets returns the configured logical bucket for the provider.
func (*Provider) ProviderType ¶
func (p *Provider) ProviderType() storagetypes.ProviderType
ProviderType returns the database provider identifier.
func (*Provider) Upload ¶
func (p *Provider) Upload(ctx context.Context, reader io.Reader, opts *storagetypes.UploadFileOptions) (*storagetypes.UploadedFileMetadata, error)
Upload stores file contents in the database for the ent file identified by provider hints.