This commit is contained in:
Michael Zhang 2021-07-14 03:16:32 -05:00
commit a79237e286
Signed by: michael
GPG Key ID: BDA47A31A3C8EE6B
6 changed files with 81 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

5
Cargo.lock generated Normal file
View File

@ -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"

7
Cargo.toml Normal file
View File

@ -0,0 +1,7 @@
[package]
name = "chow"
version = "0.1.0"
authors = ["Michael Zhang <mail@mzhang.io>"]
edition = "2018"
[dependencies]

6
src/main.rs Normal file
View File

@ -0,0 +1,6 @@
mod sync;
mod myers;
fn main() {
println!("Hello, world!");
}

3
src/myers.rs Normal file
View File

@ -0,0 +1,3 @@
pub fn myers<T>() {
}

59
src/sync.rs Normal file
View File

@ -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<T>(Vec<T>);
pub enum ListDiff<T> {
Insert(usize, T),
Delete(usize),
Update(usize, T),
}
impl<T: Differentiable> Differentiable for List<T> {
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<String>,
}
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,
}