commit a79237e2866460dfef3dd99f3b319cfc150c673c Author: Michael Zhang Date: Wed Jul 14 03:16:32 2021 -0500 chow diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..8551a8b --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "chow" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..e8b7574 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "chow" +version = "0.1.0" +authors = ["Michael Zhang "] +edition = "2018" + +[dependencies] \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..2e5986c --- /dev/null +++ b/src/main.rs @@ -0,0 +1,6 @@ +mod sync; +mod myers; + +fn main() { + println!("Hello, world!"); +} diff --git a/src/myers.rs b/src/myers.rs new file mode 100644 index 0000000..8b35cae --- /dev/null +++ b/src/myers.rs @@ -0,0 +1,3 @@ +pub fn myers() { + +} \ No newline at end of file diff --git a/src/sync.rs b/src/sync.rs new file mode 100644 index 0000000..183cbfc --- /dev/null +++ b/src/sync.rs @@ -0,0 +1,59 @@ +pub trait Differentiable { + type Diff; + fn diff(a: Self, b: Self) -> Self::Diff; + fn apply(&mut self, d: Self::Diff); +} + +pub struct List(Vec); + +pub enum ListDiff { + Insert(usize, T), + Delete(usize), + Update(usize, T), +} + +impl Differentiable for List { + type Diff = Vec<(usize, T::Diff)>; + + fn diff(_a: Self, _b: Self) -> Self::Diff { + todo!() + } + + fn apply(&mut self, _d: Self::Diff) { + + } +} + +pub struct Chow { + items: Vec, +} + +pub struct ChowDiff; + +impl Differentiable for Chow { + type Diff = ChowDiff; + fn diff(_a: Self, _b: Self) -> Self::Diff { + todo!() + } + + fn apply(&mut self, _d: Self::Diff) { + + } +} + +pub struct ClientState { + text: Chow, + shadow: Chow, + current_client_version: usize, + last_server_version: usize, +} + +impl ClientState { + +} + +pub struct ServerState { + text: Chow, + shadow: Chow, + backup_shadow: Chow, +} \ No newline at end of file