basic file layout
This commit is contained in:
parent
6f8e28826e
commit
e399e302c4
|
@ -0,0 +1,12 @@
|
|||
[package]
|
||||
name = "Rircd"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
|
||||
|
||||
[dependencies]
|
||||
eyre = "*"
|
||||
tokio = { version = "*", features = ["full"] }
|
||||
async-trait = "*"
|
||||
futures = "0.3.17"
|
|
@ -0,0 +1,8 @@
|
|||
use async_trait::async_trait;
|
||||
|
||||
|
||||
#[async_trait]
|
||||
pub trait Endpoint {
|
||||
fn name(&self) -> String;
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
use tokio::sync::oneshot;
|
||||
use eyre::Result;
|
||||
|
||||
enum InternalEvent {
|
||||
}
|
||||
|
||||
enum EventKind {
|
||||
Message,
|
||||
Internal(InternalEvent),
|
||||
}
|
||||
|
||||
|
||||
struct Event {
|
||||
kind: EventKind,
|
||||
result_channel: oneshot::Receiver<Result<()>>,
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
use eyre::Result;
|
||||
|
||||
mod endpoint;
|
||||
mod state;
|
||||
mod event;
|
||||
|
||||
use state::RircdState;
|
||||
|
||||
//TODO maybe spawn the reactor later on with
|
||||
//user provided parameters (cores/[st/mt])
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
let s = RircdState::new()?;
|
||||
|
||||
Ok(())
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
use eyre::Result;
|
||||
use std::time::Instant;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::endpoint::Endpoint;
|
||||
|
||||
pub struct RircdState {
|
||||
endpoints: Vec<Arc<dyn Endpoint>>,
|
||||
//to determine program runtime
|
||||
creation_timestamp: Option<Instant>,
|
||||
|
||||
plainlog: Option<()>,
|
||||
sqlite_log: Option<()>,
|
||||
postgres_log: Option<()>,
|
||||
}
|
||||
|
||||
impl RircdState {
|
||||
pub fn new() -> Result<Self> {
|
||||
//TODO impl
|
||||
Ok(RircdState {
|
||||
endpoints: vec![],
|
||||
creation_timestamp: Some(Instant::now()),
|
||||
plainlog: None,
|
||||
sqlite_log: None,
|
||||
postgres_log: None,
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue