32typedef PN_stdfloat Phase;
68 Status_incomplete = 0,
70 Status_decompressed = 2,
79 void output(std::ostream &out)
const;
80 void write(std::ostream &out)
const;
81 void write_version_map(std::ostream &out)
const;
84 bool write_client_db(
Filename &file);
85 bool write_server_db(
Filename &file);
87 INLINE
int get_client_num_multifiles()
const;
88 INLINE
int get_server_num_multifiles()
const;
90 INLINE std::string get_client_multifile_name(
int index)
const;
91 INLINE std::string get_server_multifile_name(
int index)
const;
93 INLINE
int get_client_multifile_size(std::string mfname)
const;
94 INLINE
void set_client_multifile_size(std::string mfname,
int size);
95 INLINE
int set_client_multifile_delta_size(std::string mfname,
int size);
96 INLINE
int get_server_multifile_size(std::string mfname)
const;
97 INLINE
void set_server_multifile_size(std::string mfname,
int size);
99 INLINE Phase get_client_multifile_phase(std::string mfname)
const;
100 INLINE Phase get_server_multifile_phase(std::string mfname)
const;
102 INLINE
void set_client_multifile_incomplete(std::string mfname);
103 INLINE
void set_client_multifile_complete(std::string mfname);
104 INLINE
void set_client_multifile_decompressed(std::string mfname);
105 INLINE
void set_client_multifile_extracted(std::string mfname);
107 INLINE
int get_server_num_files(std::string mfname)
const;
108 INLINE std::string get_server_file_name(std::string mfname,
int index)
const;
111 bool client_multifile_exists(std::string mfname)
const;
113 bool client_multifile_decompressed(std::string mfname)
const;
114 bool client_multifile_extracted(std::string mfname)
const;
123 void delete_client_multifile(std::string mfname);
124 void add_client_multifile(std::string server_mfname);
125 void expand_client_multifile(std::string mfname);
129 void server_add_multifile(std::string mfname, Phase phase,
int size,
int status);
130 void server_add_file(std::string mfname, std::string fname);
134 class EXPCL_PANDA_DOWNLOADER FileRecord :
public ReferenceCount {
137 FileRecord(std::string name);
138 void write(std::ostream &out)
const;
142 typedef pvector< PT(
FileRecord) > FileRecords;
144 class EXPCL_PANDA_DOWNLOADER MultifileRecord :
public ReferenceCount {
147 MultifileRecord(std::string name, Phase phase,
int size,
int status);
148 void write(std::ostream &out)
const;
149 int get_num_files()
const;
150 std::string get_file_name(
int index)
const;
151 bool file_exists(std::string fname)
const;
152 PT(
FileRecord) get_file_record_named(std::string fname)
const;
160 FileRecords _file_records;
165 class EXPCL_PANDA_DOWNLOADER Db {
168 void write(std::ostream &out)
const;
169 int get_num_multifiles()
const;
170 std::string get_multifile_name(
int index)
const;
171 bool multifile_exists(std::string mfname)
const;
172 PT(
MultifileRecord) get_multifile_record_named(std::string mfname)
const;
181 MultifileRecords _mfile_records;
185 int32_t _header_length;
189 Db read_db(
Filename &file,
bool want_server_info);
190 Db read_db(
Ramfile &file,
bool want_server_info);
191 bool write_db(
Filename &file,
Db db,
bool want_server_info);
200 static uint32_t _magic_number;
201 static uint32_t _bogus_magic_number;
202 typedef pvector<HashVal> VectorHash;
203 typedef pmap<Filename, VectorHash> VersionMap;
218 VersionMap _versions;
221INLINE std::ostream &operator << (std::ostream &out,
const DownloadDb &dldb) {
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
int parse_header(Datagram dg)
Verifies magic number, returns the number of multifiles or -1 if invalid.
bool write_bogus_header(StreamWriter &sw)
Writes the bogus header uncompressed with platform- independent byte ordering.
bool write_header(std::ostream &write_stream)
Writes the header uncompressed with platform- independent byte ordering.
int parse_record_header(Datagram dg)
Parses a file record (fr) header and returns the length of the next file record.
A listing of files within multifiles for management of client-side synchronization with a server-prov...
const HashVal & get_hash(const Filename &name, int version) const
Returns the MD5 hash associated with the indicated version of the indicated file.
void set_server_multifile_hash(std::string mfname, HashVal val)
Set the hash value of file we are working on.
void create_new_server_db()
Used on the server side makefiles to create a new clean server db.
HashVal get_client_multifile_hash(std::string mfname) const
Return the hash value of the file we are working on.
bool client_multifile_complete(std::string mfname) const
A multifile is complete when it is completely downloaded.
int get_version(const Filename &name, const HashVal &hash) const
Returns the version number of this particular file, determined by looking up the hash generated from ...
bool has_version(const Filename &name) const
Returns true if the indicated file has version information, false otherwise.
void insert_new_version(const Filename &name, const HashVal &hash)
Inserts a new version 1 copy of the file, sliding all the other versions up by one.
HashVal get_server_multifile_hash(std::string mfname) const
Return the hash value of the server file.
DownloadDb()
Primarily used for testing.
void set_client_multifile_hash(std::string mfname, HashVal val)
Set the hash value of file we are working on.
void set_num_versions(const Filename &name, int num_versions)
Reduces the number of versions of a particular file stored in the ddb by throwing away all versions h...
void add_version(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 ver...
int get_num_versions(const Filename &name) const
Returns the number of versions stored for the indicated file.
The name of a file, such as a texture file or an Egg file.
Stores a 128-bit value that represents the hashed contents (typically MD5) of a file or buffer.
An in-memory buffer specifically designed for downloading files to memory.
A class to read sequential binary data directly from an istream.
A StreamWriter object is used to write sequential binary data directly to an ostream.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.