diff hgext/inotify/common.py @ 8386:4aad982111b6

inotify: Abstract the layer format and sizes to a inotify.common dictionary Instead of having a single possible request format, introduce a dictionary of possible messages in inotify.common
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Thu, 14 May 2009 15:48:47 +0200
parents 46293a0c7e9f
children e387ecd7a6ed
line wrap: on
line diff
--- a/hgext/inotify/common.py	Mon May 11 08:19:28 2009 +0900
+++ b/hgext/inotify/common.py	Thu May 14 15:48:47 2009 +0200
@@ -10,8 +10,11 @@
 
 version = 1
 
-resphdrfmt = '>llllllll'
-resphdrsize = struct.calcsize(resphdrfmt)
+resphdrfmts = {
+    'STAT': '>llllllll' # status requests
+}
+resphdrsizes = dict((k, struct.calcsize(v))
+                    for k, v in resphdrfmts.iteritems())
 
 def recvcs(sock):
     cs = cStringIO.StringIO()