proplet

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RegistryAckTopicTemplate = "channels/%s/messages/control/manager/registry"
)
View Source
var ResultsTopic = "channels/%s/messages/control/proplet/results"

Functions

This section is empty.

Types

type ChunkPayload

type ChunkPayload struct {
	AppName     string `json:"app_name"`
	ChunkIdx    int    `json:"chunk_idx"`
	TotalChunks int    `json:"total_chunks"`
	Data        []byte `json:"data"`
}

func (*ChunkPayload) Validate

func (c *ChunkPayload) Validate() error

type Proplet

type Proplet struct {
	ID           string      `json:"id"`
	Name         string      `json:"name"`
	TaskCount    uint64      `json:"task_count"`
	Alive        bool        `json:"alive"`
	AliveHistory []time.Time `json:"alive_history"`
}

func (*Proplet) SetAlive

func (p *Proplet) SetAlive()

type PropletPage

type PropletPage struct {
	Offset   uint64    `json:"offset"`
	Limit    uint64    `json:"limit"`
	Total    uint64    `json:"total"`
	Proplets []Proplet `json:"proplets"`
}

type PropletService

type PropletService struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(ctx context.Context, channelID, clientID, clientKey string, livelinessInterval time.Duration, pubsub pkgmqtt.PubSub, logger *slog.Logger, runtime Runtime) (*PropletService, error)

func (*PropletService) Run

func (p *PropletService) Run(ctx context.Context, logger *slog.Logger) error

type Runtime

type Runtime interface {
	StartApp(ctx context.Context, wasmBinary []byte, cliArgs []string, id, functionName string, args ...uint64) error
	StopApp(ctx context.Context, id string) error
}

type Service

type Service interface {
	StartTask(ctx context.Context, task task.Task) error
	RunTask(ctx context.Context, taskID string) ([]uint64, error)
	StopTask(ctx context.Context, taskID string) error
	RemoveTask(ctx context.Context, taskID string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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