diff --git a/NOTES.md b/NOTES.md deleted file mode 100644 index f0fcf7e1..00000000 --- a/NOTES.md +++ /dev/null @@ -1,12 +0,0 @@ -# cr-sqlite - -What to figure out: -- ~~gossip format~~ -- ~~sync format~~ -- backup + restore - - mostly figured out in: https://github.com/vlcn-io/cr-sqlite/issues/145 -- soft deletes -- ~~filters + subscriptions~~ -- ~~schema versioning (hash of sqlite_master for each table?)~~ (probably not needed anymore with stricter constraints with the schema) -- ~~corroctl~~ -- ~~dynamic reload of schema~~ \ No newline at end of file diff --git a/crates/corro-agent/src/agent.rs b/crates/corro-agent/src/agent.rs index d632cc6a..3a6ef53b 100644 --- a/crates/corro-agent/src/agent.rs +++ b/crates/corro-agent/src/agent.rs @@ -2053,11 +2053,6 @@ pub mod tests { assert_eq!(svc.id, 1); assert_eq!(svc.text, "hello world 1"); - // assert_eq!( - // bod["outcomes"], - // serde_json::json!([{"result": "applied", "version": 1}]) - // ); - let req_body: Vec = serde_json::from_value(json!([[ "INSERT INTO tests (id,text) VALUES (?,?)", [2, "hello world 2"] diff --git a/crates/corro-agent/src/api/client.rs b/crates/corro-agent/src/api/client.rs index 82d6e9a7..e369bcfa 100644 --- a/crates/corro-agent/src/api/client.rs +++ b/crates/corro-agent/src/api/client.rs @@ -35,16 +35,6 @@ use crate::agent::process_subs; pub const MAX_CHANGES_PER_MESSAGE: usize = 50; -// TODO: accept a few options -// #[derive(Debug, Eq, PartialEq, Serialize, Deserialize)] -// #[serde(rename_all = "snake_case")] -// pub struct RqliteRequestOptions { -// pretty: Option, -// timings: Option, -// transaction: Option, -// q: Option, -// } - pub struct ChunkedChanges { iter: I, changes: Vec, diff --git a/crates/corro-client/src/lib.rs b/crates/corro-client/src/lib.rs index 2ef948cb..dcbb9178 100644 --- a/crates/corro-client/src/lib.rs +++ b/crates/corro-client/src/lib.rs @@ -170,9 +170,6 @@ impl CorrosionApiClient { match tokio::fs::read_to_string(entry.path()).await { Ok(s) => { statements.push(Statement::Simple(s)); - // pushed.push( - // entry.path().to_string_lossy().to_string().into(), - // ); } Err(e) => { warn!( diff --git a/crates/corro-tpl/src/lib.rs b/crates/corro-tpl/src/lib.rs index 545d5823..5f123ed7 100644 --- a/crates/corro-tpl/src/lib.rs +++ b/crates/corro-tpl/src/lib.rs @@ -676,20 +676,6 @@ mod tests { let tmpdir = tempfile::tempdir().unwrap(); let filepath = tmpdir.path().join("output"); - // enum Command { - // Render, - // } - - // enum Reply { - // Rendered, - // } - - // let (cmd_tx, mut cmd_rx) = mpsc::channel(10); - // let (reply_tx, mut reply_rx) = mpsc::channel(10); - - // tokio::spawn({ - // let filepath = filepath.clone(); - // async move { let f = std::fs::OpenOptions::new() .create(true) .write(true) @@ -700,10 +686,6 @@ mod tests { let engine = Engine::new::(client.clone()); - // loop { - // let cmd = cmd_rx.recv().await.unwrap(); - // assert!(matches!(cmd, Command::Render)); - { let cancel = CancellationToken::new(); block_in_place(|| { @@ -720,14 +702,6 @@ mod tests { ) .unwrap(); }); - // reply_tx.send(Reply::Rendered).await.unwrap(); - // } - // } - // }); - - // cmd_tx.send(Command::Render).await.unwrap(); - // let replied = reply_rx.recv().await.unwrap(); - // assert!(matches!(replied, Reply::Rendered)); let output = std::fs::read_to_string(&filepath).unwrap(); diff --git a/crates/corro-types/src/sync.rs b/crates/corro-types/src/sync.rs index febc9975..22cf267a 100644 --- a/crates/corro-types/src/sync.rs +++ b/crates/corro-types/src/sync.rs @@ -1,9 +1,9 @@ use std::{collections::HashMap, io, ops::RangeInclusive}; -use bytes::{BufMut, BytesMut}; +use bytes::BytesMut; use serde::{Deserialize, Serialize}; use speedy::{Readable, Writable}; -use tokio_util::codec::{Decoder, Encoder, LengthDelimitedCodec}; +use tokio_util::codec::{Decoder, LengthDelimitedCodec}; use crate::{ actor::ActorId, @@ -142,39 +142,7 @@ impl SyncMessage { Self::read_from_buffer(slice.as_ref()) } - pub fn encode_w_codec( - &self, - codec: &mut LengthDelimitedCodec, - buf: &mut BytesMut, - ) -> Result<(), SyncMessageEncodeError> { - self.write_to_stream(buf.writer())?; - // let mut bytes = buf.split(); - // let hash = crc32fast::hash(&bytes); - // bytes.put_u32(hash); - - codec.encode(buf.split().freeze(), buf)?; - - Ok(()) - } - - // pub fn encode(&self, buf: &mut BytesMut) -> Result<(), SyncMessageEncodeError> { - // let mut codec = LengthDelimitedCodec::builder() - // .length_field_type::() - // .new_codec(); - // self.encode_w_codec(&mut codec, buf)?; - - // Ok(()) - // } - pub fn from_buf(buf: &mut BytesMut) -> Result { - // let mut crc_bytes = buf.split_off(len - 4); - - // let crc = crc_bytes.get_u32(); - // let new_crc = crc32fast::hash(&buf); - // if crc != new_crc { - // return Err(SyncMessageDecodeError::Corrupted(crc, new_crc)); - // } - Ok(Self::from_slice(&buf)?) }