Panda3D

- Main Page
- Packages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions

# DownloadDb Class Reference

A listing of files within multifiles for management of client-side synchronization with a server-provided set of files. More...

List of all members.

## Public Types
enum | Status { StatusIncomplete = 0, StatusComplete = 1, StatusDecompressed = 2, StatusExtracted = 3 }
## Public Member Functions
| DownloadDb ()
| Primarily used for testing.
| DownloadDb (Filename server_file, Filename client_file)
| Create a download db with these client and server dbs.
| DownloadDb (Ramfile server_file, Filename client_file)
| Create a download db with these client and server dbs.
| addClientMultifile (string server_mfname)
| addVersion (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.
bool | clientMultifileComplete (string mfname)
| A multifile is complete when it is completely downloaded.
bool | clientMultifileDecompressed (string mfname)
bool | clientMultifileExists (string mfname)
bool | clientMultifileExtracted (string mfname)
| createNewServerDb ()
| Used on the server side makefiles to create a new clean server db.
| deleteClientMultifile (string mfname)
| expandClientMultifile (string mfname)
HashVal | getClientMultifileHash (string mfname)
| Return the hash value of the file we are working on.
string | getClientMultifileName (int index)
float | getClientMultifilePhase (string mfname)
int | getClientMultifileSize (string mfname)
int | getClientNumMultifiles ()
HashVal const | getHash (Filename const name, int version)
| Returns the MD5 hash associated with the indicated version of the indicated file.
int | getNumVersions (Filename const name)
| Returns the number of versions stored for the indicated file.
string | getServerFileName (string mfname, int index)
HashVal | getServerMultifileHash (string mfname)
| Return the hash value of the server file.
string | getServerMultifileName (int index)
float | getServerMultifilePhase (string mfname)
int | getServerMultifileSize (string mfname)
int | getServerNumFiles (string mfname)
int | getServerNumMultifiles ()
int | getVersion (Filename const name, HashVal const hash)
| Returns the version number of this particular file, determined by looking up the hash generated from the file.
bool | hasVersion (Filename const name)
| Returns true if the indicated file has version information, false otherwise.
| insertNewVersion (Filename const name, HashVal const hash)
| Inserts a new version 1 copy of the file, sliding all the other versions up by one.
| output (ostream out)
Db | readDb (Ramfile file, bool want_server_info)
Db | readDb (Filename file, bool want_server_info)
| serverAddFile (string mfname, string fname)
| serverAddMultifile (string mfname, float phase, int size, int status)
| setClientMultifileComplete (string mfname)
| setClientMultifileDecompressed (string mfname)
int | setClientMultifileDeltaSize (string mfname, int size)
| setClientMultifileExtracted (string mfname)
| setClientMultifileHash (string mfname, HashVal val)
| Set the hash value of file we are working on.
| setClientMultifileIncomplete (string mfname)
| setClientMultifileSize (string mfname, int size)
| setNumVersions (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.
| setServerMultifileHash (string mfname, HashVal val)
| Set the hash value of file we are working on.
| setServerMultifileSize (string mfname, int size)
| write (ostream out)
bool | writeClientDb (Filename file)
bool | writeDb (Filename file, Db db, bool want_server_info)
bool | writeServerDb (Filename file)
| writeVersionMap (ostream out)

## Detailed 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.

## Member Enumeration Documentation

enum Status

Enumerator:

  StatusIncomplete |
  StatusComplete |
  StatusDecompressed |
  StatusExtracted |

## Constructor & Destructor Documentation

DownloadDb | ( |  | ) |

Primarily used for testing.

DownloadDb | ( | Filename | server_file,
|  | Filename | client_file
| ) |  |

Create a download db with these client and server dbs.

DownloadDb | ( | Ramfile | server_file,
|  | Filename | client_file
| ) |  |

Create a download db with these client and server dbs.

## Member Function Documentation

addClientMultifile | ( | string | server_mfname | ) |

addVersion | ( | 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 clientMultifileComplete | ( | string | mfname | ) |

A multifile is complete when it is completely downloaded.

Note: it may already be decompressed or extracted and it is still complete

bool clientMultifileDecompressed | ( | string | mfname | ) |

bool clientMultifileExists | ( | string | mfname | ) |

bool clientMultifileExtracted | ( | string | mfname | ) |

createNewServerDb | ( |  | ) |

Used on the server side makefiles to create a new clean server db.

deleteClientMultifile | ( | string | mfname | ) |

expandClientMultifile | ( | string | mfname | ) |

HashVal getClientMultifileHash | ( | string | mfname | ) |

Return the hash value of the file we are working on.

string getClientMultifileName | ( | int | index | ) |

float getClientMultifilePhase | ( | string | mfname | ) |

int getClientMultifileSize | ( | string | mfname | ) |

int getClientNumMultifiles | ( |  | ) |

HashVal const getHash | ( | Filename const | name,
|  | int | version
| ) |  |

Returns the MD5 hash associated with the indicated version of the indicated file.

int getNumVersions | ( | Filename const | name | ) |

Returns the number of versions stored for the indicated file.

string getServerFileName | ( | string | mfname,
|  | int | index
| ) |  |

HashVal getServerMultifileHash | ( | string | mfname | ) |

Return the hash value of the server file.

string getServerMultifileName | ( | int | index | ) |

float getServerMultifilePhase | ( | string | mfname | ) |

int getServerMultifileSize | ( | string | mfname | ) |

int getServerNumFiles | ( | string | mfname | ) |

int getServerNumMultifiles | ( |  | ) |

int getVersion | ( | Filename const | name,
|  | HashVal const | hash
| ) |  |

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 hasVersion | ( | Filename const | name | ) |

Returns true if the indicated file has version information, false otherwise.

Some files recorded in the database may not bother to track versions.

insertNewVersion | ( | Filename const | name,
|  | HashVal const | hash
| ) |  |

Inserts a new version 1 copy of the file, sliding all the other versions up by one.

output | ( | ostream | out | ) |

Db readDb | ( | Filename | file,
|  | bool | want_server_info
| ) |  |

Db readDb | ( | Ramfile | file,
|  | bool | want_server_info
| ) |  |

serverAddFile | ( | string | mfname,
|  | string | fname
| ) |  |

serverAddMultifile | ( | string | mfname,
|  | float | phase,
|  | int | size,
|  | int | status
| ) |  |

setClientMultifileComplete | ( | string | mfname | ) |

setClientMultifileDecompressed | ( | string | mfname | ) |

int setClientMultifileDeltaSize | ( | string | mfname,
|  | int | size
| ) |  |

setClientMultifileExtracted | ( | string | mfname | ) |

setClientMultifileHash | ( | string | mfname,
|  | HashVal | val
| ) |  |

Set the hash value of file we are working on.

setClientMultifileIncomplete | ( | string | mfname | ) |

setClientMultifileSize | ( | string | mfname,
|  | int | size
| ) |  |

setNumVersions | ( | 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.

setServerMultifileHash | ( | string | mfname,
|  | HashVal | val
| ) |  |

Set the hash value of file we are working on.

setServerMultifileSize | ( | string | mfname,
|  | int | size
| ) |  |

write | ( | ostream | out | ) |

bool writeClientDb | ( | Filename | file | ) |

bool writeDb | ( | Filename | file,
|  | Db | db,
|  | bool | want_server_info
| ) |  |

bool writeServerDb | ( | Filename | file | ) |

writeVersionMap | ( | ostream | out | ) |

All Classes Namespaces Functions Variables Enumerations Enumerator Properties