Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Introspection types for core #107

Merged
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ require (
github.com/btcsuite/btcd v0.20.1-beta
github.com/coreos/go-semver v0.3.0
github.com/gogo/protobuf v1.3.1
github.com/golang/protobuf v1.3.2
github.com/ipfs/go-cid v0.0.4
github.com/jbenet/goprocess v0.1.3
github.com/libp2p/go-flow-metrics v0.0.3
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/gxed/hashland/keccakpg v0.0.1 h1:wrk3uMNaMxbXiHibbPO4S0ymqJMm41WiudyFSs7UnsU=
Expand Down
2 changes: 2 additions & 0 deletions introspection/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
protoc:
protoc --go_out=. ./introspection.proto
19 changes: 19 additions & 0 deletions introspection/introspection.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package introspection

// ProtoVersion is the current version of the Proto
const ProtoVersion uint32 = 1

// IntrospectorRegistry allows other sub-systems/modules to register metrics/data providers.
type IntrospectorRegistry interface {
// RegisterProviders allows a subsystem to register itself as a provider of metrics.
RegisterProviders(p *ProvidersTree) error
}

// Introspector allows other sub-systems/modules to register metrics/data providers AND also
// enables clients to fetch the current state of the system.
type Introspector interface {
IntrospectorRegistry

// FetchCurrentState fetches the current state of the sub-systems by calling the providers registered by them on the registry.
FetchCurrentState() (*State, error)
}
Loading