History

Simplified the internal API of the server class and added support for the placeholder Tflush method.

David Boddie committed 8 years ago

Commit 0bb0ec31 parent d95cc451 file · +15 −14Browse files

Unified · Split

styxserver.py+15−14
@@ -47,7 +47,7 @@ class StyxServer: · 46 unmodified lines
47 47
48 try:48 try:
49 handler = self.handlers[message.code]49 handler = self.handlers[message.code]
50 reply = handler(self, conn, client, message)50 reply = handler(self, client, message)
51 except KeyError:51 except KeyError:
52 reply = styx.Rerror(message.tag, "Unsupported message.")52 reply = styx.Rerror(message.tag, "Unsupported message.")
53 except StyxServerError as e:53 except StyxServerError as e:
@@ -58,11 +58,11 @@ class StyxServer: · 4 unmodified lines
58 58
59 reply.encode(conn)59 reply.encode(conn)
60 60
61 def Tversion(self, conn, client, msg):61 def Tversion(self, client, msg):
62 62
63 return styx.Rversion(msg.tag, msg.msize, msg.version)63 return styx.Rversion(msg.tag, msg.msize, msg.version)
64 64
65 def Tattach(self, conn, client, msg):65 def Tattach(self, client, msg):
66 66
67 store = self.clients[client]67 store = self.clients[client]
68 68
@@ -72,7 +72,7 @@ class StyxServer: · 3 unmodified lines
72 72
73 return styx.Rattach(msg.tag, qid)73 return styx.Rattach(msg.tag, qid)
74 74
75 def Tstat(self, conn, client, msg):75 def Tstat(self, client, msg):
76 76
77 store = self.clients[client]77 store = self.clients[client]
78 78
@@ -82,7 +82,7 @@ class StyxServer: · 3 unmodified lines
82 82
83 return styx.Rstat(msg.tag, s)83 return styx.Rstat(msg.tag, s)
84 84
85 def Twalk(self, conn, client, msg):85 def Twalk(self, client, msg):
86 86
87 store = self.clients[client]87 store = self.clients[client]
88 88
@@ -119,7 +119,7 @@ class StyxServer: · 30 unmodified lines
119 119
120 return styx.Rwalk(msg.tag, qids)120 return styx.Rwalk(msg.tag, qids)
121 121
122 def Topen(self, conn, client, msg):122 def Topen(self, client, msg):
123 123
124 store = self.clients[client]124 store = self.clients[client]
125 125
@@ -131,7 +131,7 @@ class StyxServer: · 5 unmodified lines
131 131
132 return styx.Ropen(msg.tag, qid, self.MAX_MSG_SIZE)132 return styx.Ropen(msg.tag, qid, self.MAX_MSG_SIZE)
133 133
134 def Tcreate(self, conn, client, msg):134 def Tcreate(self, client, msg):
135 135
136 store = self.clients[client]136 store = self.clients[client]
137 137
@@ -149,7 +149,7 @@ class StyxServer: · 11 unmodified lines
149 149
150 return styx.Rcreate(msg.tag, new_qid, self.MAX_MSG_SIZE)150 return styx.Rcreate(msg.tag, new_qid, self.MAX_MSG_SIZE)
151 151
152 def Tread(self, conn, client, msg):152 def Tread(self, client, msg):
153 153
154 store = self.clients[client]154 store = self.clients[client]
155 155
@@ -158,7 +158,7 @@ class StyxServer: · 2 unmodified lines
158 158
159 return styx.Rread(msg.tag, data)159 return styx.Rread(msg.tag, data)
160 160
161 def Twrite(self, conn, client, msg):161 def Twrite(self, client, msg):
162 162
163 store = self.clients[client]163 store = self.clients[client]
164 164
@@ -172,7 +172,7 @@ class StyxServer: · 7 unmodified lines
172 172
173 return styx.Rwrite(msg.tag, count)173 return styx.Rwrite(msg.tag, count)
174 174
175 def Tclunk(self, conn, client, msg):175 def Tclunk(self, client, msg):
176 176
177 store = self.clients[client]177 store = self.clients[client]
178 178
@@ -186,7 +186,7 @@ class StyxServer: · 7 unmodified lines
186 186
187 return styx.Rclunk(msg.tag)187 return styx.Rclunk(msg.tag)
188 188
189 def Tremove(self, conn, client, msg):189 def Tremove(self, client, msg):
190 190
191 store = self.clients[client]191 store = self.clients[client]
192 192
@@ -200,7 +200,7 @@ class StyxServer: · 7 unmodified lines
200 store.free_qid_path(msg.fid)200 store.free_qid_path(msg.fid)
201 return styx.Rerror(msg.tag, result)201 return styx.Rerror(msg.tag, result)
202 202
203 def Tflush(self, conn, client, msg):203 def Tflush(self, client, msg):
204 204
205 store = self.clients[client]205 store = self.clients[client]
206 206
@@ -209,7 +209,7 @@ class StyxServer: · 2 unmodified lines
209 209
210 return styx.Rflush(msg.tag)210 return styx.Rflush(msg.tag)
211 211
212 def Twstat(self, conn, client, msg):212 def Twstat(self, client, msg):
213 213
214 store = self.clients[client]214 store = self.clients[client]
215 215
@@ -227,5 +227,6 @@ class StyxServer: · 11 unmodified lines
227 styx.Twrite.code: Twrite,227 styx.Twrite.code: Twrite,
228 styx.Tclunk.code: Tclunk,228 styx.Tclunk.code: Tclunk,
229 styx.Tremove.code: Tremove,229 styx.Tremove.code: Tremove,
230 styx.Twstat.code: Twstat230 styx.Twstat.code: Twstat,
231 styx.Tflush.code: Tflush
231 }232 }