api

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const LoggerTag = "EVENT_API"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// EventStore is the event store to use.
	EventStore *store.EventStore
	// Address specifies the TCP address for the server to listen on in the
	// form "host:port".
	Address string
	// Logger is a current logger used by the EventAPI.
	Logger log.Logger
}

Config is the configuration for the EventAPI.

type EventAPI

type EventAPI struct {
	// contains filtered or unexported fields
}

EventAPI provides an HTTP API for EventStore.

It provides one GET endpoint in root path that expects two query parameters: type - the type of the event index - the search index for the events

If any of them is missing, then bad request status is returned. Both parameters must be provided as hex encoded strings.

Events are returned in JSON format.

func New

func New(cfg Config) (*EventAPI, error)

New returns a new instance of the EventAPI struct.

func (*EventAPI) Start

func (e *EventAPI) Start(ctx context.Context) error

Start starts HTTP server.

func (*EventAPI) Wait

func (e *EventAPI) Wait() chan error

Wait waits until the context is canceled or until an error occurs.

Jump to

Keyboard shortcuts

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