gotfsvm

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpCode_UNKNOWN = 0

	// OpCode_Nat produces a 32 bit Nat from 24 bits of data stored in the instruction.
	OpCode_Nat = 32 << 24
)

0-Arity

View Source
const (

	// Input refers to a previoius commit by index
	// (index) -> (Root)
	// This Op reads from the entire input at the index.
	OpCode_Input
	// OpCode_Data loads from an index in the data table.
	// (index) -> (Value)
	OpCode_Data

	// Promote checks a segment for consistency and returns a root.
	// (Segment) -> Root
	OpCode_PROMOTE
)

1-Arity

View Source
const (

	// Select produces a segment from a Span within a Root
	// (Root, Span) -> (Segment)
	// This Op reads only from the Span within root.
	OpCode_SELECT

	// Concat takes 2 segments and concatenates them to produce a larger segment
	// ShiftOut shifts a segment out to a path
	// (Segment, Path) -> (Segment)
	OpCode_ShiftOut
	// ShiftIn shifts a segment by removing Path
	// It errors if not every path at that segment has Path as a prefix
	// (Segment, Path) -> (Segment)
	OpCode_ShiftIn
	// Pick produces a Root, taken from a specific path within another Root
	// (Root, Path) -> (Root)
	OpCode_PICK

	// (Segment, Segment) -> Segment
	OpCode_CONCAT
)

2-Arity

View Source
const (

	// Place takes a root, a path and a second root, and places the second root at that path in the first root.
	// The parent of that path must already exist in root.
	// (Root, Path, Root) -> Root
	OpCode_PLACE

	// MkdirAll creates the directory at path and any of its ancestors if necessary.
	// (Root, Path, FileMode) -> Root
	OpCode_MKDIRALL
)
View Source
const (
	Type_UNKNOWN = iota

	Type_Nat
	Type_Root
	Type_Segment
	Type_Span
	Type_Info
	Type_Extent
	Type_Path
	Type_FileMode
)
View Source
const ISize = 4

ISize is the size of an insturction in bytes

Variables

This section is empty.

Functions

This section is empty.

Types

type Expr

type Expr[T any] struct {
	// contains filtered or unexported fields
}

Expr is a specification for a value to be computed. The type of the value is known ahead of time.

type FnBuilder

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

func (*FnBuilder) ChangesOnBase

func (fb *FnBuilder) ChangesOnBase(base Expr[gotfs.Root], changes []gotfs.Segment) Expr[gotfs.Segment]

func (*FnBuilder) Concat

func (fb *FnBuilder) Concat(xs ...Expr[gotfs.Segment]) Expr[gotfs.Segment]

func (*FnBuilder) FileMode

func (fb *FnBuilder) FileMode(m fs.FileMode) Expr[fs.FileMode]

func (*FnBuilder) Flush

func (fb *FnBuilder) Flush(ctx context.Context) (Function, error)

Flush creates a new Function and returns it. The data table is written, and then it and the program make up the rest of the function body. The function body is posted.

func (*FnBuilder) Input

func (fb *FnBuilder) Input(i uint32) Expr[gotfs.Root]

Input returns an Expr which will evaluate to the input.

func (*FnBuilder) MkdirAll

func (fb *FnBuilder) MkdirAll(base Expr[gotfs.Root], p string, mode fs.FileMode) Expr[gotfs.Root]

func (*FnBuilder) Nat

func (fb *FnBuilder) Nat(val uint32) Expr[uint32]

func (*FnBuilder) Path

func (fb *FnBuilder) Path(p string) Expr[string]

func (*FnBuilder) Promote

func (fb *FnBuilder) Promote(x Expr[gotfs.Segment]) Expr[gotfs.Root]

func (*FnBuilder) Root

func (fb *FnBuilder) Root(root gotfs.Root) Expr[gotfs.Root]

func (*FnBuilder) Segment

func (fb *FnBuilder) Segment(seg gotfs.Segment) Expr[gotfs.Segment]

Segment adds a Segment as data to the function.

func (*FnBuilder) Select

func (fb *FnBuilder) Select(root Expr[gotfs.Root], span gotkv.Span) Expr[gotfs.Segment]

func (*FnBuilder) SetOutput

func (fb *FnBuilder) SetOutput(x Expr[gotfs.Root])

func (*FnBuilder) Span

func (fb *FnBuilder) Span(span gotfs.Span) Expr[gotfs.Span]

type Function

type Function struct {
	Ref gdat.Ref
	// Arity is the number of inputs the function takes
	Arity uint32
}

Function maps a []gotfs.Root to a gotfs.Root Function is a root expression, and the number of inputs it takes.

func (Function) Marshal

func (fn Function) Marshal(out []byte) []byte

func (*Function) Unmarshal

func (fn *Function) Unmarshal(data []byte) error

type I

type I uint32

I is a single instruction, it represents a node in a computation DAG.

func (I) Args

func (i I) Args() (ret [3]uint32)

Args returns relative offsets to the inputs of this step

func (I) Arity

func (i I) Arity() int

func (I) Op

func (i I) Op() OpCode

type Input

type Input struct {
	Stores gotfs.RO
	Root   gotfs.Root
}

type Machine

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

Machine holds configuration for operating on GotFS filesystems.

func New

func New(fsmach *gotfs.Machine) Machine

func (*Machine) Apply

func (m *Machine) Apply(ctx context.Context, dst gotfs.RW, fn Function, inputs []Input) (gotfs.Root, error)

Apply applies a function to inputs.

func (*Machine) NewBuilder

func (m *Machine) NewBuilder(s stores.RW) FnBuilder

func (*Machine) NewFunction

func (m *Machine) NewFunction(ctx context.Context, s stores.RW, fn func(*FnBuilder) (Expr[gotfs.Root], error)) (Function, error)

NewFunction creates a new function from an expression.

type OpCode

type OpCode uint32

OpCode is just the arity and opcode bits. OpCode can be OR'd directly into an I to set the op and arity.

func (OpCode) Arity

func (o OpCode) Arity() int

func (OpCode) String

func (o OpCode) String() string

type TypeCode

type TypeCode uint8

type Value

type Value interface {
	// contains filtered or unexported methods
}

type Value_Extent

type Value_Extent struct {
	Extent gotfs.Extent
}

Value_Extent is a reference to data

type Value_FileMode

type Value_FileMode os.FileMode

Value_FileMode is a file mode

type Value_Info

type Value_Info struct {
	Info gotfs.Info
}

type Value_Nat

type Value_Nat uint32

type Value_Path

type Value_Path string

Value_Path is a path within a filesystem

type Value_Root

type Value_Root struct {
	Root gotfs.Root
}

Value_Root is the root of a GotFS filesystem

type Value_Segment

type Value_Segment struct {
	Segment gotfs.Segment
}

Value_Segment is a segment of a filesystem, not a valid filesystem on it's own.

type Value_Span

type Value_Span struct {
	Span gotfs.Span
}

Value_Span is a span within a filesystem

type Vertex

type Vertex uint32

Vertex is an index into a functions DAG.

Jump to

Keyboard shortcuts

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