Touch LastModified on tdb_cassandra.Relation._commit.

This commit is contained in:
Neil Williams
2012-05-24 19:45:42 -07:00
parent 14cb34c49d
commit ff7f332993
4 changed files with 17 additions and 8 deletions

View File

@@ -877,7 +877,13 @@ class Relation(ThingBase):
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 File

@@ -342,9 +342,13 @@ class DataThing(object):
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 File

@@ -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 File

@@ -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