node

package
v0.0.4-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package node provides the application-level API for MALT. MALT provides verifiable, evolvable structures on top of content-addressed storage.

Package node provides functional options for Node configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

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

Node is the stateless MALT node that holds shared infrastructure. It is the entry point for the MALT system and a factory for per-graph instances.

func NewNode

func NewNode(opts ...Option) (*Node, error)

NewNode creates a new MALT node with the given options.

Example usage:

// Simple: use defaults
node, _ := node.NewNode()

// From config file
node, _ := node.NewNode(node.WithConfigFile("malt.json"))

// Custom components
node, _ := node.NewNode(
    node.WithKVStore(badger.New(badger.WithPath("./data"))),
)

func (*Node) ArcTable

func (n *Node) ArcTable() arctable.ArcTable

ArcTable returns the shared ArcTable.

func (*Node) CAS

func (n *Node) CAS() cas.Reader

CAS returns the read-side CAS client.

func (*Node) Close

func (n *Node) Close() error

Close releases all resources.

func (*Node) Commitment

func (n *Node) Commitment() commitment.IndexCommitment

Commitment returns the default commitment scheme type from config.

func (*Node) Config

func (n *Node) Config() *config.Config

Config returns the node configuration.

func (*Node) CreateManagedGraph

func (n *Node) CreateManagedGraph(ctx context.Context, id string, backend string) (*runtimegraph.GraphMeta, error)

CreateManagedGraph creates graph metadata using the node's runtime profile. The ArcTable implementation is node-scoped, so managed graphs always persist the node's active ArcTable type. Backend may vary per graph because commitment schemes are instantiated per graph.

func (*Node) GraphManager

func (n *Node) GraphManager() *runtimegraph.Manager

GraphManager returns the graph lifecycle manager.

func (*Node) KVStore

func (n *Node) KVStore() kvstore.KVStore

KVStore returns the underlying KVStore.

func (*Node) MetricsSnapshot

func (n *Node) MetricsSnapshot() metrics.Snapshot

MetricsSnapshot returns the current node-local evaluation counters.

func (*Node) NewGraph

func (n *Node) NewGraph(id string, opts ...runtimegraph.Option) (*runtimegraph.RuntimeGraph, error)

NewGraph creates a new ad hoc per-graph instance with its own per-graph semantic wiring, resolver, and writer. It does not consult GraphManager metadata.

Parameters:

  • id: unique graph identifier
  • opts: functional options (runtimegraph.WithCommitmentScheme, runtimegraph.WithNamespace, etc.)

The Node auto-injects shared infrastructure (ArcTable, CAS).

func (*Node) OpenGraph

func (n *Node) OpenGraph(ctx context.Context, id string) (*runtimegraph.RuntimeGraph, error)

OpenGraph opens a managed graph using the runtime profile stored in GraphMeta. The persisted backend selects the commitment scheme; the persisted ArcTable type must match the node's shared ArcTable implementation.

func (*Node) RecordProofList

func (n *Node) RecordProofList(pl prooflist.ProofList)

RecordProofList records byte accounting for a verifier-facing proof artifact.

func (*Node) ResetMetrics

func (n *Node) ResetMetrics()

ResetMetrics clears node-local evaluation counters where supported.

type Option

type Option func(*options)

Option configures a MALT Node.

func WithArcTable

func WithArcTable(e arctable.ArcTable) Option

WithArcTable sets a custom ArcTable implementation.

func WithCAS

func WithCAS(c cas.Reader) Option

WithCAS sets a custom read-side CAS client.

func WithConfig

func WithConfig(cfg *config.Config) Option

WithConfig uses the provided config struct.

func WithConfigFile

func WithConfigFile(path string) Option

WithConfigFile loads configuration from a file.

func WithKVStore

func WithKVStore(store kvstore.KVStore) Option

WithKVStore sets a custom KVStore implementation.

func WithoutCASVerification added in v0.0.2

func WithoutCASVerification() Option

WithoutCASVerification disables the default CID-verifying CAS wrapper. Use only when the supplied CAS reader is already trusted (for example an in-memory test mock) or when verification is being performed elsewhere in the pipeline. Production deployments must keep verification on so the daemon does not propagate tampered bytes to clients.

Jump to

Keyboard shortcuts

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