func Online() Option {
	return Options(
		// make sure that online is applied before Config.
		// This is important because Config overrides some of Online units
		func(s *Settings) error { s.Online = true; return nil },
		ApplyIf(func(s *Settings) bool { return s.Config },
			Error(errors.New("the Online option must be set before Config option")),
		),

		libp2p(),

		// common

		// Full node

		ApplyIf(isType(repo.FullNode),
			// TODO: Fix offline mode

			Override(new(dtypes.BootstrapPeers), modules.BuiltinBootstrap),

			Override(HandleIncomingMessagesKey, modules.HandleIncomingMessages),

			Override(new(*store.ChainStore), modules.ChainStore),
			Override(new(*stmgr.StateManager), stmgr.NewStateManager),
			Override(new(*wallet.Wallet), wallet.NewWallet),

			Override(new(dtypes.ChainGCLocker), blockstore.NewGCLocker),
			Override(new(dtypes.ChainGCBlockstore), modules.ChainGCBlockstore),
			Override(new(dtypes.ChainExchange), modules.ChainExchange),
			Override(new(dtypes.ChainBlockService), modules.ChainBlockservice),
			Override(new(dtypes.ClientDAG), testing.MemoryClientDag),

			// Filecoin services
			Override(new(*chain.Syncer), modules.NewSyncer),
			Override(new(*blocksync.BlockSync), blocksync.NewBlockSyncClient),
			Override(new(*messagepool.MessagePool), modules.MessagePool),

			Override(new(modules.Genesis), modules.ErrorGenesis),
			Override(SetGenesisKey, modules.SetGenesis),

			Override(new(*hello.Service), hello.NewHelloService),
			Override(new(*blocksync.BlockSyncService), blocksync.NewBlockSyncService),
			Override(new(*peermgr.PeerMgr), peermgr.NewPeerMgr),

			Override(RunHelloKey, modules.RunHello),
			Override(RunBlockSyncKey, modules.RunBlockSync),
			Override(RunPeerMgrKey, modules.RunPeerMgr),
			Override(HandleIncomingBlocksKey, modules.HandleIncomingBlocks),

			Override(new(*discovery.Local), discovery.NewLocal),
			Override(new(discovery.PeerResolver), modules.RetrievalResolver),

			Override(new(*retrieval.Client), retrieval.NewClient),
			Override(new(dtypes.ClientDealStore), modules.NewClientDealStore),
			Override(new(dtypes.ClientDataTransfer), modules.NewClientDAGServiceDataTransfer),
			Override(new(*deals.ClientRequestValidator), deals.NewClientRequestValidator),
			Override(new(*deals.Client), deals.NewClient),
			Override(RegisterClientValidatorKey, modules.RegisterClientValidator),
			Override(RunDealClientKey, modules.RunDealClient),

			Override(new(*paych.Store), paych.NewStore),
			Override(new(*paych.Manager), paych.NewManager),
			Override(new(*market.FundMgr), market.NewFundMgr),
		),

		// Storage miner
		ApplyIf(func(s *Settings) bool { return s.nodeType == repo.StorageMiner },
			Override(new(*sectorbuilder.SectorBuilder), modules.SectorBuilder),
			Override(new(*sectorblocks.SectorBlocks), sectorblocks.NewSectorBlocks),
			Override(new(storage.TicketFn), modules.SealTicketGen),
			Override(new(*storage.Miner), modules.StorageMiner),

			Override(new(dtypes.StagingDAG), modules.StagingDAG),

			Override(new(*retrieval.Miner), retrieval.NewMiner),
			Override(new(dtypes.ProviderDealStore), modules.NewProviderDealStore),
			Override(new(dtypes.ProviderDataTransfer), modules.NewProviderDAGServiceDataTransfer),
			Override(new(*deals.ProviderRequestValidator), deals.NewProviderRequestValidator),
			Override(new(*deals.Provider), deals.NewProvider),
			Override(RegisterProviderValidatorKey, modules.RegisterProviderValidator),
			Override(HandleRetrievalKey, modules.HandleRetrieval),
			Override(GetParamsKey, modules.GetParams),
			Override(HandleDealsKey, modules.HandleDeals),
			Override(new(gen.ElectionPoStProver), storage.NewElectionPoStProver),
			Override(new(*miner.Miner), modules.SetupBlockProducer),
		),
	)
}
// Online sets up basic libp2p node
Online sets up basic libp2p node
// Online sets up basic libp2p node
func Online() Option {
	return Options(
		func(s *Settings) error { s.Online = true; return nil },
		ApplyIf(func(s *Settings) bool { return s.Config },
			Error(errors.New("the Online option must be set before Config option")),
		),
		libp2p(),
		ApplyIf(isType(repo.FullNode),
			Override(new(dtypes.BootstrapPeers), modules.BuiltinBootstrap),
			Override(HandleIncomingMessagesKey, modules.HandleIncomingMessages),
			Override(new(*store.ChainStore), modules.ChainStore),
			Override(new(*stmgr.StateManager), stmgr.NewStateManager),
			Override(new(*wallet.Wallet), wallet.NewWallet),
			Override(new(dtypes.ChainGCLocker), blockstore.NewGCLocker),
			Override(new(dtypes.ChainGCBlockstore), modules.ChainGCBlockstore),
			Override(new(dtypes.ChainExchange), modules.ChainExchange),
			Override(new(dtypes.ChainBlockService), modules.ChainBlockservice),
			Override(new(dtypes.ClientDAG), testing.MemoryClientDag),
			Override(new(*chain.Syncer), modules.NewSyncer),
			Override(new(*blocksync.BlockSync), blocksync.NewBlockSyncClient),
			Override(new(*messagepool.MessagePool), modules.MessagePool),
			Override(new(modules.Genesis), modules.ErrorGenesis),
			Override(SetGenesisKey, modules.SetGenesis),
			Override(new(*hello.Service), hello.NewHelloService),
			Override(new(*blocksync.BlockSyncService), blocksync.NewBlockSyncService),
			Override(new(*peermgr.PeerMgr), peermgr.NewPeerMgr),
			Override(RunHelloKey, modules.RunHello),
			Override(RunBlockSyncKey, modules.RunBlockSync),
			Override(RunPeerMgrKey, modules.RunPeerMgr),
			Override(HandleIncomingBlocksKey, modules.HandleIncomingBlocks),
			Override(new(*discovery.Local), discovery.NewLocal),
			Override(new(discovery.PeerResolver), modules.RetrievalResolver),
			Override(new(*retrieval.Client), retrieval.NewClient),
			Override(new(dtypes.ClientDealStore), modules.NewClientDealStore),
			Override(new(dtypes.ClientDataTransfer), modules.NewClientDAGServiceDataTransfer),
			Override(new(*deals.ClientRequestValidator), deals.NewClientRequestValidator),
			Override(new(*deals.Client), deals.NewClient),
			Override(RegisterClientValidatorKey, modules.RegisterClientValidator),
			Override(RunDealClientKey, modules.RunDealClient),
			Override(new(*paych.Store), paych.NewStore),
			Override(new(*paych.Manager), paych.NewManager),
			Override(new(*market.FundMgr), market.NewFundMgr),
		),
		ApplyIf(func(s *Settings) bool { return s.nodeType == repo.StorageMiner },
			Override(new(*sectorbuilder.SectorBuilder), modules.SectorBuilder),
			Override(new(*sectorblocks.SectorBlocks), sectorblocks.NewSectorBlocks),
			Override(new(storage.TicketFn), modules.SealTicketGen),
			Override(new(*storage.Miner), modules.StorageMiner),
			Override(new(dtypes.StagingDAG), modules.StagingDAG),
			Override(new(*retrieval.Miner), retrieval.NewMiner),
			Override(new(dtypes.ProviderDealStore), modules.NewProviderDealStore),
			Override(new(dtypes.ProviderDataTransfer), modules.NewProviderDAGServiceDataTransfer),
			Override(new(*deals.ProviderRequestValidator), deals.NewProviderRequestValidator),
			Override(new(*deals.Provider), deals.NewProvider),
			Override(RegisterProviderValidatorKey, modules.RegisterProviderValidator),
			Override(HandleRetrievalKey, modules.HandleRetrieval),
			Override(GetParamsKey, modules.GetParams),
			Override(HandleDealsKey, modules.HandleDeals),
			Override(new(gen.ElectionPoStProver), storage.NewElectionPoStProver),
			Override(new(*miner.Miner), modules.SetupBlockProducer),
		),
	)
}
func Online ( ) Option { return Options ( func ( s * Settings ) error { s . Online = true ; return nil } , ApplyIf ( func ( s * Settings ) bool { return s . Config } , Error ( errors . New ( " " ) ) , ) , libp2p ( ) , ApplyIf ( isType ( repo . FullNode ) , Override ( new ( dtypes . BootstrapPeers ) , modules . BuiltinBootstrap ) , Override ( HandleIncomingMessagesKey , modules . HandleIncomingMessages ) , Override ( new ( * store . ChainStore ) , modules . ChainStore ) , Override ( new ( * stmgr . StateManager ) , stmgr . NewStateManager ) , Override ( new ( * wallet . Wallet ) , wallet . NewWallet ) , Override ( new ( dtypes . ChainGCLocker ) , blockstore . NewGCLocker ) , Override ( new ( dtypes . ChainGCBlockstore ) , modules . ChainGCBlockstore ) , Override ( new ( dtypes . ChainExchange ) , modules . ChainExchange ) , Override ( new ( dtypes . ChainBlockService ) , modules . ChainBlockservice ) , Override ( new ( dtypes . ClientDAG ) , testing . MemoryClientDag ) , Override ( new ( * chain . Syncer ) , modules . NewSyncer ) , Override ( new ( * blocksync . BlockSync ) , blocksync . NewBlockSyncClient ) , Override ( new ( * messagepool . MessagePool ) , modules . MessagePool ) , Override ( new ( modules . Genesis ) , modules . ErrorGenesis ) , Override ( SetGenesisKey , modules . SetGenesis ) , Override ( new ( * hello . Service ) , hello . NewHelloService ) , Override ( new ( * blocksync . BlockSyncService ) , blocksync . NewBlockSyncService ) , Override ( new ( * peermgr . PeerMgr ) , peermgr . NewPeerMgr ) , Override ( RunHelloKey , modules . RunHello ) , Override ( RunBlockSyncKey , modules . RunBlockSync ) , Override ( RunPeerMgrKey , modules . RunPeerMgr ) , Override ( HandleIncomingBlocksKey , modules . HandleIncomingBlocks ) , Override ( new ( * discovery . Local ) , discovery . NewLocal ) , Override ( new ( discovery . PeerResolver ) , modules . RetrievalResolver ) , Override ( new ( * retrieval . Client ) , retrieval . NewClient ) , Override ( new ( dtypes . ClientDealStore ) , modules . NewClientDealStore ) , Override ( new ( dtypes . ClientDataTransfer ) , modules . NewClientDAGServiceDataTransfer ) , Override ( new ( * deals . ClientRequestValidator ) , deals . NewClientRequestValidator ) , Override ( new ( * deals . Client ) , deals . NewClient ) , Override ( RegisterClientValidatorKey , modules . RegisterClientValidator ) , Override ( RunDealClientKey , modules . RunDealClient ) , Override ( new ( * paych . Store ) , paych . NewStore ) , Override ( new ( * paych . Manager ) , paych . NewManager ) , Override ( new ( * market . FundMgr ) , market . NewFundMgr ) , ) , ApplyIf ( func ( s * Settings ) bool { return s . nodeType == repo . StorageMiner } , Override ( new ( * sectorbuilder . SectorBuilder ) , modules . SectorBuilder ) , Override ( new ( * sectorblocks . SectorBlocks ) , sectorblocks . NewSectorBlocks ) , Override ( new ( storage . TicketFn ) , modules . SealTicketGen ) , Override ( new ( * storage . Miner ) , modules . StorageMiner ) , Override ( new ( dtypes . StagingDAG ) , modules . StagingDAG ) , Override ( new ( * retrieval . Miner ) , retrieval . NewMiner ) , Override ( new ( dtypes . ProviderDealStore ) , modules . NewProviderDealStore ) , Override ( new ( dtypes . ProviderDataTransfer ) , modules . NewProviderDAGServiceDataTransfer ) , Override ( new ( * deals . ProviderRequestValidator ) , deals . NewProviderRequestValidator ) , Override ( new ( * deals . Provider ) , deals . NewProvider ) , Override ( RegisterProviderValidatorKey , modules . RegisterProviderValidator ) , Override ( HandleRetrievalKey , modules . HandleRetrieval ) , Override ( GetParamsKey , modules . GetParams ) , Override ( HandleDealsKey , modules . HandleDeals ) , Override ( new ( gen . ElectionPoStProver ) , storage . NewElectionPoStProver ) , Override ( new ( * miner . Miner ) , modules . SetupBlockProducer ) , ) , ) }
Online sets up basic libp2p node
Online sets up basic libp2p node
// make sure that online is applied before Config. // This is important because Config overrides some of Online units // common // Full node // TODO: Fix offline mode // Filecoin services // Storage miner