Documentation ¶
Overview ¶
Package config provides a parser for a JSON configuration file format used to configure Tarmac functions and services.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRouteNotFound = fmt.Errorf("route not found")
ErrRouteNotFound is returned when a requested route is not found in the service's route configuration.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { sync.RWMutex // Services maps the names of Tarmac services to their configurations, which include the set of functions they provide // and the routes by which they can be invoked. Services map[string]Service `json:"services"` // contains filtered or unexported fields }
Config is a struct that represents the parsed configuration file. It contains a map of Tarmac Services, where each Service is identified by a unique string key.
type Function ¶
type Function struct { // Filepath to the WASM function Filepath string `json:"filepath"` // PoolSize defines the number of instances of the function to create PoolSize int `json:"pool_size"` }
Function defines the Tarmac function to load and execute.
type Route ¶
type Route struct { // Type defines the protocol used for the route, examples are "http", "nats", "scheduled_task", etc. Type string `json:"type"` // Path defines the path for HTTP types. Path string `json:"path,omitempty"` // Topic defines the topic or channel to listen to for message queue based routes. Topic string `json:"topic,omitempty"` // Methods defines the HTTP methods to accept for the defined route. Methods []string `json:"methods,omitempty"` // Function defines the Function to execute when this route is called. Function string `json:"function"` // Frequency is used to define the frequency of scheduled_task routes in seconds. Frequency int `json:"frequency,omitempty"` }
Route defines available routes for the service.
type Service ¶
type Service struct { // Name is the human-readable name for the service. Name string `json:"name"` // Functions is a map of Function objects, where the keys are string identifiers for each function. Functions map[string]Function `json:"functions"` // Routes is a slice of Route objects representing the available routes for this service. Routes []Route `json:"routes"` }
Service defines a Tarmac service, which consists of a Name, a set of Functions, and a collection of available Routes.
Click to show internal directories.
Click to hide internal directories.