bcns

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckName

func CheckName(name string) error

func IsValidName

func IsValidName(name string) bool

Types

type Client

type Client struct {
	Service blobcache.Service
	Schema  Namespace
}

Client allows manipulation of namespace volumes.

func ClientForVolume

func ClientForVolume(ctx context.Context, svc blobcache.Service, nsvol Objectish) (*Client, error)

ClientForVolume 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.

func (*Client) CreateAt

func (nsc *Client) CreateAt(ctx context.Context, nsh blobcache.Handle, name string, spec blobcache.VolumeSpec) (*blobcache.Handle, error)

func (*Client) Delete

func (nsc *Client) Delete(ctx context.Context, nsh blobcache.Handle, name string) error

func (*Client) GC

func (nsc *Client) GC(ctx context.Context, volh blobcache.Handle) error

GC garbage collects the volume

func (*Client) Get

func (nsc *Client) Get(ctx context.Context, volh blobcache.Handle, name string, dst *Entry) (bool, error)

func (*Client) Init

func (nsc *Client) Init(ctx context.Context, volh blobcache.Handle) error

func (*Client) List

func (nsc *Client) List(ctx context.Context, volh blobcache.Handle) ([]Entry, error)

func (*Client) ListNames

func (nsc *Client) ListNames(ctx context.Context, volh blobcache.Handle) ([]string, error)

func (*Client) OpenAt

func (nsc *Client) OpenAt(ctx context.Context, nsh blobcache.Handle, name string, mask blobcache.ActionSet) (*blobcache.Handle, error)

func (*Client) Put

func (nsc *Client) Put(ctx context.Context, nsh blobcache.Handle, name string, volh blobcache.Handle, mask blobcache.ActionSet) error

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.

func (*Entry) LinkToken

func (ent *Entry) LinkToken() blobcache.LinkToken

type Namespace

type Namespace interface {
	NSList(ctx context.Context, s bcsdk.RO, root []byte) ([]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(ctx context.Context, s bcsdk.RO, root []byte, 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(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 Entry) ([]byte, error)
}

Namespace is an interface for Schemas which support common Namespace operations.

type Objectish

type Objectish struct {
	Base blobcache.Handle
	Path []string
}

Objectish is information capable of producing a Handle to an Object. Base is used to establish a connection to the local node. If the Secret is empty, then OpenFiat will be used to establish a connection The zero value for Objectish refers to the root Volume.

func ParseObjectish

func ParseObjectish(x string) (Objectish, error)

func (*Objectish) BaseHandle

func (oish *Objectish) BaseHandle() *blobcache.Handle

func (*Objectish) BaseIsHandle

func (oish *Objectish) BaseIsHandle() bool

BaseIsHandle returns true if Base is a handle instead of an OID

func (*Objectish) BaseOID

func (oish *Objectish) BaseOID() blobcache.OID

func (*Objectish) Open

func (oish *Objectish) Open(ctx context.Context, bc blobcache.Service) (*blobcache.Handle, error)

func (*Objectish) String

func (oish *Objectish) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL