pub type PgStore = RdsStore<PgClient, PgExecutorFactory, PgSqlTemplateSet>;Expand description
A PostgreSQL-backed key-value store for metasrv. It uses [deadpool_postgres::Pool] as the connection pool for RdsStore.
Aliased Type§
pub struct PgStore {
max_txn_ops: usize,
txn_retry_count: usize,
executor_factory: PgExecutorFactory,
sql_template_set: PgSqlTemplateSet,
_phantom: PhantomData<PgClient>,
}Fields§
§max_txn_ops: usize§txn_retry_count: usize§executor_factory: PgExecutorFactory§sql_template_set: PgSqlTemplateSet§_phantom: PhantomData<PgClient>Implementations§
Source§impl PgStore
impl PgStore
Sourcepub async fn with_url_and_tls(
url: &str,
table_name: &str,
max_txn_ops: usize,
tls_config: Option<TlsOption>,
) -> Result<ClosableKvBackendRef>
pub async fn with_url_and_tls( url: &str, table_name: &str, max_txn_ops: usize, tls_config: Option<TlsOption>, ) -> Result<ClosableKvBackendRef>
Create PgStore impl of ClosableKvBackendRef from url with optional TLS support.
§Arguments
url- PostgreSQL connection URLtable_name- Name of the table to use for key-value storagemax_txn_ops- Maximum number of operations per transactiontls_config- Optional TLS configuration. If None, uses plaintext connection.
Sourcepub async fn with_url(
url: &str,
table_name: &str,
max_txn_ops: usize,
) -> Result<ClosableKvBackendRef>
pub async fn with_url( url: &str, table_name: &str, max_txn_ops: usize, ) -> Result<ClosableKvBackendRef>
Create PgStore impl of ClosableKvBackendRef from url without TLS.
Sourcepub async fn with_pg_pool(
pool: Pool,
schema_name: Option<&str>,
table_name: &str,
max_txn_ops: usize,
auto_create_schema: bool,
) -> Result<ClosableKvBackendRef>
pub async fn with_pg_pool( pool: Pool, schema_name: Option<&str>, table_name: &str, max_txn_ops: usize, auto_create_schema: bool, ) -> Result<ClosableKvBackendRef>
Create PgStore impl of ClosableKvBackendRef from [deadpool_postgres::Pool] with optional schema.
Source§impl PgStore
impl PgStore
async fn get_chunks( &self, query_executor: &mut ExecutorImpl<'_, PgClient>, keys: &[Vec<u8>], chunk_size: usize, ) -> Result<BatchGetResponse>
async fn put_chunks( &self, executor: &mut ExecutorImpl<'_, PgClient>, chunks: Vec<&[KeyValue]>, prev_kv: bool, ) -> Result<BatchPutResponse>
async fn delete_chunks( &self, executor: &mut ExecutorImpl<'_, PgClient>, req: &BatchDeleteRequest, chunk_size: usize, ) -> Result<BatchDeleteResponse>
Trait Implementations§
Source§impl KvQueryExecutor<PgClient> for PgStore
impl KvQueryExecutor<PgClient> for PgStore
Source§fn batch_get_with_query_executor<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query_executor: &'life1 mut ExecutorImpl<'life2, PgClient>,
req: BatchGetRequest,
) -> Pin<Box<dyn Future<Output = Result<BatchGetResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn batch_get_with_query_executor<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query_executor: &'life1 mut ExecutorImpl<'life2, PgClient>,
req: BatchGetRequest,
) -> Pin<Box<dyn Future<Output = Result<BatchGetResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Batch get with certain client. It’s needed for a client with transaction.
fn range_with_query_executor<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query_executor: &'life1 mut ExecutorImpl<'life2, PgClient>,
req: RangeRequest,
) -> Pin<Box<dyn Future<Output = Result<RangeResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn batch_put_with_query_executor<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query_executor: &'life1 mut ExecutorImpl<'life2, PgClient>,
req: BatchPutRequest,
) -> Pin<Box<dyn Future<Output = Result<BatchPutResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn batch_put_with_query_executor<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query_executor: &'life1 mut ExecutorImpl<'life2, PgClient>,
req: BatchPutRequest,
) -> Pin<Box<dyn Future<Output = Result<BatchPutResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Applies all writes atomically. Implementations that split a request across
statements must run them in one transaction, reusing the caller’s transaction if present.