web

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth interface {
	AuthUser(context.Context, string, string, string) error
}

An Auth component is able to validate a username and password and returns a nil error only if the

type Option added in v1.1.0

type Option func(s *Server)

Option functions configure the webserver with various values.

func WithAuth added in v1.1.0

func WithAuth(auth Auth) Option

WithAuth configures the authentication backend.

func WithLogger added in v1.1.0

func WithLogger(l hclog.Logger) Option

WithLogger sets the logger for the server.

func WithStore added in v1.1.0

func WithStore(st Store) Option

WithStore sets up the storage backend.

type Server

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

Server is an abstraction over all methods needed to operate the state server. It includes the required Store and binds all HTTP methods to the appropriate routes.

func New

func New(opts ...Option) (*Server, error)

New returns an initialized server, but not one that is prepared to serve. The embedded echo.Echo instance's Serve method must still be called.

func (*Server) Serve added in v1.1.0

func (s *Server) Serve(bind string) error

Serve binds and serves http on the bound socket. An error will be returned if the server cannot initialize.

func (*Server) Shutdown added in v1.1.0

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the server.

type Store

type Store interface {
	Get([]byte) ([]byte, error)
	Put([]byte, []byte) error
	Del([]byte) error

	Close() error
	Sync() error
}

A Store is an abstraction to a persistent storage system that terrastate will use to durably store the state data it is entrusted with. This may very well be a remote KV store, in which case terrastate is providing AAA services on top of the existing KV store.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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