api

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHandleConfig

func GetHandleConfig(actions chan Action, responses chan ActionResponse) http.HandlerFunc

GetHandleConfig returns an handler for the configuration method

func GetHandleDebug

func GetHandleDebug(actions chan Action, responses chan ActionResponse) http.HandlerFunc

GetHandleDebug returns an handler for the debug method

func GetHandleDebugStep

func GetHandleDebugStep(actions chan Action, responses chan ActionResponse) http.HandlerFunc

GetHandleDebugStep returns an handler for the debug step method

func GetHandleMemory

func GetHandleMemory(actions chan Action, responses chan ActionResponse) http.HandlerFunc

GetHandleMemory returns an handler for the memory method

func HandleIndex

func HandleIndex(w http.ResponseWriter, r *http.Request)

HandleIndex handles the queries to the main page

func Process

func Process(actions chan Action, responses chan ActionResponse, ends map[string]*schema.Endpoint)

Process waits for an Action, performs it and publish an ActionResponse

func Serve

func Serve(ends map[string]*schema.Endpoint)

Serve serves the API on the API port

Types

type Action

type Action struct {
	Type    ActionType
	Payload interface{}
}

Action represents an action that the API performs

type ActionResponse

type ActionResponse struct {
	Error      bool
	StatusCode int
	Payload    interface{}
}

ActionResponse represents a response to an Action

type ActionType

type ActionType int

ActionType represents a type of valid Action

const (
	ActionConfig    ActionType = iota
	ActionMemory    ActionType = iota
	ActionInput     ActionType = iota
	ActionDebugInfo ActionType = iota
	ActionDebugSet  ActionType = iota
	ActionDebugStep ActionType = iota
)

Jump to

Keyboard shortcuts

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