-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
1,301 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use std::borrow::Cow; | ||
|
||
pub(crate) enum Credential<'a> { | ||
Password(Password<'a>), | ||
} | ||
|
||
pub(crate) trait Provider { | ||
fn credential(&self) -> Credential; | ||
} | ||
|
||
pub(crate) struct Password<'a> { | ||
pub(crate) username: Cow<'a, str>, | ||
pub(crate) password: Cow<'a, str>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// TODO: remove | ||
#![expect(dead_code)] | ||
pub(crate) mod credential; | ||
pub(crate) mod principal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
mod user; | ||
pub(crate) use user::User; | ||
|
||
#[derive(Debug, Clone)] | ||
pub(crate) enum Principal { | ||
AnonymousUser, | ||
// TODO: remove | ||
#[expect(dead_code)] | ||
User(User), | ||
} | ||
|
||
impl Principal { | ||
pub(crate) fn is_authenticated(&self) -> bool { | ||
matches!(self, Principal::User(_)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#[derive(Debug, Clone)] | ||
pub(crate) struct User { | ||
#[expect(dead_code)] | ||
pub(crate) name: String, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,8 @@ pub mod cli; | |
pub mod config; | ||
pub mod error; | ||
pub mod types; | ||
|
||
mod authn; | ||
mod middleware; | ||
mod table; | ||
mod uow; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use std::collections::HashMap; | ||
|
||
use tokio::sync::mpsc; | ||
|
||
use crate::{ | ||
table::{Namespace, TableRef}, | ||
uow::UnitOfWork, | ||
}; | ||
|
||
pub(crate) struct Dispatcher { | ||
// TODO: use TableName | ||
table: HashMap<Namespace, HashMap<String, mpsc::Sender<UnitOfWork>>>, | ||
} | ||
|
||
impl Dispatcher { | ||
pub(crate) fn new() -> Self { | ||
Self { | ||
table: HashMap::new(), | ||
} | ||
} | ||
|
||
pub(crate) fn add_table(&mut self, table_ref: TableRef<'_>, sender: mpsc::Sender<UnitOfWork>) { | ||
self.table | ||
.entry(table_ref.namespace) | ||
.or_default() | ||
.insert(table_ref.name.into(), sender); | ||
} | ||
|
||
/* | ||
fn lookup_table(&self, namespace: &str, table: &str) -> Result<&mpsc::Sender<UnitOfWork>> { | ||
self.table | ||
.get(namespace) | ||
.and_then(|tables| tables.get(table)) | ||
.ok_or_else(|| ErrorKind::TableNotFound(format!("{}/{}", namespace, table)).into()) | ||
} | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mod dispatcher; | ||
pub(crate) use dispatcher::Dispatcher; |
Oops, something went wrong.