Documentation
¶
Index ¶
- Constants
- Variables
- func ReadHeadRef(ctx context.Context, le *logrus.Entry, store object.ObjectStore, ...) (*bucket.ObjectRef, error)
- type Config
- func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Config) CloneVT() *Config
- func (this *Config) EqualMessageVT(thatMsg any) bool
- func (this *Config) EqualVT(that *Config) bool
- func (c *Config) EqualsConfig(other config.Config) bool
- func (x *Config) GetBucketId() string
- func (c *Config) GetConfigID() string
- func (x *Config) GetDisableApplyObjectOp() bool
- func (x *Config) GetDisableApplyWorldOp() bool
- func (x *Config) GetDisableChangelog() bool
- func (x *Config) GetDisableLookup() bool
- func (x *Config) GetEngineId() string
- func (x *Config) GetInitHeadRef() *bucket.ObjectRef
- func (x *Config) GetObjectStoreHeadKey() string
- func (x *Config) GetObjectStoreId() string
- func (x *Config) GetObjectStorePrefix() string
- func (x *Config) GetStateTransformConf() *transform.Config
- func (x *Config) GetVerbose() bool
- func (x *Config) GetVolumeId() string
- func (x *Config) MarshalJSON() ([]byte, error)
- func (x *Config) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config) MarshalProtoText() string
- func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Config) MarshalToVT(dAtA []byte) (int, error)
- func (m *Config) MarshalVT() (dAtA []byte, err error)
- func (*Config) ProtoMessage()
- func (x *Config) Reset()
- func (m *Config) SizeVT() (n int)
- func (x *Config) String() string
- func (x *Config) UnmarshalJSON(b []byte) error
- func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Config) UnmarshalVT(dAtA []byte) error
- func (c *Config) Validate() error
- type Controller
- func (c *Controller) Close() error
- func (c *Controller) Execute(ctx context.Context) error
- func (c *Controller) GetControllerInfo() *controller.Info
- func (c *Controller) GetWorldEngine(ctx context.Context) (Engine, error)
- func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
- type Engine
- type Factory
- func (t *Factory) Construct(ctx context.Context, conf config.Config, opts controller.ConstructOpts) (controller.Controller, error)
- func (t *Factory) ConstructConfig() config.Config
- func (t *Factory) GetConfigID() string
- func (t *Factory) GetControllerID() string
- func (t *Factory) GetVersion() semver.Version
- type HeadState
- func (m *HeadState) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *HeadState) CloneVT() *HeadState
- func (this *HeadState) EqualMessageVT(thatMsg any) bool
- func (this *HeadState) EqualVT(that *HeadState) bool
- func (x *HeadState) GetHeadRef() *bucket.ObjectRef
- func (x *HeadState) MarshalJSON() ([]byte, error)
- func (x *HeadState) MarshalProtoJSON(s *json.MarshalState)
- func (x *HeadState) MarshalProtoText() string
- func (m *HeadState) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *HeadState) MarshalToVT(dAtA []byte) (int, error)
- func (m *HeadState) MarshalVT() (dAtA []byte, err error)
- func (*HeadState) ProtoMessage()
- func (x *HeadState) Reset()
- func (m *HeadState) SizeVT() (n int)
- func (x *HeadState) String() string
- func (x *HeadState) UnmarshalJSON(b []byte) error
- func (x *HeadState) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *HeadState) UnmarshalVT(dAtA []byte) error
Constants ¶
const ConfigID = ControllerID
ConfigID is the string used to identify this config object.
const ControllerID = "hydra/world/block/engine"
ControllerID identifies the block graph engine controller.
Variables ¶
var Version = semver.MustParse("0.0.1")
Version is the controller version.
Functions ¶
func ReadHeadRef ¶
func ReadHeadRef( ctx context.Context, le *logrus.Entry, store object.ObjectStore, headKey string, stateTransformConf *block_transform.Config, sfs *block_transform.StepFactorySet, ) (*bucket.ObjectRef, error)
ReadHeadRef reads the HEAD reference from the given object store. This is the same data that the engine controller persists via commitFn. stateTransformConf may be nil if no transform is used.
Types ¶
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"`
// BucketId is the bucket id to attach to for reading/writing state.
// If set, overrides the bucket id from init_head_ref and the state.
// If unset, the bucket id is determined from head_ref.
BucketId string `protobuf:"bytes,2,opt,name=bucket_id,json=bucketId,proto3" json:"bucketId,omitempty"`
// VolumeId is the volume id to attach to for writing DB state.
// If unset, init_head_ref must be set, and the db will be read-only.
VolumeId string `protobuf:"bytes,3,opt,name=volume_id,json=volumeId,proto3" json:"volumeId,omitempty"`
// ObjectStoreId is the hydra object store to open to store the HEAD ref.
// If unset, init_head_ref must be set, and the db will be read-only.
ObjectStoreId string `protobuf:"bytes,4,opt,name=object_store_id,json=objectStoreId,proto3" json:"objectStoreId,omitempty"`
// ObjectStorePrefix is the prefix to use for all object store ops.
ObjectStorePrefix string `protobuf:"bytes,5,opt,name=object_store_prefix,json=objectStorePrefix,proto3" json:"objectStorePrefix,omitempty"`
// ObjectStoreHeadKey is the key to use in the object store for HEAD ref.
//
// Defaults to "world-head"
ObjectStoreHeadKey string `protobuf:"bytes,6,opt,name=object_store_head_key,json=objectStoreHeadKey,proto3" json:"objectStoreHeadKey,omitempty"`
// InitHeadRef is the reference to the initial HEAD state of the database.
// If the object store is empty, uses this reference to initialize it.
// BucketId is overridden by BucketId field if it is set.
InitHeadRef *bucket.ObjectRef `protobuf:"bytes,7,opt,name=init_head_ref,json=initHeadRef,proto3" json:"initHeadRef,omitempty"`
// StateTransformConf transforms the HEAD ref before storing it in storage.
// NOTE: this does not transform the entire world state.
// To transform the world state, add the transform config to InitHeadRef.
StateTransformConf *transform.Config `protobuf:"bytes,11,opt,name=state_transform_conf,json=stateTransformConf,proto3" json:"stateTransformConf,omitempty"`
// DisableChangelog disables the changelog in the world structure.
// Note: has no effect unless we initialize the world from empty.
DisableChangelog bool `protobuf:"varint,13,opt,name=disable_changelog,json=disableChangelog,proto3" json:"disableChangelog,omitempty"`
// DisableLookup disables looking up anything on the bus via directives.
// Implies both DisableApplyWorldOp and DisableApplyObjectOp.
DisableLookup bool `protobuf:"varint,8,opt,name=disable_lookup,json=disableLookup,proto3" json:"disableLookup,omitempty"`
// DisableApplyWorldOp disables calling the ApplyWorldOp directive.
DisableApplyWorldOp bool `protobuf:"varint,9,opt,name=disable_apply_world_op,json=disableApplyWorldOp,proto3" json:"disableApplyWorldOp,omitempty"`
// DisableApplyObjectOp directive.
DisableApplyObjectOp bool `protobuf:"varint,10,opt,name=disable_apply_object_op,json=disableApplyObjectOp,proto3" json:"disableApplyObjectOp,omitempty"`
// Verbose logs all operation results as debug messages.
Verbose bool `protobuf:"varint,12,opt,name=verbose,proto3" json:"verbose,omitempty"`
// contains filtered or unexported fields
}
Config configures a World Graph engine bound to a block graph. Builds a bucket handle using the given bucket ID. Stores the HEAD reference in an object store.
func NewConfig ¶
func NewConfig( engineID, volumeID, bucketID, objectStoreID string, initHeadRef *bucket.ObjectRef, stateTransformConf *block_transform.Config, enableChangelog bool, ) *Config
NewConfig constructs a new block world engine config.
func (*Config) CloneMessageVT ¶
func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Config) EqualMessageVT ¶
func (*Config) EqualsConfig ¶
EqualsConfig checks if the config is equal to another.
func (*Config) GetBucketId ¶
func (*Config) GetConfigID ¶
GetConfigID returns the unique string for this configuration type. This string is stored with the encoded config.
func (*Config) GetDisableApplyObjectOp ¶
func (*Config) GetDisableApplyWorldOp ¶
func (*Config) GetDisableChangelog ¶
func (*Config) GetDisableLookup ¶
func (*Config) GetEngineId ¶
func (*Config) GetInitHeadRef ¶
func (*Config) GetObjectStoreHeadKey ¶
func (*Config) GetObjectStoreId ¶
func (*Config) GetObjectStorePrefix ¶
func (*Config) GetStateTransformConf ¶
func (*Config) GetVerbose ¶
func (*Config) GetVolumeId ¶
func (*Config) MarshalJSON ¶
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 (*Config) MarshalToSizedBufferVT ¶
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) UnmarshalJSON ¶
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 ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements the block-graph World Engine controller. Attaches to a bucket to store blocks and a object store for state.
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, ) (*Controller, directive.Reference, error)
StartEngineWithConfig starts the block 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 Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory constructs a world engine controller
func NewFactory ¶
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 ¶
ConstructConfig constructs an instance of the controller configuration.
func (*Factory) GetConfigID ¶
GetConfigID returns the configuration ID for the controller.
func (*Factory) GetControllerID ¶
GetControllerID returns the unique ID for the controller.
func (*Factory) GetVersion ¶
GetVersion returns the version of this controller.
type HeadState ¶
type HeadState struct {
// HeadRef is the reference to the current HEAD state of the database.
HeadRef *bucket.ObjectRef `protobuf:"bytes,1,opt,name=head_ref,json=headRef,proto3" json:"headRef,omitempty"`
// contains filtered or unexported fields
}
HeadState contains the head state in the object storage.
func (*HeadState) CloneMessageVT ¶
func (m *HeadState) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*HeadState) EqualMessageVT ¶
func (*HeadState) GetHeadRef ¶
func (*HeadState) MarshalJSON ¶
MarshalJSON marshals the HeadState to JSON.
func (*HeadState) MarshalProtoJSON ¶
func (x *HeadState) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the HeadState message to JSON.
func (*HeadState) MarshalProtoText ¶
func (*HeadState) MarshalToSizedBufferVT ¶
func (*HeadState) ProtoMessage ¶
func (*HeadState) ProtoMessage()
func (*HeadState) UnmarshalJSON ¶
UnmarshalJSON unmarshals the HeadState from JSON.
func (*HeadState) UnmarshalProtoJSON ¶
func (x *HeadState) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the HeadState message from JSON.