~didrocks/ubuntuone-client/dont-suffer-zg-crash

« back to all changes in this revision

Viewing changes to ubuntuone/syncdaemon/interfaces.py

  • Committer: Bazaar Package Importer
  • Author(s): Rodney Dawes
  • Date: 2011-01-25 16:42:52 UTC
  • mto: This revision was merged to the branch mainline in revision 64.
  • Revision ID: james.westby@ubuntu.com-20110125164252-rl1pybasx1nsqgoy
Tags: upstream-1.5.3
ImportĀ upstreamĀ versionĀ 1.5.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
        however.
51
51
        """
52
52
 
53
 
    def download(share_id, node_id, server_hash, fileobj):
 
53
    def download(share_id, node_id, server_hash, path, fileobj_factory):
54
54
        """
55
55
        Go get the content for the given node and dump it into
56
56
        file-like object fileobj.
57
57
        """
58
58
 
59
59
    def upload(share_id, node_id, previous_hash, hash, crc32,
60
 
               size, deflated_size, fileobj):
 
60
               size, path, fileobj_factory, tempfile_factory=None):
61
61
        """
62
62
        Put the content of file-like object fileobj up in the given
63
63
        node.
69
69
    metadata.
70
70
    """
71
71
 
72
 
    def make_file(share_id, parent_id, name, marker):
 
72
    def make_file(share_id, parent_id, name, marker, path):
73
73
        """
74
74
        Ask the server to create a file called name in the given
75
75
        parent; and use marker as a marker in the ensuing
76
76
        notification.
77
77
        """
78
78
 
79
 
    def make_dir(share_id, parent_id, name, marker):
 
79
    def make_dir(share_id, parent_id, name, marker, path):
80
80
        """
81
81
        Ask the server to make a directory called name in the given
82
82
        parent, and use marker as a marker in the ensuing
83
83
        notification.
84
84
        """
85
85
 
86
 
    def move(share_id, node_id, old_parent_id, new_parent_id, new_name):
 
86
    def move(share_id, node_id, old_parent_id, new_parent_id, new_name,
 
87
             path_from, path_to):
87
88
        """
88
89
        Ask the server to move a node to the given parent and name.
89
90
        """
90
91
 
91
 
    def unlink(share_id, parent_id, node_id):
 
92
    def unlink(share_id, parent_id, node_id, path):
92
93
        """
93
94
        Unlink the given node.
94
95
        """
95
96
 
96
 
    def list_shares():
97
 
        """
98
 
        Get a list of the shares, and put the result on the event queue.
99
 
        """
100
 
 
101
 
    def create_share(node, share_to, name, access_level):
102
 
        """
103
 
        Ask the server to create a share.
104
 
        """
105
 
 
106
97
    def inquire_free_space(share_id):
107
98
        """
108
99
        Inquire after free space in the given volume and put the result on
112
103
    def inquire_account_info():
113
104
        """Ask the state of the user's account (purchased space, etc)."""
114
105
 
 
106
    def list_shares():
 
107
        """
 
108
        Get a list of the shares, and put the result on the event queue.
 
109
        """
 
110
 
 
111
    def answer_share(share_id, answer):
 
112
        """Answer the offer of a share."""
 
113
 
 
114
    def create_share(node, share_to, name, access_level, marker, path):
 
115
        """
 
116
        Ask the server to create a share.
 
117
        """
 
118
 
 
119
    def delete_share(share_id):
 
120
        """Delete a offered share."""
 
121
 
 
122
    def create_udf(path, name, marker):
 
123
        """Create a User Defined Folder.
 
124
 
 
125
        @param path: the path in disk to the UDF.
 
126
        @param name: the name of the UDF.
 
127
        @param marker: a marker identifying this UDF request.
 
128
 
 
129
        Result will be signaled using events:
 
130
            - AQ_CREATE_UDF_OK on succeess.
 
131
            - AQ_CREATE_UDF_ERROR on failure.
 
132
        """
 
133
 
 
134
    def list_volumes():
 
135
        """List all the volumes the user has.
 
136
 
 
137
        This includes the volumes:
 
138
            - all the user's UDFs.
 
139
            - all the shares the user has accepted.
 
140
            - the root-root volume.
 
141
 
 
142
        Result will be signaled using events.
 
143
            - AQ_LIST_VOLUMES for the volume list.
 
144
 
 
145
        """
 
146
 
 
147
    def delete_volume(volume_id, path):
 
148
        """Delete a volume on the server, removing the associated tree.
 
149
 
 
150
        @param volume_id: the id of the volume to delete.
 
151
        @param path: the path of the volume to delete
 
152
 
 
153
        Result will be signaled using events:
 
154
            - AQ_DELETE_VOLUME_OK on success.
 
155
            - AQ_DELETE_VOLUME_ERROR on failure.
 
156
 
 
157
        """
 
158
 
 
159
    def change_public_access(share_id, node_id, is_public):
 
160
        """Change the public access of a file.
 
161
 
 
162
        @param share_id: the id of the share holding the file.
 
163
        @param node_id: the id of the file.
 
164
        @param is_public: whether to make the file public.
 
165
 
 
166
        Result will be signaled using events:
 
167
            - AQ_CHANGE_PUBLIC_ACCESS_OK on success.
 
168
            - AQ_CHANGE_PUBLIC_ACCESS_ERROR on failure.
 
169
        """
 
170
 
 
171
    def get_public_files():
 
172
        """Get the list of public files.
 
173
 
 
174
        Result will be signaled using events:
 
175
            - AQ_PUBLIC_FILES_LIST_OK on success.
 
176
            - AQ_PUBLIC_FILES_LIST_ERROR on failure.
 
177
        """
 
178
 
 
179
    def get_delta(volume_id, generation):
 
180
        """Get a delta from generation for the volume.
 
181
 
 
182
        @param volume_id: the id of the volume to get the delta.
 
183
        @param generation: the generation to get the delta from.
 
184
 
 
185
        Result will be signaled using events:
 
186
            - AQ_DELTA_OK on succeess.
 
187
            - AQ_DELTA_ERROR on generic failure.
 
188
            - AQ_DELTA_NOT_POSSIBLE if the server told so
 
189
 
 
190
        """
 
191
 
 
192
    def rescan_from_scratch(volume_id):
 
193
        """Get a delta from scratch for the volume.
 
194
 
 
195
        @param volume_id: the id of the volume to get the delta.
 
196
 
 
197
        Result will be signaled using events:
 
198
            - AQ_RESCAN_FROM_SCRATCH_OK on succeess.
 
199
            - AQ_RESCAN_FROM_SCRATCH_ERROR on generic failure.
 
200
        """
 
201
 
 
202
    def node_is_with_queued_move(share_id, node_id):
 
203
        """True if a Move is queued for that node."""
 
204
 
 
205
 
115
206
class IActionQueue(IContentQueue, IMetaQueue):
116
207
    """
117
208
    The access queue itself.
118
209
    """
119
210
 
120
 
    def connect(host, port, use_ssl=False):
 
211
    queue = Attribute("The RequestQueue.")
 
212
    uuid_map = Attribute("The marker/uuid deferred map.")
 
213
 
 
214
    def connect():
121
215
        """Open a (possibly SSL) connection to the API server on (host, port).
122
216
 
123
217
        Once you've connected, authenticate.
126
220
    def disconnect():
127
221
        """Close the connection."""
128
222
 
 
223
 
129
224
class IMarker(Interface):
130
225
    """
131
226
    A marker interface for telling server uuids apart from markers.
132
227
    """
 
228