~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/vfs.py

  • Committer: John Arbash Meinel
  • Date: 2007-04-26 18:53:33 UTC
  • mfrom: (2465 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2466.
  • Revision ID: john@arbash-meinel.com-20070426185333-i1xlyaeyf049kdxc
[merge] bzr.dev 2465

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
 
65
65
    def do(self, relpath):
66
66
        r = self._backing_transport.has(relpath) and 'yes' or 'no'
67
 
        return request.SmartServerResponse((r,))
 
67
        return request.SuccessfulSmartServerResponse((r,))
68
68
 
69
69
 
70
70
class GetRequest(VfsRequest):
71
71
 
72
72
    def do(self, relpath):
73
73
        backing_bytes = self._backing_transport.get_bytes(relpath)
74
 
        return request.SmartServerResponse(('ok',), backing_bytes)
 
74
        return request.SuccessfulSmartServerResponse(('ok',), backing_bytes)
75
75
 
76
76
 
77
77
class AppendRequest(VfsRequest):
83
83
    def do_body(self, body_bytes):
84
84
        old_length = self._backing_transport.append_bytes(
85
85
            self._relpath, body_bytes, self._mode)
86
 
        return request.SmartServerResponse(('appended', '%d' % old_length))
 
86
        return request.SuccessfulSmartServerResponse(('appended', '%d' % old_length))
87
87
 
88
88
 
89
89
class DeleteRequest(VfsRequest):
90
90
 
91
91
    def do(self, relpath):
92
92
        self._backing_transport.delete(relpath)
93
 
        return request.SmartServerResponse(('ok', ))
 
93
        return request.SuccessfulSmartServerResponse(('ok', ))
94
94
 
95
95
 
96
96
class IterFilesRecursiveRequest(VfsRequest):
98
98
    def do(self, relpath):
99
99
        transport = self._backing_transport.clone(relpath)
100
100
        filenames = transport.iter_files_recursive()
101
 
        return request.SmartServerResponse(('names',) + tuple(filenames))
 
101
        return request.SuccessfulSmartServerResponse(('names',) + tuple(filenames))
102
102
 
103
103
 
104
104
class ListDirRequest(VfsRequest):
105
105
 
106
106
    def do(self, relpath):
107
107
        filenames = self._backing_transport.list_dir(relpath)
108
 
        return request.SmartServerResponse(('names',) + tuple(filenames))
 
108
        return request.SuccessfulSmartServerResponse(('names',) + tuple(filenames))
109
109
 
110
110
 
111
111
class MkdirRequest(VfsRequest):
113
113
    def do(self, relpath, mode):
114
114
        self._backing_transport.mkdir(relpath,
115
115
                                      _deserialise_optional_mode(mode))
116
 
        return request.SmartServerResponse(('ok',))
 
116
        return request.SuccessfulSmartServerResponse(('ok',))
117
117
 
118
118
 
119
119
class MoveRequest(VfsRequest):
120
120
 
121
121
    def do(self, rel_from, rel_to):
122
122
        self._backing_transport.move(rel_from, rel_to)
123
 
        return request.SmartServerResponse(('ok',))
 
123
        return request.SuccessfulSmartServerResponse(('ok',))
124
124
 
125
125
 
126
126
class PutRequest(VfsRequest):
131
131
 
132
132
    def do_body(self, body_bytes):
133
133
        self._backing_transport.put_bytes(self._relpath, body_bytes, self._mode)
134
 
        return request.SmartServerResponse(('ok',))
 
134
        return request.SuccessfulSmartServerResponse(('ok',))
135
135
 
136
136
 
137
137
class PutNonAtomicRequest(VfsRequest):
149
149
                mode=self._mode,
150
150
                create_parent_dir=self._create_parent,
151
151
                dir_mode=self._dir_mode)
152
 
        return request.SmartServerResponse(('ok',))
 
152
        return request.SuccessfulSmartServerResponse(('ok',))
153
153
 
154
154
 
155
155
class ReadvRequest(VfsRequest):
162
162
        offsets = self._deserialise_offsets(body_bytes)
163
163
        backing_bytes = ''.join(bytes for offset, bytes in
164
164
            self._backing_transport.readv(self._relpath, offsets))
165
 
        return request.SmartServerResponse(('readv',), backing_bytes)
 
165
        return request.SuccessfulSmartServerResponse(('readv',), backing_bytes)
166
166
 
167
167
    def _deserialise_offsets(self, text):
168
168
        # XXX: FIXME this should be on the protocol object.
179
179
 
180
180
    def do(self, rel_from, rel_to):
181
181
        self._backing_transport.rename(rel_from, rel_to)
182
 
        return request.SmartServerResponse(('ok', ))
 
182
        return request.SuccessfulSmartServerResponse(('ok', ))
183
183
 
184
184
 
185
185
class RmdirRequest(VfsRequest):
186
186
 
187
187
    def do(self, relpath):
188
188
        self._backing_transport.rmdir(relpath)
189
 
        return request.SmartServerResponse(('ok', ))
 
189
        return request.SuccessfulSmartServerResponse(('ok', ))
190
190
 
191
191
 
192
192
class StatRequest(VfsRequest):
193
193
 
194
194
    def do(self, relpath):
195
195
        stat = self._backing_transport.stat(relpath)
196
 
        return request.SmartServerResponse(
 
196
        return request.SuccessfulSmartServerResponse(
197
197
            ('stat', str(stat.st_size), oct(stat.st_mode)))
198
198