2018-10-20 16:55:15 -04:00
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
|
|
|
|
class IPeerMetadata(ABC):
|
|
|
|
|
2018-10-26 15:51:25 -04:00
|
|
|
def __init__(self):
|
|
|
|
pass
|
2018-10-20 16:55:15 -04:00
|
|
|
|
2018-10-21 15:15:53 -04: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 00:03:19 +01:00
|
|
|
:return: value at key for given peer
|
|
|
|
:raise Exception: peer ID not found
|
2018-10-20 16:55:15 -04:00
|
|
|
"""
|
2018-10-21 15:15:53 -04:00
|
|
|
pass
|
2018-10-20 16:55:15 -04:00
|
|
|
|
2018-10-21 15:15:53 -04: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 00:03:19 +01:00
|
|
|
:raise Exception: unsuccessful put
|
2018-10-20 16:55:15 -04:00
|
|
|
"""
|
2018-10-21 15:15:53 -04:00
|
|
|
pass
|
|
|
|
|