aboutsummaryrefslogtreecommitdiff
path: root/database/src/indices/order.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-12-16 04:30:42 +0100
committermetamuffin <metamuffin@disroot.org>2025-12-16 04:30:42 +0100
commitfc7f3ae8e39a0398ceba7b9c44f58679c01a98da (patch)
tree77eef4d5e5ccb733b15ac4039e0a966f88ee8380 /database/src/indices/order.rs
parent0e48299889c3c2b81bf351ffe5da71e0bcd4c22a (diff)
downloadjellything-fc7f3ae8e39a0398ceba7b9c44f58679c01a98da.tar
jellything-fc7f3ae8e39a0398ceba7b9c44f58679c01a98da.tar.bz2
jellything-fc7f3ae8e39a0398ceba7b9c44f58679c01a98da.tar.zst
tables
Diffstat (limited to 'database/src/indices/order.rs')
-rw-r--r--database/src/indices/order.rs16
1 files changed, 3 insertions, 13 deletions
diff --git a/database/src/indices/order.rs b/database/src/indices/order.rs
index 852342d..04fb975 100644
--- a/database/src/indices/order.rs
+++ b/database/src/indices/order.rs
@@ -4,27 +4,17 @@
Copyright (C) 2025 metamuffin <metamuffin.org>
*/
-use crate::{Table, backends::KV, indices::Index};
+use crate::{backends::KV, indices::Index, table::Table};
use anyhow::Result;
-use std::sync::Arc;
pub struct OrderIndex<T> {
id: u32,
value: fn(&T) -> [u8; 8],
- db: Arc<dyn KV>,
}
impl<T: 'static> OrderIndex<T> {
pub fn new(table: &mut Table<T>, id: u32, value: fn(&T) -> [u8; 8]) -> Self {
- table.indices.push(Box::new(Self {
- id,
- value,
- db: table.db.clone(),
- }));
- Self {
- id,
- value,
- db: table.db.clone(),
- }
+ table.indices.push(Box::new(Self { id, value }));
+ Self { id, value }
}
fn key(&self, id: u64, val: &T) -> Vec<u8> {
let mut key = Vec::new();