aboutsummaryrefslogtreecommitdiff
path: root/database/src/sort/mod.rs
blob: b05876634dec5d1f27bfacd97f8181314d6bf690 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2026 metamuffin <metamuffin.org>
*/

use crate::{backends::WriteTransaction, table::RowNum};
use anyhow::Result;
use jellyobject::Object;

pub mod none;
pub mod value;

pub trait Index: Send + Sync + 'static {
    fn add(&self, db: &mut dyn WriteTransaction, row: RowNum, val: Object) -> Result<()>;
    fn remove(&self, db: &mut dyn WriteTransaction, row: RowNum, val: Object) -> Result<()>;
    /// Might return true if objects are identical for this index; false if not or uncertain
    fn compare(&self, before: Object, after: Object) -> bool {
        let _ = (before, after);
        false
    }
}