ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

#include <storage.h>

Inheritance diagram for Cloud::Storage:
Collaboration diagram for Cloud::Storage:

List of all members.

Public Types

typedef Networking::Response
< Common::Array< StorageFile > & > 
FileArrayResponse
typedef Networking::Response
< StorageInfo
StorageInfoResponse
typedef Networking::Response
< bool > 
BoolResponse
typedef Networking::Response
< StorageFile
UploadResponse
typedef Networking::Response
< Common::Array< StorageFile > & > 
ListDirectoryResponse
typedef Common::BaseCallback
< FileArrayResponse > * 
FileArrayCallback
typedef Common::BaseCallback
< StorageInfoResponse > * 
StorageInfoCallback
typedef Common::BaseCallback
< BoolResponse > * 
BoolCallback
typedef Common::BaseCallback
< UploadResponse > * 
UploadCallback
typedef Common::BaseCallback
< ListDirectoryResponse > * 
ListDirectoryCallback

Public Member Functions

 Storage ()
virtual ~Storage ()
virtual void saveConfig (Common::String keyPrefix)=0
 Storage methods, which are used by CloudManager to save storage in configuration file.
virtual Common::String name () const =0
 Return unique storage name.
bool isEnabled () const
 Return whether Storage has been manually enabled by user.
void enable ()
 Set _isEnabled to true.
virtual Networking::RequestlistDirectory (Common::String path, ListDirectoryCallback callback, Networking::ErrorCallback errorCallback, bool recursive=false)=0
 Public Cloud API comes down there.
virtual Networking::Requestupload (Common::String path, Common::SeekableReadStream *contents, UploadCallback callback, Networking::ErrorCallback errorCallback)=0
 Returns StorageFile with info about uploaded file.
virtual Networking::Requestupload (Common::String remotePath, Common::String localPath, UploadCallback callback, Networking::ErrorCallback errorCallback)
virtual bool uploadStreamSupported ()
 Returns whether Storage supports upload(ReadStream).
virtual Networking::RequeststreamFile (Common::String path, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback)
 Returns pointer to Networking::NetworkReadStream.
virtual Networking::RequeststreamFileById (Common::String id, Networking::NetworkReadStreamCallback callback, Networking::ErrorCallback errorCallback)=0
virtual Networking::Requestdownload (Common::String remotePath, Common::String localPath, BoolCallback callback, Networking::ErrorCallback errorCallback)
 Calls the callback when finished.
virtual Networking::RequestdownloadById (Common::String remoteId, Common::String localPath, BoolCallback callback, Networking::ErrorCallback errorCallback)
virtual Networking::RequestdownloadFolder (Common::String remotePath, Common::String localPath, FileArrayCallback callback, Networking::ErrorCallback errorCallback, bool recursive=false)
 Returns Common::Array<StorageFile> with list of files, which were not downloaded.
virtual SavesSyncRequestsyncSaves (BoolCallback callback, Networking::ErrorCallback errorCallback)
 Calls the callback when finished.
virtual Networking::RequestcreateDirectory (Common::String path, BoolCallback callback, Networking::ErrorCallback errorCallback)=0
 Calls the callback when finished.
virtual Networking::Requestinfo (StorageInfoCallback callback, Networking::ErrorCallback errorCallback)=0
 Returns the StorageInfo struct via <callback>.
virtual Common::String savesDirectoryPath ()=0
 Returns storage's saves directory path with the trailing slash.
virtual bool isWorking ()
 Returns whether there are any requests running.
virtual bool isSyncing ()
 Returns whether there is a SavesSyncRequest running.
virtual double getSyncDownloadingProgress ()
 Returns a number in [0, 1] range which represents current sync progress (1 = complete).
virtual double getSyncProgress ()
 Returns a number in [0, 1] range which represents current sync progress (1 = complete).
virtual Common::Array
< Common::String
getSyncingFiles ()
 Returns an array of saves names which are not yet synced (thus cannot be used).
virtual void cancelSync ()
 Cancels running sync.
virtual void setSyncTarget (GUI::CommandReceiver *target)
 Sets SavesSyncRequest's target to given CommandReceiver.
virtual bool startDownload (Common::String remotePath, Common::String localPath)
 Starts a folder download.
virtual void cancelDownload ()
 Cancels running download.
virtual void setDownloadTarget (GUI::CommandReceiver *target)
 Sets FolderDownloadRequest's target to given CommandReceiver.
