DownloadDb

from panda3d.core import DownloadDb
class DownloadDb

Bases:

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

Inheritance diagram of DownloadDb

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
__init__()

Primarily used for testing.

__init__(param0: DownloadDb)
__init__(server_file: Filename, client_file: Filename)

Create a download db with these client and server dbs

__init__(server_file: Ramfile, client_file: Filename)

Create a download db with these client and server dbs

add_client_multifile(server_mfname: str)
add_version(name: Filename, hash: HashVal, version: int)

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

client_multifile_complete(mfname: str) bool

A multifile is complete when it is completely downloaded. Note: it may already be decompressed or extracted and it is still complete

client_multifile_decompressed(mfname: str) bool
client_multifile_exists(mfname: str) bool

Queries from the Launcher

client_multifile_extracted(mfname: str) bool
create_new_server_db()

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

delete_client_multifile(mfname: str)

Operations on multifiles

expand_client_multifile(mfname: str)
get_client_multifile_hash(mfname: str) HashVal

Return the hash value of the file we are working on

get_client_multifile_name(index: int) str
get_client_multifile_phase(mfname: str) float
get_client_multifile_size(mfname: str) int
get_client_num_multifiles() int
get_hash(name: Filename, version: int) HashVal

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

get_num_versions(name: Filename) int

Returns the number of versions stored for the indicated file.

get_server_file_name(mfname: str, index: int) str
get_server_multifile_hash(mfname: str) HashVal

Return the hash value of the server file

get_server_multifile_name(index: int) str
get_server_multifile_phase(mfname: str) float
get_server_multifile_size(mfname: str) int
get_server_num_files(mfname: str) int
get_server_num_multifiles() int
get_version(name: Filename, hash: HashVal) int

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.

has_version(name: Filename) bool

Returns true if the indicated file has version information, false otherwise. Some files recorded in the database may not bother to track versions.

insert_new_version(name: Filename, hash: HashVal)

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

output(out: ostream)
read_db(file: Filename, want_server_info: bool) Db
read_db(file: Ramfile, want_server_info: bool) Db
server_add_file(mfname: str, fname: str)
server_add_multifile(mfname: str, phase: float, size: int, status: int)
set_client_multifile_complete(mfname: str)
set_client_multifile_decompressed(mfname: str)
set_client_multifile_delta_size(mfname: str, size: int) int
set_client_multifile_extracted(mfname: str)
set_client_multifile_hash(mfname: str, val: HashVal)

Set the hash value of file we are working on

set_client_multifile_incomplete(mfname: str)
set_client_multifile_size(mfname: str, size: int)
set_num_versions(name: Filename, num_versions: int)

Reduces the number of versions of a particular file stored in the ddb by throwing away all versions higher than the indicated index.

set_server_multifile_hash(mfname: str, val: HashVal)

Set the hash value of file we are working on

set_server_multifile_size(mfname: str, size: int)
write(out: ostream)
write_client_db(file: Filename) bool

Write a database file

write_db(file: Filename, db: Db, want_server_info: bool) bool
write_server_db(file: Filename) bool
write_version_map(out: ostream)