Documentation
¶
Overview ¶
Package objects provides storage orchestration layer that combines clientpool provider resolution with objects/storage pure operations to enable multi-tenant file storage management.
Index ¶
- Constants
- Variables
- func ApplyProviderHints(ctx context.Context, hints *storagetypes.ProviderHints) context.Context
- func PopulateProviderHints(file *pkgobjects.File, orgID string)
- func ResolveModuleFromFile(f pkgobjects.File) (models.OrgModule, bool)
- type Config
- type KnownProviderHint
- type ModuleHint
- type PreferredProviderHint
- type ProviderCacheKey
- type Service
- func (s *Service) Delete(ctx context.Context, file *storagetypes.File, ...) error
- func (s *Service) Download(ctx context.Context, provider storage.Provider, file *storagetypes.File, ...) (*storage.DownloadedMetadata, error)
- func (s *Service) ErrorResponseHandler() storage.ErrResponseHandler
- func (s *Service) Exists(ctx context.Context, file *storagetypes.File) (bool, error)
- func (s *Service) GetPresignedURL(ctx context.Context, file *storagetypes.File, duration time.Duration) (string, error)
- func (s *Service) IgnoreNonExistentKeys() bool
- func (s *Service) Keys() []string
- func (s *Service) MaxSize() int64
- func (s *Service) Skipper() storage.SkipperFunc
- func (s *Service) Upload(ctx context.Context, reader io.Reader, opts *storage.UploadOptions) (*pkgobjects.File, error)
- type SizeBytesHint
Constants ¶
const ( // DefaultClientPoolTTL is the default TTL for client pool entries. DefaultClientPoolTTL = 15 * time.Minute // DefaultDevStorageBucket is used when a development storage bucket is required but not provided. DefaultDevStorageBucket = "/tmp/dev-storage" // DefaultS3Region is used when no region is specified for S3-compatible providers. DefaultS3Region = "us-east-1" )
Variables ¶
var ( // ErrProviderResolutionFailed is returned when storage provider resolution failed ErrProviderResolutionFailed = errors.New("storage provider resolution failed") // ErrProviderCreationFailed is returned when storage provider creation failed ErrProviderCreationFailed = errors.New("storage provider creation failed") // ErrInvalidUploadOptions is returned when invalid upload options provided ErrInvalidUploadOptions = errors.New("invalid upload options") // ErrInvalidIntegration is returned when an invalid integration is provided ErrInvalidIntegration = errors.New("invalid integration provided") // ErrNoOrganizationID is returned when no organization ID is available ErrNoOrganizationID = errors.New("no organization ID available") // ErrMissingIntegrationID is returned when integration ID is missing ErrMissingIntegrationID = errors.New("integration ID is missing") // ErrMissingHushID is returned when hush ID is missing ErrMissingHushID = errors.New("hush ID is missing") // ErrSystemIntegrationMissingOrgID is returned when system integration is missing organization ID ErrSystemIntegrationMissingOrgID = errors.New("system integration missing organization ID") // ErrNoIntegrationOrCredentials is returned when no integration or credentials are available ErrNoIntegrationOrCredentials = errors.New("no integration or credentials available") // ErrNoSystemIntegration is returned when no system integration is found for a provider ErrNoSystemIntegration = errors.New("no system integration found") // ErrNoIntegrationWithSecrets is returned when an integration lacks associated secrets ErrNoIntegrationWithSecrets = errors.New("no active integration with secrets found") // ErrMissingFileID is returned when file ID is required but missing ErrMissingFileID = errors.New("file id required for presigned URL") )
Functions ¶
func ApplyProviderHints ¶
func ApplyProviderHints(ctx context.Context, hints *storagetypes.ProviderHints) context.Context
ApplyProviderHints injects hint values into the resolution context using typed context values
func PopulateProviderHints ¶
func PopulateProviderHints(file *pkgobjects.File, orgID string)
PopulateProviderHints ensures standard metadata is present on the file's provider hints
func ResolveModuleFromFile ¶
func ResolveModuleFromFile(f pkgobjects.File) (models.OrgModule, bool)
ResolveModuleFromFile attempts to determine the module associated with the upload
Types ¶
type Config ¶
type Config struct {
Resolver *eddy.Resolver[storage.Provider, storage.ProviderCredentials, *storage.ProviderOptions]
ClientService *eddy.ClientService[storage.Provider, storage.ProviderCredentials, *storage.ProviderOptions]
ValidationFunc storage.ValidationFunc
}
Config holds configuration for creating a new Service
type KnownProviderHint ¶
type KnownProviderHint storagetypes.ProviderType
type PreferredProviderHint ¶
type PreferredProviderHint storagetypes.ProviderType
type ProviderCacheKey ¶
ProviderCacheKey implements eddy.CacheKey for provider caching
func (ProviderCacheKey) String ¶
func (k ProviderCacheKey) String() string
String returns the cache key as a string
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service orchestrates storage operations using eddy provider resolution
func NewService ¶
NewService creates a new storage orchestration service
func (*Service) Delete ¶
func (s *Service) Delete(ctx context.Context, file *storagetypes.File, opts *storagetypes.DeleteFileOptions) error
Delete deletes a file using provider resolution
func (*Service) Download ¶
func (s *Service) Download(ctx context.Context, provider storage.Provider, file *storagetypes.File, opts *storage.DownloadOptions) (*storage.DownloadedMetadata, error)
Download downloads a file using provider resolution
func (*Service) ErrorResponseHandler ¶
func (s *Service) ErrorResponseHandler() storage.ErrResponseHandler
ErrorResponseHandler returns the configured error response handler
func (*Service) GetPresignedURL ¶
func (s *Service) GetPresignedURL(ctx context.Context, file *storagetypes.File, duration time.Duration) (string, error)
GetPresignedURL gets a presigned URL for a file using provider resolution
func (*Service) IgnoreNonExistentKeys ¶
IgnoreNonExistentKeys returns whether to ignore non-existent form keys
func (*Service) Skipper ¶
func (s *Service) Skipper() storage.SkipperFunc
Skipper returns the configured skipper function
type SizeBytesHint ¶
type SizeBytesHint int64