Documentation
¶
Index ¶
- func CleanupStorageByPrefix(ctx context.Context, prefix string) error
- func CopyFileFromStorage(ctx context.Context, storageKey, destPath string) error
- func CopyFileToStorage(ctx context.Context, sourcePath, storageKey string) error
- func EnsureStorageKeyExists(ctx context.Context, storageKey string) error
- func GenerateBackupKey(filename string) string
- func GenerateUserConfigKey(userID uuid.UUID) string
- func GenerateUserConfigPrefix(userID uuid.UUID) string
- func GenerateUserDocumentKey(userID uuid.UUID, prefix, filename string, multiUserMode bool) string
- func GenerateUserDocumentPrefix(userID uuid.UUID) string
- func GenerateUserPrefix(userID uuid.UUID) string
- func GetStorageType() string
- func InitializeStorage() error
- func IsBackupStorageKey(storageKey string) bool
- func IsUserStorageKey(storageKey string, userID uuid.UUID) bool
- func MoveFileToStorage(ctx context.Context, sourcePath, storageKey string) error
- func MoveInStorage(ctx context.Context, srcKey, dstKey string) error
- func ParseUserIDFromKey(storageKey string) (uuid.UUID, error)
- func SanitizeStorageKey(key string) string
- func StreamToResponse(ctx context.Context, c *gin.Context, storageKey, filename, contentType string) error
- func ValidateStorageConfig(cfg StorageConfig) error
- type FilesystemBackend
- func (fs *FilesystemBackend) Copy(ctx context.Context, srcKey, dstKey string) error
- func (fs *FilesystemBackend) Delete(ctx context.Context, key string) error
- func (fs *FilesystemBackend) Exists(ctx context.Context, key string) (bool, error)
- func (fs *FilesystemBackend) Get(ctx context.Context, key string) (io.ReadCloser, error)
- func (fs *FilesystemBackend) GetInfo(ctx context.Context, key string) (*StorageInfo, error)
- func (fs *FilesystemBackend) List(ctx context.Context, prefix string) ([]string, error)
- func (fs *FilesystemBackend) ListWithInfo(ctx context.Context, prefix string) ([]StorageInfo, error)
- func (fs *FilesystemBackend) Put(ctx context.Context, key string, data io.Reader) error
- type S3Backend
- func (s3b *S3Backend) Copy(ctx context.Context, srcKey, dstKey string) error
- func (s3b *S3Backend) Delete(ctx context.Context, key string) error
- func (s3b *S3Backend) Exists(ctx context.Context, key string) (bool, error)
- func (s3b *S3Backend) Get(ctx context.Context, key string) (io.ReadCloser, error)
- func (s3b *S3Backend) GetInfo(ctx context.Context, key string) (*StorageInfo, error)
- func (s3b *S3Backend) List(ctx context.Context, prefix string) ([]string, error)
- func (s3b *S3Backend) ListWithInfo(ctx context.Context, prefix string) ([]StorageInfo, error)
- func (s3b *S3Backend) Put(ctx context.Context, key string, data io.Reader) error
- type StorageBackend
- type StorageBackendWithInfo
- type StorageConfig
- type StorageInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupStorageByPrefix ¶ added in v1.6.0
func CopyFileFromStorage ¶ added in v1.6.0
func CopyFileToStorage ¶ added in v1.6.0
func EnsureStorageKeyExists ¶ added in v1.6.0
func GenerateBackupKey ¶ added in v1.6.0
GenerateBackupKey generates a storage key for backup files
func GenerateUserConfigKey ¶ added in v1.6.0
GenerateUserConfigKey generates a storage key for user rmapi config
func GenerateUserConfigPrefix ¶ added in v1.6.0
GenerateUserConfigPrefix returns the storage prefix for a user's configs
func GenerateUserDocumentKey ¶ added in v1.6.0
GenerateUserDocumentKey generates a storage key for user documents
func GenerateUserDocumentPrefix ¶ added in v1.6.0
GenerateUserDocumentPrefix returns the storage prefix for a user's documents
func GenerateUserPrefix ¶ added in v1.6.0
GenerateUserPrefix returns the storage prefix for a user's files
func GetStorageType ¶ added in v1.6.0
func GetStorageType() string
GetStorageType returns the type of the current storage backend
func InitializeStorage ¶ added in v1.6.0
func InitializeStorage() error
InitializeStorage initializes the global storage backend based on configuration
func IsBackupStorageKey ¶ added in v1.6.0
IsBackupStorageKey checks if a storage key is for a backup file
func IsUserStorageKey ¶ added in v1.6.0
IsUserStorageKey checks if a storage key belongs to a specific user
func MoveFileToStorage ¶ added in v1.6.0
func MoveInStorage ¶ added in v1.6.0
func ParseUserIDFromKey ¶ added in v1.6.0
ParseUserIDFromKey extracts the user ID from a storage key, if present
func SanitizeStorageKey ¶ added in v1.6.0
SanitizeStorageKey ensures the storage key is safe to use
func StreamToResponse ¶ added in v1.6.0
func ValidateStorageConfig ¶ added in v1.6.0
func ValidateStorageConfig(cfg StorageConfig) error
ValidateStorageConfig validates the storage configuration
Types ¶
type FilesystemBackend ¶ added in v1.6.0
type FilesystemBackend struct {
// contains filtered or unexported fields
}
func NewFilesystemBackend ¶ added in v1.6.0
func NewFilesystemBackend(basePath string) *FilesystemBackend
func (*FilesystemBackend) Copy ¶ added in v1.6.0
func (fs *FilesystemBackend) Copy(ctx context.Context, srcKey, dstKey string) error
func (*FilesystemBackend) Delete ¶ added in v1.6.0
func (fs *FilesystemBackend) Delete(ctx context.Context, key string) error
func (*FilesystemBackend) Get ¶ added in v1.6.0
func (fs *FilesystemBackend) Get(ctx context.Context, key string) (io.ReadCloser, error)
func (*FilesystemBackend) GetInfo ¶ added in v1.6.0
func (fs *FilesystemBackend) GetInfo(ctx context.Context, key string) (*StorageInfo, error)
func (*FilesystemBackend) ListWithInfo ¶ added in v1.6.0
func (fs *FilesystemBackend) ListWithInfo(ctx context.Context, prefix string) ([]StorageInfo, error)
type S3Backend ¶ added in v1.6.0
type S3Backend struct {
// contains filtered or unexported fields
}
func (*S3Backend) ListWithInfo ¶ added in v1.6.0
type StorageBackend ¶ added in v1.6.0
type StorageBackend interface {
// Put stores data at the given key
Put(ctx context.Context, key string, data io.Reader) error
// Get retrieves data from the given key
Get(ctx context.Context, key string) (io.ReadCloser, error)
// Delete removes the object at the given key
Delete(ctx context.Context, key string) error
// List returns all keys with the given prefix
List(ctx context.Context, prefix string) ([]string, error)
// Exists checks if an object exists at the given key
Exists(ctx context.Context, key string) (bool, error)
// Copy copies an object from srcKey to dstKey
Copy(ctx context.Context, srcKey, dstKey string) error
}
StorageBackend defines the interface for different storage implementations
type StorageBackendWithInfo ¶ added in v1.6.0
type StorageBackendWithInfo interface {
StorageBackend
// ListWithInfo returns objects with metadata
ListWithInfo(ctx context.Context, prefix string) ([]StorageInfo, error)
// GetInfo returns metadata for a single object
GetInfo(ctx context.Context, key string) (*StorageInfo, error)
}
StorageBackendWithInfo extends StorageBackend with metadata operations
func GetStorageBackend ¶ added in v1.6.0
func GetStorageBackend() StorageBackendWithInfo
GetStorageBackend returns the initialized global storage backend
type StorageConfig ¶ added in v1.6.0
type StorageConfig struct {
Backend string
DataDir string
S3Endpoint string
S3Region string
S3Bucket string
S3AccessKeyID string
S3SecretKey string
S3ForcePathStyle bool
}
StorageConfig holds configuration for storage backends
func GetStorageConfig ¶ added in v1.6.0
func GetStorageConfig() StorageConfig
GetStorageConfig returns storage configuration from environment variables
type StorageInfo ¶ added in v1.6.0
StorageInfo provides metadata about stored objects