-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from viz-rs/afit_rpitit
refactor: AFIT & RPITIT
- Loading branch information
Showing
12 changed files
with
115 additions
and
120 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -8,34 +8,35 @@ members = [ | |
resolver = "2" | ||
|
||
[workspace.package] | ||
version = "0.5.1" | ||
version = "0.6.0" | ||
authors = ["Fangdun Tsai <[email protected]>"] | ||
edition = "2021" | ||
license = "MIT OR Apache-2.0" | ||
documentation = "https://docs.rs/sessions" | ||
homepage = "https://github.com/viz-rs/sessions" | ||
repository = "https://github.com/viz-rs/sessions" | ||
rust-version = "1.75" | ||
|
||
[workspace.dependencies] | ||
sessions = { version = "0.5.0", path = "sessions" } | ||
sessions-core = { version = "0.5.0", path = "sessions-core" } | ||
sessions-memory = { version = "0.5.0", path = "sessions-memory" } | ||
sessions-redis = { version = "0.5.0", path = "sessions-redis" } | ||
sessions = { version = "0.6.0", path = "sessions" } | ||
sessions-core = { version = "0.6.0", path = "sessions-core" } | ||
sessions-memory = { version = "0.6.0", path = "sessions-memory" } | ||
sessions-redis = { version = "0.6.0", path = "sessions-redis" } | ||
|
||
anyhow = "1.0" | ||
async-trait = "0.1" | ||
nano-id = "0.3" | ||
serde = "1.0" | ||
serde_json = "1.0" | ||
thiserror = "1.0" | ||
|
||
futures-executor = "0.3" | ||
tokio = { version = "1", features = ["macros"] } | ||
redis = { version = "0.23", default-features = false, features = [ | ||
redis = { version = "0.24", default-features = false, features = [ | ||
"aio", | ||
"connection-manager", | ||
] } | ||
|
||
anyhow = "1.0" | ||
nano-id = "0.3" | ||
|
||
futures-executor = "0.3" | ||
tokio = { version = "1", features = ["macros"] } | ||
|
||
[workspace.metadata.docs.rs] | ||
all-features = true | ||
rustdoc-args = ["--cfg", "docsrs"] | ||
|
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 was deleted.
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
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 |
---|---|---|
@@ -1,26 +1,25 @@ | ||
use std::time::Duration; | ||
use std::{future::Future, io::Result, time::Duration}; | ||
|
||
use crate::{async_trait, Data, Error}; | ||
use crate::Data; | ||
|
||
/// A Storage Trait | ||
#[async_trait] | ||
pub trait Storage: Send + Sync { | ||
/// Get a data from storage by the key | ||
async fn get(&self, key: &str) -> Result<Option<Data>, Error>; | ||
/// Gets a [`Data`] from storage by the key | ||
fn get(&self, key: &str) -> impl Future<Output = Result<Option<Data>>> + Send; | ||
|
||
/// Set a session to storage | ||
async fn set(&self, key: &str, val: Data, exp: &Duration) -> Result<(), Error>; | ||
/// Sets a session [`Data`] into storage | ||
fn set(&self, key: &str, val: Data, exp: &Duration) -> impl Future<Output = Result<()>> + Send; | ||
|
||
/// Remove a data from storage by the key | ||
async fn remove(&self, key: &str) -> Result<(), Error>; | ||
/// Removes a data from storage by the key | ||
fn remove(&self, key: &str) -> impl Future<Output = Result<()>> + Send; | ||
|
||
/// Reset the storage and remove all keys | ||
async fn reset(&self) -> Result<(), Error> { | ||
Ok(()) | ||
/// Resets the storage and remove all keys | ||
fn reset(&self) -> impl Future<Output = Result<()>> + Send { | ||
async { Ok(()) } | ||
} | ||
|
||
/// Close the connection | ||
async fn close(&self) -> Result<(), Error> { | ||
Ok(()) | ||
/// Closes the connection | ||
fn close(&self) -> impl Future<Output = Result<()>> + Send { | ||
async { Ok(()) } | ||
} | ||
} |
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
Oops, something went wrong.