# DownloadDb

from pandac.PandaModules import DownloadDb

Class : DownloadDb
Description : A listing of files within multifiles for management of client-side synchronization with a server-provided set of files.
This class manages one copy of the database for the client, representing the files on the client system, and another copy for the server, representing the files the server has available.

## Inheritance:

DownloadDb:

## Methods of DownloadDb:

DownloadDb (Constructor)
addClientMultifile
addVersion
clientMultifileComplete
clientMultifileDecompressed
clientMultifileExists
clientMultifileExtracted
createNewServerDb
deleteClientMultifile
expandClientMultifile
getClientMultifileHash
getClientMultifileName
getClientMultifilePhase
getClientMultifileSize
getClientNumMultifiles
getHash
getNumVersions
getServerFileName
getServerMultifileHash
getServerMultifileName
getServerMultifilePhase
getServerMultifileSize
getServerNumFiles
getServerNumMultifiles
getVersion
hasVersion
insertNewVersion
output
readDb
serverAddFile
serverAddMultifile
setClientMultifileComplete
setClientMultifileDecompressed
setClientMultifileDeltaSize
setClientMultifileExtracted
setClientMultifileHash
setClientMultifileIncomplete
setClientMultifileSize
setNumVersions
setServerMultifileHash
setServerMultifileSize
write
writeClientDb
writeDb
writeServerDb
writeVersionMap

## Constants in DownloadDb:

StatusIncomplete | (Status)
StatusComplete | (Status)
StatusDecompressed | (Status)
StatusExtracted | (Status)

DownloadDb DownloadDb::DownloadDb(void); Description: Create a download db with these client and server dbs Description: Primarily used for testing.

addClientMultifile void DownloadDb::add_client_multifile(string server_mfname); Operations on multifiles Description:

addVersion void DownloadDb::add_version(Filename const &name, HashVal const &hash, int version); Description: Appends a new version of the file onto the end of the list, or changes the hash associated with a version previously added. Note: version numbers start at 1

clientMultifileComplete bool DownloadDb::client_multifile_complete(string mfname) const; Queries from the Launcher Description: A multifile is complete when it is completely downloaded. Note: it may already be decompressed or extracted and it is still complete

clientMultifileDecompressed bool DownloadDb::client_multifile_decompressed(string mfname) const; Description:

clientMultifileExists bool DownloadDb::client_multifile_exists(string mfname) const; Queries from the Launcher Description:

clientMultifileExtracted bool DownloadDb::client_multifile_extracted(string mfname) const; Description:

createNewServerDb void DownloadDb::create_new_server_db(void); Server side operations to create multifile records Description: Used on the server side makefiles to create a new clean server db

deleteClientMultifile void DownloadDb::delete_client_multifile(string mfname); Operations on multifiles Description:

expandClientMultifile void DownloadDb::expand_client_multifile(string mfname); Description:

getClientMultifileHash HashVal DownloadDb::get_client_multifile_hash(string mfname) const; Ask what version (told with the hash) this multifile is Description: Return the hash value of the file we are working on

getClientMultifileName string DownloadDb::get_client_multifile_name(int index) const; Description:

getClientMultifilePhase float DownloadDb::get_client_multifile_phase(string mfname) const; Description:

getClientMultifileSize int DownloadDb::get_client_multifile_size(string mfname) const; Description:

getClientNumMultifiles int DownloadDb::get_client_num_multifiles(void) const; Description:

getHash HashVal const &DownloadDb::get_hash(Filename const &name, int version) const; Description: Returns the MD5 hash associated with the indicated version of the indicated file.

getNumVersions int DownloadDb::get_num_versions(Filename const &name) const; Description: Returns the number of versions stored for the indicated file.

getServerFileName string DownloadDb::get_server_file_name(string mfname, int index) const; Description:

getServerMultifileHash HashVal DownloadDb::get_server_multifile_hash(string mfname) const; Description: Return the hash value of the server file

getServerMultifileName string DownloadDb::get_server_multifile_name(int index) const; Description:

getServerMultifilePhase float DownloadDb::get_server_multifile_phase(string mfname) const; Description:

getServerMultifileSize int DownloadDb::get_server_multifile_size(string mfname) const; Description:

getServerNumFiles int DownloadDb::get_server_num_files(string mfname) const; Description:

getServerNumMultifiles int DownloadDb::get_server_num_multifiles(void) const; Description:

getVersion int DownloadDb::get_version(Filename const &name, HashVal const &hash) const; Description: Returns the version number of this particular file, determined by looking up the hash generated from the file. Returns -1 if the version number cannot be determined.

hasVersion bool DownloadDb::has_version(Filename const &name) const; Description: Returns true if the indicated file has version information, false otherwise. Some files recorded in the database may not bother to track versions.

insertNewVersion void DownloadDb::insert_new_version(Filename const &name, HashVal const &hash); Description: Inserts a new version 1 copy of the file, sliding all the other versions up by one.

output void DownloadDb::output(ostream &out) const; Description:

readDb DownloadDb::Db DownloadDb::read_db(Filename &file, bool want_server_info); Description:

serverAddFile void DownloadDb::server_add_file(string mfname, string fname); Description:

serverAddMultifile void DownloadDb::server_add_multifile(string mfname, float phase, int size, int status); Server side operations to create multifile records Description:

setClientMultifileComplete void DownloadDb::set_client_multifile_complete(string mfname); Description:

setClientMultifileDecompressed void DownloadDb::set_client_multifile_decompressed(string mfname); Description:

setClientMultifileDeltaSize int DownloadDb::set_client_multifile_delta_size(string mfname, int size); Description:

setClientMultifileExtracted void DownloadDb::set_client_multifile_extracted(string mfname); Description:

setClientMultifileHash void DownloadDb::set_client_multifile_hash(string mfname, HashVal val); Ask what version (told with the hash) this multifile is Description: Set the hash value of file we are working on

setClientMultifileIncomplete void DownloadDb::set_client_multifile_incomplete(string mfname); Description:

setClientMultifileSize void DownloadDb::set_client_multifile_size(string mfname, int size); Description:

setNumVersions void DownloadDb::set_num_versions(Filename const &name, int num_versions); Description: Reduces the number of versions of a particular file stored in the ddb by throwing away all versions higher than the indicated index.

setServerMultifileHash void DownloadDb::set_server_multifile_hash(string mfname, HashVal val); Description: Set the hash value of file we are working on

setServerMultifileSize void DownloadDb::set_server_multifile_size(string mfname, int size); Description:

write void DownloadDb::write(ostream &out) const; Description:

writeClientDb bool DownloadDb::write_client_db(Filename &file); Write a database file Description:

writeDb bool DownloadDb::write_db(Filename &file, DownloadDb::Db db, bool want_server_info); Description:

writeServerDb bool DownloadDb::write_server_db(Filename &file); Write a database file Description:

writeVersionMap void DownloadDb::write_version_map(ostream &out) const; Description: