sobject_world_engine

package
v0.51.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigID = ControllerID

ConfigID is the string used to identify this config object.

View Source
const ControllerID = "sobject/world/engine"

ControllerID identifies the block graph engine controller.

Variables

View Source
var Version = semver.MustParse("0.0.1")

Version is the controller version.

Functions

func NewSOWorldOpBlock

func NewSOWorldOpBlock() block.Block

NewSOWorldOpBlock constructs a new SOWorldOp block.

Types

type ApplyTxOp

type ApplyTxOp struct {

	// tx is the tx or tx batch to apply
	Tx *tx.Tx `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"`
	// contains filtered or unexported fields
}

ApplyTxOp is the operation to apply a world transaction.

func (*ApplyTxOp) CloneMessageVT

func (m *ApplyTxOp) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*ApplyTxOp) CloneVT

func (m *ApplyTxOp) CloneVT() *ApplyTxOp

func (*ApplyTxOp) EqualMessageVT

func (this *ApplyTxOp) EqualMessageVT(thatMsg any) bool

func (*ApplyTxOp) EqualVT

func (this *ApplyTxOp) EqualVT(that *ApplyTxOp) bool

func (*ApplyTxOp) GetTx

func (x *ApplyTxOp) GetTx() *tx.Tx

func (*ApplyTxOp) MarshalJSON

func (x *ApplyTxOp) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ApplyTxOp to JSON.

func (*ApplyTxOp) MarshalProtoJSON

func (x *ApplyTxOp) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ApplyTxOp message to JSON.

func (*ApplyTxOp) MarshalProtoText

func (x *ApplyTxOp) MarshalProtoText() string

func (*ApplyTxOp) MarshalToSizedBufferVT

func (m *ApplyTxOp) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ApplyTxOp) MarshalToVT

func (m *ApplyTxOp) MarshalToVT(dAtA []byte) (int, error)

func (*ApplyTxOp) MarshalVT

func (m *ApplyTxOp) MarshalVT() (dAtA []byte, err error)

func (*ApplyTxOp) ProtoMessage

func (*ApplyTxOp) ProtoMessage()

func (*ApplyTxOp) Reset

func (x *ApplyTxOp) Reset()

func (*ApplyTxOp) SizeVT

func (m *ApplyTxOp) SizeVT() (n int)

func (*ApplyTxOp) String

func (x *ApplyTxOp) String() string

func (*ApplyTxOp) UnmarshalJSON

func (x *ApplyTxOp) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ApplyTxOp from JSON.

func (*ApplyTxOp) UnmarshalProtoJSON

func (x *ApplyTxOp) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ApplyTxOp message from JSON.

func (*ApplyTxOp) UnmarshalVT

func (m *ApplyTxOp) UnmarshalVT(dAtA []byte) error

type Config

type Config struct {

	// EngineId is the identifier used to look up the world on the bus.
	// Used to match & resolve WorldEngine directives.
	// If empty, LookupWorldEngine will not be processed.
	EngineId string `protobuf:"bytes,1,opt,name=engine_id,json=engineId,proto3" json:"engineId,omitempty"`
	// Ref is the shared object ref.
	Ref *sobject.SharedObjectRef `protobuf:"bytes,2,opt,name=ref,proto3" json:"ref,omitempty"`
	// InitWorldOp overrides the contents of the InitWorldOp when initializing the world.
	// Only used if the shared object is empty.
	InitWorldOp *InitWorldOp `protobuf:"bytes,3,opt,name=init_world_op,json=initWorldOp,proto3" json:"initWorldOp,omitempty"`
	// DisableLookup disables looking up anything on the bus via directives.
	// Implies both DisableApplyWorldOp and DisableApplyObjectOp.
	DisableLookup bool `protobuf:"varint,4,opt,name=disable_lookup,json=disableLookup,proto3" json:"disableLookup,omitempty"`
	// DisableApplyWorldOp disables calling the ApplyWorldOp directive.
	DisableApplyWorldOp bool `protobuf:"varint,5,opt,name=disable_apply_world_op,json=disableApplyWorldOp,proto3" json:"disableApplyWorldOp,omitempty"`
	// DisableApplyObjectOp disables calling the ApplyObjectOp directive.
	DisableApplyObjectOp bool `protobuf:"varint,6,opt,name=disable_apply_object_op,json=disableApplyObjectOp,proto3" json:"disableApplyObjectOp,omitempty"`
	// Verbose logs all operation results as debug messages.
	Verbose bool `protobuf:"varint,7,opt,name=verbose,proto3" json:"verbose,omitempty"`
	// ProcessOpsBackoff is the backoff for processing ops as a validator.
	// Defaults to reasonable defaults if unset.
	ProcessOpsBackoff *backoff.Backoff `protobuf:"bytes,8,opt,name=process_ops_backoff,json=processOpsBackoff,proto3" json:"processOpsBackoff,omitempty"`
	// GcSweepIdleWindowDur is the idle window duration after the last write
	// before a GC sweep is triggered if garbage exists.
	// Duration in nanoseconds. If zero, defaults to 5 seconds.
	GcSweepIdleWindowDur uint64 `protobuf:"varint,9,opt,name=gc_sweep_idle_window_dur,json=gcSweepIdleWindowDur,proto3" json:"gcSweepIdleWindowDur,omitempty"`
	// GcSweepBackstopIntervalDur is the periodic backstop interval for GC sweeps.
	// Duration in nanoseconds. If zero, defaults to 5 minutes.
	GcSweepBackstopIntervalDur uint64 `` /* 143-byte string literal not displayed */
	// contains filtered or unexported fields
}

