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
Public crate wiring through Spectra::builder() (requires the spectra crate with the
tensorbase feature):
use std::sync::Arc;
use spectra::{Spectra, TensorBaseEventsBackend, TensorBaseMetricsBackend};
let url = "tcp+tls://tensorbase.example:9440";
// Local plaintext: SPECTRA_ALLOW_INSECURE_REMOTE=1 + 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+tls:// / https:// (or plaintext tcp:// / http:// with
SPECTRA_ALLOW_INSECURE_REMOTE=1). The call is async and executes DDL.
§Examples
use spectra_backend_tensorbase::TensorBaseEventsBackend;
let backend = TensorBaseEventsBackend::connect("tcp+tls://127.0.0.1:9440").await?;Sourcepub async fn connect_host(host: &str) -> Result<TensorBaseEventsBackend, Error>
pub async fn connect_host(host: &str) -> Result<TensorBaseEventsBackend, Error>
Connect using a host name and the default native port (9528).
Equivalent to connect with tcp://{host}:9528
(requires SPECTRA_ALLOW_INSECURE_REMOTE=1 for that plaintext scheme).
§Examples
use spectra_backend_tensorbase::TensorBaseEventsBackend;
let backend = TensorBaseEventsBackend::connect_host("127.0.0.1").await?;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);