Documentation ¶
Index ¶
- Constants
- Variables
- func BoostHandler(a api.Boost, permissioned bool) (http.Handler, error)
- func From(typ interface{}) interface{}
- func MonitorShutdown(triggerCh <-chan struct{}, handlers ...ShutdownHandler) <-chan struct{}
- type Option
- func ApplyIf(check func(s *Settings) bool, opts ...Option) Option
- func Base() Option
- func BoostAPI(out *api.Boost) Option
- func ConfigBoost(cfg *config.Boost) Option
- func ConfigCommon(cfg *config.Common) Option
- func Error(err error) Option
- func If(b bool, opts ...Option) Option
- func Options(opts ...Option) Option
- func Override(typ, constructor interface{}) Option
- func Repo(r lotus_repo.Repo) 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) // System processes. InitMemoryWatchdog // health checks CheckFDLimit // libp2p PstoreAddSelfKeysKey StartListeningKey BootstrapKey // filecoin SetGenesisKey RunHelloKey RunChainExchangeKey RunChainGraphsync RunPeerMgrKey HandleIncomingBlocksKey HandleIncomingMessagesKey HandleMigrateClientFundsKey HandlePaymentChannelManagerKey // miner GetParamsKey HandleMigrateProviderFundsKey HandleDealsKey HandleCreateRetrievalTablesKey HandleRetrievalEventsKey HandleRetrievalKey HandleRetrievalTransportsKey HandleProtocolProxyKey RunSectorServiceKey // boost should be started after legacy markets (HandleDealsKey) HandleBoostDealsKey HandleProposalLogCleanerKey // daemon ExtractApiKey HeadMetricsKey SettlePaymentChannelsKey RunPeerTaggerKey SetupFallbackBlockstoresKey SetApiEndpointKey )
Invokes are called in the order they are defined.
Variables ¶
var ( DefaultTransportsKey = special{0} // Libp2p option DiscoveryHandlerKey = special{2} // Private type AddrsFactoryKey = special{3} // Libp2p option SmuxTransportKey = special{4} // Libp2p option RelayKey = special{5} // Libp2p option SecurityKey = special{6} // Libp2p option BaseRoutingKey = special{7} // fx groups + multiret NatPortMapKey = special{8} // Libp2p option ConnectionManagerKey = special{9} // Libp2p option AutoNATSvcKey = special{10} // Libp2p option BandwidthReporterKey = special{11} // Libp2p option ConnGaterKey = special{12} // libp2p option DAGStoreKey = special{13} // constructor returns multiple values ResourceManagerKey = special{14} // Libp2p option )
var Boost boost
var BoostNode = Options( Override(new(sealer.StorageAuth), lotus_modules.StorageAuth), Override(new(lotus_dtypes.MinerAddress), lotus_modules.MinerAddress), Override(new(lotus_dtypes.MinerID), lotus_modules.MinerID), Override(new(lotus_dtypes.NetworkName), lotus_modules.StorageNetworkName), Override(new(*sql.DB), modules.NewBoostDB), Override(new(*modules.LogSqlDB), modules.NewLogsSqlDB), Override(new(*modules.RetrievalSqlDB), modules.NewRetrievalSqlDB), Override(HandleCreateRetrievalTablesKey, modules.CreateRetrievalTables), Override(new(*db.DealsDB), modules.NewDealsDB), Override(new(*db.LogsDB), modules.NewLogsDB), Override(new(*db.ProposalLogsDB), modules.NewProposalLogsDB), Override(new(*db.FundsDB), modules.NewFundsDB), Override(new(*rtvllog.RetrievalLogDB), modules.NewRetrievalLogDB), )
var LibP2P = Options( Override(new(lotus_dtypes.Bootstrapper), lotus_dtypes.Bootstrapper(false)), Override(new(peerstore.Peerstore), func() (peerstore.Peerstore, error) { return pstoremem.NewPeerstore() }), Override(PstoreAddSelfKeysKey, lotus_lp2p.PstoreAddSelfKeys), Override(StartListeningKey, lotus_lp2p.StartListening([]string{"/ip4/127.0.0.1/tcp/1899"})), Override(DefaultTransportsKey, lotus_lp2p.DefaultTransports), Override(AddrsFactoryKey, lotus_lp2p.AddrsFactory(nil, nil)), Override(SmuxTransportKey, lotus_lp2p.SmuxTransport()), Override(RelayKey, lotus_lp2p.NoRelay()), Override(SecurityKey, lotus_lp2p.Security(true, false)), Override(new(lotus_lp2p.RawHost), lotus_lp2p.Host), Override(new(host.Host), lotus_lp2p.RoutedHost), Override(new(lotus_lp2p.BaseIpfsRouting), lotus_lp2p.DHTRouting(dht.ModeAuto)), Override(DiscoveryHandlerKey, lotus_lp2p.DiscoveryHandler), Override(new(record.Validator), modules.RecordValidator), Override(BaseRoutingKey, lotus_lp2p.BaseRouting), Override(new(routing.Routing), lotus_lp2p.Routing), Override(BandwidthReporterKey, lotus_lp2p.BandwidthCounter), Override(AutoNATSvcKey, lotus_lp2p.AutoNATService), Override(new(*lotus_dtypes.ScoreKeeper), lotus_lp2p.ScoreKeeper), Override(new(*pubsub.PubSub), lotus_lp2p.GossipSub), Override(new(*lotus_config.Pubsub), func(bs lotus_dtypes.Bootstrapper) *lotus_config.Pubsub { return &lotus_config.Pubsub{ Bootstrapper: bool(bs), } }), Override(ConnectionManagerKey, lotus_lp2p.ConnectionManager(50, 200, 20*time.Second, nil)), Override(new(*conngater.BasicConnectionGater), lotus_lp2p.ConnGater), Override(ConnGaterKey, lotus_lp2p.ConnGaterOption), )
Functions ¶
func BoostHandler ¶
BoostHandler returns a boost service 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 ConfigBoost ¶
func ConfigCommon ¶
Config sets up constructors based on the provided Config
func Override ¶
func Override(typ, constructor interface{}) Option
Override option changes constructor for a given type
func Repo ¶
func Repo(r lotus_repo.Repo) 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.