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

return a ConnectionStat instead of a Stat for the Conn #224

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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() ConnectionStat
}
9 changes: 8 additions & 1 deletion network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,14 @@ func (r Reachability) String() string {
return str[r]
}

// Stat stores metadata pertaining to a given Stream/Conn.
// ConnectionStat stores metadata pertaining to a given Conn.
type ConnectionStat struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it ConnStat for consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to, but ConnStat is already the 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
// NumStreams is the number of streams on the connection.
NumStreams int
}

// Stat stores metadata pertaining to a given Stream / Conn.
type Stat struct {
// Direction specifies whether this is an inbound or an outbound connection.
Direction Direction
Expand Down