Documentation
¶
Index ¶
- Constants
- func CheckName(name string) error
- func Init(ctx context.Context, svc blobcache.Service, sch Namespace, ...) error
- func IsValidName(name string) bool
- func Modify(ctx context.Context, svc blobcache.Service, sch Namespace, ...) error
- func View(ctx context.Context, svc blobcache.Service, sch Namespace, ...) error
- type Client
- func (nsc *Client) CreateVolume(ctx context.Context, p string, spec blobcache.VolumeSpec) (blobcache.Handle, error)
- func (nsc *Client) CreateVolumeFrom(ctx context.Context, nsh blobcache.Handle, p string, spec blobcache.VolumeSpec) (blobcache.Handle, error)
- func (nsc *Client) Delete(ctx context.Context, p string) error
- func (nsc *Client) Do(ctx context.Context, p string, modify bool, fn func(DoCtx) error) error
- func (nsc *Client) FQP(ctx context.Context, p string) (FQP, error)
- func (nsc *Client) Get(ctx context.Context, p string, dst *Entry) (bool, error)
- func (nsc *Client) Init(ctx context.Context) error
- func (nsc *Client) List(ctx context.Context, p string) ([]Entry, error)
- func (nsc *Client) ListNames(ctx context.Context, p string) ([]string, error)
- func (nsc *Client) Move(ctx context.Context, oldPath, newPath string) error
- func (nsc *Client) Open(ctx context.Context, p string, mask blobcache.ActionSet) (blobcache.Handle, error)
- func (nsc *Client) OpenFrom(ctx context.Context, nsh blobcache.Handle, p string, mask blobcache.ActionSet) (blobcache.Handle, error)
- func (nsc *Client) Put(ctx context.Context, p string, target blobcache.Handle, ...) error
- func (nsc *Client) Resolve(ctx context.Context, p string) (FQP, error)
- func (nsc *Client) Root() blobcache.OID
- func (nsc *Client) SetDefaultSchema(defaultSchema Namespace)
- type DoCtx
- type Entry
- type ErrNoMatch
- type FQP
- type Linker
- type Namespace
- type Tx
- func (tx *Tx) AppendCell(out []byte) []byte
- func (tx *Tx) Create(ctx context.Context, name string, target blobcache.Handle, ...) error
- func (tx *Tx) Delete(ctx context.Context, name string) error
- func (tx *Tx) Get(ctx context.Context, name string, dst *Entry) (bool, error)
- func (tx *Tx) Init(ctx context.Context) error
- func (tx *Tx) List(ctx context.Context) ([]Entry, error)
- func (tx *Tx) Match(ctx context.Context, p string) (Entry, string, error)
- func (tx *Tx) Move(ctx context.Context, oldName, newName string) error
- func (tx *Tx) Put(ctx context.Context, name string, target blobcache.Handle, ...) error
Constants ¶
const Sep = '/'
Variables ¶
This section is empty.
Functions ¶
func IsValidName ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client gives access to the Namespace Client manages multi-volume interactions, see Tx for manipulating a single Namespace volume. The Client deals with paths, and the Tx deals with names.
func (*Client) CreateVolume ¶ added in v0.8.0
func (*Client) CreateVolumeFrom ¶ added in v0.8.0
func (nsc *Client) CreateVolumeFrom(ctx context.Context, nsh blobcache.Handle, p string, spec blobcache.VolumeSpec) (blobcache.Handle, error)
CreateVolumeFrom creates a Volume starting from a specific namespace
func (*Client) Do ¶ added in v0.8.0
Do resolves as much of p as possible and then calls fn with the remaining name and a transaction open on the parent namespace.
func (*Client) Move ¶ added in v0.5.1
Move atomically renames an entry from oldPath to newPath within a namespace volume. The link token is preserved as-is. oldPath is resolved first, and newPath must share the resolved prefix, or an error is returned.
func (*Client) Open ¶ added in v0.8.0
func (nsc *Client) Open(ctx context.Context, p string, mask blobcache.ActionSet) (blobcache.Handle, error)
Open returns a handle to the object at p.
func (*Client) OpenFrom ¶ added in v0.8.0
func (nsc *Client) OpenFrom(ctx context.Context, nsh blobcache.Handle, p string, mask blobcache.ActionSet) (blobcache.Handle, error)
OpenFrom opens the path p from the namespace in nsh.
func (*Client) Resolve ¶ added in v0.8.0
Resolve returns a resolved path. A resolved path can be looked up in a single namespace volume, and does not require traversal. It may not be directly accessible with OpenFiat.
func (*Client) SetDefaultSchema ¶ added in v0.8.0
type DoCtx ¶ added in v0.8.0
type DoCtx struct {
// Node is the node that owns the namespace Volume
Node blobcache.NodeID
// NS is the handle to the namespace Volume, that the transaction is for
// This handle is for the the local node, not Node.
NS blobcache.Handle
// Tx is a transaction for maniuplating the namespace
Tx *Tx
// Prefix is the part of the path that was matched.
Prefix string
// Name is the remaining name within the namespace
Name string
}
DoCtx is the context provided to the Do callback
type Entry ¶
type Entry 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"`
Secret blobcache.LTSecret `json:"secret"`
}
Entry represents an entry in a namespace.
type ErrNoMatch ¶ added in v0.8.0
type ErrNoMatch struct {
// Name is the name which could not be matched
Name string
}
func (*ErrNoMatch) Error ¶ added in v0.8.0
func (e *ErrNoMatch) Error() string
type FQP ¶ added in v0.8.0
type FQP struct {
// Node is the node that the root namespace Volume is on.
// If this is zero, then assume the local node.
Node blobcache.NodeID
// NS is a root/starting namespace
NS blobcache.OID
// Path is a slash separated path.
Path string
}
FQP is a fully qualified path FQPs can be written as `{Node};{NSRoot}/{Path}` The zero NodeID is used to refer to the local node, and it can be ommitted.
type Namespace ¶
type Namespace interface {
schema.Schema
NSList(c schema.ROCtx) ([]Entry, 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(c schema.ROCtx, name string, dst *Entry) (bool, error)
// Delete deletes the entry at the given name.
// Delete is idempotent, and does not fail if the entry does not exist.
NSDelete(c schema.RWCtx, name string) ([]byte, error)
// Put performs an idempotent create or replace operation.
NSPut(c schema.RWCtx, ent Entry) ([]byte, error)
}
Namespace is an interface for Schemas which support common Namespace operations.
func SchemaForVolume ¶ added in v0.8.0
func SchemaForVolume(ctx context.Context, svc blobcache.Service, nsvolh blobcache.Handle) (Namespace, error)
SchemaForVolume returns a Client configured to use the Namespace schema for the Volume If the Volume does not have a known Schema or the Schema is not Namespace then an error is returned.
type Tx ¶ added in v0.6.0
type Tx struct {
// contains filtered or unexported fields
}
Tx is a transaction on a namespace
func (*Tx) AppendCell ¶ added in v0.8.0
func (*Tx) Create ¶ added in v0.8.0
func (tx *Tx) Create(ctx context.Context, name string, target blobcache.Handle, mask blobcache.ActionSet) error
Create creates a new entry at name only if there is no exising entry
func (*Tx) Match ¶ added in v0.8.0
Match performs greedy prefix matching using / as possible split points. Match is the unit operation of path resolution. If no match is found ErrNoMatch is returned Match prefers entries with longer matching prefixes.