Skip to content

Commit

Permalink
(unfinished) config: archive node configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed Mar 9, 2023
1 parent b8dd777 commit 0814e65
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion analyzer/consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type Main struct {
var _ analyzer.Analyzer = (*Main)(nil)

// NewMain returns a new main analyzer for the consensus layer.
func NewMain(nodeCfg config.NodeConfig, cfg *config.BlockBasedAnalyzerConfig, target storage.TargetStorage, logger *log.Logger) (*Main, error) {
func NewMain(nodesCfg config.SourceConfig, cfg *config.BlockBasedAnalyzerConfig, target storage.TargetStorage, logger *log.Logger) (*Main, error) {
ctx := context.Background()

// Initialize source storage.
Expand Down
20 changes: 14 additions & 6 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ func (cfg *Config) Validate() error {

// AnalysisConfig is the configuration for chain analyzers.
type AnalysisConfig struct {
// Node is the configuration for accessing oasis-node.
Node NodeConfig `koanf:"node"`
// Nodes is the configuration for accessing oasis-node.
Nodes SourceConfig `koanf:"nodes"`

// Analyzers is the analyzer configs.
Analyzers AnalyzersList `koanf:"analyzers"`
Expand Down Expand Up @@ -109,12 +109,20 @@ type AnalyzersList struct {
AggregateStats *AggregateStatsConfig `koanf:"aggregate_stats"`
}

// NodeConfig is the configuration for chain analyzers.
type NodeConfig struct {
// ChainID is the chain ID of the chain this analyzer will process.
// SourceConfig is the configuration for chain analyzers.
type SourceConfig struct {
// ChainName is a human-readable name of the chain, e.g. "mainnet", "testnet".
// It is a product concept, not a value formally defined by oasis-node. Technically,
// a "chain" like mainnet is a collection of chain instances (in the oasis-node sense,
// each with its own ChainID) that each superseded the previous one via a
// dump-restore upgrade.
// Used to identify the chain in the database.
ChainID string `koanf:"chain_id"`
ChainName string `koanf:"chain_name"`

Nodes map[string]NodeConfig `koanf:"nodes"`
}

type NodeConfig struct {
// RPC is the node endpoint.
RPC string `koanf:"rpc"`

Expand Down
12 changes: 7 additions & 5 deletions config/docker-dev.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
analysis:
node:
chain_id: oasis-3
rpc: unix:/tmp/node.sock #unix:/node/data/internal.sock
chaincontext: b11b369e0da5bb230b220127f5e7b242d385ef8c6f54906243f30af63c815535
source:
chain_id: mainnet
nodes:
damask:
rpc: unix:/tmp/node.sock #unix:/node/data/internal.sock
chaincontext: b11b369e0da5bb230b220127f5e7b242d385ef8c6f54906243f30af63c815535
analyzers:
metadata_registry:
interval: 1h
Expand All @@ -18,7 +20,7 @@ analysis:
migrations: file://storage/migrations

server:
chain_id: oasis-3
chain_id: mainnet
endpoint: 0.0.0.0:8008
storage:
endpoint: postgresql://rwuser:password@indexer-postgres:5432/indexer?sslmode=disable
Expand Down
12 changes: 7 additions & 5 deletions config/local-dev.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
analysis:
node:
chain_id: oasis-3
rpc: unix:/tmp/node.sock #unix:/node/data/internal.sock
chaincontext: b11b369e0da5bb230b220127f5e7b242d385ef8c6f54906243f30af63c815535
source:
chain_id: mainnet
nodes:
damask:
rpc: unix:/tmp/node.sock #unix:/node/data/internal.sock
chaincontext: b11b369e0da5bb230b220127f5e7b242d385ef8c6f54906243f30af63c815535
analyzers:
metadata_registry:
interval: 1h
Expand All @@ -18,7 +20,7 @@ analysis:
migrations: file://storage/migrations

server:
chain_id: oasis-3
chain_id: mainnet
endpoint: localhost:8008
storage:
endpoint: postgresql://rwuser:password@localhost:5432/indexer?sslmode=disable
Expand Down

0 comments on commit 0814e65

Please sign in to comment.