vm

package
v0.0.0-...-49f93d6 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalRecordValue

func MarshalRecordValue(r RecordValue) ([]byte, error)

MarshalRecordValue serializes RecordValue to send it through libp2p protocol.

Types

type Machine

type Machine interface {
	Update(writer peer.ID, k string, update xr.Dict, metadata ...meta.Metadata) error // Updates the dictionary in the writer's private space.
	Get(k string) RecordValue                                                         // Get the full Record in a key
	// NOTE: No query operation will be supported until we figure out selectors
	// Query(key string, selector Selector) (RecordValue, error)
	Close() error
}

Machine captures the public interface of a smart record virtual machine.

func NewVM

func NewVM(ctx context.Context, h host.Host, updateCtx ir.UpdateContext, asm ir.AssemblerContext, options ...VMOption) (Machine, error)

NewVM creates a new smart record Machine

type RecordValue

type RecordValue map[peer.ID]*xr.Dict

RecordValue determines the structure used by the VM to interact with the outside world, outputing disassembled syntactic dicts.

func UnmarshalRecordValue

func UnmarshalRecordValue(b []byte) (RecordValue, error)

UnmarshalRecordValue unmarshals a serialized representation of RecordValue

type VMOption

type VMOption func(*vmConfig) error

Option type

func GCPeriod

func GCPeriod(p time.Duration) VMOption

GCPeriod garbage collection period for VM

Jump to

Keyboard shortcuts

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