Coder Social home page Coder Social logo

ditto's People

Contributors

alex-shapiro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ditto's Issues

Allow Site ID to be more Generic

It would be nice if Site ID was not limited to u32 as a datatype, and instead could be anything that implements the traits needed to function. (I.e, Serde traits + Eq and Hash). I'm not sure how tightly coupled the implementation is to u32 at the moment.

This would allow a more decentralised approach at Site IDs, by using something such as a Random UUID to be used in place of a u32

Reserve capacity in 'HashMap: IntoJson'

Should map_value here not have the capacity of self?

ditto/src/json.rs

Lines 547 to 555 in c32f8e0

impl<S: Into<String> + Hash + Eq, T: IntoJson> IntoJson for HashMap<S, T> {
fn into_json(self, dot: Dot) -> Result<Inner, Error> {
let mut map_value = MapInner::new();
for (key, value) in self {
let _ = map_value.insert(key.into(), value.into_json(dot)?, dot);
}
Ok(Inner::Object(map_value))
}
}

i.e.

map_value.0.reserve(self.len());

Add Counter CRDT type

A special Counter type for mutable numbers. Unfortunately, incrementing a raw number is not idempotent, so receiving duplicate increment ops on a raw number breaks consistency.

The most basic implementation of a counter is one that keeps track of its entire history; each increment has a (site,counter) UID and duplicate increments have identical UIDs. The struct would look like this:

pub struct Counter {
    value: f64,
    history: Vec<UID>,
}

pub struct UID {
    site: usize,
    counter: usize,
}

pub struct Increment {
    amount: f64,
    site: usize,
    counter: usize,
}


impl Counter {
    pub fn increment(&self, amount: f64, replica: &Replica) -> Increment {
        self.value += amount;
        history.push(UID{site: replica.site, counter: replica.counter});
        Increment{amount: amount, site: replica.site, counter: replica.counter}
    }
}

CvRDT or CmRDT?

Just found this cool library. Thanks for the awesome work you've put into it!

I'm relatively new to the ideas underlying CRDTs but having a great time digging into various research papers and other sources on the subject. I plan to dig into your code more deeply soon, but was wondering if you could provide any additional information about how the CRDTs are implemented in this library from a high level? For example, in the readme, you mention "As long as ops from a site are executed in the order they were generated, the CRDT will maintain consistenct." Does that mean that this library is built out using CmRDTs and that I have to guarantee delivery order over my transport?

Thanks in advance!

pairing with a JavaScript library?

I'd love to use this with a JavaScript front-end. Any recommendations for having it work with a JavaScript client over HTTP?

Also, are you basing this library on CvRDTs (convergent replicated data types) or CmRDTs (commutative replicated data types)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.