Documentation ¶
Index ¶
- Variables
- type MemoryDB
- func (m MemoryDB) Close()
- func (m MemoryDB) DeletePeer(key string)
- func (m MemoryDB) ExportToCSV(filePath string) error
- func (m MemoryDB) GetPeerENR(peerID string) (*enode.Node, error)
- func (m MemoryDB) GetPeers() []peer.ID
- func (m MemoryDB) LoadPeer(key string) (value models.Peer, ok bool)
- func (m MemoryDB) Range(f func(key string, value models.Peer) bool)
- func (m MemoryDB) StorePeer(key string, value models.Peer)
- func (m MemoryDB) Type() string
Constants ¶
This section is empty.
Variables ¶
var (
MemoryType = "MemoryDB"
)
Functions ¶
This section is empty.
Types ¶
type MemoryDB ¶
type MemoryDB struct {
// contains filtered or unexported fields
}
PeerStoreMemory save the peer's data in RAM. Unless exported, data is lost after execution.
func NewMemoryDB ¶
func NewMemoryDB() MemoryDB
New NewMemoryDB creates an new MemoryDB ready to accept new peers fulfills PeerStoreStorage interface
func (MemoryDB) Close ¶
func (m MemoryDB) Close()
Close and free the space from the memory relative to the DB So far just initialize the
func (MemoryDB) DeletePeer ¶
Delete removes key and value from sync.Map. @param key: the string to locate the value to delete.
func (MemoryDB) ExportToCSV ¶
ExportToCSV This method will export the whole peerstore into a CSV file. @param filePath file where to dump the CSV lines (create if it does not exist). @return an error if there was.
func (MemoryDB) GetPeerENR ¶
GetENR returns the Node after parsing the ENR. @param peerID: the peerID of which to get the Node. @return the resulting Node. @return error if applicable, nil in any other case.
func (MemoryDB) GetPeers ¶
Peers This method returns a string array with the list of PeerIDs existing in the DB. These would be the keys of each entry in the map @return the string array containisssng the PeerIDs
func (MemoryDB) Range ¶
Range iterates through the key and values of the sync.Map @param f: the function to apply to each item in the db