Expose db change batches over control
This commit is contained in:
parent
8ffe1d714c
commit
a44eef3126
8 changed files with 130 additions and 15 deletions
|
|
@ -1,5 +1,5 @@
|
|||
use geth_auth::{AuthExplanation, AuthOp};
|
||||
use geth_db::DbResource;
|
||||
use geth_db::{CrSqliteChangeBatch, DbResource};
|
||||
use geth_document::{DocumentResource, DocumentState};
|
||||
use geth_keychain::KeychainOp;
|
||||
use geth_kv::{KvEntry, KvResource};
|
||||
|
|
@ -121,6 +121,11 @@ pub enum ControlRequest {
|
|||
DbStatus {
|
||||
name: String,
|
||||
},
|
||||
DbChanges {
|
||||
name: String,
|
||||
after_db_version: Option<i64>,
|
||||
limit: u32,
|
||||
},
|
||||
KvCreate {
|
||||
name: String,
|
||||
},
|
||||
|
|
@ -165,7 +170,7 @@ pub enum ControlRequest {
|
|||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(tag = "type", rename_all = "kebab-case")]
|
||||
pub enum ControlResponse {
|
||||
Status(StatusResponse),
|
||||
|
|
@ -262,6 +267,10 @@ pub enum ControlResponse {
|
|||
DbStatus {
|
||||
db: DbResource,
|
||||
},
|
||||
DbChanges {
|
||||
db: DbResource,
|
||||
batch: CrSqliteChangeBatch,
|
||||
},
|
||||
KvCreated {
|
||||
kv: KvResource,
|
||||
},
|
||||
|
|
@ -427,5 +436,15 @@ mod tests {
|
|||
decode_request(&encode_request(&request).expect("encode")).expect("decode"),
|
||||
request
|
||||
);
|
||||
|
||||
let request = ControlRequest::DbChanges {
|
||||
name: "notes".to_owned(),
|
||||
after_db_version: Some(7),
|
||||
limit: 10,
|
||||
};
|
||||
assert_eq!(
|
||||
decode_request(&encode_request(&request).expect("encode")).expect("decode"),
|
||||
request
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue