pub struct HostStorage { /* private fields */ }Expand description
内存数据库若未启用 shared cache,第二个连接会得到独立空库;文件 WAL 库与显式
cache=shared 的内存库才启用只读池。
Implementations§
Source§impl HostStorage
impl HostStorage
pub async fn open_sqlite_url(db_url: &str) -> Result<Self, PortError>
pub fn with_metric_sink(self, metrics: Arc<dyn AsyncMetricSink>) -> Self
pub async fn execute_raw(&self, sql: &'static str) -> Result<(), PortError>
Trait Implementations§
Source§impl Clone for HostStorage
impl Clone for HostStorage
Source§fn clone(&self) -> HostStorage
fn clone(&self) -> HostStorage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Storage for HostStorage
impl Storage for HostStorage
Source§fn scoped_guarded_bump<'life0, 'async_trait>(
&'life0 self,
spec: ScopedGuardedBumpSpec,
) -> Pin<Box<dyn Future<Output = Result<(), PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn scoped_guarded_bump<'life0, 'async_trait>(
&'life0 self,
spec: ScopedGuardedBumpSpec,
) -> Pin<Box<dyn Future<Output = Result<(), PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
在复合主键作用域内兑现单条守卫式计数更新。
Source§fn scoped_get<'life0, 'async_trait>(
&'life0 self,
spec: ScopedGetSpec,
) -> Pin<Box<dyn Future<Output = Result<Option<HelixRow>, PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn scoped_get<'life0, 'async_trait>(
&'life0 self,
spec: ScopedGetSpec,
) -> Pin<Box<dyn Future<Output = Result<Option<HelixRow>, PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
在复合主键作用域内读取唯一行。
Source§fn batch_upsert<'life0, 'async_trait>(
&'life0 self,
spec: UpsertSpec,
) -> Pin<Box<dyn Future<Output = Result<(), PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn batch_upsert<'life0, 'async_trait>(
&'life0 self,
spec: UpsertSpec,
) -> Pin<Box<dyn Future<Output = Result<(), PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
batch upsert:整批一事务 INSERT,按
conflict_key 解决唯一冲突(B6 语义真源)。 Read moreSource§fn batch_update<'life0, 'async_trait>(
&'life0 self,
spec: BatchUpdateSpec,
) -> Pin<Box<dyn Future<Output = Result<(), PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn batch_update<'life0, 'async_trait>(
&'life0 self,
spec: BatchUpdateSpec,
) -> Pin<Box<dyn Future<Output = Result<(), PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
batch update:UPDATE table SET patch WHERE key_col IN (key_vals) Read more
Source§fn monotonic_upsert<'life0, 'async_trait>(
&'life0 self,
spec: MonotonicUpsertSpec,
) -> Pin<Box<dyn Future<Output = Result<(), PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn monotonic_upsert<'life0, 'async_trait>(
&'life0 self,
spec: MonotonicUpsertSpec,
) -> Pin<Box<dyn Future<Output = Result<(), PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
通用单调 MAX-guard 写:仅在 new value > 当前值时才写入(CAS / 单调寄存器语义)。 Read more
Source§fn guarded_bump<'life0, 'async_trait>(
&'life0 self,
spec: GuardedBumpSpec,
) -> Pin<Box<dyn Future<Output = Result<(), PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn guarded_bump<'life0, 'async_trait>(
&'life0 self,
spec: GuardedBumpSpec,
) -> Pin<Box<dyn Future<Output = Result<(), PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
守卫式自增:
UPDATE … SET bump_col = bump_col + delta[, set…] WHERE key=? AND ? > guard_col。 Read moreSource§fn get<'life0, 'async_trait>(
&'life0 self,
spec: GetSpec,
) -> Pin<Box<dyn Future<Output = Result<Option<HelixRow>, PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'async_trait>(
&'life0 self,
spec: GetSpec,
) -> Pin<Box<dyn Future<Output = Result<Option<HelixRow>, PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
get:单行查询
Source§fn scan<'life0, 'async_trait>(
&'life0 self,
spec: ScanSpec,
) -> Pin<Box<dyn Future<Output = Result<Vec<HelixRow>, PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn scan<'life0, 'async_trait>(
&'life0 self,
spec: ScanSpec,
) -> Pin<Box<dyn Future<Output = Result<Vec<HelixRow>, PortError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
scan:多行扫描读(评审待办 C3)。
limit = None 表示全表,driver 应设硬上限防御。 Read moreAuto Trait Implementations§
impl !RefUnwindSafe for HostStorage
impl !UnwindSafe for HostStorage
impl Freeze for HostStorage
impl Send for HostStorage
impl Sync for HostStorage
impl Unpin for HostStorage
impl UnsafeUnpin for HostStorage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request