Documentation
¶
Overview ¶
Package schema implements Schemas for blobcache volumes.
Index ¶
- func CheckName(name string) error
- func ExistsUnit(ctx context.Context, s Exists, cid blobcache.CID) (bool, error)
- func IsValidName(name string) bool
- type Change
- type Constructor
- type Exists
- type Factory
- type Initializer
- type KV
- type Link
- type MemStore
- func (ms *MemStore) Delete(ctx context.Context, cids []blobcache.CID) error
- func (ms *MemStore) Exists(ctx context.Context, cids []blobcache.CID, dst []bool) error
- func (ms *MemStore) Get(ctx context.Context, cid blobcache.CID, buf []byte) (int, error)
- func (ms *MemStore) Hash(data []byte) blobcache.CID
- func (ms *MemStore) Len() int
- func (ms *MemStore) MaxSize() int
- func (ms *MemStore) Post(ctx context.Context, data []byte) (blobcache.CID, error)
- type NSClient
- func (nsc *NSClient) CreateAt(ctx context.Context, nsh blobcache.Handle, name string, ...) (*blobcache.Handle, error)
- func (nsc *NSClient) Delete(ctx context.Context, nsh blobcache.Handle, name string) error
- func (nsc *NSClient) GC(ctx context.Context, volh blobcache.Handle) error
- func (nsc *NSClient) Get(ctx context.Context, volh blobcache.Handle, name string, dst *NSEntry) (bool, error)
- func (nsc *NSClient) Init(ctx context.Context, volh blobcache.Handle) error
- func (nsc *NSClient) List(ctx context.Context, volh blobcache.Handle) ([]NSEntry, error)
- func (nsc *NSClient) ListNames(ctx context.Context, volh blobcache.Handle) ([]string, error)
- func (nsc *NSClient) OpenAt(ctx context.Context, nsh blobcache.Handle, name string, ...) (*blobcache.Handle, error)
- func (nsc *NSClient) Put(ctx context.Context, nsh blobcache.Handle, name string, volh blobcache.Handle, ...) error
- type NSEntry
- type Namespace
- type None
- type Opener
- type RO
- type RW
- type Schema
- type Spec
- type Syncer
- type Value
- type VisitAll
- type WO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExistsUnit ¶ added in v0.0.2
func IsValidName ¶ added in v0.0.2
Types ¶
type Constructor ¶
type Constructor = func(params json.RawMessage, mkSchema Factory) (Schema, error)
Constructor is a function that constructs a Schema from its parameters.
type Factory ¶
type Factory = func(blobcache.SchemaSpec) (Schema, error)
Factory creates a Schema from a Spec.
type Initializer ¶ added in v0.0.2
Initializer is an interface for Schemas which support initialization.
type KV ¶ added in v0.0.2
type KV[K, V any] interface { Put(ctx context.Context, s bcsdk.RW, root []byte, key K, value V) ([]byte, error) Get(ctx context.Context, s bcsdk.RO, root []byte, key K, dst *V) (bool, error) Delete(ctx context.Context, s bcsdk.RW, root []byte, key K) ([]byte, error) }
KV is an interface for Schemas which support common Key-Value operations.
type Link ¶
type Link struct {
// Target is the OID of the volume being referenced.
Target blobcache.OID
// Rights are the set of actions on the target, which are granted to the caller.
Rights blobcache.ActionSet
}
Link is a reference from one volume to another.
type MemStore ¶
type MemStore struct {
// contains filtered or unexported fields
}
MemStore is a simple in-memory store, useful for testing. It has the same store methods as a transaction on an unsalted volume.
func NewTestStore ¶
type NSClient ¶ added in v0.0.2
NSClient allows manipulation of namespace volumes.
type NSEntry ¶ added in v0.0.2
type NSEntry struct {
// Name is the key for this entry within the namespace.
Name string `json:"name"`
// Target is the OID of the entry.
Target blobcache.OID `json:"target"`
// Rights is the set of rights for the entry.
Rights blobcache.ActionSet `json:"rights"`
}
NSEntry represents an entry in a namespace.
type Namespace ¶ added in v0.0.2
type Namespace interface {
NSList(ctx context.Context, s bcsdk.RO, root []byte) ([]NSEntry, error)
// NSGet retrieves the entry at the given name.
// If the entry exists, it is returned in dst and true is returned.
// If the entry does not exist, dst is not modified and false is returned.
NSGet(ctx context.Context, s bcsdk.RO, root []byte, name string, dst *NSEntry) (bool, error)
// Delete deletes the entry at the given name.
// Delete is idempotent, and does not fail if the entry does not exist.
NSDelete(ctx context.Context, s bcsdk.RW, root []byte, name string) ([]byte, error)
// Put performs an idempotent create or replace operation.
NSPut(ctx context.Context, s bcsdk.RW, root []byte, ent NSEntry) ([]byte, error)
}
Namespace is an interface for Schemas which support common Namespace operations.
type None ¶
type None struct{}
None is a Schema which does not impose any constraints on the contents of a volume.
type Opener ¶
type Opener interface {
Schema
OpenAs(ctx context.Context, s bcsdk.RO, root []byte, peer blobcache.PeerID) (blobcache.ActionSet, error)
}
Container is a Schema which can store Links to other volumes.
type Schema ¶
type Schema interface {
// ValidateChange returns nil if the state transition is valid.
ValidateChange(ctx context.Context, change Change) error
}
Schema is the most general Schema type. All a Schema has to be able to do is validate the contents of a Volume.
func NoneConstructor ¶
func NoneConstructor(_ json.RawMessage, _ Factory) (Schema, error)
type Spec ¶
type Spec = blobcache.SchemaSpec
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bcfuse implements a filesystem interface for blobcache.
|
Package bcfuse implements a filesystem interface for blobcache. |
|
gitrh
package gitrh provides a Server implementation of the Git remote helper IPC protocol
|
package gitrh provides a Server implementation of the Git remote helper IPC protocol |
|
Package hydra implements a Mergeable Schema
|
Package hydra implements a Mergeable Schema |
|
Package jsonns provides a simple namespace implementation.
|
Package jsonns provides a simple namespace implementation. |
|
package ledger implements an append-only ledger where state transitions can be verified
|
package ledger implements an append-only ledger where state transitions can be verified |