From 0942f91b1f09f2ee69d88aa51edfb83cb2b6a7be Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 7 Aug 2017 19:37:48 -0300 Subject: [refactor] add IIncomingBoxBackend IIncomingBoxBackend holds backend specific methods used for IncomingBox implementation. - Resolves: #8888 --- src/leap/soledad/server/_blobs.py | 1 + src/leap/soledad/server/interfaces.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/leap/soledad/server/_blobs.py b/src/leap/soledad/server/_blobs.py index b6323906..7d51e1b5 100644 --- a/src/leap/soledad/server/_blobs.py +++ b/src/leap/soledad/server/_blobs.py @@ -59,6 +59,7 @@ VALID_STRINGS = re.compile('^[a-zA-Z0-9_-]+$') @implementer(interfaces.IBlobsBackend) +@implementer(interfaces.IIncomingBoxBackend) class FilesystemBlobsBackend(object): def __init__(self, blobs_path='/tmp/blobs/', quota=200 * 1024): diff --git a/src/leap/soledad/server/interfaces.py b/src/leap/soledad/server/interfaces.py index 1f97624b..5e586ade 100644 --- a/src/leap/soledad/server/interfaces.py +++ b/src/leap/soledad/server/interfaces.py @@ -77,3 +77,31 @@ class IBlobsBackend(Interface): :returns: a deferred that fires upon finishing. """ + + +class IIncomingBoxBackend(Interface): + + """ + An interface for an IncomingBoxBackend implementation. + """ + + def get_flags(user, blob_id, request, namespace=''): + """ + Given a blob_id, return it's associated flags. + + :returns: a JSON encoded string with a list of flags. + """ + + def set_flags(self, user, blob_id, request, namespace=''): + """ + Set flags for a blob_id. + """ + + def list_blobs(self, user, request, namespace='', order_by=None, + filter_flag=False): + """ + Blobs listing with flags support. Accepts a filter_flag parameter, + which is a flag that can be used to filter results matching it. + + :returns: a deferred that fires upon finishing. + """ -- cgit v1.2.3