#include <downloadDb.h>
Public Types | |
typedef pvector< PointerTo< FileRecord > > | FileRecords |
typedef pvector< PointerTo< MultifileRecord > > | MultifileRecords |
typedef pvector< HashVal > | VectorHash |
typedef pmap< Filename, VectorHash > | VersionMap |
enum | Status { Status_incomplete = 0, Status_complete = 1, Status_decompressed = 2, Status_extracted = 3 } |
Public Member Functions | |
DownloadDb (void) | |
Primarily used for testing. | |
DownloadDb (Ramfile &server_file, Filename &client_file) | |
Create a download db with these client and server dbs. | |
DownloadDb (Filename &server_file, Filename &client_file) | |
Create a download db with these client and server dbs. | |
~DownloadDb (void) | |
void | output (ostream &out) const |
void | write (ostream &out) const |
void | write_version_map (ostream &out) const |
bool | write_client_db (Filename &file) |
bool | write_server_db (Filename &file) |
int | get_client_num_multifiles (void) const |
int | get_server_num_multifiles (void) const |
string | get_client_multifile_name (int index) const |
string | get_server_multifile_name (int index) const |
int | get_client_multifile_size (string mfname) const |
void | set_client_multifile_size (string mfname, int size) |
int | set_client_multifile_delta_size (string mfname, int size) |
int | get_server_multifile_size (string mfname) const |
void | set_server_multifile_size (string mfname, int size) |
Phase | get_client_multifile_phase (string mfname) const |
Phase | get_server_multifile_phase (string mfname) const |
void | set_client_multifile_incomplete (string mfname) |
void | set_client_multifile_complete (string mfname) |
void | set_client_multifile_decompressed (string mfname) |
void | set_client_multifile_extracted (string mfname) |
int | get_server_num_files (string mfname) const |
string | get_server_file_name (string mfname, int index) const |
bool | client_multifile_exists (string mfname) const |
bool | client_multifile_complete (string mfname) const |
A multifile is complete when it is completely downloaded. | |
bool | client_multifile_decompressed (string mfname) const |
bool | client_multifile_extracted (string mfname) const |
HashVal | get_client_multifile_hash (string mfname) const |
Return the hash value of the file we are working on. | |
void | set_client_multifile_hash (string mfname, HashVal val) |
Set the hash value of file we are working on. | |
HashVal | get_server_multifile_hash (string mfname) const |
Return the hash value of the server file. | |
void | set_server_multifile_hash (string mfname, HashVal val) |
Set the hash value of file we are working on. | |
void | delete_client_multifile (string mfname) |
void | add_client_multifile (string server_mfname) |
void | expand_client_multifile (string mfname) |
void | create_new_server_db () |
Used on the server side makefiles to create a new clean server db. | |
void | server_add_multifile (string mfname, Phase phase, int size, int status) |
void | server_add_file (string mfname, string fname) |
Db | read_db (Filename &file, bool want_server_info) |
Db | read_db (Ramfile &file, bool want_server_info) |
bool | write_db (Filename &file, Db db, bool want_server_info) |
void | add_version (const Filename &name, const HashVal &hash, int version) |
Appends a new version of the file onto the end of the list, or changes the hash associated with a version previously added. | |
void | insert_new_version (const Filename &name, const HashVal &hash) |
Inserts a new version 1 copy of the file, sliding all the other versions up by one. | |
bool | has_version (const Filename &name) const |
Returns true if the indicated file has version information, false otherwise. | |
int | get_num_versions (const Filename &name) const |
Returns the number of versions stored for the indicated file. | |
void | set_num_versions (const Filename &name, int num_versions) |
Reduces the number of versions of a particular file stored in the ddb by throwing away all versions higher than the indicated index. | |
int | get_version (const Filename &name, const HashVal &hash) const |
Returns the version number of this particular file, determined by looking up the hash generated from the file. | |
const HashVal & | get_hash (const Filename &name, int version) const |
Returns the MD5 hash associated with the indicated version of the indicated file. | |
Public Attributes | |
Db | _client_db |
Db | _server_db |
Static Public Attributes | |
PN_uint32 | _magic_number = 0xfeedfeed |
PN_uint32 | _bogus_magic_number = 0x11111111 |
Protected Member Functions | |
void | write_version_map (ofstream &write_stream) |
bool | read_version_map (istream &read_stream) |
Protected Attributes | |
VersionMap | _versions |
Datagram | _master_datagram |
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.
Definition at line 81 of file downloadDb.h.
|
Definition at line 162 of file downloadDb.h. |
|
Definition at line 183 of file downloadDb.h. |
|
Definition at line 226 of file downloadDb.h. |
|
Definition at line 227 of file downloadDb.h. |
|
Definition at line 87 of file downloadDb.h. |
|
Primarily used for testing.
Definition at line 102 of file downloadDb.cxx. |
|
Create a download db with these client and server dbs.
Definition at line 65 of file downloadDb.cxx. References _client_db, DownloadDb::Db::_filename, _server_db, and read_db(). |
|
Create a download db with these client and server dbs.
Definition at line 83 of file downloadDb.cxx. References _client_db, and _server_db. |
|
Definition at line 115 of file downloadDb.cxx. References _client_db, DownloadDb::Db::_filename, and DownloadDb::Db::write(). |
|
Definition at line 317 of file downloadDb.cxx. |
|
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 Definition at line 1240 of file downloadDb.cxx. |
|
A multifile is complete when it is completely downloaded. Note: it may already be decompressed or extracted and it is still complete Definition at line 208 of file downloadDb.cxx. References _client_db, and DownloadDb::Db::get_multifile_record_named(). |
|
Definition at line 221 of file downloadDb.cxx. References _server_db, and DownloadDb::Db::get_multifile_record_named(). |
|
Definition at line 191 of file downloadDb.cxx. |
|
Definition at line 234 of file downloadDb.cxx. References _client_db. |
|
Used on the server side makefiles to create a new clean server db.
Definition at line 451 of file downloadDb.cxx. |
|
Definition at line 306 of file downloadDb.cxx. |
|
Definition at line 334 of file downloadDb.cxx. |
|
Return the hash value of the file we are working on.
Definition at line 249 of file downloadDb.cxx. |
|
Definition at line 55 of file downloadDb.I. References _server_db, DownloadDb::Db::get_multifile_name(), and INLINE. |
|
Definition at line 80 of file downloadDb.I. References _client_db, DownloadDb::Db::get_multifile_record_named(), and INLINE. |
|
Definition at line 106 of file downloadDb.I. References _client_db, DownloadDb::Db::_filename, DownloadDb::Db::get_multifile_record_named(), INLINE, and write_client_db(). |
|
Definition at line 31 of file downloadDb.I. References _server_db, DownloadDb::Db::get_num_multifiles(), and INLINE. |
|
Returns the MD5 hash associated with the indicated version of the indicated file.
Definition at line 1380 of file downloadDb.cxx. |
|
Returns the number of versions stored for the indicated file.
Definition at line 1303 of file downloadDb.cxx. References _master_datagram, and length. |
|
Definition at line 239 of file downloadDb.I. |
|
Return the hash value of the server file.
Definition at line 263 of file downloadDb.cxx. References _client_db, _server_db, DownloadDb::Db::add_multifile_record(), DownloadDb::Db::get_multifile_record_named(), and PT. |
|
Definition at line 67 of file downloadDb.I. References _client_db, and DownloadDb::Db::get_multifile_record_named(). |
|
Definition at line 92 of file downloadDb.I. References _client_db, DownloadDb::Db::_filename, DownloadDb::Db::get_multifile_record_named(), INLINE, and write_client_db(). |
|
Definition at line 149 of file downloadDb.I. References _client_db, and Status_incomplete. |
|
Definition at line 227 of file downloadDb.I. |
|
Definition at line 43 of file downloadDb.I. References _client_db, DownloadDb::Db::get_multifile_name(), and INLINE. |
|
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. Definition at line 1353 of file downloadDb.cxx. |
|
Returns true if the indicated file has version information, false otherwise. Some files recorded in the database may not bother to track versions. Definition at line 1288 of file downloadDb.cxx. References _master_datagram. |
|
Inserts a new version 1 copy of the file, sliding all the other versions up by one.
Definition at line 1270 of file downloadDb.cxx. References _master_datagram, Datagram::append_data(), Datagram::clear(), DatagramIterator::get_int32(), and PN_int32. |
|
Definition at line 130 of file downloadDb.cxx. References _server_db. |
|
Definition at line 385 of file downloadDb.cxx. References _server_db. |
|
Definition at line 346 of file downloadDb.cxx. Referenced by DownloadDb(). |
|
Definition at line 1447 of file downloadDb.cxx. |
|
Definition at line 478 of file downloadDb.cxx. |
|
Definition at line 464 of file downloadDb.cxx. |
|
Definition at line 188 of file downloadDb.I. References _server_db, DownloadDb::Db::get_multifile_record_named(), and INLINE. |
|
Definition at line 201 of file downloadDb.I. References _server_db, DownloadDb::Db::get_multifile_record_named(), and INLINE. |
|
Definition at line 132 of file downloadDb.I. References _server_db, DownloadDb::Db::get_multifile_record_named(), and INLINE. |
|
Definition at line 214 of file downloadDb.I. |
|
Set the hash value of file we are working on.
Definition at line 277 of file downloadDb.cxx. |
|
Definition at line 175 of file downloadDb.I. References _client_db, DownloadDb::Db::_filename, DownloadDb::Db::get_multifile_record_named(), INLINE, Status_extracted, and write_client_db(). |
|
Definition at line 118 of file downloadDb.I. References _server_db, DownloadDb::Db::get_multifile_record_named(), and INLINE. |
|
Reduces the number of versions of a particular file stored in the ddb by throwing away all versions higher than the indicated index.
Definition at line 1325 of file downloadDb.cxx. |
|
Set the hash value of file we are working on.
Definition at line 292 of file downloadDb.cxx. |
|
Definition at line 162 of file downloadDb.I. |
|
Definition at line 142 of file downloadDb.cxx. References _client_db, and write_db(). |
|
Definition at line 166 of file downloadDb.cxx. References _client_db. Referenced by get_client_multifile_size(), get_server_multifile_phase(), and set_client_multifile_incomplete(). |
|
Definition at line 414 of file downloadDb.cxx. References _server_db. Referenced by write(). |
|
Definition at line 179 of file downloadDb.cxx. References Status_complete. |
|
Definition at line 1408 of file downloadDb.cxx. |
|
Definition at line 1520 of file downloadDb.cxx. |
|
Definition at line 39 of file downloadDb.cxx. |
|
|
Definition at line 33 of file downloadDb.cxx. |
|
Definition at line 243 of file downloadDb.h. Referenced by get_num_versions(), has_version(), and insert_new_version(). |
|
|
Definition at line 242 of file downloadDb.h. |