Browse files

checking for objects existance a ton faster

  • Loading branch information...
1 parent 694d36c commit 1877d0350b09474420d28fe5964e52539dfd4c7e @schacon committed Aug 10, 2009
Showing with 17 additions and 3 deletions.
  1. +2 −0 .gitignore
  2. +13 −1 dulwich/agitmemnon.py
  3. +2 −2 dulwich/server.py
View
2 .gitignore
@@ -1 +1,3 @@
*.pyc
+*.so
+build/
View
14 dulwich/agitmemnon.py
@@ -50,6 +50,14 @@ def get(self, column, key, count=100, consistency_level=1):
count, consistency_level)
return result
+ def get_value(self, column_family, key, column, consistency_level=1):
+ try:
+ result = self.client.get_column(self.keyspace, key,
+ ColumnPath(column_family, None, column), consistency_level)
+ return result.value
+ except:
+ return False
+
def get_super(self, column, key, count=100, consistency_level=1):
start = ''
finish = ''
@@ -62,14 +70,18 @@ def get_super(self, column, key, count=100, consistency_level=1):
def get_object(self, sha):
return self.get('Objects', sha)
+ def get_object_value(self, sha, column):
+ return self.get_value('Objects', sha, column)
+ # TODO: modify to only check cassandra for the key (maybe just look for the size)
def __contains__(self, sha):
"""Check if the object with a particular SHA is present."""
- if len(self.get_object(sha)) > 0:
+ if self.get_object_value(sha, 'size'):
return True
else:
return False
+ # TODO: look for packfiles of objects, cache all items in packfile, pull from caches
def __getitem__(self, name):
o = self.get_object(name)
data = ''
View
4 dulwich/server.py
@@ -169,11 +169,11 @@ def next(self):
if len(objects_iter) == 0:
return
- progress("dul-daemon says what\n")
progress("counting objects: %d, done.\n" % len(objects_iter))
+ progress("GitHub is collecting your data\n")
write_pack_data(ProtocolFile(None, write), objects_iter,
len(objects_iter))
- progress("how was that, then?\n")
+ progress("Have a nice day!\n")
# we are done
self.proto.write("0000")

0 comments on commit 1877d03

Please sign in to comment.