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

Commit

Permalink
rename network.Stat to Stats, introduce ConnStats (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Dec 12, 2021
1 parent 975f71b commit ed7a5ab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion network/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ type ConnMultiaddrs interface {
// ConnStat is an interface mixin for connection types that provide connection statistics.
type ConnStat interface {
// Stat stores metadata pertaining to this conn.
Stat() Stat
Stat() ConnStats
}
11 changes: 9 additions & 2 deletions network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,15 @@ func (r Reachability) String() string {
return str[r]
}

// Stat stores metadata pertaining to a given Stream/Conn.
type Stat struct {
// ConnStats stores metadata pertaining to a given Conn.
type ConnStats struct {
Stats
// NumStreams is the number of streams on the connection.
NumStreams int
}

// Stats stores metadata pertaining to a given Stream / Conn.
type Stats struct {
// Direction specifies whether this is an inbound or an outbound connection.
Direction Direction
// Opened is the timestamp when this connection was opened.
Expand Down
2 changes: 1 addition & 1 deletion network/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Stream interface {
SetProtocol(id protocol.ID)

// Stat returns metadata pertaining to this stream.
Stat() Stat
Stat() Stats

// Conn returns the connection this stream is part of.
Conn() Conn
Expand Down

0 comments on commit ed7a5ab

Please sign in to comment.