forge_worker

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: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WorkerTypeID is the type identifier for a Worker.
	WorkerTypeID = "forge/worker"
)

Variables

View Source
var WorkerCreateOpId = WorkerTypeID + "/create"

WorkerCreateOpId is the worker create operation id.

Functions

func CheckWorkerType

func CheckWorkerType(ctx context.Context, ws world.WorldState, objKey string) error

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

func ListWorkers(ctx context.Context, ws world.WorldState) ([]string, error)

ListWorkers lists all of the worker keys in the world.

func LookupWorkerOp

func LookupWorkerOp(ctx context.Context, opTypeID string) (world.Operation, error)

LookupWorkerOp performs the lookup operation for the Worker op types.

func NewWorkerBlock

func NewWorkerBlock() block.Block

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

func UnmarshalWorker(ctx context.Context, bcs *block.Cursor) (*Worker, error)

UnmarshalWorker unmarshals a worker block from the cursor.

func (*Worker) CloneMessageVT

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

func (*Worker) CloneVT

func (m *Worker) CloneVT() *Worker

func (*Worker) EqualMessageVT

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

func (*Worker) EqualVT

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

func (*Worker) GetName

func (x *Worker) GetName() string

func (*Worker) MarshalBlock

func (e *Worker) MarshalBlock() ([]byte, error)

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

func (*Worker) MarshalJSON

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

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 (x *Worker) MarshalProtoText() string

func (*Worker) MarshalToSizedBufferVT

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

func (*Worker) MarshalToVT

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

func (*Worker) MarshalVT

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

func (*Worker) ProtoMessage

func (*Worker) ProtoMessage()

func (*Worker) Reset

func (x *Worker) Reset()

func (*Worker) SizeVT

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

func (*Worker) String

func (x *Worker) String() string

func (*Worker) UnmarshalBlock

func (e *Worker) UnmarshalBlock(data []byte) error

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

func (*Worker) UnmarshalJSON

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

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

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

func (*Worker) Validate

func (e *Worker) Validate() error

Validate performs cursory checks of the Worker object.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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