jsonns

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

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

Index

Constants

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

Variables

This section is empty.

Functions

func Constructor

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

func GC

GC performs garbage collection on the namespace.

func TestSuite

func TestSuite(t *testing.T, mk func(t testing.TB) (svc blobcache.Service, nsh blobcache.Handle))

tests that the schema works on the Service.

Types

type Entry

type Entry = schema.NSEntry

type Schema

type Schema struct{}

func (Schema) NSDelete

func (sch Schema) NSDelete(ctx context.Context, s schema.RW, root []byte, name string) ([]byte, error)

func (Schema) NSGet

func (sch Schema) NSGet(ctx context.Context, s schema.RO, root []byte, name string, dst *Entry) (bool, error)

func (Schema) NSList

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

func (Schema) NSPut

func (sch Schema) NSPut(ctx context.Context, s schema.RW, root []byte, ent Entry) ([]byte, 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) ListEntries

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

func (*Tx) ListNames

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

func (*Tx) NSDelete

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

func (*Tx) NSGet

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

func (*Tx) NSPut

func (ns *Tx) NSPut(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