py-libp2p/peer/peerdata_interface.py

48 lines
850 B
Python
Raw Normal View History

from abc import ABC, abstractmethod
class IPeerData(ABC):
"""
2018-10-22 03:15:53 +08:00
:return: all protocols associated with given peer
"""
def get_protocols(self):
2018-10-22 03:15:53 +08:00
pass
"""
:param protocols: protocols to add
2018-10-22 03:15:53 +08:00
"""
def add_protocols(self, protocols):
2018-10-22 03:15:53 +08:00
pass
"""
:param addrs: multiaddresses to add
2018-10-22 03:15:53 +08:00
"""
def add_addrs(self, addrs):
2018-10-22 03:15:53 +08:00
pass
"""
:return: all multiaddresses
2018-10-22 03:15:53 +08:00
"""
def get_addrs(self):
2018-10-22 03:15:53 +08:00
pass
"""
Clear all addresses
"""
def clear_addrs(self):
2018-10-22 03:15:53 +08:00
pass
"""
:param key: key in KV pair
:param val: val to associate with key
"""
def put_metadata(self, key, val):
2018-10-22 03:15:53 +08:00
pass
"""
:param key: key in KV pair
:return: val for key, error (only defined if key not found)
"""
def get_metadata(self, key):
2018-10-22 03:15:53 +08:00
pass