mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 17:36:38 +08:00
added ledger file
This commit is contained in:
@ -21,31 +21,6 @@ const PartnerWantListMax = 10
|
|||||||
// access/lookups.
|
// access/lookups.
|
||||||
type KeySet map[u.Key]struct{}
|
type KeySet map[u.Key]struct{}
|
||||||
|
|
||||||
// Ledger stores the data exchange relationship between two peers.
|
|
||||||
type Ledger struct {
|
|
||||||
|
|
||||||
// Partner is the ID of the remote Peer.
|
|
||||||
Partner peer.ID
|
|
||||||
|
|
||||||
// BytesSent counts the number of bytes the local peer sent to Partner
|
|
||||||
BytesSent uint64
|
|
||||||
|
|
||||||
// BytesReceived counts the number of bytes local peer received from Partner
|
|
||||||
BytesReceived uint64
|
|
||||||
|
|
||||||
// FirstExchnage is the time of the first data exchange.
|
|
||||||
FirstExchange *time.Time
|
|
||||||
|
|
||||||
// LastExchange is the time of the last data exchange.
|
|
||||||
LastExchange *time.Time
|
|
||||||
|
|
||||||
// WantList is a (bounded, small) set of keys that Partner desires.
|
|
||||||
WantList KeySet
|
|
||||||
}
|
|
||||||
|
|
||||||
// LedgerMap lists Ledgers by their Partner key.
|
|
||||||
type LedgerMap map[u.Key]*Ledger
|
|
||||||
|
|
||||||
// BitSwap instances implement the bitswap protocol.
|
// BitSwap instances implement the bitswap protocol.
|
||||||
type BitSwap struct {
|
type BitSwap struct {
|
||||||
// peer is the identity of this (local) node.
|
// peer is the identity of this (local) node.
|
||||||
|
33
bitswap/ledger.go
Normal file
33
bitswap/ledger.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package bitswap
|
||||||
|
|
||||||
|
import (
|
||||||
|
peer "github.com/jbenet/go-ipfs/peer"
|
||||||
|
u "github.com/jbenet/go-ipfs/util"
|
||||||
|
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Ledger stores the data exchange relationship between two peers.
|
||||||
|
type Ledger struct {
|
||||||
|
|
||||||
|
// Partner is the ID of the remote Peer.
|
||||||
|
Partner peer.ID
|
||||||
|
|
||||||
|
// BytesSent counts the number of bytes the local peer sent to Partner
|
||||||
|
BytesSent uint64
|
||||||
|
|
||||||
|
// BytesReceived counts the number of bytes local peer received from Partner
|
||||||
|
BytesReceived uint64
|
||||||
|
|
||||||
|
// FirstExchnage is the time of the first data exchange.
|
||||||
|
FirstExchange *time.Time
|
||||||
|
|
||||||
|
// LastExchange is the time of the last data exchange.
|
||||||
|
LastExchange *time.Time
|
||||||
|
|
||||||
|
// WantList is a (bounded, small) set of keys that Partner desires.
|
||||||
|
WantList KeySet
|
||||||
|
}
|
||||||
|
|
||||||
|
// LedgerMap lists Ledgers by their Partner key.
|
||||||
|
type LedgerMap map[u.Key]*Ledger
|
Reference in New Issue
Block a user