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

Inheritance diagram of DownloadDb

__init__() → None

Primarily used for testing.

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

Create a download db with these client and server dbs

__init__(server_file: Ramfile, client_file: Filename) → None

Create a download db with these client and server dbs

output(out: ostream) → None
write(out: ostream) → None
writeVersionMap(out: ostream) → None
writeClientDb(file: Filename) → bool

Write a database file

writeServerDb(file: Filename) → bool
getClientNumMultifiles() → int
getServerNumMultifiles() → int
getClientMultifileName(index: int) → str
getServerMultifileName(index: int) → str
getClientMultifileSize(mfname: str) → int
setClientMultifileSize(mfname: str, size: int) → None
setClientMultifileDeltaSize(mfname: str, size: int) → int
getServerMultifileSize(mfname: str) → int
setServerMultifileSize(mfname: str, size: int) → None
getClientMultifilePhase(mfname: str) → Phase
Return type


getServerMultifilePhase(mfname: str) → Phase
Return type


setClientMultifileIncomplete(mfname: str) → None
setClientMultifileComplete(mfname: str) → None
setClientMultifileDecompressed(mfname: str) → None
setClientMultifileExtracted(mfname: str) → None
getServerNumFiles(mfname: str) → int
getServerFileName(mfname: str, index: int) → str
clientMultifileExists(mfname: str) → bool

Queries from the Launcher

clientMultifileComplete(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

clientMultifileDecompressed(mfname: str) → bool
clientMultifileExtracted(mfname: str) → bool
getClientMultifileHash(mfname: str) → HashVal

Return the hash value of the file we are working on

Return type


setClientMultifileHash(mfname: str, val: HashVal) → None

Set the hash value of file we are working on

getServerMultifileHash(mfname: str) → HashVal

Return the hash value of the server file

Return type


setServerMultifileHash(mfname: str, val: HashVal) → None

Set the hash value of file we are working on

deleteClientMultifile(mfname: str) → None

Operations on multifiles

addClientMultifile(server_mfname: str) → None
expandClientMultifile(mfname: str) → None
createNewServerDb() → None

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

serverAddMultifile(mfname: str, phase: Phase, size: int, status: int) → None
serverAddFile(mfname: str, fname: str) → None
readDb(file: Filename, want_server_info: bool) → Db
Return type


readDb(file: Ramfile, want_server_info: bool) → Db
Return type


writeDb(file: Filename, db: Db, want_server_info: bool) → bool
addVersion(name: Filename, hash: HashVal, version: int) → None

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

insertNewVersion(name: Filename, hash: HashVal) → None

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

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

getNumVersions(name: Filename) → int

Returns the number of versions stored for the indicated file.

setNumVersions(name: Filename, num_versions: int) → None

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

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

getHash(name: Filename, version: int) → HashVal

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

Return type


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