Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CustomFuncGenerator ¶
type CustomFuncGenerator struct {
GenerateFunc func(contentID, objectID uuid.UUID, metadata *KeyMetadata) string
}
CustomFuncGenerator allows users to provide their own key generation function
func NewCustomFuncGenerator ¶
func NewCustomFuncGenerator(fn func(contentID, objectID uuid.UUID, metadata *KeyMetadata) string) *CustomFuncGenerator
func (*CustomFuncGenerator) GenerateKey ¶
func (g *CustomFuncGenerator) GenerateKey(contentID, objectID uuid.UUID, metadata *KeyMetadata) string
type Generator ¶
type Generator interface {
// GenerateKey creates an object key for storage backends
GenerateKey(contentID, objectID uuid.UUID, metadata *KeyMetadata) string
}
Generator defines the interface for object key generation strategies
func NewHighPerformanceGenerator ¶
func NewHighPerformanceGenerator() Generator
NewHighPerformanceGenerator returns a generator optimized for high-performance scenarios
func NewMultiTenantGenerator ¶
func NewMultiTenantGenerator() Generator
NewMultiTenantGenerator returns a generator optimized for multi-tenant scenarios
func NewRecommendedGenerator ¶
func NewRecommendedGenerator() Generator
NewRecommendedGenerator returns the recommended generator for new installations
type GitLikeGenerator ¶
type GitLikeGenerator struct {
// ShardLength controls how many characters to use for sharding (default: 2)
ShardLength int
}
GitLikeGenerator provides Git-style sharded storage with original/derived separation Original: originals/objects/ab/cd1234ef5678_filename Derived: derived/{type}/{variant}/objects/ab/cd1234ef5678_filename
func NewGitLikeGenerator ¶
func NewGitLikeGenerator() *GitLikeGenerator
func (*GitLikeGenerator) GenerateKey ¶
func (g *GitLikeGenerator) GenerateKey(contentID, objectID uuid.UUID, metadata *KeyMetadata) string
type HashedGitLikeGenerator ¶
type HashedGitLikeGenerator struct {
ShardLength int
}
HashedGitLikeGenerator uses content-based hashing for deterministic sharding Useful for deduplication or when consistent keys are needed
func NewHashedGitLikeGenerator ¶
func NewHashedGitLikeGenerator() *HashedGitLikeGenerator
func (*HashedGitLikeGenerator) GenerateKey ¶
func (g *HashedGitLikeGenerator) GenerateKey(contentID, objectID uuid.UUID, metadata *KeyMetadata) string
type KeyMetadata ¶
type KeyMetadata struct {
FileName string
ContentType string
TenantID string
OwnerID string
// Content classification
IsOriginal bool
DerivationType string // "thumbnail", "preview", "transcode", etc.
Variant string // "256x256", "1080p", "small", etc.
ParentContentID uuid.UUID // For derived content
}
KeyMetadata contains information that influences key generation
type LegacyGenerator ¶
type LegacyGenerator struct{}
LegacyGenerator provides the original flat structure for backwards compatibility
func NewLegacyGenerator ¶
func NewLegacyGenerator() *LegacyGenerator
func (*LegacyGenerator) GenerateKey ¶
func (g *LegacyGenerator) GenerateKey(contentID, objectID uuid.UUID, metadata *KeyMetadata) string
type TenantAwareGitLikeGenerator ¶
TenantAwareGitLikeGenerator adds tenant isolation to Git-like sharding Structure: tenants/{tenant}/originals/objects/ab/cd1234ef5678_filename
tenants/{tenant}/derived/{type}/{variant}/objects/ab/cd1234ef5678_filename
func NewTenantAwareGitLikeGenerator ¶
func NewTenantAwareGitLikeGenerator() *TenantAwareGitLikeGenerator
func (*TenantAwareGitLikeGenerator) GenerateKey ¶
func (g *TenantAwareGitLikeGenerator) GenerateKey(contentID, objectID uuid.UUID, metadata *KeyMetadata) string