-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #312 from bloxapp/stage
- Add metrics (#307) - fix validator status (#308) - Add pubsub tracing (#311) - update grafana dashboards
- Loading branch information
Showing
34 changed files
with
2,573 additions
and
647 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package ibft | ||
|
||
import "sync" | ||
|
||
// TODO: add to ibft package as most of parts here are code duplicates | ||
// tests should be added as well, currently it would cause redundant maintenance | ||
|
||
var ( | ||
decidedReaders sync.Map | ||
networkReaders sync.Map | ||
) | ||
|
||
// Reader is an interface for ibft in the context of an exporter | ||
type Reader interface { | ||
Start() error | ||
} | ||
|
||
// Syncer is an interface for syncing data | ||
type Syncer interface { | ||
Sync() error | ||
} | ||
|
||
// SyncRead reads and sync data | ||
type SyncRead interface { | ||
Reader | ||
Syncer | ||
} | ||
|
||
// NewNetworkReader factory to create network readers | ||
func NewNetworkReader(o IncomingMsgsReaderOptions) Reader { | ||
pk := o.PK.SerializeToHexStr() | ||
r, exist := networkReaders.Load(pk) | ||
if !exist { | ||
reader := newIncomingMsgsReader(o) | ||
networkReaders.Store(pk, reader) | ||
return reader | ||
} | ||
return r.(*incomingMsgsReader) | ||
} | ||
|
||
// NewDecidedReader factory to create decided readers | ||
func NewDecidedReader(o DecidedReaderOptions) SyncRead { | ||
pk := o.ValidatorShare.PublicKey.SerializeToHexStr() | ||
r, exist := decidedReaders.Load(pk) | ||
if !exist { | ||
reader := newDecidedReader(o) | ||
decidedReaders.Store(pk, reader) | ||
return reader | ||
} | ||
return r.(*decidedReader) | ||
} |
Oops, something went wrong.