virtual bool isDownloading ()
 Returns whether there is a FolderDownloadRequest running.
virtual double getDownloadingProgress ()
 Returns a number in [0, 1] range which represents current download progress (1 = complete).
virtual uint64 getDownloadBytesNumber ()
 Returns a number of bytes that is downloaded in current download progress.
virtual uint64 getDownloadTotalBytesNumber ()
 Returns a total number of bytes to be downloaded in current download progress.
virtual uint64 getDownloadSpeed ()
 Returns download speed of current download progress.
virtual Common::String getDownloadRemoteDirectory ()
 Returns remote directory path.
virtual Common::String getDownloadLocalDirectory ()
 Returns local directory path.

Protected Member Functions

virtual Networking::ErrorCallback getErrorPrintingCallback ()
 Returns default error callback (printErrorResponse).
virtual void printErrorResponse (Networking::ErrorResponse error)
 Prints ErrorResponse contents with debug().
virtual Networking::RequestaddRequest (Networking::Request *request)
 Adds request to the ConnMan, but also increases _runningRequestsCount.
virtual void requestFinishedCallback (Networking::Request *invalidRequestPointer)
 Decreases _runningRequestCount.
virtual void savesSyncDefaultCallback (BoolResponse response)
 Finishes the sync.
virtual void savesSyncDefaultErrorCallback (Networking::ErrorResponse error)
 Finishes the sync.
virtual void directoryDownloadedCallback (FileArrayResponse response)
 Finishes the download.
virtual void directoryDownloadedErrorCallback (Networking::ErrorResponse error)
 Finishes the download.

Protected Attributes

uint32 _runningRequestsCount
 Keeps track of running requests.
Common::Mutex _runningRequestsMutex
SavesSyncRequest_savesSyncRequest
 SavesSyncRequest-related.
bool _syncRestartRequestsed
FolderDownloadRequest_downloadFolderRequest
 FolderDownloadRequest-related.
bool _isEnabled
 Whether user manually enabled the Storage.

Detailed Description

Definition at line 47 of file storage.h.


Member Typedef Documentation

Definition at line 51 of file storage.h.


Constructor & Destructor Documentation

Cloud::Storage::Storage (  ) 

Definition at line 35 of file storage.cpp.

Cloud::Storage::~Storage (  )  [virtual]

Definition at line 39 of file storage.cpp.


Member Function Documentation

Networking::Request * Cloud::Storage::addRequest ( Networking::Request request  )  [protected, virtual]

Adds request to the ConnMan, but also increases _runningRequestsCount.

This method should be used by Storage implementations instead of direct ConnMan.addRequest() call.

Returns:
the same Request pointer, just as a shortcut

Definition at line 58 of file storage.cpp.

void Cloud::Storage::cancelDownload (  )  [virtual]

Cancels running download.

Definition at line 266 of file storage.cpp.

void Cloud::Storage::cancelSync (  )  [virtual]

Cancels running sync.

Definition at line 211 of file storage.cpp.

virtual Networking::Request* Cloud::Storage::createDirectory ( Common::String  path,
BoolCallback  callback,
Networking::ErrorCallback  errorCallback 
) [pure virtual]

Calls the callback when finished.

Implemented in Cloud::Dropbox::DropboxStorage, Cloud::Id::IdStorage, and Cloud::OneDrive::OneDriveStorage.

void Cloud::Storage::directoryDownloadedCallback ( FileArrayResponse  response  )  [protected, virtual]

Finishes the download.

Shows an OSD message.

Definition at line 341 of file storage.cpp.

void Cloud::Storage::directoryDownloadedErrorCallback ( Networking::ErrorResponse  error  )  [protected, virtual]

Finishes the download.

Shows an OSD message.

Definition at line 355 of file storage.cpp.

Networking::Request * Cloud::Storage::download ( Common::String  remotePath,
Common::String  localPath,
BoolCallback  callback,
Networking::ErrorCallback  errorCallback 
) [virtual]

Calls the callback when finished.

Reimplemented in Cloud::Id::IdStorage.

Definition at line 110 of file storage.cpp.

Networking::Request * Cloud::Storage::downloadById ( Common::String  remoteId,
Common::String  localPath,
BoolCallback  callback,
Networking::ErrorCallback  errorCallback 
) [virtual]

Definition at line 115 of file storage.cpp.