Config configures a World Graph engine bound to a block graph and controlled by a Shared Object. Uses MountSharedObject to mount and access the shared object and block store. Stores the HEAD reference in the Shared Object.

func NewConfig

func NewConfig(engineID string, ref *sobject.SharedObjectRef) *Config

NewConfig constructs a new block world engine config.

func (*Config) CloneMessageVT

func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Config) CloneVT

func (m *Config) CloneVT() *Config

func (*Config) EqualMessageVT

func (this *Config) EqualMessageVT(thatMsg any) bool

func (*Config) EqualVT

func (this *Config) EqualVT(that *Config) bool

func (*Config) EqualsConfig

func (c *Config) EqualsConfig(other config.Config) bool

EqualsConfig checks if the config is equal to another.

func (*Config) GetConfigID

func (c *Config) GetConfigID() string

GetConfigID returns the unique string for this configuration type. This string is stored with the encoded config.

func (*Config) GetDisableApplyObjectOp

func (x *Config) GetDisableApplyObjectOp() bool

func (*Config) GetDisableApplyWorldOp

func (x *Config) GetDisableApplyWorldOp() bool

func (*Config) GetDisableLookup

func (x *Config) GetDisableLookup() bool

func (*Config) GetEngineId

func (x *Config) GetEngineId() string

func (*Config) GetGcSweepBackstopIntervalDur

func (x *Config) GetGcSweepBackstopIntervalDur() uint64

func (*Config) GetGcSweepIdleWindowDur

func (x *Config) GetGcSweepIdleWindowDur() uint64

func (*Config) GetInitWorldOp

func (x *Config) GetInitWorldOp() *InitWorldOp

func (*Config) GetProcessOpsBackoff

func (x *Config) GetProcessOpsBackoff() *backoff.Backoff

func (*Config) GetRef

func (x *Config) GetRef() *sobject.SharedObjectRef

func (*Config) GetVerbose

func (x *Config) GetVerbose() bool

func (*Config) MarshalJSON

func (x *Config) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Config to JSON.

func (*Config) MarshalProtoJSON

func (x *Config) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Config message to JSON.

func (*Config) MarshalProtoText

func (x *Config) MarshalProtoText() string

func (*Config) MarshalToSizedBufferVT

func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Config) MarshalToVT

func (m *Config) MarshalToVT(dAtA []byte) (int, error)

func (*Config) MarshalVT

func (m *Config) MarshalVT() (dAtA []byte, err error)

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (x *Config) Reset()

func (*Config) SizeVT

func (m *Config) SizeVT() (n int)

func (*Config) String

func (x *Config) String() string

func (*Config) UnmarshalJSON

func (x *Config) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Config from JSON.

func (*Config) UnmarshalProtoJSON

func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Config message from JSON.

func (*Config) UnmarshalVT

func (m *Config) UnmarshalVT(dAtA []byte) error

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration. This is a cursory validation to see if the values "look correct."

type Controller

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

Config configures a World Graph engine bound to a block graph and controlled by a Shared Object. Uses MountSharedObject to mount and access the shared object and block store. Stores the HEAD reference in the Shared Object.

