aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud
AgeCommit message (Collapse)Author
2016-08-24CLOUD: Make syncSaves() common for all StoragesAlexander Tkachev
As it uses SavesSyncRequest and this request is using Storage's upload(), download() and listDirectory(), there is no need to make storage-dependent version of that request and so method could be implemented in base Storage.
2016-08-24CLOUD: Add OneDrive::info()Alexander Tkachev
Unfortunately, OneDrive doesn't share quota information anymore because of some reason. I had to get as much information as I could.
2016-08-24CLOUD: Make SavesSyncRequest work with OneDriveAlexander Tkachev
It actually works fine, but small Storage::savesDirectoryPath() was added, because Dropbox's directories must start with a slash, and OneDrive's directories must not. Saves sync tested and it works fine with OneDrive.
2016-08-24CLOUD: Add OneDriveUploadRequestAlexander Tkachev
Doesn't support server's requested ranges yet. Commit also adds some PUT-related code in NetworkReadStream and CurlRequest.
2016-08-24CLOUD: Refactor RequestAlexander Tkachev
Added ErrorResponse and ErrorCallback. Each Request now has an ErrorCallback, which should be called instead of usual callback in case of failure.
2016-08-24CLOUD: Fix OneDriveTokenRefresherAlexander Tkachev
It was calling finish(), causing stack overflow. Some minor changes are added also.
2016-08-24CLOUD: Make SavesSyncRequest workAlexander Tkachev
It now actually read the "timestamps" file, loads and saves files as it should, ignores Dropbox's "not_found" error.
2016-08-24CLOUD: Add ListDirectoryStatus structAlexander Tkachev
It contains flags to indicate whether Request was interrupted or failed, so dependent Requests may see that list is incomplete.
2016-08-24CLOUD: Make DropboxUploadRequest use "/upload" tooAlexander Tkachev
If file could be uploaded in one API call, no need to create a session (which requires at least two calls: to start and then to finish it).
2016-08-24CLOUD: Add UploadStatus structAlexander Tkachev
It contains not just "success" flag, but also "file" struct, so the caller can find out some information about uploaded file - like timestamp.
2016-08-24CLOUD: Add DropboxUploadRequestAlexander Tkachev
2016-08-24CLOUD: Add SavesSyncRequest sketchAlexander Tkachev
Never tested it, actually. It requires Storage to implement upload() method and me to find some way to get saves' ReadStream. The saveTimestamps() and loadTimestamps() part should be tested, other parts should work fine.
2016-08-24CLOUD: Add "device_id" into configuration fileAlexander Tkachev
2016-08-24Remove some unnecessary blank linesPeter Bozsó
2016-08-24Fix comment formattingPeter Bozsó
2016-08-24Replace 0 constant with nullptr in getCurrentStorage()Peter Bozsó
2016-08-24CLOUD: Add OneDriveStorage::downloadFolder()Alexander Tkachev
Just uses FolderDownloadRequest the way DropboxStorage does.
2016-08-24CLOUD: Fix Requests destructorsAlexander Tkachev
I forgot to delete callbacks!
2016-08-24CLOUD: Add OneDriveListDirectoryRequestAlexander Tkachev
Works as charm.
2016-08-24CLOUD: Fix format string warningsAlexander Tkachev
I get 'warning: ISO C++98 does not support the '%lg' ms_printf format' warning though.
2016-08-24CLOUD: Fix "global destructor" warningAlexander Tkachev
Plain char * is used instead of Common::String in DropboxStorage and OneDriveStorage's KEY and SECRET.
2016-08-24CLOUD: Add FolderDownloadRequestAlexander Tkachev
Uses Storage's listDirectory() and download() methods to download contents.
2016-08-24CLOUD: Simplify OneDriveTokenRefresherAlexander Tkachev
It now just extends CurlJsonRequest, not wraps one.
2016-08-24CLOUD: Fix OneDriveTokenRefresherAlexander Tkachev
Failed to update token in header when "Bearer" was used instead of "bearer".
2016-08-24CLOUD: Add access to CurlRequest's StreamAlexander Tkachev
One can access CurlRequest's NetworkReadStream in order to find out HTTP response code or some other Stream-related data. OneDriveTokenRefresher uses it to print some info on that 404 error I'm trying to troubleshoot.
2016-08-24CLOUD: Refactor ConnectionManager/Requests systemAlexander Tkachev
ConnectionManager now storages Request * (not generates ids for it), Requests have control on their RequestState, RequestIdPair is now called Response and storages Request * with some response together. All related classes are changed to use it in more clean and understandable way. Request, RequestState and Response are carefully commented/documented.
2016-08-24CLOUD: Make OneDriveStorage::download() work fineAlexander Tkachev
Well, it takes two API calls instead of one now, but there are no problems with expired token because of it. This commit changes Storage::streamFile() to pass NetworkReadStream * through callback.
2016-08-24CLOUD: Add OneDriveStorage::download()Alexander Tkachev
Doesn't work when token is invalid, though.
2016-08-24CLOUD: Add OneDriveTokenRefresherAlexander Tkachev
OneDriveTokenRefresher is a CurlJsonRequest replacement for OneDriveStorage methods. It behaves very similarly, but checks received JSON before passing it to user. If it contains "error" key, it attempts to refresh the token through OneDriveStorage, and then restarts the original request, so user won't notice that there ever was an error.
2016-08-24CLOUD: Fix CurlJsonRequest to use JsonCallbackAlexander Tkachev
Type safety first.
2016-08-24CLOUD: Change Request::handle()Alexander Tkachev
With new ConnectionManager upgrade Requests indicate that they are finished with RequestInfo.state. No need to use handle() return value anymore.
2016-08-24CLOUD: Add RequestIdPair structAlexander Tkachev
Can be used with Callback<T> (means it's still type safe). It's used to pass not only Request id to user's callback, but also a value user wanted. void *data field is removed from RequestInfo.
2016-08-24CLOUD: Add RequestInfo structAlexander Tkachev
ConnectionManager upgrade: it now contains a special struct for each request, so you can access request status and data by request id.
2016-08-24CLOUD: Add Requests idAlexander Tkachev
(Upgrading ConnectionManager step by step.)
2016-08-24CLOUD: Make download() create necessary directoriesAlexander Tkachev
DumpFile::open() with createPath=true create would create the missing directories from the path before opening a file. Thus, one can easily create a file and avoid "can't open a file" error.
2016-08-24CLOUD: Add OneDrive refresh_token supportAlexander Tkachev
It might be not that easy to restart the request after new token received, though.
2016-08-24CLOUD: Add OneDrive Storage stubAlexander Tkachev
Knows how to OAuth already. This commit also adds CloudManager::addStorage(), so OneDriveStorage can add newly created Storage and CloudManager can save it in the configuration file.
2016-08-24CLOUD: Make DownloadRequest write to local fileAlexander Tkachev
Tested with .jpg file. Transfer complete, CRC-32 is the same.
2016-08-24CLOUD: Add DownloadRequest stubAlexander Tkachev
It reads the passed NetworkReadStream and prints its contents onto console (for now). It would be writing contents into file. To simplify work with raw NetworkReadStream there is a new CurlRequest. It basically does nothing, but as ConnMan handles transfers only if there is an active Request, you need some Request to get NetworkReadStream working. Thus, there is a CurlRequest, which is active until NetworkReadStream is completely read. CurlRequest also has useful addHeader() and addPostField() methods in order to customize the request easily. Use execute() method to get its NetworkReadStream. DropboxStorage implements streamFile() and download() API methods. As DownloadRequest is incomplete, it is not actually downloading a file, though.
2016-08-24CLOUD: Change ISO8601 to use strchrAlexander Tkachev
I'm not sure it works as it should though.
2016-08-24CLOUD: Add DropboxListDirectoryRequestAlexander Tkachev
Does multiple CurlJsonRequests while Dropbox returns "has_more" = true.
2016-08-24CLOUD: Add DropboxStorage::listDirectory sketchAlexander Tkachev
It doesn't support any "has_more", doesn't call user's callback and just prints JSON instead of parsing in into an array of files. I believe it would become DropboxListDirectoryRequest in the next commit.
2016-08-24CLOUD: Make StorageInfo usefulAlexander Tkachev
It now contains a few useful methods to get name or quota usage. DropboxStorage returns a finely filled StorageInfo.
2016-08-24CLOUD: Add Storage saving mechanismAlexander Tkachev
In this commit CloudManager starts supporting multiple Storage. Now, in its init() it loads all the Storages and determines the current one. It now also has save() method. In that method all Storages are saved with their new saveConfig() method. CloudManager::save() not called from anywhere, though. The only one Storage that could be added is DropboxStorage in case you have no cloud-related config keys or you have no storages connected.
2016-08-24CLOUD: Add Callback typedefsAlexander Tkachev
And do some minor cleanup work.
2016-08-24CLOUD: Polish CallbacksAlexander Tkachev
Cleaned up all example code and old callbacks. New Callback classes are introduced in "common/callback.h" and documented.
2016-08-24CLOUD: Add CallbackBridgeAlexander Tkachev
This commit also adds GlobalFunctionCallback, because it was needed in order to replace plain C pointers to functions (which were used in Request) into our object-oriented BaseCallback pointers.
2016-08-24CLOUD: Add object-oriented CallbacksAlexander Tkachev
These callbacks can call object's methods, not some global C functions. DropboxStorage::info2() and DropboxStorage::infoMethodCallback() demonstrate the idea.
2016-08-24CLOUD: Add complex callbacksAlexander Tkachev
Originally, I intended to add Storage API, StorageFile and StorageInfo stubs. When I tried to implement a simple info() call, I ended up fixing Request to contain some pointer field and all callbacks to have Request* parameter. And, now I have to place callback pointer into Request. which calls another callback. And, eventually, these "simple" callbacks would again require another pointer (to some caller class).
2016-08-24CLOUD: Add ConnectionManager hotfixAlexander Tkachev
Tried to compile these two last commits with GCC and found a few minor problems.