Documentation
¶
Index ¶
- Constants
- Variables
- func ComputeExecutionOutputs(outputs []*forge_target.Output, execOutputVals []forge_value.ValueSlice, ...) ([]*forge_value.Value, error)
- func CreateExecutionWithTarget(ctx context.Context, ws world.WorldState, sender peer.ID, objKey string, ...) (*bucket.ObjectRef, error)
- func NewExecutionBlock() block.Block
- type Execution
- func FilterExecutionOutputs(execs []*Execution, allowFailed bool, minComplete int) ([]*Execution, [][]*forge_value.Value, error)
- func LookupExecution(ctx context.Context, ws world.WorldState, objKey string) (*Execution, world.ObjectState, error)
- func UnmarshalExecution(ctx context.Context, bcs *block.Cursor) (*Execution, error)
- func WaitExecutionComplete(ctx context.Context, le *logrus.Entry, ws world.WorldState, ...) (*Execution, error)
- func (e *Execution) ApplyBlockRef(id uint32, ptr *block.BlockRef) error
- func (e *Execution) ApplySubBlock(id uint32, next block.SubBlock) error
- func (e *Execution) CheckPeerID(id peer.ID) error
- func (m *Execution) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Execution) CloneVT() *Execution
- func (this *Execution) EqualMessageVT(thatMsg any) bool
- func (this *Execution) EqualVT(that *Execution) bool
- func (e *Execution) GetBlockRefCtor(id uint32) block.Ctor
- func (e *Execution) GetBlockRefs() (map[uint32]*block.BlockRef, error)
- func (x *Execution) GetExecutionState() State
- func (x *Execution) GetLogEntries() []*LogEntry
- func (x *Execution) GetPeerId() string
- func (x *Execution) GetResult() *value.Result
- func (e *Execution) GetSubBlockCtor(id uint32) block.SubBlockCtor
- func (e *Execution) GetSubBlocks() map[uint32]block.SubBlock
- func (x *Execution) GetTargetRef() *block.BlockRef
- func (x *Execution) GetTimestamp() *timestamppb.Timestamp
- func (x *Execution) GetValueSet() *target.ValueSet
- func (e *Execution) IsComplete() bool
- func (e *Execution) MarshalBlock() ([]byte, error)
- func (x *Execution) MarshalJSON() ([]byte, error)
- func (x *Execution) MarshalProtoJSON(s *json.MarshalState)
- func (x *Execution) MarshalProtoText() string
- func (m *Execution) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Execution) MarshalToVT(dAtA []byte) (int, error)
- func (m *Execution) MarshalVT() (dAtA []byte, err error)
- func (e *Execution) ParsePeerID() (peer.ID, error)
- func (*Execution) ProtoMessage()
- func (x *Execution) Reset()
- func (m *Execution) SizeVT() (n int)
- func (x *Execution) String() string
- func (e *Execution) UnmarshalBlock(data []byte) error
- func (x *Execution) UnmarshalJSON(b []byte) error
- func (x *Execution) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Execution) UnmarshalVT(dAtA []byte) error
- func (e *Execution) Validate() error
- type LogEntry
- func (m *LogEntry) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *LogEntry) CloneVT() *LogEntry
- func (this *LogEntry) EqualMessageVT(thatMsg any) bool
- func (this *LogEntry) EqualVT(that *LogEntry) bool
- func (x *LogEntry) GetLevel() string
- func (x *LogEntry) GetMessage() string
- func (x *LogEntry) GetTimestamp() *timestamppb.Timestamp
- func (x *LogEntry) MarshalJSON() ([]byte, error)
- func (x *LogEntry) MarshalProtoJSON(s *json.MarshalState)
- func (x *LogEntry) MarshalProtoText() string
- func (m *LogEntry) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *LogEntry) MarshalToVT(dAtA []byte) (int, error)
- func (m *LogEntry) MarshalVT() (dAtA []byte, err error)
- func (*LogEntry) ProtoMessage()
- func (x *LogEntry) Reset()
- func (m *LogEntry) SizeVT() (n int)
- func (x *LogEntry) String() string
- func (x *LogEntry) UnmarshalJSON(b []byte) error
- func (x *LogEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *LogEntry) UnmarshalVT(dAtA []byte) error
- type Spec
- func (s *Spec) ApplyBlockRef(id uint32, ptr *block.BlockRef) error
- func (s *Spec) ApplySubBlock(id uint32, next block.SubBlock) error
- func (s *Spec) AssignTarget(bcs *block.Cursor, tgt *forge_target.Target)
- func (m *Spec) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Spec) CloneVT() *Spec
- func (this *Spec) EqualMessageVT(thatMsg any) bool
- func (this *Spec) EqualVT(that *Spec) bool
- func (s *Spec) GetBlockRefCtor(id uint32) block.Ctor
- func (s *Spec) GetBlockRefs() (map[uint32]*block.BlockRef, error)
- func (x *Spec) GetPeerId() string
- func (s *Spec) GetSubBlockCtor(id uint32) block.SubBlockCtor
- func (s *Spec) GetSubBlocks() map[uint32]block.SubBlock
- func (x *Spec) GetTargetRef() *block.BlockRef
- func (x *Spec) GetValueSet() *target.ValueSet
- func (s *Spec) MarshalBlock() ([]byte, error)
- func (x *Spec) MarshalJSON() ([]byte, error)
- func (x *Spec) MarshalProtoJSON(s *json.MarshalState)
- func (x *Spec) MarshalProtoText() string
- func (m *Spec) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Spec) MarshalToVT(dAtA []byte) (int, error)
- func (m *Spec) MarshalVT() (dAtA []byte, err error)
- func (*Spec) ProtoMessage()
- func (x *Spec) Reset()
- func (m *Spec) SizeVT() (n int)
- func (x *Spec) String() string
- func (s *Spec) UnmarshalBlock(data []byte) error
- func (x *Spec) UnmarshalJSON(b []byte) error
- func (x *Spec) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Spec) UnmarshalVT(dAtA []byte) error
- type State
- func (s State) EnsureMatches(sts ...State) error
- func (x State) Enum() *State
- func (x State) MarshalJSON() ([]byte, error)
- func (x State) MarshalProtoJSON(s *json.MarshalState)
- func (x State) MarshalProtoText() string
- func (x State) MarshalText() ([]byte, error)
- func (x State) String() string
- func (x *State) UnmarshalJSON(b []byte) error
- func (x *State) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (x *State) UnmarshalText(b []byte) error
- func (s State) Validate(allowUnknown bool) error
Constants ¶
const (
// ExecutionTypeID is the type identifier for a Execution.
ExecutionTypeID = "forge/execution"
)
Variables ¶
var ( State_name = map[int32]string{ 0: "ExecutionState_UNKNOWN", 1: "ExecutionState_PENDING", 2: "ExecutionState_RUNNING", 3: "ExecutionState_COMPLETE", } State_value = map[string]int32{ "ExecutionState_UNKNOWN": 0, "ExecutionState_PENDING": 1, "ExecutionState_RUNNING": 2, "ExecutionState_COMPLETE": 3, } )
Enum value maps for State.
var ErrUnknownState = errors.New("unknown execution state")
ErrUnknownState is returned if the state was unknown.
Functions ¶
func ComputeExecutionOutputs ¶
func ComputeExecutionOutputs( outputs []*forge_target.Output, execOutputVals []forge_value.ValueSlice, allowFailed bool, ) ([]*forge_value.Value, error)
ComputeExecutionOutputs computes the result from a set of Executions. if allowFailed is set, any failed or invalid executions are skipped. if no valid executions are in the list, returns an error. If minComplete != 0 and len(valid execs) < minComplete, fails.
func CreateExecutionWithTarget ¶
func CreateExecutionWithTarget( ctx context.Context, ws world.WorldState, sender peer.ID, objKey string, execPeerID peer.ID, valueSet *forge_target.ValueSet, tgt *forge_target.Target, ts *timestamp.Timestamp, ) (*bucket.ObjectRef, error)
CreateExecutionWithTarget creates a pending Execution object in the world.
Writes the Target to a block linked to by the Execution. peerID is the peer id to assign to the execution.
func NewExecutionBlock ¶
NewExecutionBlock constructs a new Execution block.
Types ¶
type Execution ¶
type Execution struct {
// ExecutionState is the current state of the execution.
ExecutionState State `protobuf:"varint,1,opt,name=execution_state,json=executionState,proto3" json:"executionState,omitempty"`
// PeerId is the identifier of the peer assigned to the execution.
// Can be empty.
PeerId string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"`
// Timestamp is the time the parent object (usually Pass) was created.
// Used as a reference timestamp to make all ops deterministic.
// Must be set & is not updated.
Timestamp *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
// ValueSet is the set of inputs and outputs used in the execution.
// Outputs are updated while the execution is in RUNNING state.
ValueSet *target.ValueSet `protobuf:"bytes,4,opt,name=value_set,json=valueSet,proto3" json:"valueSet,omitempty"`
// TargetRef is the block ref to the Target block.
TargetRef *block.BlockRef `protobuf:"bytes,5,opt,name=target_ref,json=targetRef,proto3" json:"targetRef,omitempty"`
// Result is information about the outcome of a completed execution.
Result *value.Result `protobuf:"bytes,6,opt,name=result,proto3" json:"result,omitempty"`
// LogEntries contains log output from the execution.
// Appended while the execution is in RUNNING state.
LogEntries []*LogEntry `protobuf:"bytes,7,rep,name=log_entries,json=logEntries,proto3" json:"logEntries,omitempty"`
// contains filtered or unexported fields
}
World graph links:
- <parent> -> usually a Pass which created the Execution
func FilterExecutionOutputs ¶
func FilterExecutionOutputs(execs []*Execution, allowFailed bool, minComplete int) ([]*Execution, [][]*forge_value.Value, error)
FilterExecutionOutputs returns only valid outputs for completed executions. if allowFailed, skips any failed or invalid executions.
func LookupExecution ¶
func LookupExecution(ctx context.Context, ws world.WorldState, objKey string) (*Execution, world.ObjectState, error)
LookupExecution looks up an execution in the world.
func UnmarshalExecution ¶
UnmarshalExecution unmarshals an execution block from the cursor.
func WaitExecutionComplete ¶
func WaitExecutionComplete( ctx context.Context, le *logrus.Entry, ws world.WorldState, executionObjectKey string, ) (*Execution, error)
WaitExecutionComplete waits until the execution is in the COMPLETE state.
func (*Execution) ApplyBlockRef ¶
ApplyBlockRef applies a ref change with a field id. The reference may be nil if the child block is nil.
func (*Execution) ApplySubBlock ¶
ApplySubBlock applies a sub-block change with a field id.
func (*Execution) CheckPeerID ¶
CheckPeerID checks if the peer ID matches the Execution.
func (*Execution) CloneMessageVT ¶
func (m *Execution) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Execution) EqualMessageVT ¶
func (*Execution) GetBlockRefCtor ¶
GetBlockRefCtor returns the constructor for the block at the ref id. Return nil to indicate invalid ref ID or unknown.
func (*Execution) GetBlockRefs ¶
GetBlockRefs returns all block references by ID. May return nil, and values may also be nil. Note: this does not include pending references (in a cursor)
func (*Execution) GetExecutionState ¶
func (*Execution) GetLogEntries ¶
func (*Execution) GetSubBlockCtor ¶
func (e *Execution) GetSubBlockCtor(id uint32) block.SubBlockCtor
GetSubBlockCtor returns a function which creates or returns the existing sub-block at reference id. Can return nil to indicate invalid reference id.
func (*Execution) GetSubBlocks ¶
GetSubBlocks returns all constructed sub-blocks by ID. May return nil, and values may also be nil.
func (*Execution) GetTargetRef ¶
func (*Execution) GetTimestamp ¶
func (x *Execution) GetTimestamp() *timestamppb.Timestamp
func (*Execution) GetValueSet ¶
func (*Execution) IsComplete ¶
IsComplete checks if the execution is in the COMPLETE state.
func (*Execution) MarshalBlock ¶
MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.
func (*Execution) MarshalJSON ¶
MarshalJSON marshals the Execution to JSON.
func (*Execution) MarshalProtoJSON ¶
func (x *Execution) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Execution message to JSON.
func (*Execution) MarshalProtoText ¶
func (*Execution) MarshalToSizedBufferVT ¶
func (*Execution) ParsePeerID ¶
ParsePeerID parses the peer ID field. Returns empty if not set.
func (*Execution) ProtoMessage ¶
func (*Execution) ProtoMessage()
func (*Execution) UnmarshalBlock ¶
UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.
func (*Execution) UnmarshalJSON ¶
UnmarshalJSON unmarshals the Execution from JSON.
func (*Execution) UnmarshalProtoJSON ¶
func (x *Execution) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Execution message from JSON.
func (*Execution) UnmarshalVT ¶
type LogEntry ¶
type LogEntry struct {
// Timestamp is when the log entry was created.
Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
// Level is the log level (e.g. "info", "warn", "error", "debug").
Level string `protobuf:"bytes,2,opt,name=level,proto3" json:"level,omitempty"`
// Message is the log message text.
Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
// contains filtered or unexported fields
}
LogEntry is a single log line from an execution.
func (*LogEntry) CloneMessageVT ¶
func (m *LogEntry) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*LogEntry) EqualMessageVT ¶
func (*LogEntry) GetMessage ¶
func (*LogEntry) GetTimestamp ¶
func (x *LogEntry) GetTimestamp() *timestamppb.Timestamp
func (*LogEntry) MarshalJSON ¶
MarshalJSON marshals the LogEntry to JSON.
func (*LogEntry) MarshalProtoJSON ¶
func (x *LogEntry) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the LogEntry message to JSON.
func (*LogEntry) MarshalProtoText ¶
func (*LogEntry) MarshalToSizedBufferVT ¶
func (*LogEntry) ProtoMessage ¶
func (*LogEntry) ProtoMessage()
func (*LogEntry) UnmarshalJSON ¶
UnmarshalJSON unmarshals the LogEntry from JSON.
func (*LogEntry) UnmarshalProtoJSON ¶
func (x *LogEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the LogEntry message from JSON.
func (*LogEntry) UnmarshalVT ¶
type Spec ¶
type Spec struct {
// PeerId is the identifier of the peer assigned to the execution.
// Can be empty.
PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"`
// ValueSet is the set of inputs and outputs used in the execution.
// Specified output values are used as initial values, and can be overridden.
ValueSet *target.ValueSet `protobuf:"bytes,2,opt,name=value_set,json=valueSet,proto3" json:"valueSet,omitempty"`
// TargetRef is the target to run in the Execution.
// Overrides "target" field if set.
TargetRef *block.BlockRef `protobuf:"bytes,3,opt,name=target_ref,json=targetRef,proto3" json:"targetRef,omitempty"`
// contains filtered or unexported fields
}
Spec contains information specified when creating a Execution.
func (*Spec) ApplyBlockRef ¶
ApplyBlockRef applies a ref change with a field id.
func (*Spec) ApplySubBlock ¶
ApplySubBlock applies a sub-block change with a field id.
func (*Spec) AssignTarget ¶
func (s *Spec) AssignTarget(bcs *block.Cursor, tgt *forge_target.Target)
AssignTarget assigns a target to the spec with a block cursor. if tgt is nil clears the field
func (*Spec) CloneMessageVT ¶
func (m *Spec) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Spec) EqualMessageVT ¶
func (*Spec) GetBlockRefCtor ¶
GetBlockRefCtor returns the constructor for the block at the ref id.
func (*Spec) GetBlockRefs ¶
GetBlockRefs returns all block references by ID.
func (*Spec) GetSubBlockCtor ¶
func (s *Spec) GetSubBlockCtor(id uint32) block.SubBlockCtor
GetSubBlockCtor returns a function which creates or returns the existing sub-block at reference id. Can return nil to indicate invalid reference id.
func (*Spec) GetSubBlocks ¶
GetSubBlocks returns all constructed sub-blocks by ID. May return nil, and values may also be nil.
func (*Spec) GetTargetRef ¶
func (*Spec) GetValueSet ¶
func (*Spec) MarshalBlock ¶
MarshalBlock marshals the block to binary.
func (*Spec) MarshalJSON ¶
MarshalJSON marshals the Spec to JSON.
func (*Spec) MarshalProtoJSON ¶
func (x *Spec) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Spec message to JSON.
func (*Spec) MarshalProtoText ¶
func (*Spec) MarshalToSizedBufferVT ¶
func (*Spec) ProtoMessage ¶
func (*Spec) ProtoMessage()
func (*Spec) UnmarshalBlock ¶
UnmarshalBlock unmarshals the block to the object.
func (*Spec) UnmarshalJSON ¶
UnmarshalJSON unmarshals the Spec from JSON.
func (*Spec) UnmarshalProtoJSON ¶
func (x *Spec) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Spec message from JSON.
func (*Spec) UnmarshalVT ¶
type State ¶
type State int32
State contains the possible execution states.
const ( // ExecutionState_UNKNOWN is the unknown type. State_ExecutionState_UNKNOWN State = 0 // ExecutionState_PENDING is the state before the execution starts. // Transitions to RUNNING when the assigned peer acks exec start. State_ExecutionState_PENDING State = 1 // ExecutionState_RUNNING is the state when the execution is running. State_ExecutionState_RUNNING State = 2 // ExecutionState_COMPLETE is the terminal state of the execution. // This includes both success and failure termination states. State_ExecutionState_COMPLETE State = 3 )
func (State) EnsureMatches ¶
EnsureMatches checks if the state matches or returns an error.
func (State) MarshalJSON ¶
MarshalJSON marshals the State to JSON.
func (State) MarshalProtoJSON ¶
func (x State) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the State to JSON.
func (State) MarshalProtoText ¶
func (State) MarshalText ¶
MarshalText marshals the State to text.
func (*State) UnmarshalJSON ¶
UnmarshalJSON unmarshals the State from JSON.
func (*State) UnmarshalProtoJSON ¶
func (x *State) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the State from JSON.
func (*State) UnmarshalText ¶
UnmarshalText unmarshals the State from text.