Networking::Request * Cloud::Storage::downloadFolder ( Common::String  remotePath,
Common::String  localPath,
FileArrayCallback  callback,
Networking::ErrorCallback  errorCallback,
bool  recursive = false 
) [virtual]

Returns Common::Array<StorageFile> with list of files, which were not downloaded.

Definition at line 131 of file storage.cpp.

void Cloud::Storage::enable (  ) 

Set _isEnabled to true.

Definition at line 45 of file storage.cpp.

uint64 Cloud::Storage::getDownloadBytesNumber (  )  [virtual]

Returns a number of bytes that is downloaded in current download progress.

Definition at line 296 of file storage.cpp.

double Cloud::Storage::getDownloadingProgress (  )  [virtual]

Returns a number in [0, 1] range which represents current download progress (1 = complete).

Definition at line 287 of file storage.cpp.

Common::String Cloud::Storage::getDownloadLocalDirectory (  )  [virtual]

Returns local directory path.

Definition at line 332 of file storage.cpp.

Common::String Cloud::Storage::getDownloadRemoteDirectory (  )  [virtual]

Returns remote directory path.

Definition at line 323 of file storage.cpp.

uint64 Cloud::Storage::getDownloadSpeed (  )  [virtual]

Returns download speed of current download progress.

Definition at line 314 of file storage.cpp.

uint64 Cloud::Storage::getDownloadTotalBytesNumber (  )  [virtual]

Returns a total number of bytes to be downloaded in current download progress.

Definition at line 305 of file storage.cpp.

Networking::ErrorCallback Cloud::Storage::getErrorPrintingCallback (  )  [protected, virtual]

Returns default error callback (printErrorResponse).

Definition at line 49 of file storage.cpp.

double Cloud::Storage::getSyncDownloadingProgress (  )  [virtual]

Returns a number in [0, 1] range which represents current sync progress (1 = complete).

Definition at line 184 of file storage.cpp.

Common::Array< Common::String > Cloud::Storage::getSyncingFiles (  )  [virtual]

Returns an array of saves names which are not yet synced (thus cannot be used).

Definition at line 202 of file storage.cpp.

double Cloud::Storage::getSyncProgress (  )  [virtual]

Returns a number in [0, 1] range which represents current sync progress (1 = complete).

Definition at line 193 of file storage.cpp.

virtual Networking::Request* Cloud::Storage::info ( StorageInfoCallback  callback,
Networking::ErrorCallback  errorCallback 
) [pure virtual]

Returns the StorageInfo struct via <callback>.

Calls the <errorCallback> if failed to get information.

Note:
on success Storage should also call CloudMan.setStorageUsername().

Implemented in Cloud::Box::BoxStorage, Cloud::Dropbox::DropboxStorage, Cloud::GoogleDrive::GoogleDriveStorage, and Cloud::OneDrive::OneDriveStorage.

bool Cloud::Storage::isDownloading (  )  [virtual]

Returns whether there is a FolderDownloadRequest running.

Definition at line 280 of file storage.cpp.

bool Cloud::Storage::isEnabled (  )  const

Return whether Storage has been manually enabled by user.

Definition at line 41 of file storage.cpp.

bool Cloud::Storage::isSyncing (  )  [virtual]

Returns whether there is a SavesSyncRequest running.

Definition at line 177 of file storage.cpp.

bool Cloud::Storage::isWorking (  )  [virtual]

Returns whether there are any requests running.

Definition at line 168 of file storage.cpp.

virtual Networking::Request* Cloud::Storage::listDirectory ( Common::String  path,
ListDirectoryCallback  callback,
Networking::ErrorCallback  errorCallback,
bool  recursive = false 
) [pure virtual]

Public Cloud API comes down there.

All Cloud API methods return Networking::Request *, which might be used to control request. All methods also accept a callback, which is called, when request is complete. Returns ListDirectoryResponse with list of files.

Implemented in Cloud::Dropbox::DropboxStorage, Cloud::Id::IdStorage, and Cloud::OneDrive::OneDriveStorage.

virtual Common::String Cloud::Storage::name (  )  const [pure virtual]

Return unique storage name.

Returns:
some unique storage name (for example, "Dropbox (user@example.com)")

Implemented in Cloud::Box::BoxStorage, Cloud::Dropbox::DropboxStorage, Cloud::GoogleDrive::GoogleDriveStorage, and Cloud::OneDrive::OneDriveStorage.

