Documentation
¶
Overview ¶
wasmcloud platform core data structures
wasmcloud core data models for messaging and code generation
Index ¶
- func ConsoleLog(msg string)
- func HostCall(binding, namespace, operation string, payload []byte) ([]byte, error)
- func RegisterHandlers(handlers ...Handler)
- type Actor
- type ActorLinks
- type ActorReceiver
- type ActorSender
- type CapabilityContractId
- type ClusterIssuerKey
- type ClusterIssuers
- type Context
- type DefaultResponder
- type Document
- type F32
- type F64
- type Handler
- type HealthCheckRequest
- type HealthCheckResponse
- type HostData
- type HostEnvValues
- type HostError
- type I16
- type I32
- type I64
- type I8
- type IdentifierList
- type Invocation
- type InvocationResponse
- type LinkDefinition
- type LinkSettings
- type Message
- type RpcError
- type ServiceDispatch
- type Timestamp
- type TraceContext
- type Transport
- type U16
- type U32
- type U64
- type U8
- type Unit
- type WasmCloudEntity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConsoleLog ¶
func ConsoleLog(msg string)
ConsoleLog sends log message to host console. For internal use - Actors should use the logging capability provider for logging Deprecated - support for this function may go away
func HostCall ¶
HostCall performs a "host call" - a request from the actor to either invoke another actor or invoke an operation on a linked capability provider.
binding - this is either the link name (e.g. "default") or, in the case of an actor-to-actor call, the public key or call alias of the target
namespace - this is the contract ID when invoking a provider, empty string for actor-to-actor calls
operation - the name of the operation to invoke
func RegisterHandlers ¶
func RegisterHandlers(handlers ...Handler)
RegisterHandlers is called by actors during main() Example: ``` me = MyActor{} actor.RegisterHandlers(me, actor.Handler(), httpserver.Handler()) ```
Types ¶
type Actor ¶
type Actor interface { // Perform health check. Called at regular intervals by host HealthRequest(ctx *Context, arg HealthCheckRequest) (*HealthCheckResponse, error) }
Actor service
type ActorLinks ¶
type ActorLinks []LinkDefinition
List of linked actors for a provider
func CDecodeActorLinks ¶ added in v0.1.2
func CDecodeActorLinks(d *cbor.Decoder) (ActorLinks, error)
CDecodeActorLinks deserializes a ActorLinks using cbor
func MDecodeActorLinks ¶ added in v0.1.2
func MDecodeActorLinks(d *msgpack.Decoder) (ActorLinks, error)
MDecodeActorLinks deserializes a ActorLinks using msgpack
type ActorReceiver ¶
type ActorReceiver struct{}
ActorReceiver receives messages defined in the Actor service interface Actor service
type ActorSender ¶
type ActorSender struct {
// contains filtered or unexported fields
}
ActorSender sends messages to a Actor service Actor service
func NewActorActorSender ¶
func NewActorActorSender(actor_id string) *ActorSender
NewActorSender constructs a client for actor-to-actor messaging using the recipient actor's public key
func (*ActorSender) HealthRequest ¶
func (s *ActorSender) HealthRequest(ctx *Context, arg HealthCheckRequest) (*HealthCheckResponse, error)
Perform health check. Called at regular intervals by host
type CapabilityContractId ¶
type CapabilityContractId string
Capability contract id, e.g. 'wasmcloud:httpserver' This declaration supports code generations and is not part of an actor or provider sdk
func CDecodeCapabilityContractId ¶ added in v0.1.2
func CDecodeCapabilityContractId(d *cbor.Decoder) (CapabilityContractId, error)
CDecodeCapabilityContractId deserializes a CapabilityContractId using cbor
func MDecodeCapabilityContractId ¶ added in v0.1.2
func MDecodeCapabilityContractId(d *msgpack.Decoder) (CapabilityContractId, error)
MDecodeCapabilityContractId deserializes a CapabilityContractId using msgpack
type ClusterIssuerKey ¶
type ClusterIssuerKey string
func CDecodeClusterIssuerKey ¶ added in v0.1.2
func CDecodeClusterIssuerKey(d *cbor.Decoder) (ClusterIssuerKey, error)
CDecodeClusterIssuerKey deserializes a ClusterIssuerKey using cbor
func MDecodeClusterIssuerKey ¶ added in v0.1.2
func MDecodeClusterIssuerKey(d *msgpack.Decoder) (ClusterIssuerKey, error)
MDecodeClusterIssuerKey deserializes a ClusterIssuerKey using msgpack
type ClusterIssuers ¶
type ClusterIssuers []ClusterIssuerKey
func CDecodeClusterIssuers ¶ added in v0.1.2
func CDecodeClusterIssuers(d *cbor.Decoder) (ClusterIssuers, error)
CDecodeClusterIssuers deserializes a ClusterIssuers using cbor
func MDecodeClusterIssuers ¶ added in v0.1.2
func MDecodeClusterIssuers(d *msgpack.Decoder) (ClusterIssuers, error)
MDecodeClusterIssuers deserializes a ClusterIssuers using msgpack
type DefaultResponder ¶ added in v0.1.2
type DefaultResponder struct{}
default health check responder
func (*DefaultResponder) HealthRequest ¶ added in v0.1.2
func (hc *DefaultResponder) HealthRequest(ctx *Context, arg HealthCheckRequest) (*HealthCheckResponse, error)
type Document ¶
type Document struct{}
Document is an 'any' type interface and is not currently implemented for TinyGo actors
func CDecodeDocument ¶ added in v0.1.2
func MDecodeDocument ¶ added in v0.1.2
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler used to invoke callbacks when actor receives a message
func ActorHandler ¶
ActorHandler is called by an actor during `main` to generate a dispatch handler The output of this call should be passed into `actor.RegisterHandlers`
func NewHandler ¶
func NewHandler(service string, dispatch ServiceDispatch, actor interface{}) Handler
NewHandler constructor - called by service (generated interface) during actor initialization Not used directly by actors. Actors should use RegisterHandlers
type HealthCheckRequest ¶
type HealthCheckRequest struct { }
health check request parameter
func CDecodeHealthCheckRequest ¶ added in v0.1.2
func CDecodeHealthCheckRequest(d *cbor.Decoder) (HealthCheckRequest, error)
CDecodeHealthCheckRequest deserializes a HealthCheckRequest using cbor
func MDecodeHealthCheckRequest ¶ added in v0.1.2
func MDecodeHealthCheckRequest(d *msgpack.Decoder) (HealthCheckRequest, error)
MDecodeHealthCheckRequest deserializes a HealthCheckRequest using msgpack
type HealthCheckResponse ¶
type HealthCheckResponse struct { // A flag that indicates the the actor is healthy Healthy bool // A message containing additional information about the actors health Message string }
Return value from actors and providers for health check status
func CDecodeHealthCheckResponse ¶ added in v0.1.2
func CDecodeHealthCheckResponse(d *cbor.Decoder) (HealthCheckResponse, error)
CDecodeHealthCheckResponse deserializes a HealthCheckResponse using cbor
func MDecodeHealthCheckResponse ¶ added in v0.1.2
func MDecodeHealthCheckResponse(d *msgpack.Decoder) (HealthCheckResponse, error)
MDecodeHealthCheckResponse deserializes a HealthCheckResponse using msgpack
type HostData ¶
type HostData struct { HostId string LatticeRpcPrefix string LinkName string LatticeRpcUserJwt string LatticeRpcUserSeed string LatticeRpcUrl string ProviderKey string InvocationSeed string EnvValues HostEnvValues InstanceId string // initial list of links for provider LinkDefinitions ActorLinks // list of cluster issuers ClusterIssuers ClusterIssuers // Optional configuration JSON sent to a given link name of a provider // without an actor context ConfigJson string // Host-wide default RPC timeout for rpc messages, in milliseconds. Defaults to 2000. DefaultRpcTimeoutMs uint64 }
initialization data for a capability provider
func CDecodeHostData ¶ added in v0.1.2
CDecodeHostData deserializes a HostData using cbor
func MDecodeHostData ¶ added in v0.1.2
MDecodeHostData deserializes a HostData using msgpack
type HostEnvValues ¶
Environment settings for initializing a capability provider
func CDecodeHostEnvValues ¶ added in v0.1.2
func CDecodeHostEnvValues(d *cbor.Decoder) (HostEnvValues, error)
CDecodeHostEnvValues deserializes a HostEnvValues using cbor
func MDecodeHostEnvValues ¶ added in v0.1.2
func MDecodeHostEnvValues(d *msgpack.Decoder) (HostEnvValues, error)
MDecodeHostEnvValues deserializes a HostEnvValues using msgpack
type HostError ¶
type HostError struct {
// contains filtered or unexported fields
}
HostError is returned by the host from HostCall
type IdentifierList ¶
type IdentifierList []string
list of identifiers This declaration supports code generations and is not part of an actor or provider sdk
func CDecodeIdentifierList ¶ added in v0.1.2
func CDecodeIdentifierList(d *cbor.Decoder) (IdentifierList, error)
CDecodeIdentifierList deserializes a IdentifierList using cbor
func MDecodeIdentifierList ¶ added in v0.1.2
func MDecodeIdentifierList(d *msgpack.Decoder) (IdentifierList, error)
MDecodeIdentifierList deserializes a IdentifierList using msgpack
type Invocation ¶
type Invocation struct { Origin WasmCloudEntity Target WasmCloudEntity Operation string Msg []byte Id string EncodedClaims string HostId string // total message size (optional) ContentLength uint64 // Open Telemetry tracing support TraceContext TraceContext }
RPC message to capability provider
func CDecodeInvocation ¶ added in v0.1.2
func CDecodeInvocation(d *cbor.Decoder) (Invocation, error)
CDecodeInvocation deserializes a Invocation using cbor
func MDecodeInvocation ¶ added in v0.1.2
func MDecodeInvocation(d *msgpack.Decoder) (Invocation, error)
MDecodeInvocation deserializes a Invocation using msgpack
type InvocationResponse ¶
type InvocationResponse struct { // serialize response message Msg []byte // id connecting this response to the invocation InvocationId string // optional error message Error string // total message size (optional) ContentLength uint64 }
Response to an invocation
func CDecodeInvocationResponse ¶ added in v0.1.2
func CDecodeInvocationResponse(d *cbor.Decoder) (InvocationResponse, error)
CDecodeInvocationResponse deserializes a InvocationResponse using cbor
func MDecodeInvocationResponse ¶ added in v0.1.2
func MDecodeInvocationResponse(d *msgpack.Decoder) (InvocationResponse, error)
MDecodeInvocationResponse deserializes a InvocationResponse using msgpack
type LinkDefinition ¶
type LinkDefinition struct { // actor public key ActorId string // provider public key ProviderId string // link name LinkName string // contract id ContractId string Values LinkSettings }
Link definition for binding actor to provider
func CDecodeLinkDefinition ¶ added in v0.1.2
func CDecodeLinkDefinition(d *cbor.Decoder) (LinkDefinition, error)
CDecodeLinkDefinition deserializes a LinkDefinition using cbor
func MDecodeLinkDefinition ¶ added in v0.1.2
func MDecodeLinkDefinition(d *msgpack.Decoder) (LinkDefinition, error)
MDecodeLinkDefinition deserializes a LinkDefinition using msgpack
type LinkSettings ¶
Settings associated with an actor-provider link
func CDecodeLinkSettings ¶ added in v0.1.2
func CDecodeLinkSettings(d *cbor.Decoder) (LinkSettings, error)
CDecodeLinkSettings deserializes a LinkSettings using cbor
func MDecodeLinkSettings ¶ added in v0.1.2
func MDecodeLinkSettings(d *msgpack.Decoder) (LinkSettings, error)
MDecodeLinkSettings deserializes a LinkSettings using msgpack
type RpcError ¶
type RpcError struct {
// contains filtered or unexported fields
}
RpcError is an error type emitted by the rpc infrastructure
func NewRpcError ¶
NewRpcError constructs an RpcError
type ServiceDispatch ¶
type ServiceDispatch interface { // dispatch calls the actor's registered handler for the operation Dispatch(ctx *Context, actor interface{}, message *Message) (*Message, error) }
ServiceDispatch defines the interface that all Receivers implement
type Timestamp ¶
type Timestamp struct { // the number of non-leap seconds since unix epoch in UTC Sec int64 // the number of nanoseconds since the beginning of the last whole non-leap second Nsec uint32 }
Timestamp identifies an instant in time
func CDecodeTimestamp ¶ added in v0.1.2
CDecodeTimestamp deserializes a Timestamp using cbor
func MDecodeTimestamp ¶ added in v0.1.2
MDecodeTimestamp deserializes a Timestamp using msgpack
type TraceContext ¶
Environment settings for initializing a capability provider
func CDecodeTraceContext ¶ added in v0.1.2
func CDecodeTraceContext(d *cbor.Decoder) (TraceContext, error)
CDecodeTraceContext deserializes a TraceContext using cbor
func MDecodeTraceContext ¶ added in v0.1.2
func MDecodeTraceContext(d *msgpack.Decoder) (TraceContext, error)
MDecodeTraceContext deserializes a TraceContext using msgpack
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport interface used to send rpc messages over some connection
func ToProvider ¶
ToProvider constructs a Transport for actor-to-provider calls
type Unit ¶
type Unit struct { }
Unit type
func CDecodeUnit ¶ added in v0.1.2
CDecodeUnit deserializes a Unit using cbor
func MDecodeUnit ¶ added in v0.1.2
MDecodeUnit deserializes a Unit using msgpack
type WasmCloudEntity ¶
type WasmCloudEntity struct { PublicKey string LinkName string ContractId CapabilityContractId }
func CDecodeWasmCloudEntity ¶ added in v0.1.2
func CDecodeWasmCloudEntity(d *cbor.Decoder) (WasmCloudEntity, error)
CDecodeWasmCloudEntity deserializes a WasmCloudEntity using cbor
func MDecodeWasmCloudEntity ¶ added in v0.1.2
func MDecodeWasmCloudEntity(d *msgpack.Decoder) (WasmCloudEntity, error)
MDecodeWasmCloudEntity deserializes a WasmCloudEntity using msgpack