Documentation
¶
Overview ¶
Package bclocal implements a local Blobcache service.
Index ¶
- Constants
- type AllOrNothingPolicy
- type Config
- type Env
- type ErrNotAllowed
- type Policy
- type Service
- func (s *Service) Abort(ctx context.Context, txh blobcache.Handle) error
- func (s *Service) AbortAll(ctx context.Context) error
- func (s *Service) BeginTx(ctx context.Context, volh blobcache.Handle, txspec blobcache.TxParams) (*blobcache.Handle, error)
- func (s *Service) Cleanup(ctx context.Context) error
- func (s *Service) CloneVolume(ctx context.Context, caller *blobcache.PeerID, volh blobcache.Handle) (*blobcache.Handle, error)
- func (s *Service) Close() error
- func (s *Service) Commit(ctx context.Context, txh blobcache.Handle) error
- func (s *Service) Copy(ctx context.Context, txh blobcache.Handle, srcTxns []blobcache.Handle, ...) error
- func (s *Service) CreateQueue(ctx context.Context, host *blobcache.Endpoint, qspec blobcache.QueueSpec) (*blobcache.Handle, error)
- func (s *Service) CreateVolume(ctx context.Context, host *blobcache.Endpoint, vspec blobcache.VolumeSpec) (*blobcache.Handle, error)
- func (s *Service) Delete(ctx context.Context, txh blobcache.Handle, cids []blobcache.CID) error
- func (s *Service) Drop(ctx context.Context, h blobcache.Handle) error
- func (s *Service) Endpoint(ctx context.Context) (blobcache.Endpoint, error)
- func (s *Service) Exists(ctx context.Context, txh blobcache.Handle, cids []blobcache.CID, dst []bool) error
- func (s *Service) Get(ctx context.Context, txh blobcache.Handle, cid blobcache.CID, buf []byte, ...) (int, error)
- func (s *Service) Insert(ctx context.Context, from *blobcache.Endpoint, qh blobcache.Handle, ...) (*blobcache.InsertResp, error)
- func (s *Service) InspectHandle(ctx context.Context, h blobcache.Handle) (*blobcache.HandleInfo, error)
- func (s *Service) InspectTx(ctx context.Context, txh blobcache.Handle) (*blobcache.TxInfo, error)
- func (s *Service) InspectVolume(ctx context.Context, h blobcache.Handle) (*blobcache.VolumeInfo, error)
- func (s *Service) IsVisited(ctx context.Context, txh blobcache.Handle, cids []blobcache.CID, dst []bool) error
- func (s *Service) KeepAlive(ctx context.Context, hs []blobcache.Handle) error
- func (s *Service) Link(ctx context.Context, txh blobcache.Handle, target blobcache.Handle, ...) error
- func (s *Service) Load(ctx context.Context, txh blobcache.Handle, dst *[]byte) error
- func (s *Service) LocalID() blobcache.PeerID
- func (s *Service) Next(ctx context.Context, qh blobcache.Handle, buf []blobcache.Message, ...) (int, error)
- func (s *Service) OpenFiat(ctx context.Context, x blobcache.OID, mask blobcache.ActionSet) (*blobcache.Handle, error)
- func (s *Service) OpenFrom(ctx context.Context, base blobcache.Handle, x blobcache.OID, ...) (*blobcache.Handle, error)
- func (s *Service) Ping(ctx context.Context, ep blobcache.Endpoint) error
- func (s *Service) Post(ctx context.Context, txh blobcache.Handle, data []byte, ...) (blobcache.CID, error)
- func (s *Service) Save(ctx context.Context, txh blobcache.Handle, root []byte) error
- func (s *Service) Serve(ctx context.Context, pc net.PacketConn) error
- func (s *Service) Share(ctx context.Context, h blobcache.Handle, to blobcache.PeerID, ...) (*blobcache.Handle, error)
- func (s *Service) SubToVolume(ctx context.Context, qh blobcache.Handle, volh blobcache.Handle) error
- func (s *Service) Unlink(ctx context.Context, txh blobcache.Handle, targets []blobcache.OID) error
- func (s *Service) Visit(ctx context.Context, txh blobcache.Handle, cids []blobcache.CID) error
- func (s *Service) VisitLinks(ctx context.Context, txh blobcache.Handle, targets []blobcache.OID) error
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 // MaxMaxBlobSize is the maximum value that a Volume's max size can be set to. MaxMaxBlobSize = 1 << 24 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllOrNothingPolicy ¶
AllOrNothingPolicy is a policy that allows or disallows all actions for all peers.
func (*AllOrNothingPolicy) CanConnect ¶
func (p *AllOrNothingPolicy) CanConnect(peer blobcache.PeerID) bool
type Config ¶
type Config struct {
// When set to true, the service will not sync the database and blob directory.
NoSync bool
}
Config contains configuration for the service. Config{} works fine. You don't need to worry about anything in here.
type Env ¶
type Env struct {
Background context.Context
// StateDir is the directory where all the state is stored.
StateDir string
// PrivateKey determines the node's identity.
// It must be provided if PacketConn is set.
PrivateKey ed25519.PrivateKey
// MkSchema is the factory function to create a schema.
MkSchema schema.Factory
// Root is the spec to use for the root volume.
Root blobcache.VolumeSpec
// Policy control network access to the service.
Policy Policy
}
func NewTestEnv ¶
NewTestEnv creates a test environment. It uses: - t.TempDir() to create a temporary directory - creates a UDP socket on a random port. All the resources are cleaned up when the test is done.
type ErrNotAllowed ¶
func (ErrNotAllowed) Error ¶
func (e ErrNotAllowed) Error() string
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements a blobcache.Service.
func NewTestService ¶
NewTestService creates a service scoped to the life of the test. It calls NewTestEnv and NewTestServiceFromEnv
func NewTestServiceFromEnv ¶
NewTestServiceFromEnv creates a service from an environment. It runs the service in the background and forcibly aborts all transactions when the test is done.
func (*Service) Cleanup ¶
Cleanup runs the full cleanup process. This method is called periodically by Run, but it can also be called manually.
func (*Service) CloneVolume ¶
func (*Service) CreateQueue ¶
func (*Service) CreateVolume ¶
func (*Service) 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) InspectHandle ¶
func (*Service) InspectVolume ¶
func (*Service) 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) SubToVolume ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
blobman/shard
Package shard implements a single Shard in the database A Shard is a single directory on disk, called the Shard's "root".
|
Package shard implements a single Shard in the database A Shard is a single directory on disk, called the Shard's "root". |
|
dbtab
package dbtab contains constant IDs for each Table
|
package dbtab contains constant IDs for each Table |
|
pdb
package pdb has utilities for working with the Pebble database.
|
package pdb has utilities for working with the Pebble database. |