actorcore

package module
v0.0.0-...-0b6fd76 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

README

wasmCloud Core Actor Interface

This is the actor interface for the wasmcloud:core capability contract ID. This interface is required by all actors. Using this interface your actor can implement a handler for the health check message.

package main

import (
	core "github.com/wasmcloud/actor-interfaces/actor-core/go"
)

func main() {
	core.Handlers{
		HealthRequest: healthRequest,
	}.Register()
}

func healthRequest(request core.HealthCheckRequest) (core.HealthCheckResponse, error) {
	return core.HealthCheckResponse{
        healthy: true
    }, nil // TODO: Provide implementation.
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CapabilityConfiguration

type CapabilityConfiguration struct {
	// The module name
	Module string
	// A map of values that represent the configuration values
	Values map[string]string
}

Represents the data sent to a capability provider at link time

func DecodeCapabilityConfiguration

func DecodeCapabilityConfiguration(decoder *msgpack.Decoder) (CapabilityConfiguration, error)

func DecodeCapabilityConfigurationNullable

func DecodeCapabilityConfigurationNullable(decoder *msgpack.Decoder) (*CapabilityConfiguration, error)

func (*CapabilityConfiguration) Decode

func (o *CapabilityConfiguration) Decode(decoder *msgpack.Decoder) error

func (*CapabilityConfiguration) Encode

func (o *CapabilityConfiguration) Encode(encoder msgpack.Writer) error

type Handlers

type Handlers struct {
	// This operation is invoked by the host runtime to determine the health of an
	// actor
	HealthRequest func(request HealthCheckRequest) (HealthCheckResponse, error)
}

func (Handlers) Register

func (h Handlers) Register()

type HealthCheckRequest

type HealthCheckRequest struct {
	// Since we cannot currently serialize empty requests, this placeholder is required
	Placeholder bool
}

A request sent to the actor by the host in order to determine health status

func DecodeHealthCheckRequest

func DecodeHealthCheckRequest(decoder *msgpack.Decoder) (HealthCheckRequest, error)

func DecodeHealthCheckRequestNullable

func DecodeHealthCheckRequestNullable(decoder *msgpack.Decoder) (*HealthCheckRequest, error)

func (*HealthCheckRequest) Decode

func (o *HealthCheckRequest) Decode(decoder *msgpack.Decoder) error

func (*HealthCheckRequest) Encode

func (o *HealthCheckRequest) Encode(encoder msgpack.Writer) error

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
}

All actors must return a health check response to the host upon receipt of a health request. Returning in `Err` indicates total actor failure, while returning a valid response with the `healthy` flag set to false indicates that the actor has somehow detected that it cannot perform its given task

func DecodeHealthCheckResponse

func DecodeHealthCheckResponse(decoder *msgpack.Decoder) (HealthCheckResponse, error)

func DecodeHealthCheckResponseNullable

func DecodeHealthCheckResponseNullable(decoder *msgpack.Decoder) (*HealthCheckResponse, error)

func (*HealthCheckResponse) Decode

func (o *HealthCheckResponse) Decode(decoder *msgpack.Decoder) error

func (*HealthCheckResponse) Encode

func (o *HealthCheckResponse) Encode(encoder msgpack.Writer) error

Jump to

Keyboard shortcuts

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