From d124aec39f0e346b67434795b433797528084a57 Mon Sep 17 00:00:00 2001 From: Meng-Ying Yang Date: Thu, 27 Dec 2018 19:22:41 +0800 Subject: indexer: support data exporting/forwarding (#103) To support more effective and flexible blockchain info exploring, we add `indexer` package, defines the flow of indexer dameon, and integrate into dex.Dexon fullnode. For more export options, we use Golang built-in `plugin` package to support mulitple implementations. --- cmd/utils/flags.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'cmd/utils') diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index da820a544..ee5a3be6d 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -643,6 +643,17 @@ var ( Usage: "External EVM configuration (default = built-in interpreter)", Value: "", } + + // Data sources options. + IndexerEnableFlag = cli.BoolFlag{ + Name: "indexer", + Usage: "Enable indexer", + } + IndexerPluginFlag = cli.StringFlag{ + Name: "indexer.plugin", + Usage: "External indexer plugin shared object path", + Value: "", + } ) // MakeDataDir retrieves the currently requested data directory, terminating @@ -1274,6 +1285,18 @@ func SetDexConfig(ctx *cli.Context, stack *node.Node, cfg *dex.Config) { now.Hour(), now.Minute(), (now.Second()/5+1)*5, 0, now.Location()).Unix() } + + // Set indexer config. + setIndexerConfig(ctx, cfg) +} + +func setIndexerConfig(ctx *cli.Context, cfg *dex.Config) { + cfg.Indexer.Enable = ctx.GlobalBool(IndexerEnableFlag.Name) + if !cfg.Indexer.Enable { + return + } + + cfg.Indexer.Plugin = ctx.GlobalString(IndexerPluginFlag.Name) } // SetDashboardConfig applies dashboard related command line flags to the config. -- cgit v1.2.3