Skip to content
Snippets Groups Projects
Commit 89babd49 authored by Moritz Langenstein's avatar Moritz Langenstein
Browse files

(ml5717) Erasure interval footprints in sync state vector

parent 5019bf53
No related branches found
No related tags found
No related merge requests found
[submodule "vec-map"]
path = vec-map
url = git@gitlab.doc.ic.ac.uk:ml5717/vec-map.git
url = git@gitlab.doc.ic.ac.uk:sweng-group-15/vec-map.git
......@@ -20,7 +20,9 @@ serde-wasm-bindgen = "0.1.3"
vec_map = { path = "vec-map", features = ["serde"] }
bincode = "1.2.1"
fixedbitset = "0.2.0"
# web-sys = { version = "0.3.33", features = ["console"] }
ordered-float = { version = "1.0.2", features = ["serde"] }
twox-hash = "1.1.1"
web-sys = { version = "0.3.33", features = ["console"] }
# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
......
This diff is collapsed.
use wasm_bindgen::prelude::*;
use js_sys::Error;
use ordered_float::NotNan;
use serde_wasm_bindgen::to_value as to_js_value;
use std::collections::HashMap;
use std::option::Option;
......@@ -40,7 +41,7 @@ impl EventListener for WasmEventListener {
self.on_stroke(stroke, to_js_value(points).unwrap())
}
fn on_interval(&self, stroke: String, intervals: &IntervalUnion<f32>) {
fn on_interval(&self, stroke: String, intervals: &IntervalUnion<NotNan<f32>>) {
self.on_interval(stroke, to_js_value(intervals).unwrap())
}
......@@ -144,12 +145,12 @@ impl WasmCRDT {
Ok(self.0.apply_deltas(deltas))
}
pub fn get_state_vector(&self) -> Box<[u8]> {
pub fn get_state_vector(&mut self) -> Box<[u8]> {
packing::pack(&bincode::serialize(&self.0.get_state_vector()).unwrap()).into_boxed_slice()
}
pub fn fetch_deltas_from_state_vector(
&self,
&mut self,
user: String,
remote_state: Box<[u8]>,
) -> Result<(), JsValue> {
......
......@@ -29,6 +29,7 @@ crdt.add_stroke(4, 2, 3.14, "ffff00")
crdt.add_stroke(4, 2, 3.14, "ffff00")
let end_id = crdt.add_stroke(4, 2, 3.14, "ffff00")
crdt.erase_stroke(end_id, 0.0, 0.0)
console.log("canonical stroke author 4:", WasmCRDT.canonicalise_stroke_author(end_id))
crdt.add_stroke(4, 2, 3.14, "ffff00")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment