chore(key-pool): expose inner storage and client

This commit is contained in:
pyrite 2025-05-27 19:23:21 +02:00
parent dbb35c4e82
commit a0dd9574ea
Signed by: pyrite
GPG key ID: 7F1BA9170CD35D15
3 changed files with 14 additions and 4 deletions

2
Cargo.lock generated
View file

@ -2329,7 +2329,7 @@ dependencies = [
[[package]] [[package]]
name = "torn-key-pool" name = "torn-key-pool"
version = "1.1.2" version = "1.1.3"
dependencies = [ dependencies = [
"chrono", "chrono",
"futures", "futures",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "torn-key-pool" name = "torn-key-pool"
version = "1.1.2" version = "1.1.3"
edition = "2021" edition = "2021"
authors = ["Pyrit [2111649]"] authors = ["Pyrit [2111649]"]
license-file = { workspace = true } license-file = { workspace = true }

View file

@ -3,7 +3,7 @@
#[cfg(feature = "postgres")] #[cfg(feature = "postgres")]
pub mod postgres; pub mod postgres;
use std::{collections::HashMap, future::Future, sync::Arc, time::Duration}; use std::{collections::HashMap, future::Future, ops::Deref, sync::Arc, time::Duration};
use futures::{future::BoxFuture, FutureExt, Stream, StreamExt}; use futures::{future::BoxFuture, FutureExt, Stream, StreamExt};
use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION}; use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION};
@ -354,7 +354,7 @@ where
} }
} }
struct KeyPoolInner<S> pub struct KeyPoolInner<S>
where where
S: KeyPoolStorage, S: KeyPoolStorage,
{ {
@ -473,6 +473,16 @@ where
inner: Arc<KeyPoolInner<S>>, inner: Arc<KeyPoolInner<S>>,
} }
impl<S> Deref for KeyPool<S>
where
S: KeyPoolStorage,
{
type Target = KeyPoolInner<S>;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
enum RequestResult { enum RequestResult {
Response(ApiResponse), Response(ApiResponse),
Retry, Retry,