feat(smartdb): add operation log APIs, point-in-time revert support, and a web-based debug dashboard
This commit is contained in:
@@ -2,6 +2,7 @@ use std::collections::HashMap;
|
||||
|
||||
use bson::{doc, oid::ObjectId, Bson, Document};
|
||||
use rustdb_index::IndexEngine;
|
||||
use rustdb_storage::OpType;
|
||||
use tracing::{debug, warn};
|
||||
|
||||
use crate::context::CommandContext;
|
||||
@@ -63,7 +64,17 @@ pub async fn handle(
|
||||
|
||||
// Attempt storage insert.
|
||||
match ctx.storage.insert_one(db, coll, doc.clone()).await {
|
||||
Ok(_id_str) => {
|
||||
Ok(id_str) => {
|
||||
// Record in oplog.
|
||||
ctx.oplog.append(
|
||||
OpType::Insert,
|
||||
db,
|
||||
coll,
|
||||
&id_str,
|
||||
Some(doc.clone()),
|
||||
None,
|
||||
);
|
||||
|
||||
// Update index engine.
|
||||
let mut engine = ctx
|
||||
.indexes
|
||||
|
||||
Reference in New Issue
Block a user