Documentation
¶
Index ¶
- Constants
- type Orchestrator
- func (o *Orchestrator) AddPolicy(p RoutingPolicy)
- func (o *Orchestrator) CapabilityCheck(ctx context.Context, key string) ([]string, error)
- func (o *Orchestrator) Delete(ctx context.Context, key string) error
- func (o *Orchestrator) DiscoverCache()
- func (o *Orchestrator) DiscoverStorage() error
- func (o *Orchestrator) Exists(ctx context.Context, key string) (bool, error)
- func (o *Orchestrator) Get(ctx context.Context, key string) (io.ReadCloser, error)
- func (o *Orchestrator) List(ctx context.Context, prefix string) ([]contracts.ObjectInfo, error)
- func (o *Orchestrator) Move(ctx context.Context, src, dst string) error
- func (o *Orchestrator) ProviderCount() int
- func (o *Orchestrator) ProviderInfo() []StorageProviderInfo
- func (o *Orchestrator) Put(ctx context.Context, key string, data io.Reader, size int64) error
- func (o *Orchestrator) SetAuditLogger(a contracts.AuditLogger)
- func (o *Orchestrator) SetCache(c contracts.CacheLayer)
- func (o *Orchestrator) SetTimeouts(t StorageTimeouts)
- func (o *Orchestrator) Stat(ctx context.Context, key string) (contracts.ObjectInfo, error)
- func (o *Orchestrator) Stream(ctx context.Context, key string, offset, length int64) (io.ReadCloser, error)
- func (o *Orchestrator) WatchModules(bus contracts.EventBus) (cancel func())
- type RoutingPolicy
- type StorageProviderInfo
- type StorageTimeouts
Constants ¶
const MaxObjectSize = 100 * 1024 * 1024 // 100 MB
MaxObjectSize is the maximum size of a single object that can be stored. Objects larger than this are rejected to prevent memory exhaustion.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Orchestrator ¶
type Orchestrator struct {
// contains filtered or unexported fields
}
Orchestrator routes storage operations to registered providers based on capability negotiation and user-defined policies.
Per-operation timeouts wrap every provider call so a hung provider cannot block the caller indefinitely. Set via StorageTimeouts, defaulting to 30s reads, 5m writes, 30s deletes.
func NewOrchestrator ¶
func NewOrchestrator(reg contracts.Registry) *Orchestrator
NewOrchestrator creates an Orchestrator that uses the given registry for provider discovery. Default timeouts: 30s read/delete, 5m write.
func (*Orchestrator) AddPolicy ¶
func (o *Orchestrator) AddPolicy(p RoutingPolicy)
AddPolicy registers a routing policy.
func (*Orchestrator) CapabilityCheck ¶
func (*Orchestrator) DiscoverCache ¶ added in v0.2.0
func (o *Orchestrator) DiscoverCache()
DiscoverCache finds a cache module from the registry and sets it as the read-through cache. If no cache module is registered, the orchestrator operates without a cache.
func (*Orchestrator) DiscoverStorage ¶ added in v0.2.0
func (o *Orchestrator) DiscoverStorage() error
DiscoverStorage finds all registered storage modules and adds them to the pool.
func (*Orchestrator) Get ¶
func (o *Orchestrator) Get(ctx context.Context, key string) (io.ReadCloser, error)
func (*Orchestrator) List ¶
func (o *Orchestrator) List(ctx context.Context, prefix string) ([]contracts.ObjectInfo, error)
func (*Orchestrator) ProviderCount ¶
func (o *Orchestrator) ProviderCount() int
func (*Orchestrator) ProviderInfo ¶ added in v0.4.0
func (o *Orchestrator) ProviderInfo() []StorageProviderInfo
ProviderInfo returns metadata for all registered storage providers.
func (*Orchestrator) SetAuditLogger ¶ added in v0.4.0
func (o *Orchestrator) SetAuditLogger(a contracts.AuditLogger)
SetAuditLogger attaches an audit logger for recording storage operations.
func (*Orchestrator) SetCache ¶
func (o *Orchestrator) SetCache(c contracts.CacheLayer)
SetCache directly sets the cache layer (for testing or forced override).
func (*Orchestrator) SetTimeouts ¶ added in v0.4.0
func (o *Orchestrator) SetTimeouts(t StorageTimeouts)
SetTimeouts configures per-operation deadlines. Zero values keep the current default. Call before any storage operations begin.
func (*Orchestrator) Stat ¶
func (o *Orchestrator) Stat(ctx context.Context, key string) (contracts.ObjectInfo, error)
func (*Orchestrator) Stream ¶ added in v0.4.0
func (o *Orchestrator) Stream(ctx context.Context, key string, offset, length int64) (io.ReadCloser, error)
Stream reads a byte range from a storage object. If the routed provider implements Streamable, it uses that for efficient range requests. Otherwise falls back to Get() with a full read and slice. This enables progressive download and in-RAM streaming without requiring every provider to implement range requests.
func (*Orchestrator) WatchModules ¶ added in v0.4.0
func (o *Orchestrator) WatchModules(bus contracts.EventBus) (cancel func())
WatchModules subscribes to module.registered events and automatically re-discovers storage providers and cache layers when new modules appear. Call this after bootstrap to enable dynamic provider registration. The returned cancel function stops watching.
type RoutingPolicy ¶
RoutingPolicy decides which provider handles a given key.
type StorageProviderInfo ¶ added in v0.4.0
type StorageProviderInfo struct {
ID string `json:"id"`
Capabilities []string `json:"capabilities"`
IsCache bool `json:"is_cache"`
}
StorageProviderInfo describes a registered storage provider for the admin API.