routing

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CandidateUnavailableErrorName = "CandidateUnavailable"

Variables

View Source
var ErrCandidateUnavailable = errors.New(CandidateUnavailableErrorName, "no storage providers available")

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL