Documentation
¶
Index ¶
- Constants
- Variables
- func CheckWorkerType(ctx context.Context, ws world.WorldState, objKey string) error
- func CollectWorkerKeypairs(ctx context.Context, w world.WorldState, workerKeys ...string) ([]*identity.Keypair, []string, error)
- func CreateWorker(ctx context.Context, w world.WorldState, objKey string, name string, ...) (uint64, bool, error)
- func ListWorkerKeypairs(ctx context.Context, w world.WorldState, workerKeys ...string) ([]string, error)
- func ListWorkers(ctx context.Context, ws world.WorldState) ([]string, error)
- func LookupWorkerOp(ctx context.Context, opTypeID string) (world.Operation, error)
- func NewWorkerBlock() block.Block
- type Worker
- func (m *Worker) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Worker) CloneVT() *Worker
- func (this *Worker) EqualMessageVT(thatMsg any) bool
- func (this *Worker) EqualVT(that *Worker) bool
- func (x *Worker) GetName() string
- func (e *Worker) MarshalBlock() ([]byte, error)
- func (x *Worker) MarshalJSON() ([]byte, error)
- func (x *Worker) MarshalProtoJSON(s *json.MarshalState)
- func (x *Worker) MarshalProtoText() string
- func (m *Worker) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Worker) MarshalToVT(dAtA []byte) (int, error)
- func (m *Worker) MarshalVT() (dAtA []byte, err error)
- func (*Worker) ProtoMessage()
- func (x *Worker) Reset()
- func (m *Worker) SizeVT() (n int)
- func (x *Worker) String() string
- func (e *Worker) UnmarshalBlock(data []byte) error
- func (x *Worker) UnmarshalJSON(b []byte) error
- func (x *Worker) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Worker) UnmarshalVT(dAtA []byte) error
- func (e *Worker) Validate() error
- type WorkerCreateOp
- func (o *WorkerCreateOp) ApplyWorldObjectOp(ctx context.Context, le *logrus.Entry, objectHandle world.ObjectState, ...) (sysErr bool, err error)
- func (o *WorkerCreateOp) ApplyWorldOp(ctx context.Context, le *logrus.Entry, worldHandle world.WorldState, ...) (sysErr bool, err error)
- func (o *WorkerCreateOp) BuildWorker() *Worker
- func (m *WorkerCreateOp) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *WorkerCreateOp) CloneVT() *WorkerCreateOp
- func (this *WorkerCreateOp) EqualMessageVT(thatMsg any) bool
- func (this *WorkerCreateOp) EqualVT(that *WorkerCreateOp) bool
- func (x *WorkerCreateOp) GetKeypairs() []*identity.Keypair
- func (x *WorkerCreateOp) GetName() string
- func (x *WorkerCreateOp) GetObjectKey() string
- func (o *WorkerCreateOp) GetOperationTypeId() string
- func (o *WorkerCreateOp) MarshalBlock() ([]byte, error)
- func (x *WorkerCreateOp) MarshalJSON() ([]byte, error)
- func (x *WorkerCreateOp) MarshalProtoJSON(s *json.MarshalState)
- func (x *WorkerCreateOp) MarshalProtoText() string
- func (m *WorkerCreateOp) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *WorkerCreateOp) MarshalToVT(dAtA []byte) (int, error)
- func (m *WorkerCreateOp) MarshalVT() (dAtA []byte, err error)
- func (*WorkerCreateOp) ProtoMessage()
- func (x *WorkerCreateOp) Reset()
- func (m *WorkerCreateOp) SizeVT() (n int)
- func (x *WorkerCreateOp) String() string
- func (o *WorkerCreateOp) UnmarshalBlock(data []byte) error
- func (x *WorkerCreateOp) UnmarshalJSON(b []byte) error
- func (x *WorkerCreateOp) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *WorkerCreateOp) UnmarshalVT(dAtA []byte) error
- func (o *WorkerCreateOp) Validate() error
Constants ¶
const (
// WorkerTypeID is the type identifier for a Worker.
WorkerTypeID = "forge/worker"
)
Variables ¶
var WorkerCreateOpId = WorkerTypeID + "/create"
WorkerCreateOpId is the worker create operation id.
Functions ¶
func CheckWorkerType ¶
CheckWorkerType checks the type graph quad for a worker.
func CollectWorkerKeypairs ¶
func CollectWorkerKeypairs(ctx context.Context, w world.WorldState, workerKeys ...string) ([]*identity.Keypair, []string, error)
CollectWorkerKeypairs collects all Keypair linked to by the given entities. returns list of Keypair for each object key
func CreateWorker ¶
func CreateWorker( ctx context.Context, w world.WorldState, objKey string, name string, keypairs []*identity.Keypair, sender peer.ID, ) (uint64, bool, error)
CreateWorker stores a Worker in a object. Optionally creates keypairs linked to the Worker. Returns seqno, sysErr, error.
func ListWorkerKeypairs ¶
func ListWorkerKeypairs(ctx context.Context, w world.WorldState, workerKeys ...string) ([]string, error)
ListWorkerKeypairs lists all Keypair linked to by the given Worker object keys. returns list of object keys
func ListWorkers ¶
ListWorkers lists all of the worker keys in the world.
func LookupWorkerOp ¶
LookupWorkerOp performs the lookup operation for the Worker op types.
func NewWorkerBlock ¶
NewWorkerBlock constructs a new Worker block.
Types ¶
type Worker ¶
type Worker struct {
// Name is the human readable worker name.
// Example: "my-worker-1"
// Must be a valid DNS label as defined in RFC 1123.
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// contains filtered or unexported fields
}
Worker associates a set of keypairs with a worker name. The name is used for API calls and command-line / UI tools. The keypairs are load-balance assigned tasks to run by the scheduler. Worker automatically starts controllers for all assigned objects.
Graph links: - identity/keypair-link: links to Keypairs representing the Worker. Incoming links: - forge/cluster-worker: links from Cluster to Worker.
func LookupWorker ¶
func LookupWorker(ctx context.Context, ws world.WorldState, objKey string) (*Worker, world.ObjectState, error)
LookupWorker looks up a worker in the world.
func UnmarshalWorker ¶
UnmarshalWorker unmarshals a worker block from the cursor.
func (*Worker) CloneMessageVT ¶
func (m *Worker) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Worker) EqualMessageVT ¶
func (*Worker) MarshalBlock ¶
MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.
func (*Worker) MarshalJSON ¶
MarshalJSON marshals the Worker to JSON.
func (*Worker) MarshalProtoJSON ¶
func (x *Worker) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Worker message to JSON.
func (*Worker) MarshalProtoText ¶
func (*Worker) MarshalToSizedBufferVT ¶
func (*Worker) ProtoMessage ¶
func (*Worker) ProtoMessage()
func (*Worker) UnmarshalBlock ¶
UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.
func (*Worker) UnmarshalJSON ¶
UnmarshalJSON unmarshals the Worker from JSON.
func (*Worker) UnmarshalProtoJSON ¶
func (x *Worker) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Worker message from JSON.
func (*Worker) UnmarshalVT ¶
type WorkerCreateOp ¶
type WorkerCreateOp struct {
// ObjectKey is the object key to create the Worker.
ObjectKey string `protobuf:"bytes,1,opt,name=object_key,json=objectKey,proto3" json:"objectKey,omitempty"`
// Name is the worker name to create.
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
// Keypairs is the list of keypairs to add and/or link to the worker.
// Must not have duplicates.
// Optional.
Keypairs []*identity.Keypair `protobuf:"bytes,3,rep,name=keypairs,proto3" json:"keypairs,omitempty"`
// contains filtered or unexported fields
}
WorkerCreateOp creates a Worker.
func NewWorkerCreateOp ¶
func NewWorkerCreateOp(objectKey, name string, keypairs []*identity.Keypair) *WorkerCreateOp
NewWorkerCreateOp constructs a new WorkerCreateOp block.
func (*WorkerCreateOp) ApplyWorldObjectOp ¶
func (o *WorkerCreateOp) ApplyWorldObjectOp( ctx context.Context, le *logrus.Entry, objectHandle world.ObjectState, sender peer.ID, ) (sysErr bool, err error)
ApplyWorldObjectOp applies the operation to a world object handle.
func (*WorkerCreateOp) ApplyWorldOp ¶
func (o *WorkerCreateOp) ApplyWorldOp( ctx context.Context, le *logrus.Entry, worldHandle world.WorldState, sender peer.ID, ) (sysErr bool, err error)
ApplyWorldOp applies the operation as a world operation.
func (*WorkerCreateOp) BuildWorker ¶
func (o *WorkerCreateOp) BuildWorker() *Worker
BuildWorker builds the worker object from the create op.
func (*WorkerCreateOp) CloneMessageVT ¶
func (m *WorkerCreateOp) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*WorkerCreateOp) CloneVT ¶
func (m *WorkerCreateOp) CloneVT() *WorkerCreateOp
func (*WorkerCreateOp) EqualMessageVT ¶
func (this *WorkerCreateOp) EqualMessageVT(thatMsg any) bool
func (*WorkerCreateOp) EqualVT ¶
func (this *WorkerCreateOp) EqualVT(that *WorkerCreateOp) bool
func (*WorkerCreateOp) GetKeypairs ¶
func (x *WorkerCreateOp) GetKeypairs() []*identity.Keypair
func (*WorkerCreateOp) GetName ¶
func (x *WorkerCreateOp) GetName() string
func (*WorkerCreateOp) GetObjectKey ¶
func (x *WorkerCreateOp) GetObjectKey() string
func (*WorkerCreateOp) GetOperationTypeId ¶
func (o *WorkerCreateOp) GetOperationTypeId() string
GetOperationTypeId returns the operation type identifier.
func (*WorkerCreateOp) MarshalBlock ¶
func (o *WorkerCreateOp) MarshalBlock() ([]byte, error)
MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.
func (*WorkerCreateOp) MarshalJSON ¶
func (x *WorkerCreateOp) MarshalJSON() ([]byte, error)
MarshalJSON marshals the WorkerCreateOp to JSON.
func (*WorkerCreateOp) MarshalProtoJSON ¶
func (x *WorkerCreateOp) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the WorkerCreateOp message to JSON.
func (*WorkerCreateOp) MarshalProtoText ¶
func (x *WorkerCreateOp) MarshalProtoText() string
func (*WorkerCreateOp) MarshalToSizedBufferVT ¶
func (m *WorkerCreateOp) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*WorkerCreateOp) MarshalToVT ¶
func (m *WorkerCreateOp) MarshalToVT(dAtA []byte) (int, error)
func (*WorkerCreateOp) MarshalVT ¶
func (m *WorkerCreateOp) MarshalVT() (dAtA []byte, err error)
func (*WorkerCreateOp) ProtoMessage ¶
func (*WorkerCreateOp) ProtoMessage()
func (*WorkerCreateOp) Reset ¶
func (x *WorkerCreateOp) Reset()
func (*WorkerCreateOp) SizeVT ¶
func (m *WorkerCreateOp) SizeVT() (n int)
func (*WorkerCreateOp) String ¶
func (x *WorkerCreateOp) String() string
func (*WorkerCreateOp) UnmarshalBlock ¶
func (o *WorkerCreateOp) UnmarshalBlock(data []byte) error
UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.
func (*WorkerCreateOp) UnmarshalJSON ¶
func (x *WorkerCreateOp) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the WorkerCreateOp from JSON.
func (*WorkerCreateOp) UnmarshalProtoJSON ¶
func (x *WorkerCreateOp) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the WorkerCreateOp message from JSON.
func (*WorkerCreateOp) UnmarshalVT ¶
func (m *WorkerCreateOp) UnmarshalVT(dAtA []byte) error
func (*WorkerCreateOp) Validate ¶
func (o *WorkerCreateOp) Validate() error
Validate performs cursory validation of the operation. Should not block.