mirror of https://github.com/libp2p/py-libp2p.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
659 B
27 lines
659 B
from abc import ABC, abstractmethod
|
|
|
|
class IPeerMetadata(ABC):
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
@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
|
|
:raise Exception: peer ID not found
|
|
"""
|
|
pass
|
|
|
|
@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
|
|
:raise Exception: unsuccessful put
|
|
"""
|
|
pass
|
|
|