#include <AutopatcherPostgreRepository.h>
Public Member Functions | |
bool | CreateAutopatcherTables (void) |
bool | DestroyAutopatcherTables (void) |
bool | AddApplication (const char *applicationName, char *userName) |
bool | RemoveApplication (const char *applicationName) |
bool | UpdateApplicationFiles (const char *applicationName, const char *applicationDirectory, char *userName) |
virtual bool | GetChangelistSinceDate (const char *applicationName, FileList *addedFiles, FileList *deletedFiles, const char *sinceDate, char currentDate[64]) |
virtual bool | GetPatches (const char *applicationName, FileList *input, FileList *patchList, char currentDate[64]) |
virtual char * | GetLastError (void) const |
If any of the above functions fail, the error string is stored internally. Call this to get it. |
bool AutopatcherPostgreRepository::CreateAutopatcherTables | ( | void | ) |
Create the tables used by the autopatcher, for all applications. Call this first.
bool 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.
bool AutopatcherPostgreRepository::AddApplication | ( | const char * | applicationName, | |
char * | userName | |||
) |
Add an application for use by files. Call this second.
[in] | applicationName | A null terminated string. |
[in] | userName | Stored in the database, but otherwise unused. Useful to track who added this application. |
bool AutopatcherPostgreRepository::RemoveApplication | ( | const char * | applicationName | ) |
Remove an application and files used by that application.
[in] | applicationName | A null terminated string previously passed to AddApplication |
bool AutopatcherPostgreRepository::UpdateApplicationFiles | ( | const char * | applicationName, | |
const char * | applicationDirectory, | |||
char * | userName | |||
) |
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.
[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 |
bool AutopatcherPostgreRepository::GetChangelistSinceDate | ( | const char * | applicationName, | |
FileList * | addedFiles, | |||
FileList * | deletedFiles, | |||
const char * | sinceDate, | |||
char | currentDate[64] | |||
) | [virtual] |
Get list of files added and deleted since a certain date. This is used by AutopatcherServer and not usually explicitly called.
[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] | An | input date, in the string format of a timestamp. |
[out] | currentDate | The server date, in the string format of a timestamp. |
Implements AutopatcherRepositoryInterface.
bool AutopatcherPostgreRepository::GetPatches | ( | const char * | applicationName, | |
FileList * | input, | |||
FileList * | patchList, | |||
char | currentDate[64] | |||
) | [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.
[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. |
[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 |
[out] | currentDate | The current server date, in whatever format your repository uses |
Implements AutopatcherRepositoryInterface.