diff options
author | Alex Auvolat <alex@adnab.me> | 2022-12-14 11:58:06 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-12-14 11:58:06 +0100 |
commit | 83c8467e23c1f531ae233766d5dc7244afe57f08 (patch) | |
tree | d2f959bccc6c779917ce64bee2b2f1cc236164db /src/table/table.rs | |
parent | f8e528c15de0c9d31c16e5cd8e58f99f4132f103 (diff) | |
download | garage-83c8467e23c1f531ae233766d5dc7244afe57f08.tar.gz garage-83c8467e23c1f531ae233766d5dc7244afe57f08.zip |
Proper queueing for delayed inserts, now backed to disk
Diffstat (limited to 'src/table/table.rs')
-rw-r--r-- | src/table/table.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/table/table.rs b/src/table/table.rs index 8a66c420..c8e0576e 100644 --- a/src/table/table.rs +++ b/src/table/table.rs @@ -25,6 +25,7 @@ use crate::crdt::Crdt; use crate::data::*; use crate::gc::*; use crate::merkle::*; +use crate::queue::InsertQueueWorker; use crate::replication::*; use crate::schema::*; use crate::sync::*; @@ -88,6 +89,11 @@ where endpoint, }); + table + .system + .background + .spawn_worker(InsertQueueWorker(table.clone())); + table.endpoint.set_handler(table.clone()); table @@ -128,6 +134,11 @@ where Ok(()) } + /// Insert item locally + pub fn queue_insert(&self, tx: &mut db::Transaction, e: &F::E) -> db::TxResult<(), Error> { + self.data.queue_insert(tx, e) + } + pub async fn insert_many<I, IE>(&self, entries: I) -> Result<(), Error> where I: IntoIterator<Item = IE> + Send + Sync, |