commit 8d592609355333fa7c031989ff7d88f8dee58d4a
parent dea2873d9aa8add75cf2a13c78fe19d8c439c277
Author: William Casarin <jb55@jb55.com>
Date: Thu, 28 Nov 2024 16:40:18 -0800
windows: handle large mapsizes gracefully
Update nostrdb to gracefully handle mapsizes that
are too large and fail to create nostrdb files.
We now keep shrinking the mapsize until database creation
succeeds. We still use the default mapsize of 32GiB on
windows, which is a bit annoying until we have nostrdb
resizing like monero.
Fixes: https://github.com/damus-io/notedeck/issues/491
Diffstat:
4 files changed, 74 insertions(+), 76 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
@@ -141,7 +141,7 @@ dependencies = [
"ndk-context",
"ndk-sys 0.5.0+25.2.9519653",
"num_enum 0.7.3",
- "thiserror",
+ "thiserror 1.0.63",
]
[[package]]
@@ -261,7 +261,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -310,7 +310,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -427,7 +427,7 @@ dependencies = [
"regex",
"rustc-hash 1.1.0",
"shlex",
- "syn 2.0.77",
+ "syn 2.0.89",
"which",
]
@@ -603,7 +603,7 @@ checksum = "0cc8b54b395f2fcfbb3d90c47b01c7f444d94d05bdeb775811dec868ac3bbc26"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -635,7 +635,7 @@ dependencies = [
"polling",
"rustix",
"slab",
- "thiserror",
+ "thiserror 1.0.63",
]
[[package]]
@@ -649,7 +649,7 @@ dependencies = [
"polling",
"rustix",
"slab",
- "thiserror",
+ "thiserror 1.0.63",
]
[[package]]
@@ -1132,7 +1132,7 @@ dependencies = [
"epaint",
"log",
"puffin",
- "thiserror",
+ "thiserror 1.0.63",
"type-map",
"web-time 0.2.4",
"wgpu",
@@ -1292,7 +1292,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -1303,7 +1303,7 @@ checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -1490,7 +1490,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -1564,7 +1564,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -1711,7 +1711,7 @@ checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884"
dependencies = [
"log",
"presser",
- "thiserror",
+ "thiserror 1.0.63",
"winapi",
"windows",
]
@@ -1772,7 +1772,7 @@ dependencies = [
"com",
"libc",
"libloading 0.8.5",
- "thiserror",
+ "thiserror 1.0.63",
"widestring",
"winapi",
]
@@ -2059,7 +2059,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -2139,7 +2139,7 @@ dependencies = [
"combine",
"jni-sys",
"log",
- "thiserror",
+ "thiserror 1.0.63",
"walkdir",
"windows-sys 0.45.0",
]
@@ -2455,7 +2455,7 @@ dependencies = [
"rustc-hash 1.1.0",
"spirv",
"termcolor",
- "thiserror",
+ "thiserror 1.0.63",
"unicode-xid",
]
@@ -2476,7 +2476,7 @@ dependencies = [
"ndk-sys 0.4.1+23.1.7779620",
"num_enum 0.5.11",
"raw-window-handle 0.5.2",
- "thiserror",
+ "thiserror 1.0.63",
]
[[package]]
@@ -2491,7 +2491,7 @@ dependencies = [
"ndk-sys 0.5.0+25.2.9519653",
"num_enum 0.7.3",
"raw-window-handle 0.6.2",
- "thiserror",
+ "thiserror 1.0.63",
]
[[package]]
@@ -2585,12 +2585,13 @@ dependencies = [
[[package]]
name = "nostrdb"
version = "0.3.4"
-source = "git+https://github.com/damus-io/nostrdb-rs?rev=8d96dbd9b8e73ecb90819d843d14dc6c57e3acd4#8d96dbd9b8e73ecb90819d843d14dc6c57e3acd4"
+source = "git+https://github.com/damus-io/nostrdb-rs?rev=71154e4100775f6932ee517da4350c433ba14ec7#71154e4100775f6932ee517da4350c433ba14ec7"
dependencies = [
"bindgen",
"cc",
"flatbuffers",
"libc",
+ "thiserror 2.0.3",
"tokio",
"tracing",
"tracing-subscriber",
@@ -2677,7 +2678,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -2757,7 +2758,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -2769,7 +2770,7 @@ dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -3049,7 +3050,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -3154,7 +3155,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba"
dependencies = [
"proc-macro2",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -3169,9 +3170,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.86"
+version = "1.0.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
+checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
dependencies = [
"unicode-ident",
]
@@ -3192,7 +3193,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd"
dependencies = [
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -3266,7 +3267,7 @@ dependencies = [
"rustc-hash 2.0.0",
"rustls 0.23.13",
"socket2",
- "thiserror",
+ "thiserror 1.0.63",
"tokio",
"tracing",
]
@@ -3283,7 +3284,7 @@ dependencies = [
"rustc-hash 2.0.0",
"rustls 0.23.13",
"slab",
- "thiserror",
+ "thiserror 1.0.63",
"tinyvec",
"tracing",
]
@@ -3370,7 +3371,7 @@ dependencies = [
"rand_chacha",
"simd_helpers",
"system-deps",
- "thiserror",
+ "thiserror 1.0.63",
"v_frame",
"wasm-bindgen",
]
@@ -3462,7 +3463,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
dependencies = [
"getrandom",
"libredox 0.1.3",
- "thiserror",
+ "thiserror 1.0.63",
]
[[package]]
@@ -3891,7 +3892,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -4033,7 +4034,7 @@ dependencies = [
"log",
"memmap2",
"rustix",
- "thiserror",
+ "thiserror 1.0.63",
"wayland-backend",
"wayland-client",
"wayland-csd-frame",
@@ -4058,7 +4059,7 @@ dependencies = [
"log",
"memmap2",
"rustix",
- "thiserror",
+ "thiserror 1.0.63",
"wayland-backend",
"wayland-client",
"wayland-csd-frame",
@@ -4154,7 +4155,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustversion",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -4186,9 +4187,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.77"
+version = "2.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed"
+checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e"
dependencies = [
"proc-macro2",
"quote",
@@ -4251,7 +4252,16 @@ version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724"
dependencies = [
- "thiserror-impl",
+ "thiserror-impl 1.0.63",
+]
+
+[[package]]
+name = "thiserror"
+version = "2.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa"
+dependencies = [
+ "thiserror-impl 2.0.3",
]
[[package]]
@@ -4262,7 +4272,18 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "2.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.89",
]
[[package]]
@@ -4382,7 +4403,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -4415,7 +4436,7 @@ checksum = "0d4770b8024672c1101b3f6733eab95b18007dbe0847a8afe341fcf79e06043f"
dependencies = [
"either",
"futures-util",
- "thiserror",
+ "thiserror 1.0.63",
"tokio",
]
@@ -4525,7 +4546,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf"
dependencies = [
"crossbeam-channel",
- "thiserror",
+ "thiserror 1.0.63",
"time",
"tracing-subscriber",
]
@@ -4538,7 +4559,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
@@ -4618,7 +4639,7 @@ dependencies = [
"rand",
"rustls 0.20.9",
"sha-1",
- "thiserror",
+ "thiserror 1.0.63",
"url",
"utf-8",
"webpki",
@@ -4890,7 +4911,7 @@ dependencies = [
"once_cell",
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
"wasm-bindgen-shared",
]
@@ -4924,7 +4945,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
@@ -5198,7 +5219,7 @@ dependencies = [
"raw-window-handle 0.6.2",
"rustc-hash 1.1.0",
"smallvec",
- "thiserror",
+ "thiserror 1.0.63",
"web-sys",
"wgpu-hal",
"wgpu-types",
@@ -5239,7 +5260,7 @@ dependencies = [
"renderdoc-sys",
"rustc-hash 1.1.0",
"smallvec",
- "thiserror",
+ "thiserror 1.0.63",
"wasm-bindgen",
"web-sys",
"wgpu-types",
@@ -5722,7 +5743,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.77",
+ "syn 2.0.89",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
@@ -17,7 +17,7 @@ crate-type = ["lib", "cdylib"]
egui = { git = "https://github.com/emilk/egui", rev = "fcb7764e48ce00f8f8e58da10f937410d65b0bfb", features = ["serde"] }
eframe = { git = "https://github.com/emilk/egui", rev = "fcb7764e48ce00f8f8e58da10f937410d65b0bfb", package = "eframe", default-features = false, features = [ "wgpu", "wayland", "x11", "android-native-activity" ] }
egui_extras = { git = "https://github.com/emilk/egui", rev = "fcb7764e48ce00f8f8e58da10f937410d65b0bfb", package = "egui_extras", features = ["all_loaders"] }
-nostrdb = { git = "https://github.com/damus-io/nostrdb-rs", rev = "8d96dbd9b8e73ecb90819d843d14dc6c57e3acd4" }
+nostrdb = { git = "https://github.com/damus-io/nostrdb-rs", rev = "71154e4100775f6932ee517da4350c433ba14ec7" }
[dependencies]
#egui-android = { git = "https://github.com/jb55/egui-android.git" }
diff --git a/enostr/src/error.rs b/enostr/src/error.rs
@@ -17,25 +17,6 @@ pub enum Error {
Generic(String),
}
-impl std::cmp::PartialEq for Error {
- fn eq(&self, other: &Self) -> bool {
- match (self, other) {
- (Error::Empty, Error::Empty) => true,
- (Error::DecodeFailed, Error::DecodeFailed) => true,
- (Error::HexDecodeFailed, Error::HexDecodeFailed) => true,
- (Error::InvalidSignature, Error::InvalidSignature) => true,
- (Error::InvalidByteSize, Error::InvalidByteSize) => true,
- (Error::InvalidPublicKey, Error::InvalidPublicKey) => true,
- // This is slightly wrong but whatevs
- (Error::Json(..), Error::Json(..)) => true,
- (Error::Generic(left), Error::Generic(right)) => left == right,
- (Error::Nostrdb(left), Error::Nostrdb(right)) => left == right,
- //(Error::Secp(left), Error::Secp(right)) => left == right,
- _ => false,
- }
- }
-}
-
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
@@ -54,8 +35,6 @@ impl fmt::Display for Error {
}
}
-impl std::cmp::Eq for Error {}
-
impl From<String> for Error {
fn from(s: String) -> Self {
Error::Generic(s)
diff --git a/src/app.rs b/src/app.rs
@@ -402,8 +402,7 @@ impl Damus {
let imgcache_dir = path.path(DataPathType::Cache).join(ImageCache::rel_dir());
let _ = std::fs::create_dir_all(imgcache_dir.clone());
- let mut config = Config::new();
- config.set_ingester_threads(4);
+ let config = Config::new().set_ingester_threads(4);
let keystore = if parsed_args.use_keystore {
let keys_path = path.path(DataPathType::Keys);
@@ -587,8 +586,7 @@ impl Damus {
let app_rect_handler = AppSizeHandler::new(&path);
let support = Support::new(&path);
- let mut config = Config::new();
- config.set_ingester_threads(2);
+ let config = Config::new().set_ingester_threads(2);
Self {
debug,