1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! Read-first `LevelDB` access for Minecraft Bedrock world databases.
//!
//! `bedrock-leveldb` can read native Bedrock/LevelDB table, manifest, and WAL
//! files and exposes lazy point lookups plus visitor-based scans over raw byte
//! keys and values. The write path appends standard `LevelDB` write batches to
//! WAL files and flushes native `.ldb` tables plus native manifest edits, while
//! older crate-specific `BWLDB...` files remain readable for migration.
//!
//! # Logging
//!
//! The crate emits low-noise diagnostics through the [`log`] facade at
//! `trace`, `debug`, and `warn` levels. It never installs a global logger and
//! never writes to stdout or stderr; applications decide whether to connect
//! `env_logger`, `log4rs`, `tracing-log`, or another logging backend.
//!
//! # Errors
//!
//! Errors are returned as [`LevelDbError`]. Prefer matching
//! [`ErrorKind`] through [`LevelDbError::kind`] and using
//! [`LevelDbError::path`] for path-aware recovery instead of parsing display
//! strings.
//!
//! # Bedrock Record Helpers
//!
//! The crate includes small helpers for Bedrock `LevelDB` record keys and legacy
//! terrain payload families. These helpers parse documented storage bytes such
//! as `LegacyTerrain` and pre-paletted `SubChunkPrefix` values, but they do not
//! interpret NBT, actors, players, or gameplay semantics.
//!
//! # Features
//!
//! docs.rs builds this crate with all features enabled. Default builds enable
//! `zlib`, `snappy`, and `async`. Optional `mmap` exposes read-only mapped
//! table scans, while `repair-tools` and `bench` are reserved for tooling and
//! benchmark-only paths.
//!
//! # Example
//!
//! ```
//! use bedrock_leveldb::{Db, OpenOptions, VisitorControl};
//!
//! # fn example() -> bedrock_leveldb::Result<()> {
//! let dir = tempfile::tempdir()?;
//! let db = Db::open(dir.path(), OpenOptions::default())?;
//! db.put(b"player_1".as_slice(), b"value".as_slice(), Default::default())?;
//!
//! assert_eq!(db.get(b"player_1")?.as_deref(), Some(b"value".as_slice()));
//!
//! db.for_each_key(Default::default(), |_key| Ok(VisitorControl::Continue))?;
//! # Ok(())
//! # }
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;