diff options
author | Aleksey Lim <alsroot@sugarlabs.org> | 2012-10-12 15:13:53 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@sugarlabs.org> | 2012-10-12 15:13:53 (GMT) |
commit | 9108cb5aba91ae30dd5ad5534ec6407ebc54f7df (patch) | |
tree | cf213c0050cef35cee9808db324d0d72be440d66 /active_document | |
parent | 334359b1cabcd99afbcc34658c2e3f82523a5d50 (diff) |
Remove client side content changes tracking using seqno, client should rely on mtime which more appropriate for HTTP
Diffstat (limited to 'active_document')
-rw-r--r-- | active_document/directory.py | 9 | ||||
-rw-r--r-- | active_document/index.py | 2 | ||||
-rw-r--r-- | active_document/volume.py | 4 |
3 files changed, 10 insertions, 5 deletions
diff --git a/active_document/directory.py b/active_document/directory.py index c0fd242..8af5aa4 100644 --- a/active_document/directory.py +++ b/active_document/directory.py @@ -74,6 +74,10 @@ class Directory(object): _logger.debug('Initiated %r document', document_class) + @property + def mtime(self): + return self._index.mtime + def close(self): """Flush index write pending queue and close the index.""" self._index.close() @@ -249,7 +253,7 @@ class Directory(object): if found: self._save_layout() self.commit() - self._notify({'event': 'populate', 'seqno': self._seqno.value}) + self._notify({'event': 'populate'}) def diff(self, accept_range, limit): """Return documents' properties for specified times range. @@ -370,7 +374,6 @@ class Directory(object): def _post_store(self, guid, changes, event, increment_seqno): if event: - event['seqno'] = self._seqno.value self._notify(event) def _post_delete(self, guid, event): @@ -379,7 +382,7 @@ class Directory(object): def _post_commit(self): self._seqno.commit() - self._notify({'event': 'commit', 'seqno': self._seqno.value}) + self._notify({'event': 'commit'}) def _post(self, guid, props, new): for prop_name, value in props.items(): diff --git a/active_document/index.py b/active_document/index.py index d0a0f98..67ed083 100644 --- a/active_document/index.py +++ b/active_document/index.py @@ -56,7 +56,7 @@ class IndexReader(object): def mtime(self): """UNIX seconds of the last `commit()` call.""" if exists(self._mtime_path): - return os.stat(self._mtime_path).st_mtime + return int(os.stat(self._mtime_path).st_mtime) else: return 0 diff --git a/active_document/volume.py b/active_document/volume.py index 7e9e166..5da9f44 100644 --- a/active_document/volume.py +++ b/active_document/volume.py @@ -161,8 +161,10 @@ class VolumeCommands(CommandsProcessor): permissions=env.ACCESS_AUTH | env.ACCESS_AUTHOR) def update(self, request): with self._post(request, env.ACCESS_WRITE) as (directory, doc): + modified = bool(doc.props) self.before_update(request, doc.props) - directory.update(doc.guid, doc.props) + if modified: + directory.update(doc.guid, doc.props) @property_command(method='PUT', permissions=env.ACCESS_AUTH | env.ACCESS_AUTHOR) |