Commit ba93cb36 authored by Aarsh Shah's avatar Aarsh Shah

added a fnc to get all buckets

parent ae212638
......@@ -24,7 +24,7 @@ func newBucket() *Bucket {
return b
}
func (b *Bucket) GetLastQueriedAt() time.Time {
func (b *Bucket) LastQueriedAt() time.Time {
b.lastQueriedAtLk.RLock()
defer b.lastQueriedAtLk.RUnlock()
......
......@@ -24,7 +24,6 @@ var ErrGenRandPeerIDFailed = errors.New("failed to generate random peerID in buc
// RoutingTable defines the routing table.
type RoutingTable struct {
// ID of the local peer
local ID
......@@ -61,6 +60,12 @@ func NewRoutingTable(bucketsize int, localID ID, latency time.Duration, m peerst
return rt
}
func (rt *RoutingTable) GetAllBuckets() []*Bucket {
rt.tabLock.RLock()
defer rt.tabLock.RUnlock()
return rt.Buckets
}
func (rt *RoutingTable) GenRandPeerID(bucketID int) (peer.ID, error) {
rt.tabLock.RLock()
bucketLen := len(rt.Buckets)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment