Compact and reindex database api calls
This commit is contained in:
@@ -21,6 +21,8 @@ class Database(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
addApiView('database.list_documents', self.listDocuments)
|
addApiView('database.list_documents', self.listDocuments)
|
||||||
|
addApiView('database.reindex', self.reindex)
|
||||||
|
addApiView('database.compact', self.compact)
|
||||||
addApiView('database.document.update', self.updateDocument)
|
addApiView('database.document.update', self.updateDocument)
|
||||||
addApiView('database.document.delete', self.deleteDocument)
|
addApiView('database.document.delete', self.deleteDocument)
|
||||||
|
|
||||||
@@ -117,6 +119,34 @@ class Database(object):
|
|||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
def reindex(self, **kwargs):
|
||||||
|
|
||||||
|
success = True
|
||||||
|
try:
|
||||||
|
db = self.getDB()
|
||||||
|
db.reindex()
|
||||||
|
except:
|
||||||
|
log.error('Failed index: %s', traceback.format_exc())
|
||||||
|
success = False
|
||||||
|
|
||||||
|
return {
|
||||||
|
'success': success
|
||||||
|
}
|
||||||
|
|
||||||
|
def compact(self, **kwargs):
|
||||||
|
|
||||||
|
success = True
|
||||||
|
try:
|
||||||
|
db = self.getDB()
|
||||||
|
db.compact()
|
||||||
|
except:
|
||||||
|
log.error('Failed compact: %s', traceback.format_exc())
|
||||||
|
success = False
|
||||||
|
|
||||||
|
return {
|
||||||
|
'success': success
|
||||||
|
}
|
||||||
|
|
||||||
def migrate(self):
|
def migrate(self):
|
||||||
|
|
||||||
from couchpotato import Env
|
from couchpotato import Env
|
||||||
|
|||||||
Reference in New Issue
Block a user