aboutsummaryrefslogtreecommitdiffstats
path: root/indexer/interfaces.go
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 /indexer/interfaces.go
parent980e57e46f0c7b29357baf31447871abff8192d6 (diff)
downloadgo-tangerine-9da899a81e8c8e564fce464de77f6566dd818c2f.tar
go-tangerine-9da899a81e8c8e564fce464de77f6566dd818c2f.tar.gz
go-tangerine-9da899a81e8c8e564fce464de77f6566dd818c2f.tar.bz2
go-tangerine-9da899a81e8c8e564fce464de77f6566dd818c2f.tar.lz
go-tangerine-9da899a81e8c8e564fce464de77f6566dd818c2f.tar.xz
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 'indexer/interfaces.go')
-rw-r--r--indexer/interfaces.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/indexer/interfaces.go b/indexer/interfaces.go
new file mode 100644
index 000000000..f35bc6547
--- /dev/null
+++ b/indexer/interfaces.go
@@ -0,0 +1,19 @@
+package indexer
+
+// NewIndexerFuncName plugin looks up name.
+var NewIndexerFuncName = "NewIndexer"
+
+// NewIndexerFunc init function alias.
+type NewIndexerFunc = func(ReadOnlyBlockChain, Config) Indexer
+
+// Indexer defines indexer daemon interface. The daemon would hold a
+// core.Blockhain, passed by initialization function, to receiving latest block
+// event or other information query and interaction.
+type Indexer interface {
+ // Start is called by dex.Dexon if config is set.
+ Start() error
+
+ // Stop is called by dex.Dexon if config is set and procedure is
+ // terminating.
+ Stop() error
+}