func NewController

func NewController(
	le *logrus.Entry,
	bus bus.Bus,
	conf *Config,
	sfs *block_transform.StepFactorySet,
) (*Controller, error)

NewController constructs a new World Engine controller.

func StartEngineWithConfig

func StartEngineWithConfig(
	ctx context.Context,
	b bus.Bus,
	conf *Config,
	rel func(),
) (*Controller, directive.Instance, directive.Reference, error)

StartEngineWithConfig starts the sobject world engine with a config. Waits for the controller to start. Returns a Release function to close the controller when done.

func (*Controller) Close

func (c *Controller) Close() error

Close releases any resources used by the controller. Error indicates any issue encountered releasing.

func (*Controller) Execute

func (c *Controller) Execute(ctx context.Context) error

Execute executes the engine controller. Returning nil ends execution. Returning an error triggers a retry with backoff.

func (*Controller) GetControllerInfo

func (c *Controller) GetControllerInfo() *controller.Info

GetControllerInfo returns information about the controller.

func (*Controller) GetWorldEngine

func (c *Controller) GetWorldEngine(ctx context.Context) (Engine, error)

GetWorldEngine waits for the engine to be built. Returns the Engine managed by the controller.

func (*Controller) HandleDirective

func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)

HandleDirective asks if the handler can resolve the directive.

type Engine

type Engine = world.Engine

Engine is the world engine type.

type Factory

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

Factory constructs a world engine controller

func NewFactory

func NewFactory(bus bus.Bus) *Factory

NewFactory builds a world block engine factory.

func (*Factory) Construct

func (t *Factory) Construct(
	ctx context.Context,
	conf config.Config,
	opts controller.ConstructOpts,
) (controller.Controller, error)

Construct constructs the associated controller given configuration.

func (*Factory) ConstructConfig

func (t *Factory) ConstructConfig() config.Config

ConstructConfig constructs an instance of the controller configuration.

func (*Factory) GetConfigID

func (t *Factory) GetConfigID() string

GetConfigID returns the configuration ID for the controller.

func (*Factory) GetControllerID

func (t *Factory) GetControllerID() string

GetControllerID returns the unique ID for the controller.

func (*Factory) GetVersion

func (t *Factory) GetVersion() semver.Version

GetVersion returns the version of this controller.

type InitWorldOp

type InitWorldOp struct {

	// LastChangeDisable indicates the changelog is disabled for this world.
	// If set, last_change will be empty, except for the seqno field.
	// NOTE: the seqno field will not be empty on LastChange.
	LastChangeDisable bool `protobuf:"varint,1,opt,name=last_change_disable,json=lastChangeDisable,proto3" json:"lastChangeDisable,omitempty"`
	// TransformConf is the transform configuration to use for the world.
	// If unset, a default transform config with a random key will be generated.
	TransformConf *transform.Config `protobuf:"bytes,2,opt,name=transform_conf,json=transformConf,proto3" json:"transformConf,omitempty"`
	// contains filtered or unexported fields
}

InitWorldOp is the operation to initialize the inner state.

func (*InitWorldOp) CloneMessageVT

func (m *InitWorldOp) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*InitWorldOp) CloneVT

func (m *InitWorldOp) CloneVT() *InitWorldOp

func (*InitWorldOp) EqualMessageVT

func (this *InitWorldOp) EqualMessageVT(thatMsg any) bool

func (*InitWorldOp) EqualVT

func (this *InitWorldOp) EqualVT(that *InitWorldOp) bool

func (*InitWorldOp) GetLastChangeDisable

func (x *InitWorldOp) GetLastChangeDisable() bool

func (*InitWorldOp) GetTransformConf

func (x *InitWorldOp) GetTransformConf() *transform.Config

func (*InitWorldOp) MarshalJSON

func (x *InitWorldOp) MarshalJSON() ([]byte, error)

MarshalJSON marshals the InitWorldOp to JSON.

func (*InitWorldOp) MarshalProtoJSON

func (x *InitWorldOp) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the InitWorldOp message to JSON.

func (*InitWorldOp) MarshalProtoText

func (x *InitWorldOp) MarshalProtoText() string

func (*InitWorldOp) MarshalToSizedBufferVT

func (m *InitWorldOp) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*InitWorldOp) MarshalToVT

func (m *InitWorldOp) MarshalToVT(dAtA []byte) (int, error)

