Documentation ¶
Index ¶
- type ConnectionInfo
- type ContentMatrix
- type DiscoveredNodeMatrix
- type MatrixKeeper
- func (mKeeper *MatrixKeeper) BLEDiscovered(address string)
- func (mKeeper *MatrixKeeper) Close() error
- func (mKeeper *MatrixKeeper) ContentAddProvider(hash string, provider peer.ID)
- func (mKeeper *MatrixKeeper) ContentDownloadFinished(hash string)
- func (mKeeper *MatrixKeeper) ContentDownloadStarted(tag, hash string, size int64)
- func (mKeeper *MatrixKeeper) ContentMatrixSnapshot() map[string]interface{}
- func (mKeeper *MatrixKeeper) Flush() error
- func (mKeeper *MatrixKeeper) GetContentStat(hash string) ContentMatrix
- func (mKeeper *MatrixKeeper) GetNodeStat(address string) DiscoveredNodeMatrix
- func (mKeeper *MatrixKeeper) GetTotalUptime() int64
- func (mKeeper *MatrixKeeper) NewContent(hash string)
- func (mKeeper *MatrixKeeper) NodeConnected(address string)
- func (mKeeper *MatrixKeeper) NodeConnectionFailed(address string)
- func (mKeeper *MatrixKeeper) NodeDisconnected(address string)
- func (mKeeper *MatrixKeeper) NodeMatrixSnapshot() map[string]interface{}
- func (mKeeper *MatrixKeeper) StartTicker(ctx context.Context)
- func (mKeeper *MatrixKeeper) WifiConnected(address string, rssi, speed, freq int)
- type NodeMatrix
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionInfo ¶
type ConnectionInfo struct { BLEDiscoveredAt int64 WifiConnectedAt int64 RSSI int Speed int Frequency int IPFSConnectedAt int64 DisconnectedAt int64 }
ConnectionInfo keeps d2d connection info
type ContentMatrix ¶
type ContentMatrix struct { Tag string Size int64 AvgSpeed float32 DownloadStartedAt int64 DownloadFinishedAt int64 ProvidedBy []peer.ID }
ContentMatrix keeps record for each hash
type DiscoveredNodeMatrix ¶
type DiscoveredNodeMatrix struct { ConnectionAlive bool ConnectionSuccessCount int ConnectionFailureCount int LastSuccessfulConnectionDuration int64 BLEDiscoveredAt int64 WifiConnectedAt int64 RSSI int Speed int Frequency int IPFSConnectedAt int64 DiscoveryDelays []int64 // from BLE Discovery to ipfs Connection ConnectionHistory []ConnectionInfo }
DiscoveredNodeMatrix keeps record for each discovered node
type MatrixKeeper ¶
type MatrixKeeper struct { NodeMatrix *NodeMatrix ContentMatrix map[string]*ContentMatrix // contains filtered or unexported fields }
MatrixKeeper takes care of entire node matrix
func NewMatrixKeeper ¶
func NewMatrixKeeper(ds datastore.Datastore) *MatrixKeeper
NewMatrixKeeper creates a new matrix keeper
func (*MatrixKeeper) BLEDiscovered ¶
func (mKeeper *MatrixKeeper) BLEDiscovered(address string)
BLEDiscovered updates BLE connectivity info with another node
func (*MatrixKeeper) Close ¶
func (mKeeper *MatrixKeeper) Close() error
Close stops the ticker job and flushes matrix
func (*MatrixKeeper) ContentAddProvider ¶
func (mKeeper *MatrixKeeper) ContentAddProvider(hash string, provider peer.ID)
ContentAddProvider updates content providers of a hash
func (*MatrixKeeper) ContentDownloadFinished ¶
func (mKeeper *MatrixKeeper) ContentDownloadFinished(hash string)
ContentDownloadFinished updates content download finished time of a hash
func (*MatrixKeeper) ContentDownloadStarted ¶
func (mKeeper *MatrixKeeper) ContentDownloadStarted(tag, hash string, size int64)
ContentDownloadStarted updates content download start time of a hash
func (*MatrixKeeper) ContentMatrixSnapshot ¶
func (mKeeper *MatrixKeeper) ContentMatrixSnapshot() map[string]interface{}
ContentMatrixSnapshot returns a snapshot of the content distribution matrix
func (*MatrixKeeper) Flush ¶
func (mKeeper *MatrixKeeper) Flush() error
Flush matrix info into datastore
func (*MatrixKeeper) GetContentStat ¶
func (mKeeper *MatrixKeeper) GetContentStat(hash string) ContentMatrix
GetContentStat returns content info of a given hash
func (*MatrixKeeper) GetNodeStat ¶
func (mKeeper *MatrixKeeper) GetNodeStat(address string) DiscoveredNodeMatrix
GetNodeStat returns node connectivity info of a given node
func (*MatrixKeeper) GetTotalUptime ¶
func (mKeeper *MatrixKeeper) GetTotalUptime() int64
GetTotalUptime returns the total time the node has been running
func (*MatrixKeeper) NewContent ¶ added in v0.0.13
func (mKeeper *MatrixKeeper) NewContent(hash string)
func (*MatrixKeeper) NodeConnected ¶
func (mKeeper *MatrixKeeper) NodeConnected(address string)
NodeConnected updates connectivity time info with another node
func (*MatrixKeeper) NodeConnectionFailed ¶
func (mKeeper *MatrixKeeper) NodeConnectionFailed(address string)
NodeConnectionFailed updates connectivity fail time info with another node
func (*MatrixKeeper) NodeDisconnected ¶
func (mKeeper *MatrixKeeper) NodeDisconnected(address string)
NodeDisconnected updates connectivity disconnection time info with another node
func (*MatrixKeeper) NodeMatrixSnapshot ¶
func (mKeeper *MatrixKeeper) NodeMatrixSnapshot() map[string]interface{}
NodeMatrixSnapshot returns a snapshot of the node connectivity matrix
func (*MatrixKeeper) StartTicker ¶
func (mKeeper *MatrixKeeper) StartTicker(ctx context.Context)
StartTicker starts a ticker to flush matrix information into datastore after certain interval
func (*MatrixKeeper) WifiConnected ¶
func (mKeeper *MatrixKeeper) WifiConnected(address string, rssi, speed, freq int)
WifiConnected updates wifi connectivity info with another node
type NodeMatrix ¶
type NodeMatrix struct { TotalUptime int64 // total time node has been inline (seconds) NodesDiscovered map[string]*DiscoveredNodeMatrix // Nodes discovered this session }
NodeMatrix keeps track of uptime and connectivity matrix of a node