Documentation ¶
Index ¶
- Constants
- func From(typ interface{}) interface{}
- func IsType(t repo.RepoType) func(s *Settings) bool
- func LocatorHandler(a api.Locator, permission bool) (http.Handler, error)
- func MonitorShutdown(triggerCh <-chan struct{}, handlers ...ShutdownHandler) <-chan struct{}
- func SchedulerHandler(a api.Scheduler, permission bool, opts ...jsonrpc.ServerOption) (http.Handler, error)
- type Option
- func ApplyIf(check func(s *Settings) bool, opts ...Option) Option
- func Base() Option
- func Candidate(out *api.Candidate) Option
- func ConfigCandidate(c interface{}) Option
- func ConfigEdge(c interface{}) Option
- func ConfigLocator(c interface{}) Option
- func ConfigScheduler(c interface{}) Option
- func Edge(out *api.Edge) Option
- func Error(err error) Option
- func If(b bool, opts ...Option) Option
- func Locator(out *api.Locator) Option
- func Options(opts ...Option) Option
- func Override(typ, constructor interface{}) Option
- func Repo(r repo.Repo) Option
- func Scheduler(out *api.Scheduler) Option
- func Unset(typ interface{}) Option
- type Settings
- type ShutdownHandler
- type StopFunc
Constants ¶
const ( // InitJournal at position 0 initializes the journal global var as soon as // the system starts, so that it's available for all other components. InitJournalKey = invoke(iota) ExtractAPIKey CheckFDLimit InitDataTables RunGateway )
Invokes are called in the order they are defined.
Variables ¶
This section is empty.
Functions ¶
func LocatorHandler ¶
LocatorHandler returns a locator handler, to be mounted as-is on the server.
func MonitorShutdown ¶
func MonitorShutdown(triggerCh <-chan struct{}, handlers ...ShutdownHandler) <-chan struct{}
MonitorShutdown manages shutdown requests, by watching signals and invoking the supplied handlers in order.
It watches SIGTERM and SIGINT OS signals, as well as the trigger channel. When any of them fire, it calls the supplied handlers in order. If any of them errors, it merely logs the error.
Once the shutdown has completed, it closes the returned channel. The caller can watch this channel
Types ¶
type Option ¶
Option is a functional option which can be used with the New function to change how the node is constructed
Options are applied in sequence
func ConfigCandidate ¶
func ConfigCandidate(c interface{}) Option
func ConfigEdge ¶
func ConfigEdge(c interface{}) Option
func ConfigLocator ¶
func ConfigLocator(c interface{}) Option
func ConfigScheduler ¶
func ConfigScheduler(c interface{}) Option
type ShutdownHandler ¶
type StopFunc ¶
func ServeRPC ¶
ServeRPC serves an HTTP handler over the supplied listen multiaddr.
This function spawns a goroutine to run the server, and returns immediately. It returns the stop function to be called to terminate the endpoint.
The supplied ID is used in tracing, by inserting a tag in the context.