basicns

package
v0.0.0-...-bc5d075 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

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) 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 (sch Schema) ReadLinks(ctx context.Context, s schema.RO, root []byte, dst map[blobcache.OID]blobcache.ActionSet) error

func (Schema) ValidateChange

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

type Tx

type Tx struct {
	Tx *blobcache.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

Jump to

Keyboard shortcuts

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