#include <AutopatcherPostgreRepository.h>
|
virtual bool | CreateAutopatcherTables (void) |
|
bool | DestroyAutopatcherTables (void) |
|
bool | AddApplication (const char *applicationName, const char *userName) |
|
bool | RemoveApplication (const char *applicationName) |
|
virtual bool | UpdateApplicationFiles (const char *applicationName, const char *applicationDirectory, const char *userName, FileListProgress *cb) |
|
virtual bool | GetChangelistSinceDate (const char *applicationName, FileList *addedOrModifiedFilesWithHashData, FileList *deletedFiles, double sinceDate) |
|
virtual int | GetPatches (const char *applicationName, FileList *input, bool allowDownloadOfOriginalUnmodifiedFiles, FileList *patchList) |
|
virtual bool | GetMostRecentChangelistWithPatches (RakNet::RakString &applicationName, FileList *patchedFiles, FileList *addedFiles, FileList *addedOrModifiedFileHashes, FileList *deletedFiles, double *priorRowPatchTime, double *mostRecentRowPatchTime) |
|
virtual const char * | GetLastError (void) const |
| If any of the above functions fail, the error string is stored internally. Call this to get it.
|
|
virtual unsigned int | GetFilePart (const char *filename, unsigned int startReadBytes, unsigned int numBytesToRead, void *preallocatedDestination, FileListNodeContext context) |
|
virtual const int | GetIncrementalReadChunkSize (void) const |
|
bool | Connect (const char *conninfo) |
|
void | AssignConnection (PGconn *_pgConn) |
| Use a connection allocated elsewehre.
|
|
PGconn * | GetPGConn (void) const |
| Get the instance of PGconn.
|
|
void | Disconnect (void) |
| Disconnect from the database.
|
|
virtual const char * | GetLastError (void) const |
| If any of the above functions fail, the error string is stored internally. Call this to get it.
|
|
An implementation of the AutopatcherRepositoryInterface to use PostgreSQL to store the relevant data
bool RakNet::AutopatcherPostgreRepository::AddApplication |
( |
const char * |
applicationName, |
|
|
const char * |
userName |
|
) |
| |
Add an application for use by files. Call this second.
- Parameters
-
[in] | applicationName | A null terminated string. |
[in] | userName | Stored in the database, but otherwise unused. Useful to track who added this application. |
- Returns
- True on success, false on failure.
virtual bool RakNet::AutopatcherPostgreRepository::CreateAutopatcherTables |
( |
void |
| ) |
|
|
virtual |
Create the tables used by the autopatcher, for all applications. Call this first.
- Returns
- True on success, false on failure.
bool RakNet::AutopatcherPostgreRepository::DestroyAutopatcherTables |
( |
void |
| ) |
|
Destroy the tables used by the autopatcher. Don't call this unless you don't want to use the autopatcher anymore, or are testing.
- Returns
- True on success, false on failure.
virtual bool RakNet::AutopatcherPostgreRepository::GetChangelistSinceDate |
( |
const char * |
applicationName, |
|
|
FileList * |
addedOrModifiedFilesWithHashData, |
|
|
FileList * |
deletedFiles, |
|
|
double |
sinceDate |
|
) |
| |
|
virtual |
Get list of files added and deleted since a certain date. This is used by AutopatcherServer and not usually explicitly called.
- Parameters
-
[in] | applicationName | A null terminated string previously passed to AddApplication |
[out] | addedFiles | A list of the current versions of filenames with SHA1_LENGTH byte hashes as their data that were created after sinceData |
[out] | deletedFiles | A list of the current versions of filenames that were deleted after sinceData |
[in] | sinceDate | |
- Returns
- True on success, false on failure.
Implements RakNet::AutopatcherRepositoryInterface.
virtual unsigned int RakNet::AutopatcherPostgreRepository::GetFilePart |
( |
const char * |
filename, |
|
|
unsigned int |
startReadBytes, |
|
|
unsigned int |
numBytesToRead, |
|
|
void * |
preallocatedDestination, |
|
|
FileListNodeContext |
context |
|
) |
| |
|
virtual |
Read part of a file into destination Return the number of bytes written. Return 0 when file is done.
- Parameters
-
[in] | filename | Filename to read |
[in] | startReadBytes | What offset from the start of the file to read from |
[in] | numBytesToRead | How many bytes to read. This is also how many bytes have been allocated to preallocatedDestination |
[out] | preallocatedDestination | Write your data here |
- Returns
- The number of bytes read, or 0 if none
virtual const int RakNet::AutopatcherPostgreRepository::GetIncrementalReadChunkSize |
( |
void |
| ) |
const |
|
virtual |
virtual bool RakNet::AutopatcherPostgreRepository::GetMostRecentChangelistWithPatches |
( |
RakNet::RakString & |
applicationName, |
|
|
FileList * |
patchedFiles, |
|
|
FileList * |
addedFiles, |
|
|
FileList * |
addedOrModifiedFileHashes, |
|
|
FileList * |
deletedFiles, |
|
|
double * |
priorRowPatchTime, |
|
|
double * |
mostRecentRowPatchTime |
|
) |
| |
|
virtual |
For the most recent update, return files that were patched, added, or deleted. For files that were patched, return both the patch in patchedFiles and the current version in updatedFiles
- Parameters
-
[in,out] | applicationName | Name of the application to get patches for. If empty, uses the most recently updated application, and the string will be updated to reflect this name. |
[out] | patchedFiles | A list of patched files with op PC_HASH_2_WITH_PATCH. It has 2 hashes, the priorHash and the currentHash. The currentHash is checked on the client after patching for patch success. The priorHash is checked in AutopatcherServer::OnGetPatch() to see if the client is able to hash with the version they currently have |
[out] | patchedFiles | A list of new files. It contains the actual data in addition to the filename |
[out] | addedOrModifiedFileHashes | A list of file hashes that were either modified or new. This is returned to the client when replying to ID_AUTOPATCHER_CREATION_LIST, which tells the client what files have changed on the server since a certain date |
[out] | deletedFiles | A list of the current versions of filenames that were deleted in the most recent patch |
[out] | whenPatched | time in seconds since epoch when patched. Use time() function to get this in C |
- Returns
- true on success, false on failure
Implements RakNet::AutopatcherRepositoryInterface.
virtual int RakNet::AutopatcherPostgreRepository::GetPatches |
( |
const char * |
applicationName, |
|
|
FileList * |
input, |
|
|
bool |
allowDownloadOfOriginalUnmodifiedFiles, |
|
|
FileList * |
patchList |
|
) |
| |
|
virtual |
Get patches (or files) for every file in input, assuming that input has a hash for each of those files. This is used by AutopatcherServer and not usually explicitly called.
- Parameters
-
[in] | applicationName | A null terminated string previously passed to AddApplication |
[in] | input | A list of files with hashes to get from the database. If this hash exists, a patch to the current version is returned if this file is not the current version. Otherwise the current version is returned. |
[in] | allowDownloadOfOriginalUnmodifiedFiles | If false, then if a file has never been modified and there is no hash for it in the input list, return false. This is to prevent clients from just downloading the game from the autopatcher. |
[out] | patchList | A list of files with either the filedata or the patch. This is a subset of input. The context data for each file will be either PC_WRITE_FILE (to just write the file) or PC_HASH_WITH_PATCH (to patch). If PC_HASH_WITH_PATCH, then the file contains a SHA1_LENGTH byte patch followed by the hash. The datalength is patchlength + SHA1_LENGTH |
- Returns
- 1 on success, 0 on database failure, -1 on tried to download original unmodified file
Implements RakNet::AutopatcherRepositoryInterface.
bool RakNet::AutopatcherPostgreRepository::RemoveApplication |
( |
const char * |
applicationName | ) |
|
Remove an application and files used by that application.
- Parameters
-
[in] | applicationName | A null terminated string previously passed to AddApplication |
- Returns
- True on success, false on failure.
virtual bool RakNet::AutopatcherPostgreRepository::UpdateApplicationFiles |
( |
const char * |
applicationName, |
|
|
const char * |
applicationDirectory, |
|
|
const char * |
userName, |
|
|
FileListProgress * |
cb |
|
) |
| |
|
virtual |
Update all the files for an application to match what is at the specified directory. Call this third. Be careful not to call this with the wrong directory. This is implemented in a Begin and Rollback block so you won't a messed up database from get partial updates.
- Note
- It takes 10 bytes of memory to create a patch per byte on disk for a file. So you should not have any files larger than 1/10th your server memory.
- Parameters
-
[in] | applicationName | A null terminated string previously passed to AddApplication |
[in] | applicationDirectory | The base directory of your application. All files in this directory and subdirectories are added. |
[in] | userName | Stored in the database, but otherwise unused. Useful to track who added this revision |
[in] | cb | Callback to get progress updates. Pass 0 to not use. |
- Returns
- True on success, false on failure.
The documentation for this class was generated from the following file: