Documentation
¶
Overview ¶
TODO: eventually remove this file, all errors should be in src/blobcache
Index ¶
- Constants
- type Config
- type Env
- type ErrNotAllowed
- type LVParams
- type LocalVolume
- type MetadataStore
- type PeerLocator
- type Policy
- type Service
- func (s *Service[LV, LK]) Abort(ctx context.Context, txh blobcache.Handle) error
- func (s *Service[LK, LV]) AbortAll(ctx context.Context) error
- func (s *Service[LV, LK]) BeginTx(ctx context.Context, volh blobcache.Handle, txspec blobcache.TxParams) (*blobcache.Handle, error)
- func (s *Service[LK, LV]) Cleanup(ctx context.Context) ([]blobcache.OID, error)
- func (s *Service[LK, LV]) CloneVolume(ctx context.Context, caller *blobcache.PeerID, volh blobcache.Handle) (*blobcache.Handle, error)
- func (s *Service[LV, LK]) Commit(ctx context.Context, txh blobcache.Handle) error
- func (s *Service[LK, LV]) Copy(ctx context.Context, txh blobcache.Handle, srcTxns []blobcache.Handle, ...) error
- func (s *Service[LK, LV]) CreateQueue(ctx context.Context, host *blobcache.Endpoint, qspec blobcache.QueueSpec) (*blobcache.Handle, error)
- func (s *Service[LK, LV]) CreateVolume(ctx context.Context, host *blobcache.Endpoint, vspec blobcache.VolumeSpec) (*blobcache.Handle, error)
- func (s *Service[LV, LK]) Delete(ctx context.Context, txh blobcache.Handle, cids []blobcache.CID) error
- func (s *Service[LK, LV]) Drop(ctx context.Context, h blobcache.Handle) error
- func (s *Service[LK, LV]) Endpoint(ctx context.Context) (blobcache.Endpoint, error)
- func (s *Service[LV, LK]) Exists(ctx context.Context, txh blobcache.Handle, cids []blobcache.CID, dst []bool) error
- func (s *Service[LV, LK]) Get(ctx context.Context, txh blobcache.Handle, cid blobcache.CID, buf []byte, ...) (int, error)
- func (s *Service[LK, LV]) Insert(ctx context.Context, from *blobcache.Endpoint, qh blobcache.Handle, ...) (*blobcache.InsertResp, error)
- func (s *Service[LK, LV]) InspectHandle(ctx context.Context, h blobcache.Handle) (*blobcache.HandleInfo, error)
- func (s *Service[LK, LV]) InspectTx(ctx context.Context, txh blobcache.Handle) (*blobcache.TxInfo, error)
- func (s *Service[LV, LK]) InspectVolume(ctx context.Context, h blobcache.Handle) (*blobcache.VolumeInfo, error)
- func (s *Service[LK, LV]) IsVisited(ctx context.Context, txh blobcache.Handle, cids []blobcache.CID, dst []bool) error
- func (s *Service[LK, LV]) KeepAlive(ctx context.Context, hs []blobcache.Handle) error
- func (s *Service[LK, LV]) Link(ctx context.Context, txh blobcache.Handle, target blobcache.Handle, ...) (*blobcache.LinkToken, error)
- func (s *Service[LV, LK]) Load(ctx context.Context, txh blobcache.Handle, dst *[]byte) error
- func (s *Service[LK, LV]) LocalID() blobcache.PeerID
- func (s *Service[LK, LV]) Next(ctx context.Context, qh blobcache.Handle, buf []blobcache.Message, ...) (int, error)
- func (s *Service[LK, LV]) OpenFiat(ctx context.Context, x blobcache.OID, mask blobcache.ActionSet) (*blobcache.Handle, error)
- func (s *Service[LK, LV]) OpenFrom(ctx context.Context, base blobcache.Handle, ltok blobcache.LinkToken, ...) (*blobcache.Handle, error)
- func (s *Service[LK, LV]) Ping(ctx context.Context, ep blobcache.Endpoint) error
- func (s *Service[LV, LK]) Post(ctx context.Context, txh blobcache.Handle, data []byte, ...) (blobcache.CID, error)
- func (s *Service[LV, LK]) Save(ctx context.Context, txh blobcache.Handle, root []byte) error
- func (s *Service[LK, LV]) Serve(ctx context.Context, pc net.PacketConn) error
- func (s *Service[LK, LV]) Share(ctx context.Context, h blobcache.Handle, to blobcache.PeerID, ...) (*blobcache.Handle, error)
- func (s *Service[LK, LV]) SubToVolume(ctx context.Context, qh blobcache.Handle, volh blobcache.Handle) error
- func (s *Service[LK, LV]) Unlink(ctx context.Context, txh blobcache.Handle, targets []blobcache.LinkToken) error
- func (s *Service[LK, LV]) Visit(ctx context.Context, txh blobcache.Handle, cids []blobcache.CID) error
- func (s *Service[LK, LV]) VisitLinks(ctx context.Context, txh blobcache.Handle, targets []blobcache.LinkToken) error
- type VolumeEntry
Constants ¶
const ( // DefaultVolumeTTL is the default time to live for a volume handle. DefaultVolumeTTL = 5 * time.Minute // DefaultTxTTL is the default time to live for a transaction handle. DefaultTxTTL = 1 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// MaxMaxBlobSize is the maximum size of the MaxSize volume parameter, for any local volume.
MaxMaxBlobSize int64
}
type Env ¶
type Env[LK any, LV LocalVolume[LK]] struct { Background context.Context PrivateKey ed25519.PrivateKey // Root is the root volume. // It will have the all-zero OID. Root volumes.Volume // MDS is where Volume metadata is stored. MDS MetadataStore Policy Policy PeerLocator PeerLocator MkSchema schema.Factory // Local is the local volume system. Local volumes.System[LVParams[LK], LV] GenerateLK func() (LK, error) LKToOID func(LK) blobcache.OID OIDToLK func(blobcache.OID) (LK, error) }
type ErrNotAllowed ¶
type ErrNotAllowed struct {
Peer blobcache.PeerID
// TODO: this should be a blobcache.ActionSet
Action string
Target blobcache.OID
}
func (ErrNotAllowed) Error ¶
func (e ErrNotAllowed) Error() string
type LVParams ¶
type LVParams[K any] struct { Key K Params blobcache.VolumeConfig }
LVParams are the parameters for a local volume
type LocalVolume ¶
type MetadataStore ¶
type PeerLocator ¶
PeerLocator finds the address of peers
type Service ¶
type Service[LK any, LV LocalVolume[LK]] struct { // contains filtered or unexported fields }
func (*Service[LK, LV]) Cleanup ¶
Cleanup runs the full cleanup process. Cleanup removes expired handles, and cleans up any transactions, which are no longer referenced. It also removes volumes which are no longer referenced, and cleans up any in-memory resources for them. The dropped volumes are returned.
func (*Service[LK, LV]) CloneVolume ¶
func (*Service[LK, LV]) CreateQueue ¶
func (*Service[LK, LV]) CreateVolume ¶
func (*Service[LK, LV]) Endpoint ¶
Endpoint blocks waiting for a node to be created (happens when Serve is running). And then returns the Endpoint for that Node.
func (*Service[LK, LV]) InspectHandle ¶
func (*Service[LV, LK]) InspectVolume ¶
func (*Service[LK, LV]) Serve ¶
Serve handles requests from the network. Serve blocks untilt the context is cancelled, or Close is called. Cancelling the context will cause Run to return without an error. If Serve is *not* running, then remote volumes will not work, hosted on this Node or other Nodes.
func (*Service[LK, LV]) SubToVolume ¶
type VolumeEntry ¶
type VolumeEntry struct {
OID blobcache.OID
MaxSize int64
Schema blobcache.SchemaSpec
HashAlgo blobcache.HashAlgo
Salted bool
Backend blobcache.VolumeBackend[blobcache.OID]
Deps []blobcache.OID
}
func (VolumeEntry) Config ¶
func (ve VolumeEntry) Config() blobcache.VolumeConfig
func (VolumeEntry) Info ¶
func (ve VolumeEntry) Info() *blobcache.VolumeInfo