py-libp2p/libp2p/peer/peermetadata_interface.py

26 lines
626 B
Python
Raw Normal View History

from abc import ABC, abstractmethod
2019-01-10 02:38:56 +08:00
class IPeerMetadata(ABC):
def __init__(self):
pass
2018-10-22 03:15:53 +08:00
@abstractmethod
def get(self, peer_id, key):
"""
:param peer_id: peer ID to lookup key for
:param key: key to look up
2018-10-30 07:03:19 +08:00
:return: value at key for given peer
:raise Exception: peer ID not found
"""
2018-10-22 03:15:53 +08:00
@abstractmethod
def put(self, peer_id, key, val):
"""
:param peer_id: peer ID to lookup key for
:param key: key to associate with peer
:param val: value to associated with key
2018-10-30 07:03:19 +08:00
:raise Exception: unsuccessful put
"""