assembly_fdb/
lib.rs

1//! # The database (`*.fdb`) file format used for the core database (`CDClient`)
2//!
3//! Among the resource files distributed with the LEGO® Universe game client is
4//! a copy of the core database. This database includes information on all zones,
5//! objects, components, behaviors, items, loot, currency, missions, scripts, …
6//!
7//! This (unpacked) name of this file is `/res/CDClient.fdb`. The file uses a custom
8//! database format which is essentially a sorted list of hash maps.
9//!
10//! ## Terminology
11//!
12//! - **Database**: The whole file, a collection of tables
13//! - **Table**: A collection of rows, implemented as an array of buckets
14//! - **Column**: A name and default type for the fields in every row
15//! - **Bucket**: A linked-list of rows for one value of the primary-key hash
16//! - **Row**: A list of fields, corresponding to the columns of the table definition
17//! - **Field**: A value with a type marker
18//!
19//! ## File format
20//!
21//! The file format is constructed from a bunch of structs made out of 32-bit words
22//! that may reference other structs by offset from the start of the file. These structs
23//! form a tree without circular references.
24//!
25//! These basic structs are implemented in the [`assembly_fdb_core`] crate.
26//!
27//! ## Using this library
28//!
29//! You can use the `mem` module to load a database from an in-memory buffer:
30//!
31//! ```
32//! use assembly_fdb::mem::Database;
33//!
34//! let file: &[u8] = &[0,0,0,0,8,0,0,0];
35//! let db = Database::new(file);
36//! let tables = db.tables().unwrap();
37//!
38//! assert_eq!(0, tables.len());
39//! ```
40
41#![doc(html_logo_url = "https://assembly.lu-dev.net/rust-logo-lu-256.png")]
42#![doc(html_favicon_url = "https://assembly.lu-dev.net/rust-logo-lu-256.png")]
43#![warn(missing_docs)]
44
45#[cfg(feature = "core")]
46pub mod core;
47#[cfg(any(feature = "io-read", feature = "io-write"))]
48pub mod io;
49pub mod mem;
50pub mod query;
51#[cfg(feature = "ro")]
52pub mod ro;
53#[cfg(feature = "store")]
54pub mod store;
55
56mod handle;
57mod util;
58
59// Re-exports
60pub use assembly_fdb_core::{file, value, FdbHash};
61
62#[cfg(feature = "sqlite")]
63pub mod sqlite;