py-libp2p/peer/peermetadata_interface.py

26 lines
629 B
Python
Raw Normal View History

from abc import ABC, abstractmethod
class IPeerMetadata(ABC):
2018-10-22 03:15:53 +08:00
def __init__(self, context):
self.context = context
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
:return: value at key for given peer, error
"""
2018-10-22 03:15:53 +08:00
pass
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
:return: error
"""
2018-10-22 03:15:53 +08:00
pass