Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asynchronous + Structured Database Refactor (Part One) #551

Merged
merged 25 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2db017a
simplify service trait bounds and lifetimes
jevolk Aug 30, 2024
99ad404
add str traits for split, between, unquote; consolidate tests
jevolk Aug 31, 2024
2709995
add MapExpect to Result
jevolk Sep 1, 2024
3d4b0f1
add expected! macro to checked math expression suite
jevolk Sep 7, 2024
aa265f7
add err log trait to Result
jevolk Sep 8, 2024
bd75ff6
move common_elements util into unit
jevolk Sep 8, 2024
6305364
add util functors for is_zero/is_equal; move clamp to math utils
jevolk Sep 13, 2024
a5822eb
add missing err! case
jevolk Sep 13, 2024
f7ce4db
add is_not_found functor to error; tweak status code matcher
jevolk Sep 12, 2024
a5de274
re-export crates used by error macros
jevolk Sep 12, 2024
6001014
add UnwrapInfallible to Result
jevolk Sep 13, 2024
946ca36
Database Refactor
jevolk Aug 8, 2024
4776fe6
handle serde_json for deserialized()
jevolk Sep 28, 2024
3f7ec42
minor auth_chain optimizations/cleanup
jevolk Sep 25, 2024
4496cf2
add missing await to first admin room creation
girlbossceo Sep 21, 2024
5192927
split remaining map suites
jevolk Sep 29, 2024
0e8ae1e
add ArrayVec-backed serialized query overload; doc comments
jevolk Sep 29, 2024
c569881
merge rooms/short Data w/ Service; optimize queries
jevolk Sep 29, 2024
a8d5cf9
Add rocksdb logging integration with tracing.
jevolk Sep 23, 2024
6b80361
additional stream tools
jevolk Sep 30, 2024
96fcf7f
add rocksdb secondary; fix read_only mode.
jevolk Oct 1, 2024
26dcab2
various cleanup tweaks/fixes
jevolk Oct 1, 2024
ab06701
refactor multi-get to handle result type
jevolk Oct 1, 2024
36677bb
optimize auth_chain short_id to event_id translation step
jevolk Oct 1, 2024
8311952
bump ruma, cargo.lock, and deps
girlbossceo Sep 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 39 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,10 @@ features = [
"string",
]

[workspace.dependencies.futures-util]
[workspace.dependencies.futures]
version = "0.3.30"
default-features = false
features = ["std"]

[workspace.dependencies.tokio]
version = "1.40.0"
Expand Down Expand Up @@ -314,7 +315,7 @@ version = "0.1.2"
[workspace.dependencies.ruma]
git = "https://github.com/girlbossceo/ruwuma"
#branch = "conduwuit-changes"
rev = "9900d0676564883cfade556d6e8da2a2c9061efd"
rev = "ade2f1daf0b1d9e8f7de81a24dca8925406e4d8e"
features = [
"compat",
"rand",
Expand Down Expand Up @@ -463,7 +464,6 @@ version = "1.0.36"
[workspace.dependencies.proc-macro2]
version = "1.0.89"


#
# Patches
#
Expand Down Expand Up @@ -828,6 +828,7 @@ missing_panics_doc = { level = "allow", priority = 1 }
module_name_repetitions = { level = "allow", priority = 1 }
no_effect_underscore_binding = { level = "allow", priority = 1 }
similar_names = { level = "allow", priority = 1 }
single_match_else = { level = "allow", priority = 1 }
struct_field_names = { level = "allow", priority = 1 }
unnecessary_wraps = { level = "allow", priority = 1 }
unused_async = { level = "allow", priority = 1 }
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ array-size-threshold = 4096
cognitive-complexity-threshold = 94 # TODO reduce me ALARA
excessive-nesting-threshold = 11 # TODO reduce me to 4 or 5
future-size-threshold = 7745 # TODO reduce me ALARA
stack-size-threshold = 144000 # reduce me ALARA
stack-size-threshold = 196608 # reduce me ALARA
too-many-lines-threshold = 700 # TODO reduce me to <= 100
type-complexity-threshold = 250 # reduce me to ~200
3 changes: 2 additions & 1 deletion src/admin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ release_max_log_level = [
clap.workspace = true
conduit-api.workspace = true
conduit-core.workspace = true
conduit-database.workspace = true
conduit-macros.workspace = true
conduit-service.workspace = true
const-str.workspace = true
futures-util.workspace = true
futures.workspace = true
log.workspace = true
ruma.workspace = true
serde_json.workspace = true
Expand Down
9 changes: 4 additions & 5 deletions src/admin/check/commands.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use conduit::Result;
use conduit_macros::implement;
use futures::StreamExt;
use ruma::events::room::message::RoomMessageEventContent;

use crate::Command;
Expand All @@ -10,14 +11,12 @@ use crate::Command;
#[implement(Command, params = "<'_>")]
pub(super) async fn check_all_users(&self) -> Result<RoomMessageEventContent> {
let timer = tokio::time::Instant::now();
let results = self.services.users.db.iter();
let users = self.services.users.iter().collect::<Vec<_>>().await;
let query_time = timer.elapsed();

let users = results.collect::<Vec<_>>();

let total = users.len();
let err_count = users.iter().filter(|user| user.is_err()).count();
let ok_count = users.iter().filter(|user| user.is_ok()).count();
let err_count = users.iter().filter(|_user| false).count();
let ok_count = users.iter().filter(|_user| true).count();

let message = format!(
"Database query completed in {query_time:?}:\n\n```\nTotal entries: {total:?}\nFailure/Invalid user count: \
Expand Down
Loading