update cargo deps

This commit is contained in:
2021-01-23 17:13:34 +01:00
parent 30fa479156
commit 2ac4fdbc07
12 changed files with 63 additions and 25 deletions

View File

@@ -5,16 +5,16 @@ authors = ["Thomas Heck <t@b128.net>"]
edition = "2018"
[dependencies]
crdts = "4"
crdts = "5"
serde = "1"
serde_bytes = "0.11"
rmp-serde = "0.14"
rmp-serde = "0.15"
async-trait = "0.1"
anyhow = "1"
thiserror = "1"
futures = "0.3"
dyn-clone = "1"
bytes = "0.5"
bytes = "1"
[dependencies.uuid]
version = "0.8"

View File

@@ -9,6 +9,7 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize};
use std::{
borrow::Borrow,
cmp::{Eq, Ord, Ordering, PartialEq},
convert::Infallible,
fmt::Debug,
hash::{Hash, Hasher},
sync::Arc,
@@ -42,6 +43,12 @@ pub struct Keys {
}
impl CvRDT for Keys {
type Validation = Infallible;
fn validate_merge(&self, _other: &Self) -> Result<(), Infallible> {
Ok(())
}
fn merge(&mut self, other: Keys) {
self.latest_key_id.merge(other.latest_key_id);
self.keys.merge(other.keys);

View File

@@ -22,6 +22,7 @@ use futures::{
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use std::{
collections::HashSet,
convert::Infallible,
default::Default,
fmt::Debug,
mem,
@@ -740,6 +741,12 @@ struct RemoteMeta {
}
impl CvRDT for RemoteMeta {
type Validation = Infallible;
fn validate_merge(&self, _other: &Self) -> Result<(), Infallible> {
Ok(())
}
fn merge(&mut self, other: Self) {
self.storage.merge(other.storage);
self.cryptor.merge(other.cryptor);

View File

@@ -4,6 +4,7 @@ pub use version_bytes::*;
use crdts::{CmRDT, CvRDT};
use serde::{Deserialize, Serialize};
use std::convert::Infallible;
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct EmptyCrdt;
@@ -11,9 +12,21 @@ pub struct EmptyCrdt;
impl CmRDT for EmptyCrdt {
type Op = ();
type Validation = Infallible;
fn validate_op(&self, op: &Self::Op) -> Result<(), Infallible> {
Ok(())
}
fn apply(&mut self, _op: Self::Op) {}
}
impl CvRDT for EmptyCrdt {
type Validation = Infallible;
fn validate_merge(&self, _other: &Self) -> Result<(), Infallible> {
Ok(())
}
fn merge(&mut self, _other: Self) {}
}

View File

@@ -226,7 +226,7 @@ impl<'a> ::bytes::Buf for VersionBytesBuf<'a> {
BUF_VERSION_LEN_BYTES + self.content.len() - self.pos
}
fn bytes(&self) -> &[u8] {
fn chunk(&self) -> &[u8] {
if self.pos < BUF_VERSION_LEN_BYTES {
&self.version_len[self.pos..]
} else {
@@ -244,7 +244,7 @@ impl<'a> ::bytes::Buf for VersionBytesBuf<'a> {
self.pos += cnt;
}
fn bytes_vectored<'b>(&'b self, dst: &mut [IoSlice<'b>]) -> usize {
fn chunks_vectored<'b>(&'b self, dst: &mut [IoSlice<'b>]) -> usize {
// TODO: TESTING!
if dst.len() == 0 {