func (*InitWorldOp) MarshalVT

func (m *InitWorldOp) MarshalVT() (dAtA []byte, err error)

func (*InitWorldOp) ProtoMessage

func (*InitWorldOp) ProtoMessage()

func (*InitWorldOp) Reset

func (x *InitWorldOp) Reset()

func (*InitWorldOp) SizeVT

func (m *InitWorldOp) SizeVT() (n int)

func (*InitWorldOp) String

func (x *InitWorldOp) String() string

func (*InitWorldOp) UnmarshalJSON

func (x *InitWorldOp) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the InitWorldOp from JSON.

func (*InitWorldOp) UnmarshalProtoJSON

func (x *InitWorldOp) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the InitWorldOp message from JSON.

func (*InitWorldOp) UnmarshalVT

func (m *InitWorldOp) UnmarshalVT(dAtA []byte) error

func (*InitWorldOp) Validate

func (i *InitWorldOp) Validate() error

Validate validates the InitWorldOp configuration.

type InnerState

type InnerState struct {

	// HeadRef is the most recent reference to the world state.
	// Includes the in-line transform config w/ crypto key.
	// The bucket ID will be overridden when loaded.
	// The bucket ID should be set to empty.
	// The object referenced is a .world.block.World block.
	HeadRef *bucket.ObjectRef `protobuf:"bytes,1,opt,name=head_ref,json=headRef,proto3" json:"headRef,omitempty"`
	// contains filtered or unexported fields
}

InnerState contains the inner state object for the SharedObject. Note that the SharedObject inner state thas a very small size limit.

func BuildInitialInnerState added in v0.51.2

func BuildInitialInnerState(initOp *InitWorldOp) (*InnerState, error)

BuildInitialInnerState builds the initialized empty world state.

func (*InnerState) CloneMessageVT

func (m *InnerState) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*InnerState) CloneVT

func (m *InnerState) CloneVT() *InnerState

func (*InnerState) EqualMessageVT

func (this *InnerState) EqualMessageVT(thatMsg any) bool

func (*InnerState) EqualVT

func (this *InnerState) EqualVT(that *InnerState) bool

func (*InnerState) GetHeadRef

func (x *InnerState) GetHeadRef() *bucket.ObjectRef

func (*InnerState) MarshalJSON

func (x *InnerState) MarshalJSON() ([]byte, error)

MarshalJSON marshals the InnerState to JSON.

func (*InnerState) MarshalProtoJSON

func (x *InnerState) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the InnerState message to JSON.

func (*InnerState) MarshalProtoText

func (x *InnerState) MarshalProtoText() string

func (*InnerState) MarshalToSizedBufferVT

func (m *InnerState) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*InnerState) MarshalToVT

func (m *InnerState) MarshalToVT(dAtA []byte) (int, error)

func (*InnerState) MarshalVT

func (m *InnerState) MarshalVT() (dAtA []byte, err error)

func (*InnerState) ProtoMessage

func (*InnerState) ProtoMessage()

func (*InnerState) Reset

func (x *InnerState) Reset()

func (*InnerState) SizeVT

func (m *InnerState) SizeVT() (n int)

func (*InnerState) String

func (x *InnerState) String() string

func (*InnerState) UnmarshalJSON

func (x *InnerState) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the InnerState from JSON.

func (*InnerState) UnmarshalProtoJSON

func (x *InnerState) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the InnerState message from JSON.

func (*InnerState) UnmarshalVT

func (m *InnerState) UnmarshalVT(dAtA []byte) error

type SOWorldOp

type SOWorldOp struct {

	// Body is the body of the operation.
	//
	// Types that are assignable to Body:
	//
	//	*SOWorldOp_InitWorld
	//	*SOWorldOp_ApplyTxOp
	Body isSOWorldOp_Body `protobuf_oneof:"body"`
	// contains filtered or unexported fields
}

SOWorldOp is the outer wrapper for a shared object operation against a world InnerState.

func (*SOWorldOp) CloneMessageVT

func (m *SOWorldOp) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*SOWorldOp) CloneVT

func (m *SOWorldOp) CloneVT() *SOWorldOp

func (*SOWorldOp) EqualMessageVT

func (this *SOWorldOp) EqualMessageVT(thatMsg any) bool

func (*SOWorldOp) EqualVT

func (this *SOWorldOp) EqualVT(that *SOWorldOp) bool

