pub struct TensorBaseEventsBackend(/* private fields */);Expand description
Scale-out TensorBase structured-event storage over its ClickHouse-compatible protocol.
Use connect with a full protocol URL or
connect_host for the default native port (9528). Pair this type
with TensorBaseMetricsBackend when building the runtime.
§Examples
Facade wiring through Spectra::builder() (requires the spectra crate with the
tensorbase feature):
ⓘ
use std::sync::Arc;
use spectra::{Spectra, TensorBaseEventsBackend, TensorBaseMetricsBackend};
let url = "tcp://127.0.0.1:9528";
let spectra = Spectra::builder()
.metrics_backend(Arc::new(TensorBaseMetricsBackend::connect(url).await?))
.events_backend(Arc::new(TensorBaseEventsBackend::connect(url).await?))
.build()?;Implementations§
Source§impl TensorBaseEventsBackend
impl TensorBaseEventsBackend
Sourcepub async fn connect(url: &str) -> Result<TensorBaseEventsBackend, Error>
pub async fn connect(url: &str) -> Result<TensorBaseEventsBackend, Error>
Connect with a full TensorBase protocol URL and ensure event tables exist.
Accepts tcp://host:9528 (native) or an HTTP ClickHouse-compatible endpoint. The call
is async and executes DDL.
§Examples
ⓘ
use spectra_backend_tensorbase::TensorBaseEventsBackend;
let backend = TensorBaseEventsBackend::connect("tcp://127.0.0.1:9528").await?;Sourcepub async fn connect_host(host: &str) -> Result<TensorBaseEventsBackend, Error>
pub async fn connect_host(host: &str) -> Result<TensorBaseEventsBackend, Error>
Sourcepub fn in_memory_stub() -> TensorBaseEventsBackend
pub fn in_memory_stub() -> TensorBaseEventsBackend
In-memory stub that preserves the TensorBase engine type for storage-contract tests.
§Examples
use spectra_backend_tensorbase::TensorBaseEventsBackend;
use spectra_core::{EventStorageBackend, StorageEngineType};
let backend = TensorBaseEventsBackend::in_memory_stub();
assert_eq!(backend.engine_type(), StorageEngineType::TensorBase);Trait Implementations§
Source§impl EventStorageBackend for TensorBaseEventsBackend
impl EventStorageBackend for TensorBaseEventsBackend
Source§fn engine_type(&self) -> StorageEngineType
fn engine_type(&self) -> StorageEngineType
Returns the engine type for this backend.
Source§fn append_row<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
table: &'life1 str,
fields: &'life2 Value,
ts: DateTime<Utc>,
correlation_id: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
TensorBaseEventsBackend: 'async_trait,
fn append_row<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
table: &'life1 str,
fields: &'life2 Value,
ts: DateTime<Utc>,
correlation_id: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
TensorBaseEventsBackend: 'async_trait,
Appends one event row.
Source§fn append_rows_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
rows: &'life1 [EventWriteRow],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
TensorBaseEventsBackend: 'async_trait,
fn append_rows_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
rows: &'life1 [EventWriteRow],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
TensorBaseEventsBackend: 'async_trait,
Batch append event rows (default: per-row dispatch).
Source§fn query_rows<'life0, 'async_trait>(
&'life0 self,
filter: EventsQueryFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<EventRow>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
TensorBaseEventsBackend: 'async_trait,
fn query_rows<'life0, 'async_trait>(
&'life0 self,
filter: EventsQueryFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<EventRow>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
TensorBaseEventsBackend: 'async_trait,
Queries event rows matching the filter.
Source§fn query_aggregate<'life0, 'async_trait>(
&'life0 self,
filter: EventsAggregateFilter,
) -> Pin<Box<dyn Future<Output = Result<EventAggregateResult, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
TensorBaseEventsBackend: 'async_trait,
fn query_aggregate<'life0, 'async_trait>(
&'life0 self,
filter: EventsAggregateFilter,
) -> Pin<Box<dyn Future<Output = Result<EventAggregateResult, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
TensorBaseEventsBackend: 'async_trait,
Queries aggregated chart data.
Auto Trait Implementations§
impl !RefUnwindSafe for TensorBaseEventsBackend
impl !UnwindSafe for TensorBaseEventsBackend
impl Freeze for TensorBaseEventsBackend
impl Send for TensorBaseEventsBackend
impl Sync for TensorBaseEventsBackend
impl Unpin for TensorBaseEventsBackend
impl UnsafeUnpin for TensorBaseEventsBackend
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