httpserver

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConsoleRouter

func ConsoleRouter(logger zerolog.Logger) chi.Router

The console router serves the single page app for the console. It will serve the index.html file for any path that does not exist, allowing client-side to handle routing

func EventRouter added in v0.7.0

func EventRouter(eventsClient EventsClient, logger zerolog.Logger) chi.Router

func Healthcheck

func Healthcheck(natsClient NatsClient, endpoint string) func(http.Handler) http.Handler

func Serve

func Serve(addr string, hopsContent *hcl.BodyContent, natsClient NatsClient, logger zerolog.Logger) error

func TaskRouter

func TaskRouter(taskHops taskReader, natsClient NatsClient, logger zerolog.Logger) chi.Router

Types

type Event added in v0.7.0

type Event map[string](interface{})

Event is arbitrary json struct of event

type EventItem added in v0.7.0

type EventItem struct {
	Event      Event     `json:"event"`
	SequenceId string    `json:"sequence_id"`
	Timestamp  time.Time `json:"timestamp"`
}

EventItem includes metadata for /events api endpoint

type EventLog added in v0.7.0

type EventLog struct {
	StartTimestamp time.Time   `json:"start_timestamp"`
	EndTimestamp   time.Time   `json:"end_timestamp"`
	EventItems     []EventItem `json:"event_items"`
}

EventLog is a list of events with search start and search end timestamps

type EventsClient added in v0.7.0

type EventsClient interface {
	GetEventHistory(ctx context.Context, start time.Time) ([]*nats.MsgMeta, error)
}

type NatsClient added in v0.3.0

type NatsClient interface {
	Publish(context.Context, []byte, ...string) (*jetstream.PubAck, bool, error)
	CheckConnection() bool
	GetEventHistory(context.Context, time.Time) ([]*nats.MsgMeta, error)
}

Jump to

Keyboard shortcuts

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