More fragmentation

This commit is contained in:
Nadja Reitzenstein 2021-10-28 00:32:25 +02:00
parent 4e60b5d767
commit 150b2e68d9
13 changed files with 75 additions and 72 deletions

13
Cargo.lock generated
View File

@ -70,6 +70,15 @@ dependencies = [
"winapi",
]
[[package]]
name = "api"
version = "0.1.0"
dependencies = [
"capnp",
"capnpc",
"walkdir",
]
[[package]]
name = "arrayref"
version = "0.3.6"
@ -602,15 +611,14 @@ dependencies = [
name = "diflouroborane"
version = "0.3.0"
dependencies = [
"api",
"async-channel",
"async-native-tls",
"async-oneshot",
"async-trait",
"bincode",
"capnp",
"capnp-futures",
"capnp-rpc",
"capnpc",
"chrono",
"clap",
"erased-serde",
@ -637,7 +645,6 @@ dependencies = [
"tracing",
"tracing-subscriber",
"uuid",
"walkdir",
]
[[package]]

View File

@ -57,10 +57,9 @@ tracing = "0.1.28"
tracing-subscriber = "0.2.25"
# API
capnp = "0.14.3"
capnpc = "0.14.4"
api = { path = "api" }
capnp = "0.14"
capnp-rpc = "0.14.1"
capnp-futures = "0.14.1"
# API Authentication
rsasl = "1.4.0" # TODO update this if bindgen breaks (again)
@ -76,11 +75,6 @@ erased-serde = "0.3"
serde_dhall = { version = "0.10.1", default-features = false }
serde_json = "1.0"
[build-dependencies]
capnpc = "0.14.4"
# Used in build.rs to iterate over all files in schema/
walkdir = "2.3.2"
[dev-dependencies]
futures-test = "0.3.16"
tempfile = "3.2"

View File

@ -2,7 +2,15 @@
name = "api"
version = "0.1.0"
edition = "2021"
build = "build.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
capnp = "0.14.3"
capnpc = "0.14.4"
[build-dependencies]
capnpc = "0.14.4"
# Used in build.rs to iterate over all files in schema/
walkdir = "2.3.2"

View File

@ -8,14 +8,8 @@ fn is_hidden(entry: &DirEntry) -> bool {
}
fn main() {
// Tell cargo to only run this script if the schema files or this script have changed
println!("cargo:rerun-if-changed=schema");
let mut compile_command = ::capnpc::CompilerCommand::new();
// Set parent module of all generated schema files.
// i.e. a file "user.capnp" will result in module "schema::user"
compile_command.default_parent_module(vec!["schema".into()]);
compile_command.src_prefix("schema");
for entry in WalkDir::new("schema")
.max_depth(2)

@ -1 +1 @@
Subproject commit 3023fb22598980352f0865825f6d91ce5f20754e
Subproject commit f713df2221727f2f9535be4c4c9ae36de77c1a63

View File

@ -1,8 +1,41 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
let result = 2 + 2;
assert_eq!(result, 4);
}
pub use capnpc::schema_capnp;
#[allow(dead_code)]
pub mod auth_capnp {
include!(concat!(env!("OUT_DIR"), "/auth_capnp.rs"));
}
#[allow(dead_code)]
pub mod main_capnp {
include!(concat!(env!("OUT_DIR"), "/main_capnp.rs"));
}
#[allow(dead_code)]
pub mod utils_capnp {
include!(concat!(env!("OUT_DIR"), "/utils_capnp.rs"));
}
#[allow(dead_code)]
pub mod resource_capnp {
include!(concat!(env!("OUT_DIR"), "/resource_capnp.rs"));
}
#[allow(dead_code)]
pub mod resources_capnp {
include!(concat!(env!("OUT_DIR"), "/resources_capnp.rs"));
}
#[allow(dead_code)]
pub mod role_capnp {
include!(concat!(env!("OUT_DIR"), "/role_capnp.rs"));
}
#[allow(dead_code)]
pub mod user_capnp {
include!(concat!(env!("OUT_DIR"), "/user_capnp.rs"));
}
#[allow(dead_code)]
pub mod users_capnp {
include!(concat!(env!("OUT_DIR"), "/users_capnp.rs"));
}

View File

@ -1,13 +1,13 @@
#![forbid(unused_imports)]
#![warn(missing_docs, missing_debug_implementations)]
pub mod config;
pub mod db;
pub mod error;
pub mod network;
pub mod oid;
pub mod permissions;
pub mod resource;
pub mod schema;
pub mod state;
pub mod varint;

View File

@ -1,4 +1,4 @@
//! oid crate by https://github.com/UnnecessaryEngineering/oid turned into vendore'd module
//! oid crate by <https://github.com/UnnecessaryEngineering/oid> turned into vendore'd module
//!
//! [Object Identifiers] are a standard of the [ITU] used to reference objects, things, and
//! concepts in a globally unique way. This crate provides for data structures and methods

View File

@ -1,41 +0,0 @@
pub use capnpc::schema_capnp;
#[allow(dead_code)]
pub mod auth_capnp {
include!(concat!(env!("OUT_DIR"), "/schema/auth_capnp.rs"));
}
#[allow(dead_code)]
pub mod main_capnp {
include!(concat!(env!("OUT_DIR"), "/schema/main_capnp.rs"));
}
#[allow(dead_code)]
pub mod utils_capnp {
include!(concat!(env!("OUT_DIR"), "/schema/utils_capnp.rs"));
}
#[allow(dead_code)]
pub mod resource_capnp {
include!(concat!(env!("OUT_DIR"), "/schema/resource_capnp.rs"));
}
#[allow(dead_code)]
pub mod resources_capnp {
include!(concat!(env!("OUT_DIR"), "/schema/resources_capnp.rs"));
}
#[allow(dead_code)]
pub mod role_capnp {
include!(concat!(env!("OUT_DIR"), "/schema/role_capnp.rs"));
}
#[allow(dead_code)]
pub mod user_capnp {
include!(concat!(env!("OUT_DIR"), "/schema/user_capnp.rs"));
}
#[allow(dead_code)]
pub mod users_capnp {
include!(concat!(env!("OUT_DIR"), "/schema/users_capnp.rs"));
}

View File

@ -113,6 +113,7 @@ impl_convert_from_to!(u32, 5, VarU32);
impl_convert_from_to!(u64, 10, VarU64);
impl_convert_from_to!(u128, 19, VarU128);
#[allow(dead_code)]
#[cfg(target_pointer_width = "64")]
type VarUsize = VarU64;
#[cfg(target_pointer_width = "32")]

View File

@ -7,7 +7,7 @@ use serde::{Serialize, Deserialize, Deserializer, Serializer};
use std::fmt::Formatter;
use std::net::{SocketAddr, IpAddr, ToSocketAddrs};
use std::str::FromStr;
use crate::permissions::{PermRule, RoleIdentifier};
use diflouroborane::permissions::{PermRule, RoleIdentifier};
use serde::de::Error;
type Result<T> = std::result::Result<T, serde_dhall::Error>;

View File

@ -5,10 +5,12 @@ use std::{
};
use clap::{App, Arg, crate_version, crate_description, crate_name};
use std::str::FromStr;
use diflouroborane::{config, error::Error};
use diflouroborane::{error::Error};
use diflouroborane::db::{Databases, Dump};
use std::net::ToSocketAddrs;
mod config;
fn main() -> Result<(), Error> {
tracing_subscriber::fmt::init();
// Argument parsing

View File

@ -1,6 +1,11 @@
strict digraph connection {
Establish [label="TCP/SCTP connection established"];
Closed [label="TCP/SCTP connection closed"];
Open;
SASL;
Authenticated;
STARTTLS;
Encrypted;
Establish -> Open [label=open];