Documentation ¶
Index ¶
- type RouteAdder
- type Server
- func (s *Server) AddAliases(endpoint string, aliases ...string) error
- func (s *Server) AddAliasesWithReadLock(endpoint string, aliases ...string) error
- func (s *Server) AddChainRoute(handler *common.HTTPHandler, ctx *snow.ConsensusContext, base, endpoint string, ...) error
- func (s *Server) AddRoute(handler *common.HTTPHandler, lock *sync.RWMutex, base, endpoint string, ...) error
- func (s *Server) Dispatch() error
- func (s *Server) DispatchTLS(certBytes, keyBytes []byte) error
- func (s *Server) Initialize(log logging.Logger, factory logging.Factory, host string, port uint16, ...)
- func (s *Server) RegisterChain(chainName string, engine common.Engine)
- func (s *Server) Shutdown() error
- type Wrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RouteAdder ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server maintains the HTTP router
func (*Server) AddAliases ¶
AddAliases registers aliases to the server
func (*Server) AddAliasesWithReadLock ¶
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) DispatchTLS ¶
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 ¶
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.