server

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RouteAdder

type RouteAdder interface {
	AddRoute(handler *common.HTTPHandler, lock *sync.RWMutex, base, endpoint string, loggingWriter io.Writer) error
}

type Server

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

Server maintains the HTTP router

func (*Server) AddAliases

func (s *Server) AddAliases(endpoint string, aliases ...string) error

AddAliases registers aliases to the server

func (*Server) AddAliasesWithReadLock

func (s *Server) AddAliasesWithReadLock(endpoint string, aliases ...string) error

AddAliasesWithReadLock registers aliases to the server assuming the http read lock is currently held.

func (*Server) AddChainRoute

func (s *Server) AddChainRoute(handler *common.HTTPHandler, ctx *snow.ConsensusContext, base, endpoint string, loggingWriter io.Writer) error

AddChainRoute registers a route to a chain's handler

func (*Server) AddRoute

func (s *Server) AddRoute(handler *common.HTTPHandler, lock *sync.RWMutex, base, endpoint string, loggingWriter io.Writer) error

AddRoute registers a route to a handler.

func (*Server) Dispatch

func (s *Server) Dispatch() error

Dispatch starts the API server

func (*Server) DispatchTLS

func (s *Server) DispatchTLS(certBytes, keyBytes []byte) error

DispatchTLS starts the API server with the provided TLS certificate

func (*Server) Initialize

func (s *Server) Initialize(
	log logging.Logger,
	factory logging.Factory,
	host string,
	port uint16,
	allowedOrigins []string,
	shutdownTimeout time.Duration,
	nodeID ids.ShortID,
	wrappers ...Wrapper,
)

Initialize creates the API server at the provided host and port

func (*Server) RegisterChain

func (s *Server) RegisterChain(chainName string, engine common.Engine)

RegisterChain registers the API endpoints associated with this chain. That is, add <route, handler> pairs to server so that API calls can be made to the VM. This method runs in a goroutine to avoid a deadlock in the event that the caller holds the engine's context lock. Namely, this could happen when the P-Chain is creating a new chain and holds the P-Chain's lock when this function is held, and at the same time the server's lock is held due to an API call and is trying to grab the P-Chain's lock.

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown this server

type Wrapper

type Wrapper interface {
	// WrapHandler wraps an http.Handler.
	WrapHandler(h http.Handler) http.Handler
}

Jump to

Keyboard shortcuts

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