apis

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: BSD-2-Clause, Unlicense Imports: 17 Imported by: 0

README

Server APIs

This package contains the implementation code for exposing a Blackboard interface.

HTTP

This is currently the only maintained API for the blackboard.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORSMiddleware added in v0.2.6

func CORSMiddleware(next http.Handler) http.HandlerFunc

this enables CORS (https://enable-cors.org)

Types

type BlackboardHTTPService

type BlackboardHTTPService struct {
	R *http.ServeMux
	// contains filtered or unexported fields
}

BlackboardHTTPService is an implementation of CoreAPI for HTTP.

func NewBlackboardHTTPService

func NewBlackboardHTTPService(ctx context.Context, bb blackboards.StreamingBlackboard) *BlackboardHTTPService

NewBlackboardHTTPService creates a new BlackboardHTTPService from a Blackboard.

func (*BlackboardHTTPService) BlackboardHandler

func (b *BlackboardHTTPService) BlackboardHandler(w http.ResponseWriter, r *http.Request)

BlackboardHandler is a handler function for the "/blackboard" endpoint.

func (*BlackboardHTTPService) BlackboardLengthHandler

func (b *BlackboardHTTPService) BlackboardLengthHandler(w http.ResponseWriter, r *http.Request)

BlackboardLengthHandler is a handler function for the "/blackboard/len" endpoint.

func (*BlackboardHTTPService) BlackboardSSEHandler added in v0.2.6

func (b *BlackboardHTTPService) BlackboardSSEHandler(w http.ResponseWriter, r *http.Request)

func (*BlackboardHTTPService) MessageHandler

func (b *BlackboardHTTPService) MessageHandler(w http.ResponseWriter, r *http.Request)

MessageHandler is a handler function for the "/message/{id}" endpoint.

func (*BlackboardHTTPService) NewMessageHandler

func (b *BlackboardHTTPService) NewMessageHandler(w http.ResponseWriter, r *http.Request)

NewMessageHandler is a handler function for the "/message" endpoint.

func (*BlackboardHTTPService) PostError added in v0.2.6

func (b *BlackboardHTTPService) PostError(msgs ...any)

func (*BlackboardHTTPService) PostErrorf added in v0.2.6

func (b *BlackboardHTTPService) PostErrorf(fmt_str string, msgs ...any)

func (*BlackboardHTTPService) PostLog added in v0.2.6

func (b *BlackboardHTTPService) PostLog(msgs ...any)

func (*BlackboardHTTPService) PostLogf added in v0.2.6

func (b *BlackboardHTTPService) PostLogf(fmt_str string, msgs ...any)

func (*BlackboardHTTPService) Shutdown

func (b *BlackboardHTTPService) Shutdown() error

Shutdown shuts the blackboard service down.

func (*BlackboardHTTPService) Start

func (b *BlackboardHTTPService) Start(listen_addr string) error

Start is a blocking call to begin listening list_addr.

func (*BlackboardHTTPService) TraceHandler

func (b *BlackboardHTTPService) TraceHandler(w http.ResponseWriter, r *http.Request)

TraceHandler is a handler function for the "/trace" endpoint.

type CoreAPI

type CoreAPI interface {
	Start(listen_addr string) error
	Shutdown() error
}

This interface is intended to allow us to manage an API layer via the core executable (q: should be defined closer to cmd then?), NOT to dictate what functionality you should expose for for your blackboard. The core-provided apis generally expose all of the desired blackboard functionality.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