Panda3D
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
DownloadDb Class Reference

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

#include <pandadoc.hpp>

Public Types

enum  Status { Status_incomplete = 0 , Status_complete = 1 , Status_decompressed = 2 , Status_extracted = 3 }
 

Public Member Functions

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

◆ Status

enum Status
Enumerator
Status_incomplete 
Status_complete 
Status_decompressed 
Status_extracted 

Member Function Documentation

◆ __init__() [1/4]

__init__ ( )

Primarily used for testing.

◆ __init__() [2/4]

__init__ ( const DownloadDb )

◆ __init__() [3/4]

__init__ ( Filename server_file,
Filename client_file )

Create a download db with these client and server dbs.

◆ __init__() [4/4]

__init__ ( Ramfile server_file,
Filename client_file )

Create a download db with these client and server dbs.

◆ addClientMultifile()

addClientMultifile ( str server_mfname)

◆ addVersion()

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

Note: version numbers start at 1

◆ clientMultifileComplete()

bool clientMultifileComplete ( str mfname)

A multifile is complete when it is completely downloaded.

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

◆ clientMultifileDecompressed()

bool clientMultifileDecompressed ( str mfname)

◆ clientMultifileExists()

bool clientMultifileExists ( str mfname)

◆ clientMultifileExtracted()

bool clientMultifileExtracted ( str mfname)

◆ createNewServerDb()

createNewServerDb ( )

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

◆ deleteClientMultifile()

deleteClientMultifile ( str mfname)

◆ expandClientMultifile()

expandClientMultifile ( str mfname)

◆ getClientMultifileHash()

HashVal getClientMultifileHash ( str mfname)

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

◆ getClientMultifileName()

str getClientMultifileName ( int index)

◆ getClientMultifilePhase()

Phase getClientMultifilePhase ( str mfname)

◆ getClientMultifileSize()

int getClientMultifileSize ( str mfname)

◆ getClientNumMultifiles()

int getClientNumMultifiles ( )

◆ getHash()

const HashVal getHash ( const Filename name,
int version )

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

◆ getNumVersions()

int getNumVersions ( const Filename name)

Returns the number of versions stored for the indicated file.

◆ getServerFileName()

str getServerFileName ( str mfname,
int index )

◆ getServerMultifileHash()

HashVal getServerMultifileHash ( str mfname)

Return the hash value of the server file.

◆ getServerMultifileName()

str getServerMultifileName ( int index)

◆ getServerMultifilePhase()

Phase getServerMultifilePhase ( str mfname)

◆ getServerMultifileSize()

int getServerMultifileSize ( str mfname)

◆ getServerNumFiles()

int getServerNumFiles ( str mfname)

◆ getServerNumMultifiles()

int getServerNumMultifiles ( )

◆ getVersion()

int getVersion ( const Filename name,
const HashVal 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.

◆ hasVersion()

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

insertNewVersion ( const Filename name,
const HashVal hash )

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

◆ output()

output ( Ostream out)

◆ readDb() [1/2]

DownloadDb::Db readDb ( Filename file,
bool want_server_info )

◆ readDb() [2/2]

DownloadDb::Db readDb ( Ramfile file,
bool want_server_info )

◆ serverAddFile()

serverAddFile ( str mfname,
str fname )

◆ serverAddMultifile()

serverAddMultifile ( str mfname,
Phase phase,
int size,
int status )

◆ setClientMultifileComplete()

setClientMultifileComplete ( str mfname)

◆ setClientMultifileDecompressed()

setClientMultifileDecompressed ( str mfname)

◆ setClientMultifileDeltaSize()

int setClientMultifileDeltaSize ( str mfname,
int size )

◆ setClientMultifileExtracted()

setClientMultifileExtracted ( str mfname)

◆ setClientMultifileHash()

setClientMultifileHash ( str mfname,
HashVal val )

Set the hash value of file we are working on.

◆ setClientMultifileIncomplete()

setClientMultifileIncomplete ( str mfname)

◆ setClientMultifileSize()

setClientMultifileSize ( str mfname,
int size )

◆ setNumVersions()

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

◆ setServerMultifileHash()

setServerMultifileHash ( str mfname,
HashVal val )

Set the hash value of file we are working on.

◆ setServerMultifileSize()

setServerMultifileSize ( str mfname,
int size )

◆ write()

write ( Ostream out)

◆ writeClientDb()

bool writeClientDb ( Filename file)

◆ writeDb()

bool writeDb ( Filename file,
DownloadDb::Db db,
bool want_server_info )

◆ writeServerDb()

bool writeServerDb ( Filename file)

◆ writeVersionMap()

writeVersionMap ( Ostream out)