mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-18 09:23:13 +00:00
Split code for modular compilation
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
[package]
|
||||
name = "garage_table"
|
||||
version = "0.1.0"
|
||||
authors = ["Alex Auvolat <alex@adnab.me>"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
garage_util = { path = "../util" }
|
||||
garage_rpc = { path = "../rpc" }
|
||||
|
||||
bytes = "0.4"
|
||||
rand = "0.7"
|
||||
hex = "0.3"
|
||||
arc-swap = "0.4"
|
||||
log = "0.4"
|
||||
|
||||
sled = "0.31"
|
||||
|
||||
rmp-serde = "0.14.3"
|
||||
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
|
||||
serde_bytes = "0.11"
|
||||
|
||||
async-trait = "0.1.30"
|
||||
futures = "0.3"
|
||||
futures-util = "0.3"
|
||||
tokio = { version = "0.2", default-features = false, features = ["rt-core", "rt-threaded", "io-driver", "net", "tcp", "time", "macros", "sync", "signal", "fs"] }
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
#![recursion_limit = "1024"]
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
pub mod table;
|
||||
pub mod table_fullcopy;
|
||||
pub mod table_sharded;
|
||||
+10
-10
@@ -8,14 +8,14 @@ use futures::stream::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_bytes::ByteBuf;
|
||||
|
||||
use crate::data::*;
|
||||
use crate::error::Error;
|
||||
use garage_util::data::*;
|
||||
use garage_util::error::Error;
|
||||
|
||||
use crate::rpc::membership::{Ring, System};
|
||||
use crate::rpc::rpc_client::*;
|
||||
use crate::rpc::rpc_server::*;
|
||||
use garage_rpc::membership::{Ring, System};
|
||||
use garage_rpc::rpc_client::*;
|
||||
use garage_rpc::rpc_server::*;
|
||||
|
||||
use crate::table::table_sync::*;
|
||||
use crate::table_sync::*;
|
||||
|
||||
const TABLE_RPC_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
|
||||
@@ -78,14 +78,14 @@ impl PartitionKey for EmptyKey {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: AsRef<str>> PartitionKey for T {
|
||||
impl PartitionKey for String {
|
||||
fn hash(&self) -> Hash {
|
||||
hash(self.as_ref().as_bytes())
|
||||
hash(self.as_bytes())
|
||||
}
|
||||
}
|
||||
impl<T: AsRef<str>> SortKey for T {
|
||||
impl SortKey for String {
|
||||
fn sort_key(&self) -> &[u8] {
|
||||
self.as_ref().as_bytes()
|
||||
self.as_bytes()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
use arc_swap::ArcSwapOption;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::data::*;
|
||||
use crate::rpc::membership::{Ring, System};
|
||||
use crate::table::*;
|
||||
use garage_rpc::membership::{Ring, System};
|
||||
use garage_util::data::*;
|
||||
|
||||
use crate::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct TableFullReplication {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::data::*;
|
||||
use crate::rpc::membership::{Ring, System};
|
||||
use crate::table::*;
|
||||
use garage_rpc::membership::{Ring, System};
|
||||
use garage_util::data::*;
|
||||
|
||||
use crate::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct TableShardedReplication {
|
||||
|
||||
@@ -12,10 +12,11 @@ use serde_bytes::ByteBuf;
|
||||
use tokio::sync::Mutex;
|
||||
use tokio::sync::{mpsc, watch};
|
||||
|
||||
use crate::data::*;
|
||||
use crate::error::Error;
|
||||
use crate::rpc::membership::Ring;
|
||||
use crate::table::*;
|
||||
use garage_rpc::membership::Ring;
|
||||
use garage_util::data::*;
|
||||
use garage_util::error::Error;
|
||||
|
||||
use crate::*;
|
||||
|
||||
const MAX_DEPTH: usize = 16;
|
||||
const SCAN_INTERVAL: Duration = Duration::from_secs(3600);
|
||||
|
||||
Reference in New Issue
Block a user