set default database backend in nixos module to rocksdb

The media backend already has a default value.
This commit is contained in:
Olivia Lee 2025-04-06 20:03:09 -07:00 committed by avdb13
parent 1cd12460d7
commit cc0bde5b4d
2 changed files with 25 additions and 37 deletions

View file

@ -40,18 +40,27 @@ in
''; '';
default = false; default = false;
}; };
database.path = lib.mkOption { database = {
type = types.nonEmptyStr; backend = lib.mkOption {
readOnly = true; type = types.nonEmptyStr;
description = '' description = ''
The path to store database files in. The database backend to use.
'';
default = "rocksdb";
};
path = lib.mkOption {
type = types.nonEmptyStr;
readOnly = true;
description = ''
The path to store database files in.
Note that this is read-only because this module makes use of Note that this is read-only because this module makes use of
systemd's `StateDirectory` option. systemd's `StateDirectory` option.
''; '';
default = if cfg.settings.conduit_compat default = if cfg.settings.conduit_compat
then "/var/lib/matrix-conduit/database" then "/var/lib/matrix-conduit/database"
else "/var/lib/grapevine/database"; else "/var/lib/grapevine/database";
};
}; };
media.backend = { media.backend = {
type = lib.mkOption { type = lib.mkOption {

View file

@ -716,7 +716,10 @@ pub(crate) fn parse_incoming_pdu(
let room_version_id = services() let room_version_id = services()
.rooms .rooms
.state .state
.get_create_content::<ExtractVersion>(&room_id)?; .get_create_content::<ExtractVersion>(&room_id)
.inspect_err(|_| {
debug!(%room_id, "This server is not in the room");
})?;
let Ok((event_id, value)) = let Ok((event_id, value)) =
gen_event_id_canonical_json(pdu, &room_version_id) gen_event_id_canonical_json(pdu, &room_version_id)
@ -745,31 +748,7 @@ pub(crate) async fn send_transaction_message_route(
let pub_key_map = RwLock::new(BTreeMap::new()); let pub_key_map = RwLock::new(BTreeMap::new());
for pdu in &body.pdus { for pdu in &body.pdus {
let value: CanonicalJsonObject = serde_json::from_str(pdu.get()) let (event_id, value, room_id) = match parse_incoming_pdu(pdu) {
.map_err(|error| {
warn!(%error, object = ?pdu, "Error parsing incoming event");
Error::BadServerResponse("Invalid PDU in server response")
})?;
let room_id: OwnedRoomId = value
.get("room_id")
.and_then(|id| RoomId::parse(id.as_str()?).ok())
.ok_or(Error::BadRequest(
ErrorKind::InvalidParam,
"Invalid room id in pdu",
))?;
if services()
.rooms
.state
.get_create_content::<ExtractVersion>(&room_id)
.is_err()
{
debug!(%room_id, "This server is not in the room");
continue;
}
let r = parse_incoming_pdu(pdu);
let (event_id, value, room_id) = match r {
Ok(t) => t, Ok(t) => t,
Err(error) => { Err(error) => {
warn!(%error, object = ?pdu, "Error parsing incoming event"); warn!(%error, object = ?pdu, "Error parsing incoming event");