peerstatus

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package peerstatus is a threadsafe global cache to store recent peer status messages for access across multiple services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear()

Clear the cache. This method should only be used for tests.

func Count

func Count() int

Count of peer statuses in cache. Threadsafe.

func Delete

func Delete(pid peer.ID)

Delete peer status from cache. Threadsafe.

func FailureCount

func FailureCount(pid peer.ID) int

FailureCount returns the failure count for the particular peer.

func Get

func Get(pid peer.ID) *pb.Status

Get most recent status from peer in cache. Threadsafe.

func IncreaseFailureCount

func IncreaseFailureCount(pid peer.ID)

IncreaseFailureCount increases the failure count for the particular peer.

func IsBadPeer

func IsBadPeer(pid peer.ID) bool

IsBadPeer checks whether the given peer has exceeded the number of bad handshakes threshold.

func Keys

func Keys() []peer.ID

Keys is the list of peer IDs which status exists. Threadsafe.

func LastUpdated

func LastUpdated(pid peer.ID) time.Time

LastUpdated time which the status was set for the given peer. Threadsafe.

func Set

func Set(pid peer.ID, status *pb.Status)

Set most recent status from peer in cache. Threadsafe.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL