Help us shape the future of Go! Take the 2026 Go Developer Survey

store

package
v0.57.21 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Rendered for js/wasm

Overview

Package store implements a kvtx.Store backed by OPFS flat files.

Each key-value pair is stored as a file in a sharded directory structure. Keys are base58-encoded as filenames, sharded by the first character. Values are the raw file contents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is an OPFS-backed key-value store implementing kvtx.Store.

func NewStore

func NewStore(root *opfs.DirectoryHandle) (*Store, error)

NewStore creates a new OPFS store rooted at the given directory. It creates a "data" subdirectory for key-value storage.

func Open

func Open(name string) (*Store, error)

Open creates a new OPFS store in a subdirectory of the OPFS root.

func (*Store) Close

func (s *Store) Close()

Close releases resources held by the store.

func (*Store) GetStorageTally

func (s *Store) GetStorageTally() uint64

GetStorageTally returns the current storage tally in bytes.

func (*Store) NewTransaction

func (s *Store) NewTransaction(ctx context.Context, write bool) (kvtx.Tx, error)

NewTransaction returns a new transaction against the store.

Jump to

Keyboard shortcuts

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