basicns

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package basicns provides a simple namespace implementation. All entries are stored in the root of the volume.

Index

Constants

View Source
const SchemaName blobcache.SchemaName = "blobcache/basicns"

Variables

This section is empty.

Functions

func Constructor

func Constructor(_ json.RawMessage, _ schema.Factory) (schema.Schema, error)

Types

type Client

type Client struct {
	Service blobcache.Service
	Schema  Schema
}

Client provides methods for interacting with a Namespace using a Service.

func (*Client) CreateAt

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

CreateAt creates a new Volume using spec, and links it to volh.

func (*Client) DeleteEntry

func (c *Client) DeleteEntry(ctx context.Context, volh blobcache.Handle, name string) error

func (*Client) GC

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

GC performs garbage collection on the namespace.

func (*Client) GetEntry

func (c *Client) GetEntry(ctx context.Context, volh blobcache.Handle, name string) (*Entry, error)

func (*Client) ListEntries

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

func (*Client) ListNames

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

func (*Client) OpenAt

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

func (*Client) PutEntry

func (c *Client) PutEntry(ctx context.Context, volh blobcache.Handle, name string, target blobcache.Handle) error

type Entry

type Entry struct {
	Name   string
	Target blobcache.OID
	Rights blobcache.ActionSet
}
func (ent *Entry) Link() schema.Link

type Schema

type Schema struct{}

func (Schema) ListEntries

func (sch Schema) ListEntries(ctx context.Context, s schema.RO, root []byte) ([]Entry, error)

func (Schema) OpenAs

func (sch Schema) OpenAs(ctx context.Context, s schema.RO, root []byte, peer blobcache.PeerID) (blobcache.ActionSet, error)

func (Schema) ValidateChange

func (sch Schema) ValidateChange(ctx context.Context, change schema.Change) error

type Tx

type Tx struct {
	Tx *bcsdk.Tx
	// Root is the current root, set by calls to PutEntry and DeleteEntry
	Root   []byte
	Schema Schema
}

Tx wraps a Tx to provide a namespace view.

func (*Tx) Commit

func (ns *Tx) Commit(ctx context.Context) error

func (*Tx) DeleteEntry

func (ns *Tx) DeleteEntry(ctx context.Context, name string) error

func (*Tx) GetEntry

func (ns *Tx) GetEntry(ctx context.Context, name string) (*Entry, error)

func (*Tx) ListEntries

func (ns *Tx) ListEntries(ctx context.Context) ([]Entry, error)

func (*Tx) ListNames

func (ns *Tx) ListNames(ctx context.Context) ([]string, error)

func (*Tx) PutEntry

func (ns *Tx) PutEntry(ctx context.Context, name string, target blobcache.OID, rights blobcache.ActionSet) error

func (*Tx) VisitAll

func (ns *Tx) VisitAll(ctx context.Context) error

VisitAll visits the root blob and all the links to other volumes. If the underlying Tx is not a GC transaction, it will return an error (on the first call to Visit).

Jump to

Keyboard shortcuts

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