handlers

package
v0.0.0-...-fd84699 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package handlers : this one is to start a new Capsule HTTP process

Package handlers : this one is to start a new Capsule HTTP process

Package handlers : this one is to start a new Capsule HTTP process

Package handlers : this one is to start a new Capsule HTTP process

Package handlers : this one is to start a new Capsule HTTP process

Package handlers : this one is to start a new Capsule HTTP process

Package handlers : this one is to start a new Capsule HTTP process

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallExternalFunction

func CallExternalFunction(c *fiber.Ctx) error

CallExternalFunction calls the WASM module of another Capsule HTTP process ! this a work in progress c *fiber.Ctx: a pointer to a fiber context object that contains information about the http request. error: returns an error if the external function call fails.

func CallExternalFunctionHealthCheck

func CallExternalFunctionHealthCheck(c *fiber.Ctx) error

CallExternalFunctionHealthCheck is called by the main process of the faas mode

Routes:

app.All("/functions/health/:function_name", handlers.CallExternalFunctionHealthCheck)
app.All("/functions/health/:function_name/:function_revision", handlers.CallExternalFunctionHealthCheck)
app.All("/functions/health/:function_name/:function_revision/:function_index", handlers.CallExternalFunctionHealthCheck)

func CallExternalIndexPageFunction

func CallExternalIndexPageFunction(c *fiber.Ctx) error

CallExternalIndexPageFunction is called by the main process of the faas mode to call the index.page.wasm the function name is "index.page" only GET method is supported

func CallWasmFunction

func CallWasmFunction(c *fiber.Ctx) error

CallWasmFunction is a function that handles the execution of a WebAssembly function.

c is a pointer to a Fiber context. error is the error returned by the function.

func CallWasmFunctionHealthCheck

func CallWasmFunctionHealthCheck(c *fiber.Ctx) error

CallWasmFunctionHealthCheck is a function that handles the execution of a WebAssembly function. Route: app.All("/health", handlers.CallWasmFunctionHealthCheck)

func CallWasmFunctionMetrics

func CallWasmFunctionMetrics(c *fiber.Ctx) error

CallWasmFunctionMetrics is a function that handles the execution of a WebAssembly function. Route: app.All("/metrics", handlers.CallWasmFunctionMetrics)

func DuplicateExternalFunction

func DuplicateExternalFunction(c *fiber.Ctx) error

DuplicateExternalFunction duplicates a given function and returns its new function name.

c: a fiber context that contains information about the request. Returns an error in case of an error.

! this a work in progress The handler duplicate an existing function record with a different revision name !With the same process (it's a pointer to the same process).

func GetLastCall

func GetLastCall() time.Time

GetLastCall returns the time of the last call.

This function does not take any parameters. It returns a time.Time object.

func GetListOfCapsuleHTTPProcesses

func GetListOfCapsuleHTTPProcesses(c *fiber.Ctx) error

GetListOfCapsuleHTTPProcesses retrieves the list of external Capsule processes and sends it as a JSON response.

c *fiber.Ctx: A pointer to the fiber context. error: An error indicating if there was a problem with the retrieval of the data. error: An error indicating if there was a problem with sending the JSON response.

func GetMainCapsuleTaskPath

func GetMainCapsuleTaskPath() string

GetMainCapsuleTaskPath returns the path where the main Capsule HTTP process is installed

func GetModule

func GetModule(ctx context.Context, wasmFile []byte) (api.Module, error)

GetModule from modules map

func NotifiedMainCapsuleHTTPProcess

func NotifiedMainCapsuleHTTPProcess(c *fiber.Ctx) error

NotifiedMainCapsuleHTTPProcess is triggered when a Capsule HTTP child process notifies the parent process (main Capsule HTTP process)

func ReStartCapsuleHTTPProcess

func ReStartCapsuleHTTPProcess(c *fiber.Ctx) error

ReStartCapsuleHTTPProcess restarts an existing stopped process Called by CallExternalFunction

func SetLastCall

func SetLastCall(t time.Time)

SetLastCall sets the last call time to the given time.

t time.Time

func SetMainCapsuleTaskPath

func SetMainCapsuleTaskPath(path string)

SetMainCapsuleTaskPath sets the path where the main Capsule HTTP process is installed

func StartNewCapsuleHTTPProcess

func StartNewCapsuleHTTPProcess(c *fiber.Ctx) error

StartNewCapsuleHTTPProcess is a Go function that handles HTTP requests for starting a capsule. ! this a work in progress It takes in a pointer to a fiber.Ctx object. It returns an error object.

func StopAndKillCapsuleHTTPProcess

func StopAndKillCapsuleHTTPProcess(c *fiber.Ctx) error

StopAndKillCapsuleHTTPProcess stops the HTTP process for the given Fiber context.

c: a pointer to a fiber.Ctx object representing the context of the HTTP request. error: an error object that indicates whether an error occurred during the function execution.

func StoreContext

func StoreContext(capsuleContext context.Context)

StoreContext stores the given context for later use.

capsuleContext: the context to be stored.

func StoreRuntime

func StoreRuntime(capsuleRuntime wazero.Runtime)

StoreRuntime stores the given capsule runtime.

capsuleRuntime: a wazero.Runtime object representing the runtime to be stored.

func StoreWasmFile

func StoreWasmFile(loadedWasmFile []byte)

StoreWasmFile stores the given byte slice of a loaded WebAssembly file.

loadedWasmFile is a byte slice containing the contents of the loaded WebAssembly file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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