mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Add interfaces for Address Book, PeerStore Metadata, and Peerstore
This commit is contained in:
25
peer/peermetadata_interface.py
Normal file
25
peer/peermetadata_interface.py
Normal file
@ -0,0 +1,25 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
class IPeerMetadata(ABC):
|
||||
|
||||
def __init__(self, context):
|
||||
self.context = context
|
||||
|
||||
@abstractmethod
|
||||
def get(self, peerID, key):
|
||||
"""
|
||||
:param peerID: peer ID to lookup key for
|
||||
:param key: key to look up
|
||||
:return: value at key for given peer, error
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def put(self, peerID, key, val):
|
||||
"""
|
||||
:param peerID: peer ID to lookup key for
|
||||
:param key: key to associate with peer
|
||||
:param val: value to associated with key
|
||||
:return: error
|
||||
"""
|
||||
pass
|
||||
Reference in New Issue
Block a user