Permalink
Browse files

Touch LastModified on tdb_cassandra.Relation._commit.

  • Loading branch information...
1 parent 14cb34c commit ff7f332993d543e66c76c2f1fca9333caf697b57 @spladug spladug committed May 25, 2012
Showing with 17 additions and 8 deletions.
  1. +7 −1 r2/r2/lib/db/tdb_cassandra.py
  2. +5 −1 r2/r2/lib/db/thing.py
  3. +5 −2 r2/r2/models/link.py
  4. +0 −4 r2/r2/models/vote.py
@@ -877,7 +877,13 @@ def _rowkey(thing1_id36, thing2_id36):
def _commit(self, *a, **kw):
assert self._id == self._rowkey(self.thing1_id, self.thing2_id)
- return ThingBase._commit(self, *a, **kw)
+ retval = ThingBase._commit(self, *a, **kw)
+
+ from r2.models.last_modified import LastModified
+ fullname = self._thing1_cls._fullname_from_id36(self.thing1_id)
+ LastModified.touch(fullname, self._cf.column_family)
+
+ return retval
@classmethod
def _rel(cls, thing1_cls, thing2_cls):
View
@@ -342,9 +342,13 @@ def _incr(self, prop, amt = 1):
def _id36(self):
return to36(self._id)
+ @classmethod
+ def _fullname_from_id36(cls, id36):
+ return cls._type_prefix + to36(cls._type_id) + '_' + id36
+
@property
def _fullname(self):
- return self._type_prefix + to36(self._type_id) + '_' + to36(self._id)
+ return self._fullname_from_id36(self._id36)
#TODO error when something isn't found?
@classmethod
View
@@ -1228,8 +1228,8 @@ class CassandraSave(SimpleRelation):
_cf_name = 'Save'
_connection_pool = 'main'
- # thing1_cls = Account
- # thing2_cls = Link
+ _thing1_cls = Account
+ _thing2_cls = Link
@classmethod
def _save(cls, *a, **kw):
@@ -1262,6 +1262,9 @@ class CassandraHide(SimpleRelation):
_ttl = 7*24*60*60
_connection_pool = 'main'
+ _thing1_cls = Account
+ _thing2_cls = Link
+
@classmethod
def _hide(cls, *a, **kw):
return cls._create(*a, **kw)
View
@@ -136,8 +136,6 @@ class CassandraLinkVote(CassandraVote):
_cf_name = 'LinkVote'
_read_consistency_level = tdb_cassandra.CL.ONE
- # these parameters aren't actually meaningful, they just help
- # keep track
# _views = [VotesByLink, VotesByDay]
_thing1_cls = Account
_thing2_cls = Link
@@ -161,8 +159,6 @@ class CassandraCommentVote(CassandraVote):
_cf_name = 'CommentVote'
_read_consistency_level = tdb_cassandra.CL.ONE
- # these parameters aren't actually meaningful, they just help
- # keep track
_thing1_cls = Account
_thing2_cls = Comment

0 comments on commit ff7f332

Please sign in to comment.