func (*SOWorldOp) GetApplyTxOp

func (x *SOWorldOp) GetApplyTxOp() *ApplyTxOp

func (*SOWorldOp) GetBody

func (m *SOWorldOp) GetBody() isSOWorldOp_Body

func (*SOWorldOp) GetInitWorld

func (x *SOWorldOp) GetInitWorld() *InitWorldOp

func (*SOWorldOp) MarshalBlock

func (s *SOWorldOp) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.

func (*SOWorldOp) MarshalJSON

func (x *SOWorldOp) MarshalJSON() ([]byte, error)

MarshalJSON marshals the SOWorldOp to JSON.

func (*SOWorldOp) MarshalProtoJSON

func (x *SOWorldOp) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the SOWorldOp message to JSON.

func (*SOWorldOp) MarshalProtoText

func (x *SOWorldOp) MarshalProtoText() string

func (*SOWorldOp) MarshalToSizedBufferVT

func (m *SOWorldOp) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*SOWorldOp) MarshalToVT

func (m *SOWorldOp) MarshalToVT(dAtA []byte) (int, error)

func (*SOWorldOp) MarshalVT

func (m *SOWorldOp) MarshalVT() (dAtA []byte, err error)

func (*SOWorldOp) ProtoMessage

func (*SOWorldOp) ProtoMessage()

func (*SOWorldOp) Reset

func (x *SOWorldOp) Reset()

func (*SOWorldOp) SizeVT

func (m *SOWorldOp) SizeVT() (n int)

func (*SOWorldOp) String

func (x *SOWorldOp) String() string

func (*SOWorldOp) UnmarshalBlock

func (s *SOWorldOp) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.

func (*SOWorldOp) UnmarshalJSON

func (x *SOWorldOp) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the SOWorldOp from JSON.

func (*SOWorldOp) UnmarshalProtoJSON

func (x *SOWorldOp) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the SOWorldOp message from JSON.

func (*SOWorldOp) UnmarshalVT

func (m *SOWorldOp) UnmarshalVT(dAtA []byte) error

type SOWorldOp_ApplyTxOp

type SOWorldOp_ApplyTxOp struct {
	// ApplyTxOp applies a world transaction.
	ApplyTxOp *ApplyTxOp `protobuf:"bytes,2,opt,name=apply_tx_op,json=applyTxOp,proto3,oneof"`
}

func (*SOWorldOp_ApplyTxOp) CloneOneofVT

func (m *SOWorldOp_ApplyTxOp) CloneOneofVT() isSOWorldOp_Body

func (*SOWorldOp_ApplyTxOp) CloneVT

func (*SOWorldOp_ApplyTxOp) EqualVT

func (this *SOWorldOp_ApplyTxOp) EqualVT(thatIface isSOWorldOp_Body) bool

func (*SOWorldOp_ApplyTxOp) MarshalToSizedBufferVT

func (m *SOWorldOp_ApplyTxOp) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*SOWorldOp_ApplyTxOp) MarshalToVT

func (m *SOWorldOp_ApplyTxOp) MarshalToVT(dAtA []byte) (int, error)

func (*SOWorldOp_ApplyTxOp) SizeVT

func (m *SOWorldOp_ApplyTxOp) SizeVT() (n int)

type SOWorldOp_InitWorld

type SOWorldOp_InitWorld struct {
	// InitWorld is the init world operation.
	InitWorld *InitWorldOp `protobuf:"bytes,1,opt,name=init_world,json=initWorld,proto3,oneof"`
}

func (*SOWorldOp_InitWorld) CloneOneofVT

func (m *SOWorldOp_InitWorld) CloneOneofVT() isSOWorldOp_Body

func (*SOWorldOp_InitWorld) CloneVT

func (*SOWorldOp_InitWorld) EqualVT

func (this *SOWorldOp_InitWorld) EqualVT(thatIface isSOWorldOp_Body) bool

func (*SOWorldOp_InitWorld) MarshalToSizedBufferVT

func (m *SOWorldOp_InitWorld) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*SOWorldOp_InitWorld) MarshalToVT

func (m *SOWorldOp_InitWorld) MarshalToVT(dAtA []byte) (int, error)

func (*SOWorldOp_InitWorld) SizeVT

func (m *SOWorldOp_InitWorld) SizeVT() (n int)

Jump to

Keyboard shortcuts

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