53
def download(share_id, node_id, server_hash, fileobj):
53
def download(share_id, node_id, server_hash, path, fileobj_factory):
55
55
Go get the content for the given node and dump it into
56
56
file-like object fileobj.
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):
62
62
Put the content of file-like object fileobj up in the given
72
def make_file(share_id, parent_id, name, marker):
72
def make_file(share_id, parent_id, name, marker, path):
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
79
def make_dir(share_id, parent_id, name, marker):
79
def make_dir(share_id, parent_id, name, marker, path):
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
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,
88
89
Ask the server to move a node to the given parent and name.
91
def unlink(share_id, parent_id, node_id):
92
def unlink(share_id, parent_id, node_id, path):
93
94
Unlink the given node.
98
Get a list of the shares, and put the result on the event queue.
101
def create_share(node, share_to, name, access_level):
103
Ask the server to create a share.
106
97
def inquire_free_space(share_id):
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)."""
108
Get a list of the shares, and put the result on the event queue.
111
def answer_share(share_id, answer):
112
"""Answer the offer of a share."""
114
def create_share(node, share_to, name, access_level, marker, path):
116
Ask the server to create a share.
119
def delete_share(share_id):
120
"""Delete a offered share."""
122
def create_udf(path, name, marker):
123
"""Create a User Defined Folder.
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.
129
Result will be signaled using events:
130
- AQ_CREATE_UDF_OK on succeess.
131
- AQ_CREATE_UDF_ERROR on failure.
135
"""List all the volumes the user has.
137
This includes the volumes:
138
- all the user's UDFs.
139
- all the shares the user has accepted.
140
- the root-root volume.
142
Result will be signaled using events.
143
- AQ_LIST_VOLUMES for the volume list.
147
def delete_volume(volume_id, path):
148
"""Delete a volume on the server, removing the associated tree.
150
@param volume_id: the id of the volume to delete.
151
@param path: the path of the volume to delete
153
Result will be signaled using events:
154
- AQ_DELETE_VOLUME_OK on success.
155
- AQ_DELETE_VOLUME_ERROR on failure.
159
def change_public_access(share_id, node_id, is_public):
160
"""Change the public access of a file.
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.
166
Result will be signaled using events:
167
- AQ_CHANGE_PUBLIC_ACCESS_OK on success.
168
- AQ_CHANGE_PUBLIC_ACCESS_ERROR on failure.
171
def get_public_files():
172
"""Get the list of public files.
174
Result will be signaled using events:
175
- AQ_PUBLIC_FILES_LIST_OK on success.
176
- AQ_PUBLIC_FILES_LIST_ERROR on failure.
179
def get_delta(volume_id, generation):
180
"""Get a delta from generation for the volume.
182
@param volume_id: the id of the volume to get the delta.
183
@param generation: the generation to get the delta from.
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
192
def rescan_from_scratch(volume_id):
193
"""Get a delta from scratch for the volume.
195
@param volume_id: the id of the volume to get the delta.
197
Result will be signaled using events:
198
- AQ_RESCAN_FROM_SCRATCH_OK on succeess.
199
- AQ_RESCAN_FROM_SCRATCH_ERROR on generic failure.
202
def node_is_with_queued_move(share_id, node_id):
203
"""True if a Move is queued for that node."""
115
206
class IActionQueue(IContentQueue, IMetaQueue):
117
208
The access queue itself.
120
def connect(host, port, use_ssl=False):
211
queue = Attribute("The RequestQueue.")
212
uuid_map = Attribute("The marker/uuid deferred map.")
121
215
"""Open a (possibly SSL) connection to the API server on (host, port).
123
217
Once you've connected, authenticate.