Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor|FS: Continued refactoring remote file repository classes
The different types of repositories form a class hierarchy, and the application (DoomsdayApp) can register its own repository type(s). libcore just provides access to the serverside files.
- Loading branch information
Showing
18 changed files
with
237 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#include "remote/query.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/** @file remote/query.h | ||
* | ||
* @authors Copyright (c) 2017 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* | ||
* @par License | ||
* LGPL: http://www.gnu.org/licenses/lgpl.html | ||
* | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or (at your | ||
* option) any later version. This program is distributed in the hope that it | ||
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | ||
* General Public License for more details. You should have received a copy of | ||
* the GNU Lesser General Public License along with this program; if not, see: | ||
* http://www.gnu.org/licenses</small> | ||
*/ | ||
|
||
#ifndef DENG2_FILESYS_QUERY_H | ||
#define DENG2_FILESYS_QUERY_H | ||
|
||
#include "../../AsyncCallback" | ||
#include "../../DictionaryValue" | ||
#include "../../IdentifiedPacket" | ||
|
||
namespace de { | ||
namespace filesys { | ||
|
||
typedef DictionaryValue FileList; | ||
|
||
typedef std::function<void (FileList const &)> FileListFunc; | ||
typedef std::function<void (duint64 startOffset, Block const &, duint64 remainingBytes)> DataReceivedFunc; | ||
|
||
typedef std::shared_ptr<AsyncCallback<FileListFunc>> FileListRequest; | ||
typedef std::shared_ptr<AsyncCallback<DataReceivedFunc>> FileContentsRequest; | ||
|
||
using QueryId = IdentifiedPacket::Id; | ||
|
||
/** | ||
* Query about information stored in the remote repository. The callbacks will | ||
* be called when a reply is received. | ||
*/ | ||
struct DENG2_PUBLIC Query | ||
{ | ||
// Query parameters: | ||
QueryId id; | ||
String path; | ||
|
||
// Callbacks: | ||
FileListRequest fileList; | ||
FileContentsRequest fileContents; | ||
|
||
// Internal status: | ||
duint64 receivedBytes = 0; | ||
duint64 fileSize = 0; | ||
|
||
Query(FileListRequest req, String path); | ||
Query(FileContentsRequest req, String path); | ||
bool isValid() const; | ||
void cancel(); | ||
}; | ||
|
||
} // namespace filesys | ||
} // namespace de | ||
|
||
#endif // DENG2_FILESYS_QUERY_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.