aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorMeng-Ying Yang <garfield@dexon.org>2018-12-27 19:22:41 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:20 +0800
commit9da899a81e8c8e564fce464de77f6566dd818c2f (patch)
tree4fc1149be97de3c8a577247659d159a65f0fa921 /cmd
parent980e57e46f0c7b29357baf31447871abff8192d6 (diff)
downloadgo-tangerine-9da899a81e8c8e564fce464de77f6566dd818c2f.tar.gz
go-tangerine-9da899a81e8c8e564fce464de77f6566dd818c2f.tar.zst
go-tangerine-9da899a81e8c8e564fce464de77f6566dd818c2f.zip
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.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gdex/main.go2
-rw-r--r--cmd/gdex/usage.go7
-rw-r--r--cmd/utils/flags.go23
3 files changed, 32 insertions, 0 deletions
diff --git a/cmd/gdex/main.go b/cmd/gdex/main.go
index 9a1ef7bc9..c054e3ad5 100644
--- a/cmd/gdex/main.go
+++ b/cmd/gdex/main.go
@@ -137,6 +137,8 @@ var (
utils.GpoPercentileFlag,
utils.EWASMInterpreterFlag,
utils.EVMInterpreterFlag,
+ utils.IndexerEnableFlag,
+ utils.IndexerPluginFlag,
configFileFlag,
}
diff --git a/cmd/gdex/usage.go b/cmd/gdex/usage.go
index d67817096..880e447f3 100644
--- a/cmd/gdex/usage.go
+++ b/cmd/gdex/usage.go
@@ -240,6 +240,13 @@ var AppHelpFlagGroups = []flagGroup{
},
},
{
+ Name: "INDEXER",
+ Flags: []cli.Flag{
+ utils.IndexerEnableFlag,
+ utils.IndexerPluginFlag,
+ },
+ },
+ {
Name: "WHISPER (EXPERIMENTAL)",
Flags: whisperFlags,
},
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 971ccd349..96a642850 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -648,6 +648,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
@@ -1282,6 +1293,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.