chore: rm needless package

This commit is contained in:
Zixuan Chen 2023-10-29 22:13:59 +08:00
parent ce8dc9284d
commit 4d87725f32
No known key found for this signature in database
13 changed files with 1 additions and 312 deletions

106
Cargo.lock generated
View file

@ -168,15 +168,6 @@ dependencies = [
"typenum",
]
[[package]]
name = "block-buffer"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
dependencies = [
"generic-array",
]
[[package]]
name = "bumpalo"
version = "3.11.1"
@ -360,15 +351,6 @@ dependencies = [
"unicode-segmentation",
]
[[package]]
name = "cpufeatures"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
dependencies = [
"libc",
]
[[package]]
name = "crc32fast"
version = "1.3.2"
@ -500,16 +482,6 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "crypto-common"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"generic-array",
"typenum",
]
[[package]]
name = "ctor"
version = "0.1.26"
@ -598,16 +570,6 @@ dependencies = [
"thousands",
]
[[package]]
name = "digest"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
dependencies = [
"block-buffer",
"crypto-common",
]
[[package]]
name = "either"
version = "1.8.0"
@ -705,16 +667,6 @@ dependencies = [
"byteorder",
]
[[package]]
name = "generic-array"
version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
dependencies = [
"typenum",
"version_check",
]
[[package]]
name = "generic-btree"
version = "0.8.0"
@ -778,7 +730,7 @@ dependencies = [
"hash32",
"rustc_version",
"serde",
"spin 0.9.4",
"spin",
"stable_deref_trait",
]
@ -964,13 +916,6 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "loro"
version = "0.1.0"
dependencies = [
"loro-internal",
]
[[package]]
name = "loro-common"
version = "0.1.0"
@ -995,17 +940,6 @@ dependencies = [
"loro-internal",
]
[[package]]
name = "loro-framework"
version = "0.1.0"
dependencies = [
"fxhash",
"loro-internal",
"ring",
"rle",
"sha2",
]
[[package]]
name = "loro-internal"
version = "0.1.0"
@ -1720,21 +1654,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "ring"
version = "0.16.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
dependencies = [
"cc",
"libc",
"once_cell",
"spin 0.5.2",
"untrusted",
"web-sys",
"winapi",
]
[[package]]
name = "rle"
version = "0.1.0"
@ -1899,17 +1818,6 @@ dependencies = [
"serde",
]
[[package]]
name = "sha2"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
dependencies = [
"cfg-if",
"cpufeatures",
"digest",
]
[[package]]
name = "siphasher"
version = "0.3.10"
@ -1946,12 +1854,6 @@ dependencies = [
"version_check",
]
[[package]]
name = "spin"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "spin"
version = "0.9.4"
@ -2241,12 +2143,6 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c"
[[package]]
name = "untrusted"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "version_check"
version = "0.9.4"

View file

@ -1,16 +0,0 @@
[package]
name = "loro-framework"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
fxhash = "0.2.1"
loro-internal = { path = "../loro-internal" }
ring = "0.16.20"
rle = { path = "../rle" }
sha2 = "0.10.2"
[lib]
doctest = false

View file

@ -1,10 +0,0 @@
# Loro Framework
The layers of loro:
- Loro Framework(this crate): It is agnostic to the op content. Thus intermediary nodes can work on this layer. It can handle apply updates, encode updates, hash and authentication.
- The change content is byte stream in this layer (may be encrypted).
- If it's encrypted, the public key is accessible for the intermediary nodes
- Encoding & Decoding layer(this crate). This layer also handle encryption and decryption
- CRDT Framework(loro-internal crate): It is agnostic to the specific CRDT algorithms. We can register different CRDT algorithm upon it.
- Specific CRDT Algorithm(loro-text, loro-array crate).

View file

@ -1,5 +0,0 @@
#![allow(unused)]
mod encoding;
mod loro;
mod raw_change;
mod raw_store;

View file

