fcrpeermgr

package
v0.0.0-...-7a4b066 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Overview

Package fcrpeermgr - peer manager manages all retrieval peers.

Package fcrpeermgr - peer manager manages all retrieval peers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FCRPeerMgr

type FCRPeerMgr interface {
	// Start starts the manager's routine.
	Start() error

	// Shutdown ends the manager's routine safely.
	Shutdown()

	// Sync forces the manager to do a sync to the register.
	Sync()

	// SyncGW forces the manager to do a quick sync to the register for a specific gateway.
	SyncGW(gwID string) *Peer

	// SyncPVD forces the manager to do a quick sync to the register for a specific provider.
	SyncPVD(pvdID string) *Peer

	// GetGWInfo gets the data of a gateway, it queries the local storage, rather than the remote register.
	GetGWInfo(gwID string) *Peer

	// GetPVDInfo gets the data of a provider, it queries the local storage rather than the remote register.
	GetPVDInfo(pvdID string) *Peer

	// ListGWS lists all the gateways
	ListGWS() []Peer

	// GetGWSNearCID gets 16 gateways that are near given CID. Called only by gateways.
	GetGWSNearCIDHash(hash string, numDHT int, except string) []Peer

	// GetCurrentCIDHashRange gets the cid min hash and cid max hash that a gateway should store based on current network. Called only by gateways.
	GetCurrentCIDHashRange() (string, string)
}

FCRPeerMgr represents the manager that manages all peers.

func NewFCRPeerMgrImplV1

func NewFCRPeerMgrImplV1(registerMgr fcrregistermgr.FCRRegisterMgr, reputationMgr fcrreputationmgr.FCRReputationMgr, gatewayDiscv bool, providerDiscv bool, trackCIDRange bool, trackAnchor string, refreshDuration time.Duration) FCRPeerMgr

type FCRPeerMgrImplV1

type FCRPeerMgrImplV1 struct {
	// contains filtered or unexported fields
}

FCRPeerMgrImplV1 implements FCRPeerMgr, it is an in-memory version.

func (*FCRPeerMgrImplV1) GetCurrentCIDHashRange

func (mgr *FCRPeerMgrImplV1) GetCurrentCIDHashRange() (string, string)

func (*FCRPeerMgrImplV1) GetGWInfo

func (mgr *FCRPeerMgrImplV1) GetGWInfo(gwID string) *Peer

func (*FCRPeerMgrImplV1) GetGWSNearCIDHash

func (mgr *FCRPeerMgrImplV1) GetGWSNearCIDHash(hash string, numDHT int, except string) []Peer

func (*FCRPeerMgrImplV1) GetPVDInfo

func (mgr *FCRPeerMgrImplV1) GetPVDInfo(pvdID string) *Peer

func (*FCRPeerMgrImplV1) ListGWS

func (mgr *FCRPeerMgrImplV1) ListGWS() []Peer

func (*FCRPeerMgrImplV1) Shutdown

func (mgr *FCRPeerMgrImplV1) Shutdown()

func (*FCRPeerMgrImplV1) Start

func (mgr *FCRPeerMgrImplV1) Start() error

func (*FCRPeerMgrImplV1) Sync

func (mgr *FCRPeerMgrImplV1) Sync()

func (*FCRPeerMgrImplV1) SyncGW

func (mgr *FCRPeerMgrImplV1) SyncGW(gwID string) *Peer

func (*FCRPeerMgrImplV1) SyncPVD

func (mgr *FCRPeerMgrImplV1) SyncPVD(pvdID string) *Peer

type Peer

type Peer struct {
	// RootKey is the peer's public key,
	// and can be used to derive the filecoin wallet address for payment.
	// It is a 65 bytes hex string.
	RootKey string

	// NodeID is derived from the root key, it is set by the smart contract.
	// It is a 32 bytes hex string.
	NodeID string

	// MsgSigningKey is the message signing public key.
	MsgSigningKey string

	// MsgSigningKeyVer is the message signing public key version.
	MsgSigningKeyVer byte

	// OfferSigningKey is the offer signing public key.
	// It is a 32 bytes hex string. Empty for gateway peer.
	OfferSigningKey string

	// RegionCode is the region code of this peer.
	RegionCode string

	// NetworkAddr is the network address of this peer.
	NetworkAddr string

	// Deregistering indicates whether or not this peer is in the middle of deregistering itself.
	Deregistering bool

	// DeregisteringHeight is the height of the block which contains the deregistering transaction.
	DeregisteringHeight uint64
}

Peer represents a peer in the system.

Jump to

Keyboard shortcuts

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