Documentation
¶
Index ¶
- Constants
- Variables
- type SelectOption
- type Service
- func (s *Service) GetProviderInfo(ctx context.Context, provider ucan.Principal) (StorageProviderInfo, error)
- func (s *Service) SelectReplicationProvider(ctx context.Context, primary ucan.Principal, blob types.Blob, ...) (StorageProviderInfo, error)
- func (s *Service) SelectStorageProvider(ctx context.Context, blob types.Blob, options ...SelectOption) (StorageProviderInfo, error)
- type StorageProviderInfo
Constants ¶
Variables ¶
ErrCandidateUnavailable is returned when there are no candidates willing to allocate space for the given blob.
Functions ¶
This section is empty.
Types ¶
type SelectOption ¶
type SelectOption func(*selectCfg)
func WithExclusions ¶
func WithExclusions(providers ...ucan.Principal) SelectOption
WithExclusions configures a list of storage providers that should be excluded from the routing selection.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(storageProviderStore storageprovider.Store, logger *zap.Logger) *Service
func (*Service) GetProviderInfo ¶
func (s *Service) GetProviderInfo(ctx context.Context, provider ucan.Principal) (StorageProviderInfo, error)
GetProviderInfo returns information about a registered storage provider. It may return storageprovider.ErrStorageProviderNotFound.
func (*Service) SelectReplicationProvider ¶
func (s *Service) SelectReplicationProvider(ctx context.Context, primary ucan.Principal, blob types.Blob, options ...SelectOption) (StorageProviderInfo, error)
SelectReplicationProvider selects a candidate for blob allocation from the current list of available storage nodes, excluding the primary node. It may return ErrCandidateUnavailable if no candidates are available.
func (*Service) SelectStorageProvider ¶
func (s *Service) SelectStorageProvider(ctx context.Context, blob types.Blob, options ...SelectOption) (StorageProviderInfo, error)
SelectStorageProvider selects a candidate for blob allocation from the current list of available storage nodes. It may return ErrCandidateUnavailable if no candidates are available.
type StorageProviderInfo ¶
type StorageProviderInfo struct {
ID ucan.Principal
Endpoint url.URL
// FIXME: the client should authorize the upload service to blob/allocate and
// blob/accept in the blob/add invocation. The upload service should use that
// delegation to authorize allocate and accept calls to the storage provider.
// This removes the need for storage providers to grant love lived delegations
// to the upload service. We will fix this in UCAN 1.0.
Proof delegation.Delegation
}