@ -1,9 +0,0 @@
use loro_internal::{id::PeerID, LoroDoc};
use crate::raw_store::RawStore;
pub struct Loro {
pub this_client_id: PeerID,
pub raw_store: Option<RawStore>,
pub log_store: Option<LoroDoc>,
}

View file

@ -1,61 +0,0 @@
use rle::{HasLength, Mergable};
use sha2::{Digest, Sha256};
pub(crate) type ChangeHash = [u8; 32];
pub struct ChangeData {
pub counter: usize,
pub len: usize,
pub data: Vec<u8>,
pub hash: Option<ChangeHash>,
}
impl ChangeData {
pub fn update_hash(&mut self, prev_hash: Option<ChangeHash>) {
self.hash = Some(self.calc_hash(prev_hash));
}
pub fn calc_hash(&mut self, prev_hash: Option<ChangeHash>) -> ChangeHash {
let mut hasher = Sha256::new();
hasher.update(&self.data);
if let Some(prev) = prev_hash {
hasher.update(prev);
}
hasher.finalize()[..].try_into().unwrap()
}
pub fn match_hash(&self, prev_hash: Option<ChangeHash>) -> bool {
if let Some(hash) = self.hash {
if let Some(prev) = prev_hash {
hash == prev
} else {
false
}
} else {
false
}
}
}
impl HasLength for ChangeData {
fn content_len(&self) -> usize {
self.len
}
}
impl Mergable for ChangeData {
fn is_mergable(&self, _other: &Self, _conf: &()) -> bool
where
Self: Sized,
{
false
}
fn merge(&mut self, _other: &Self, _conf: &())
where
Self: Sized,
{
unreachable!()
}
}

View file

@ -1,95 +0,0 @@
use fxhash::FxHashMap;
use loro_internal::{
id::{Counter, PeerID},
version::VersionVector,
};
use rle::{HasLength, RleVecWithIndex};
use crate::raw_change::{ChangeData, ChangeHash};
pub type Mac = [u8; 32];
pub struct RawStore {
changes: FxHashMap<PeerID, RleVecWithIndex<ChangeData>>,
macs: Option<FxHashMap<PeerID, Mac>>,
}
impl RawStore {
pub fn new() -> Self {
Self {
changes: FxHashMap::default(),
macs: None,
}
}
pub fn maced(&self) -> bool {
self.macs.is_some()
}
pub fn encode_update(&self, _from: Option<&VersionVector>) -> Vec<u8> {
unimplemented!()
}
pub fn verify(&mut self, _pub_key: &[u8; 32]) -> bool {
if !self.maced() {
return true;
}
if self.macs.as_ref().unwrap().len() < self.changes.len() {
return false;
}
self.calc_hash();
for (_client_id, _mac) in self.macs.as_ref().unwrap().iter() {
todo!("pending");
}
true
}
pub fn get_final_hash(&self, client_id: PeerID) -> ChangeHash {
let changes = self.changes.get(&client_id).unwrap();
let last = changes.vec().last().unwrap();
last.hash.unwrap()
}
fn calc_hash(&mut self) {
for (_client_id, changes) in &mut self.changes.iter_mut() {
let changes = changes.vec_mut();
let mut start_index = 0;
for i in (0..changes.len()).rev() {
if changes[i].hash.is_some() {
start_index = i + 1;
break;
}
}
for index in start_index..changes.len() {
let (prev, cur) = changes.split_at_mut(index);
cur[0].update_hash(if index == 0 {
None
} else {
Some(prev.last().unwrap().hash.unwrap())
});
}
}
}
pub fn version_vector(&self) -> VersionVector {
let mut version_vector = VersionVector::new();
for (client_id, changes) in &self.changes {
version_vector.insert(*client_id, changes.atom_len() as Counter);
}
version_vector
}
pub fn sign(&self, _pub_key: ()) {
unimplemented!()
}
}
impl Default for RawStore {
fn default() -> Self {
Self::new()
}
}

View file

@ -1,9 +0,0 @@
[package]
name = "loro"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
loro-internal = { path = "../loro-internal" }

View file

@ -1 +0,0 @@

View file

@ -1 +0,0 @@