wapcutils

package
v0.0.0-...-3b62d95 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KVPutOperationName is the string that indicates the operation in WAPC is a KV PUT.
	KVPutOperationName = "KV-PUT"
	// KVGetOperationName is the string that indicates the operation in WAPC is a KV GET.
	KVGetOperationName = "KV-GET"
	// CreateActorOperationName is the string that indicates the operation in WAPC is to
	// create a new actor.
	CreateActorOperationName = "CREATE-ACTOR"
	// InvokeActorOperationName is the string that indicates the operation in WAPC is to
	// invoke an operation (function) on another actor.
	InvokeActorOperationName = "INVOKE-ACTOR"
	// StartupOperationName is the string that indicates the operation in WAPC is the
	// startup function which should be run once when a worker/actor is first loaded into
	// memory.
	StartupOperationName = "STARTUP"
	// ShutdownOperationName is the string that indicates the operation in WAPC is the
	// shutdown function which should be run once right before a worker/actor is evicted
	// from memory.
	ShutdownOperationName = "SHUTDOWN"
	// ScheduleSelfTimerOperationName is the string that indicates the operation in WAPC is to schedule
	// a self timer.
	ScheduleSelfTimerOperationName = "SCHEDULE-SELF-TIMER"
)

Variables

This section is empty.

Functions

func EncodePutPayload

func EncodePutPayload(dst []byte, key, value []byte) []byte

EncodePUTPayload encodes the provided KV pair into dst (returning a possible re-allocated byte slice) such that it can be decoded by ExtractKVFromPutPayload.

func ExtractKVFromPutPayload

func ExtractKVFromPutPayload(payload []byte) ([]byte, []byte, error)

ExtractKVFromPutPayload extracts the encoded KV pair from an encoded []byte payload.

Types

type CreateActorRequest

type CreateActorRequest struct {
	// ActorID is the requested ID for the new actor that should be created.
	ActorID string `json:"actor_id"`
	// ModuleID is the ID of the module from which the new actor should be created. If
	// this is empty then it will default to the module ID of the calling actor. This
	// allows actors to "fork" themselves without being aware of their own module ID
	// as a convenience.
	ModuleID string `json:"module_id"`
}

CreateActorRequest is the JSON struct that represents a request from an existing actor to create a new one.

type ScheduleSelfTimer

type ScheduleSelfTimer struct {
	// Operation is the name of the operation to invoke on the target actor.
	Operation string `json:"operation"`
	// Payload is the []byte payload to provide to the invoked function on the
	// target actor.
	Payload     []byte `json:"payload"`
	AfterMillis int    `json:"after_millis"`
}

ScheduleSelfTimer is the JSON struct that represents a request from an actor to schedule an invocation on itself (if its still activated in memory) at a later time.

Jump to

Keyboard shortcuts

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