Documentation ¶
Index ¶
- Constants
- Variables
- func Hash(x []byte) cadata.ID
- func NewStore(bc Service, pinSet Handle) cadata.Store
- type Entry
- type Handle
- type Node
- func (node *Node) Add(ctx context.Context, psh Handle, id cadata.ID) error
- func (n *Node) CreateDir(ctx context.Context, h Handle, name string) (*Handle, error)
- func (n *Node) CreatePinSet(ctx context.Context, h Handle, name string, opts PinSetOptions) (*Handle, error)
- func (n *Node) Delete(ctx context.Context, psh Handle, id cadata.ID) error
- func (n *Node) DeleteEntry(ctx context.Context, h Handle, name string) error
- func (n *Node) Exists(ctx context.Context, psh Handle, id cadata.ID) (bool, error)
- func (n *Node) Get(ctx context.Context, psh Handle, id cadata.ID, buf []byte) (int, error)
- func (n *Node) GetPinSet(ctx context.Context, psh Handle) (*PinSet, error)
- func (node *Node) List(ctx context.Context, psh Handle, span cadata.Span, ids []cadata.ID) (n int, err error)
- func (n *Node) ListEntries(ctx context.Context, h Handle) ([]Entry, error)
- func (n *Node) MaxSize() int
- func (n *Node) Open(ctx context.Context, h Handle, p []string) (*Handle, error)
- func (n *Node) Post(ctx context.Context, psh Handle, data []byte) (cadata.ID, error)
- func (n *Node) Root() Handle
- func (n *Node) WaitOK(ctx context.Context, psh Handle) error
- type Params
- type PeerInfo
- type PinSet
- type PinSetID
- type PinSetOptions
- type Service
- type Source
- type Store
- type StoreSpec
Constants ¶
View Source
const MaxSize = stores.MaxSize
MaxSize is the maximum blob size
View Source
const (
StatusOK = "OK"
)
Variables ¶
View Source
var ( ErrPinSetNotFound = errors.New("pinset not found") ErrDataNotFound = cadata.ErrNotFound )
Functions ¶
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) CreatePinSet ¶
func (n *Node) CreatePinSet(ctx context.Context, h Handle, name string, opts PinSetOptions) (*Handle, error)
CreatePinSet implements Service
func (*Node) DeleteEntry ¶
DeleteEntry implements Service
func (*Node) ListEntries ¶
ListEntries
type Params ¶
type Params struct { // DB is the database to use for Directories, PinSets and other metadata. (REQUIRED) DB bcdb.DB // Primary is the Primary store (REQUIRED) Primary cadata.Store // PrivateKey is a private key used by the node for secure connections and for deriving a unique identifer. (REQUIRED) PrivateKey inet256.PrivateKey // AuxStores are auxillary stores. AuxStores []StoreSpec // INET256 is the INET256 service to use. (REQUIRED if len(Peers) > 0 ) INET256 inet256.Service // Peers contains information about other Blobcache nodes to connect to. Peers []PeerInfo Logger *logrus.Logger // The maximum number of blobs to store in the Primary if any. MaxCount int64 }
func NewMemParams ¶
func NewMemParams() Params
type PinSetOptions ¶
type PinSetOptions struct { }
type Service ¶
type Service interface { // CreateDir creates a directory below handle CreateDir(ctx context.Context, h Handle, name string) (*Handle, error) // Open returns a handle to an object Open(ctx context.Context, h Handle, p []string) (*Handle, error) // ListEntries lists the entries in the directory which h points to. ListEntries(ctx context.Context, h Handle) ([]Entry, error) // DeleteEntry ensures that there is no entry at name DeleteEntry(ctx context.Context, h Handle, name string) error // CreatePinSet creates a PinSet with the provided options and returns a handle to it. CreatePinSet(ctx context.Context, h Handle, name string, opts PinSetOptions) (*Handle, error) // GetPinSet returns information about the PinSet GetPinSet(ctx context.Context, h Handle) (*PinSet, error) // Add adds data to the PinSet by ID. Add(ctx context.Context, pinset Handle, id cadata.ID) error // Delete removes data from the PinSet by ID. Delete(ctx context.Context, pinset Handle, id cadata.ID) error // Post adds data to a PinSet and returns the ID. Post(ctx context.Context, pinset Handle, data []byte) (cadata.ID, error) // Get retrieves data from the PinSet and returns the ID. Get(ctx context.Context, pinset Handle, id cadata.ID, buf []byte) (int, error) // Exists returns whether the PinSet contains ID Exists(ctx context.Context, pinset Handle, id cadata.ID) (bool, error) // List lists the ids in the pinSet. List(ctx context.Context, pinSet Handle, span cadata.Span, ids []cadata.ID) (n int, err error) // WaitOK waits until the pinSet is status is OK. // This means that all the blobs in the pinSet are correctly replicated according to the pinset's config. WaitOK(ctx context.Context, pinSet Handle) error // MaxSize returns the maximum blob size MaxSize() int }
Service is the API exposed by either a blobcache client, or inmemory node.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.