void Cloud::Storage::printErrorResponse ( Networking::ErrorResponse  error  )  [protected, virtual]

Prints ErrorResponse contents with debug().

Definition at line 53 of file storage.cpp.

void Cloud::Storage::requestFinishedCallback ( Networking::Request invalidRequestPointer  )  [protected, virtual]

Decreases _runningRequestCount.

It's called from ConnMan automatically. Passed pointer is dangling, but one can use the address to determine some special Requests (which addresses were remembered somewhere).

Definition at line 67 of file storage.cpp.

virtual void Cloud::Storage::saveConfig ( Common::String  keyPrefix  )  [pure virtual]

Storage methods, which are used by CloudManager to save storage in configuration file.

Save storage data using ConfMan.

Parameters:
keyPrefix all saved keys must start with this prefix.
Note:
every Storage must write keyPrefix + "type" key with common value (e.g. "Dropbox").

Implemented in Cloud::Box::BoxStorage, Cloud::Dropbox::DropboxStorage, Cloud::GoogleDrive::GoogleDriveStorage, and Cloud::OneDrive::OneDriveStorage.

virtual Common::String Cloud::Storage::savesDirectoryPath (  )  [pure virtual]

Returns storage's saves directory path with the trailing slash.

Implemented in Cloud::Box::BoxStorage, Cloud::Dropbox::DropboxStorage, Cloud::GoogleDrive::GoogleDriveStorage, and Cloud::OneDrive::OneDriveStorage.

void Cloud::Storage::savesSyncDefaultCallback ( BoolResponse  response  )  [protected, virtual]

Finishes the sync.

Shows an OSD message.

Definition at line 225 of file storage.cpp.

void Cloud::Storage::savesSyncDefaultErrorCallback ( Networking::ErrorResponse  error  )  [protected, virtual]

Finishes the sync.

Shows an OSD message.

Definition at line 234 of file storage.cpp.

void Cloud::Storage::setDownloadTarget ( GUI::CommandReceiver target  )  [virtual]

Sets FolderDownloadRequest's target to given CommandReceiver.

Definition at line 273 of file storage.cpp.

void Cloud::Storage::setSyncTarget ( GUI::CommandReceiver target  )  [virtual]

Sets SavesSyncRequest's target to given CommandReceiver.

Definition at line 218 of file storage.cpp.

bool Cloud::Storage::startDownload ( Common::String  remotePath,
Common::String  localPath 
) [virtual]

Starts a folder download.

Definition at line 249 of file storage.cpp.

Networking::Request * Cloud::Storage::streamFile ( Common::String  path,
Networking::NetworkReadStreamCallback  callback,
Networking::ErrorCallback  errorCallback 
) [virtual]

Returns pointer to Networking::NetworkReadStream.

Reimplemented in Cloud::Id::IdStorage.

Definition at line 105 of file storage.cpp.

SavesSyncRequest * Cloud::Storage::syncSaves ( BoolCallback  callback,
Networking::ErrorCallback  errorCallback 
) [virtual]

Calls the callback when finished.

Definition at line 143 of file storage.cpp.

Networking::Request * Cloud::Storage::upload ( Common::String  remotePath,
Common::String  localPath,
UploadCallback  callback,
Networking::ErrorCallback  errorCallback 
) [virtual]

Reimplemented in Cloud::Box::BoxStorage.

Definition at line 84 of file storage.cpp.

virtual Networking::Request* Cloud::Storage::upload ( Common::String  path,
Common::SeekableReadStream contents,
UploadCallback  callback,
Networking::ErrorCallback  errorCallback 
) [pure virtual]
bool Cloud::Storage::uploadStreamSupported (  )  [virtual]

Returns whether Storage supports upload(ReadStream).

Reimplemented in Cloud::Box::BoxStorage.

Definition at line 101 of file storage.cpp.


Member Data Documentation

FolderDownloadRequest-related.

Definition at line 71 of file storage.h.

bool Cloud::Storage::_isEnabled [protected]

Whether user manually enabled the Storage.

Definition at line 74 of file storage.h.

Keeps track of running requests.

Definition at line 63 of file storage.h.

Definition at line 64 of file storage.h.

SavesSyncRequest-related.

Definition at line 67 of file storage.h.

Definition at line 68 of file storage.h.


The documentation for this class was generated from the following files:


Generated on Sat May 23 2020 05:02:07 for ResidualVM by doxygen 1.7.1
curved edge   curved edge