Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit 45839a2

Browse files
committed
Add capability properties, fix index caching
1 parent 9021923 commit 45839a2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

orbitdbapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.1.0.rc.1.dev1'
1+
__version__ = '0.1.0.rc.1.dev2'

orbitdbapi/db.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ def dbname(self):
4848
def dbtype(self):
4949
return self.__type
5050

51+
@property
52+
def queryable(self):
53+
return 'query' in self.__params.get('capabilities', {})
54+
@property
55+
def putable(self):
56+
return 'put' in self.__params.get('capabilities', {})
57+
5158
def info(self):
5259
endpoint = '/'.join(['db', self.__id_safe])
5360
return self.__client._call('get', endpoint)
@@ -101,7 +108,9 @@ def iterator(self, params):
101108

102109
def index(self):
103110
endpoint = '/'.join(['db', self.__id_safe, 'index'])
104-
return self.__client._call('get', endpoint)
111+
result = self.__client._call('get', endpoint)
112+
self.__cache = result
113+
return result
105114

106115
def unload(self):
107116
endpoint = '/'.join(['db', self.__id_safe])

0 commit comments

Comments
 (0)