Acquire.Storage._driveinfo module

class DriveInfo(drive_uid=None, identifiers=None, is_authorised=False, parent_drive_uid=None)[source]

Bases: object

This class provides a service-side handle to the information about a particular cloud drive

aclrules()[source]

Return the acl rules for this drive

bulk_upload(authorisation, encrypt_key, max_size=None, aclrules=None)[source]

Start the process of a bulk upload of a set of files to this Drive. This will return a Bucket-Write PAR to a temporary bucket to which the files can be uploaded. Once the PAR is closed the files will be copied to the Drive and the temporary bucket deleted.

You need to provide authorisation for this action, a public key to encrypt the PAR, and optionally specify the maximum size of the data to be uploaded and the ACLs. If the maximum size is not set then you will be limited to a maximum of 100MB upload. If the ACLs are not set, then they will inherit from the Drive (or from previous versions of the file if they exist)

download(filename, authorisation, version=None, encrypt_key=None, force_par=False)[source]

Download the file called filename. This will return a FileHandle that describes the file. If the file is sufficiently small, then the filedata will be embedded into this handle. Otherwise a PAR will be generated and also returned to allow the file to be downloaded separately. The PAR will be encrypted with ‘encrypt_key’. Remember to close the PAR once you have finished downloading the file…

static from_data(data)[source]

Return a DriveInfo constructed from the passed json-deserialised dictionary

is_null()[source]
is_opened_by_owner()[source]

Return whether or not this drive was opened and authorised by one of the drive owners

list_files(authorisation=None, include_metadata=False)[source]

Return the list of FileMeta data for the files contained in this Drive. The passed authorisation is needed in case the list contents of this drive is not public

list_versions(filename, authorisation=None, include_metadata=False)[source]

Return the list of versions of the file with specified filename. If ‘include_metadata’ is true then this will load full metadata for each version. This will return a sorted list of FileMeta objects. The passed authorisation is needed in case the version info is not public

load()[source]

Load the metadata about this drive from the object store

save()[source]

Save the metadata about this drive to the object store

set_permission(user_guid, aclrule)[source]

Set the permission for the user with the passed user_guid to ‘aclrule”. Note that you can only do this if you are the owner and this drive was opened in an authorised way. Also note that you cannot remove your own ownership permission if this would leave the drive without any owners

to_data()[source]

Return a json-serialisable dictionary for this object

uid()[source]

Return the UID of this drive

upload(filehandle, authorisation, encrypt_key=None)[source]

Upload the file associated with the passed filehandle. If the filehandle has the data embedded, then this uploads the file data directly and returns a FileMeta for the result. Otherwise, this returns a PAR which should be used to upload the data. The PAR will be encrypted using ‘encrypt_key’. Remember to close the PAR once the file has been uploaded, so that it can be validated as correct