DownloadDb
-
class DownloadDb
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 diagram
-
enum Status
Status of a multifile is stored in this enum Note these values are in increasing order of “doneness” So if you are decompressed, you are complete If you are extracted, you are decompressed and complete
-
enumerator Status_incomplete = 0
-
enumerator Status_complete = 1
-
enumerator Status_decompressed = 2
-
enumerator Status_extracted = 3
-
enumerator Status_incomplete = 0
-
DownloadDb(void)
-
DownloadDb(DownloadDb const&) = default
Create a download db with these client and server dbs
Create a download db with these client and server dbs
Primarily used for testing.
-
void add_client_multifile(std::string server_mfname)
-
void add_version(Filename const &name, HashVal const &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.
Note: version numbers start at 1
-
bool client_multifile_complete(std::string mfname) const
A multifile is complete when it is completely downloaded. Note: it may already be decompressed or extracted and it is still complete
-
bool client_multifile_decompressed(std::string mfname) const
-
bool client_multifile_exists(std::string mfname) const
Queries from the Launcher
-
bool client_multifile_extracted(std::string mfname) const
-
void create_new_server_db(void)
Server side operations to create multifile records
Used on the server side makefiles to create a new clean server db
-
void delete_client_multifile(std::string mfname)
Operations on multifiles
-
void expand_client_multifile(std::string mfname)
-
HashVal get_client_multifile_hash(std::string mfname) const
Ask what version (told with the hash) this multifile is
Return the hash value of the file we are working on
-
std::string get_client_multifile_name(int index) const
-
Phase get_client_multifile_phase(std::string mfname) const
-
int get_client_multifile_size(std::string mfname) const
-
int get_client_num_multifiles(void) const
-
HashVal const &get_hash(Filename const &name, int version) const
Returns the MD5 hash associated with the indicated version of the indicated file.
-
int get_num_versions(Filename const &name) const
Returns the number of versions stored for the indicated file.
-
std::string get_server_file_name(std::string mfname, int index) const
-
HashVal get_server_multifile_hash(std::string mfname) const
Return the hash value of the server file
-
std::string get_server_multifile_name(int index) const
-
Phase get_server_multifile_phase(std::string mfname) const
-
int get_server_multifile_size(std::string mfname) const
-
int get_server_num_files(std::string mfname) const
-
int get_server_num_multifiles(void) const
-
int get_version(Filename const &name, HashVal const &hash) const
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.
-
bool has_version(Filename const &name) const
Returns true if the indicated file has version information, false otherwise. Some files recorded in the database may not bother to track versions.
-
void insert_new_version(Filename const &name, HashVal const &hash)
Inserts a new version 1 copy of the file, sliding all the other versions up by one.
-
void output(std::ostream &out) const
-
void server_add_file(std::string mfname, std::string fname)
-
void server_add_multifile(std::string mfname, Phase phase, int size, int status)
-
void set_client_multifile_complete(std::string mfname)
-
void set_client_multifile_decompressed(std::string mfname)
-
int set_client_multifile_delta_size(std::string mfname, int size)
-
void set_client_multifile_extracted(std::string mfname)
-
void set_client_multifile_hash(std::string mfname, HashVal val)
Set the hash value of file we are working on
-
void set_client_multifile_incomplete(std::string mfname)
-
void set_client_multifile_size(std::string mfname, int size)
-
void set_num_versions(Filename const &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.
-
void set_server_multifile_hash(std::string mfname, HashVal val)
Set the hash value of file we are working on
-
void set_server_multifile_size(std::string mfname, int size)
-
void write(std::ostream &out) const
-
void write_version_map(std::ostream &out) const
-
enum Status