pub struct TursoStorage { /* private fields */ }Expand description
Turso storage backend for durable persistence
Implementations§
Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn add_relationship(
&self,
from_episode_id: Uuid,
to_episode_id: Uuid,
relationship_type: RelationshipType,
metadata: RelationshipMetadata,
) -> Result<Uuid>
pub async fn add_relationship( &self, from_episode_id: Uuid, to_episode_id: Uuid, relationship_type: RelationshipType, metadata: RelationshipMetadata, ) -> Result<Uuid>
Add a relationship between two episodes
Sourcepub async fn store_relationship(
&self,
relationship: &EpisodeRelationship,
) -> Result<()>
pub async fn store_relationship( &self, relationship: &EpisodeRelationship, ) -> Result<()>
Store a relationship between two episodes
This is the StorageBackend trait implementation that takes a pre-built EpisodeRelationship.
Sourcepub async fn remove_relationship(&self, relationship_id: Uuid) -> Result<()>
pub async fn remove_relationship(&self, relationship_id: Uuid) -> Result<()>
Remove a relationship by ID
Sourcepub async fn get_relationships(
&self,
episode_id: Uuid,
direction: Direction,
) -> Result<Vec<EpisodeRelationship>>
pub async fn get_relationships( &self, episode_id: Uuid, direction: Direction, ) -> Result<Vec<EpisodeRelationship>>
Get relationships for an episode
Sourcepub async fn get_relationships_by_type(
&self,
episode_id: Uuid,
relationship_type: RelationshipType,
direction: Direction,
) -> Result<Vec<EpisodeRelationship>>
pub async fn get_relationships_by_type( &self, episode_id: Uuid, relationship_type: RelationshipType, direction: Direction, ) -> Result<Vec<EpisodeRelationship>>
Get relationships by type
Sourcepub async fn relationship_exists(
&self,
from_episode_id: Uuid,
to_episode_id: Uuid,
relationship_type: RelationshipType,
) -> Result<bool>
pub async fn relationship_exists( &self, from_episode_id: Uuid, to_episode_id: Uuid, relationship_type: RelationshipType, ) -> Result<bool>
Check if a relationship exists
Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn store_episodes_with_patterns_batch(
&self,
episodes: Vec<Episode>,
patterns: Vec<Pattern>,
) -> Result<()>
pub async fn store_episodes_with_patterns_batch( &self, episodes: Vec<Episode>, patterns: Vec<Pattern>, ) -> Result<()>
Store episodes with their associated patterns in a single transaction
This is more efficient than storing episodes and patterns separately when they are related, as it ensures atomicity and reduces round-trips.
§Arguments
episodes- Episodes to storepatterns- Patterns to store (may be associated with episodes)
§Example
let storage = TursoStorage::new("file:test.db", "").await?;
let episodes = vec![/* ... */];
let patterns = vec![/* ... */];
storage.store_episodes_with_patterns_batch(episodes, patterns).await?;Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn store_episodes_batch(&self, episodes: Vec<Episode>) -> Result<()>
pub async fn store_episodes_batch(&self, episodes: Vec<Episode>) -> Result<()>
Store multiple episodes in a single transaction
Uses prepared statements and transactions for 4-6x throughput improvement.
§Arguments
episodes- Vector of episodes to store
§Returns
Result indicating success or failure
§Example
let storage = TursoStorage::new("file:test.db", "").await?;
let episodes = vec![
Episode::new("Task 1".to_string(), TaskContext::default(), TaskType::CodeGeneration),
Episode::new("Task 2".to_string(), TaskContext::default(), TaskType::Debugging),
];
storage.store_episodes_batch(episodes).await?;Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn get_episodes_batch(
&self,
ids: &[Uuid],
) -> Result<Vec<Option<Episode>>>
pub async fn get_episodes_batch( &self, ids: &[Uuid], ) -> Result<Vec<Option<Episode>>>
Retrieve multiple episodes by IDs efficiently
Uses a single query with IN clause for efficient batch retrieval.
§Arguments
ids- Slice of episode UUIDs to retrieve
§Returns
Vector of optional episodes (None if episode not found)
§Example
let storage = TursoStorage::new("file:test.db", "").await?;
let ids = vec![Uuid::new_v4(), Uuid::new_v4()];
let episodes = storage.get_episodes_batch(&ids).await?;
for episode in episodes {
if let Some(ep) = episode {
println!("Found episode: {}", ep.episode_id);
}
}Sourcepub async fn get_patterns_batch(
&self,
ids: &[PatternId],
) -> Result<Vec<Option<Pattern>>>
pub async fn get_patterns_batch( &self, ids: &[PatternId], ) -> Result<Vec<Option<Pattern>>>
Retrieve multiple patterns by IDs efficiently
Uses a single query with IN clause for efficient batch retrieval.
§Arguments
ids- Slice of pattern IDs to retrieve
§Returns
Vector of optional patterns (None if pattern not found)
§Example
let storage = TursoStorage::new("file:test.db", "").await?;
let ids = vec![PatternId::new_v4(), PatternId::new_v4()];
let patterns = storage.get_patterns_batch(&ids).await?;
for pattern in patterns {
if let Some(p) = pattern {
println!("Found pattern: {:?}", p.id());
}
}Sourcepub async fn get_heuristics_batch(
&self,
ids: &[Uuid],
) -> Result<Vec<Option<Heuristic>>>
pub async fn get_heuristics_batch( &self, ids: &[Uuid], ) -> Result<Vec<Option<Heuristic>>>
Retrieve multiple heuristics by IDs efficiently
Uses a single query with IN clause for efficient batch retrieval.
§Arguments
ids- Slice of heuristic UUIDs to retrieve
§Returns
Vector of optional heuristics (None if heuristic not found)
§Example
let storage = TursoStorage::new("file:test.db", "").await?;
let ids = vec![Uuid::new_v4(), Uuid::new_v4()];
let heuristics = storage.get_heuristics_batch(&ids).await?;
for heuristic in heuristics {
if let Some(h) = heuristic {
println!("Found heuristic: {}", h.heuristic_id);
}
}Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn store_patterns_batch(&self, patterns: Vec<Pattern>) -> Result<()>
pub async fn store_patterns_batch(&self, patterns: Vec<Pattern>) -> Result<()>
Store multiple patterns in a single transaction
Uses prepared statements and transactions for 4-6x throughput improvement. All patterns are stored atomically - if any fails, all are rolled back.
Sourcepub async fn update_patterns_batch(&self, patterns: Vec<Pattern>) -> Result<()>
pub async fn update_patterns_batch(&self, patterns: Vec<Pattern>) -> Result<()>
Update multiple patterns in a single transaction
Sourcepub async fn store_patterns_batch_with_progress(
&self,
patterns: Vec<Pattern>,
batch_size: usize,
) -> Result<BatchResult>
pub async fn store_patterns_batch_with_progress( &self, patterns: Vec<Pattern>, batch_size: usize, ) -> Result<BatchResult>
Store patterns in batches with progress tracking
Sourcepub async fn get_patterns_batch_by_ids(
&self,
pattern_ids: Vec<PatternId>,
) -> Result<Vec<Pattern>>
pub async fn get_patterns_batch_by_ids( &self, pattern_ids: Vec<PatternId>, ) -> Result<Vec<Pattern>>
Retrieve multiple patterns by IDs in a single query
Uses a single IN query for efficient bulk retrieval (4-6x improvement over individual queries).
§Arguments
pattern_ids- Vector of pattern IDs to retrieve
§Returns
Vector of patterns (only patterns that exist are returned)
§Example
let storage = TursoStorage::new("file:test.db", "").await?;
let ids = vec![
PatternId::new_v4(),
PatternId::new_v4(),
];
let patterns = storage.get_patterns_batch(&ids).await?;Sourcepub async fn delete_patterns_batch(
&self,
pattern_ids: Vec<PatternId>,
) -> Result<usize>
pub async fn delete_patterns_batch( &self, pattern_ids: Vec<PatternId>, ) -> Result<usize>
Delete multiple patterns in a single transaction
All deletions are atomic - if any fails, all are rolled back.
§Arguments
pattern_ids- Vector of pattern IDs to delete
§Returns
Number of patterns actually deleted
§Example
let storage = TursoStorage::new("file:test.db", "").await?;
let ids = vec![
PatternId::new_v4(),
PatternId::new_v4(),
];
let deleted = storage.delete_patterns_batch(ids).await?;
println!("Deleted {} patterns", deleted);Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn store_heuristics_batch(
&self,
heuristics: Vec<Heuristic>,
) -> Result<()>
pub async fn store_heuristics_batch( &self, heuristics: Vec<Heuristic>, ) -> Result<()>
Store multiple heuristics in a single transaction
Uses prepared statements and transactions for 4-6x throughput improvement. All heuristics are stored atomically - if any fails, all are rolled back.
Sourcepub async fn update_heuristics_batch(
&self,
heuristics: Vec<Heuristic>,
) -> Result<()>
pub async fn update_heuristics_batch( &self, heuristics: Vec<Heuristic>, ) -> Result<()>
Update multiple heuristics in a single transaction
Sourcepub async fn store_heuristics_batch_with_progress(
&self,
heuristics: Vec<Heuristic>,
batch_size: usize,
) -> Result<HeuristicBatchResult>
pub async fn store_heuristics_batch_with_progress( &self, heuristics: Vec<Heuristic>, batch_size: usize, ) -> Result<HeuristicBatchResult>
Store heuristics in batches with progress tracking
Sourcepub async fn update_heuristics_batch_with_progress(
&self,
heuristics: Vec<Heuristic>,
batch_size: usize,
) -> Result<HeuristicBatchResult>
pub async fn update_heuristics_batch_with_progress( &self, heuristics: Vec<Heuristic>, batch_size: usize, ) -> Result<HeuristicBatchResult>
Update heuristics in batches with progress tracking
Sourcepub async fn delete_heuristics_batch(&self, ids: Vec<Uuid>) -> Result<()>
pub async fn delete_heuristics_batch(&self, ids: Vec<Uuid>) -> Result<()>
Delete multiple heuristics in a single transaction
Uses transactions for atomic deletion - if any fails, all are rolled back.
§Arguments
ids- Vector of heuristic IDs to delete
§Returns
Result indicating success or failure
§Example
let storage = TursoStorage::new("file:test.db", "").await?;
let ids = vec![Uuid::new_v4(), Uuid::new_v4()];
storage.delete_heuristics_batch(ids).await?;Sourcepub async fn delete_heuristics_batch_with_progress(
&self,
ids: Vec<Uuid>,
batch_size: usize,
) -> Result<HeuristicBatchResult>
pub async fn delete_heuristics_batch_with_progress( &self, ids: Vec<Uuid>, batch_size: usize, ) -> Result<HeuristicBatchResult>
Delete heuristics in batches with progress tracking
Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn store_episode_with_capacity(
&self,
episode: &Episode,
max_episodes: usize,
) -> Result<()>
pub async fn store_episode_with_capacity( &self, episode: &Episode, max_episodes: usize, ) -> Result<()>
Store an episode with capacity management
When the episode limit is reached, the least relevant episodes are evicted based on the configured eviction policy.
Sourcepub async fn get_capacity_statistics(&self) -> Result<CapacityStatistics>
pub async fn get_capacity_statistics(&self) -> Result<CapacityStatistics>
Get storage statistics including capacity info
Source§impl TursoStorage
impl TursoStorage
pub fn get_embedding_table_for_dimension( &self, dimension: usize, ) -> &'static str
pub fn get_vector_index_for_dimension( &self, dimension: usize, ) -> Option<&'static str>
Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn store_episode(&self, episode: &Episode) -> Result<()>
pub async fn store_episode(&self, episode: &Episode) -> Result<()>
Store an episode
Uses INSERT OR REPLACE for upsert semantics. When compression is enabled, large payloads are compressed to reduce bandwidth.
Sourcepub async fn get_episode(&self, episode_id: Uuid) -> Result<Option<Episode>>
pub async fn get_episode(&self, episode_id: Uuid) -> Result<Option<Episode>>
Retrieve an episode by ID
When adaptive-ttl feature is enabled and caching is configured, this method will first check the cache before querying the database. Cache hits record access for TTL adaptation.
Sourcepub async fn delete_episode(&self, episode_id: Uuid) -> Result<()>
pub async fn delete_episode(&self, episode_id: Uuid) -> Result<()>
Delete an episode by ID
Sourcepub async fn store_episode_summary(
&self,
summary: &EpisodeSummary,
) -> Result<()>
pub async fn store_episode_summary( &self, summary: &EpisodeSummary, ) -> Result<()>
Store an episode summary
Sourcepub async fn get_episode_summary(
&self,
episode_id: Uuid,
) -> Result<Option<EpisodeSummary>>
pub async fn get_episode_summary( &self, episode_id: Uuid, ) -> Result<Option<EpisodeSummary>>
Retrieve an episode summary by episode ID
Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn query_episodes(&self, query: &EpisodeQuery) -> Result<Vec<Episode>>
pub async fn query_episodes(&self, query: &EpisodeQuery) -> Result<Vec<Episode>>
Query episodes with filters
Sourcepub async fn query_episodes_since(
&self,
since: DateTime<Utc>,
limit: Option<usize>,
) -> Result<Vec<Episode>>
pub async fn query_episodes_since( &self, since: DateTime<Utc>, limit: Option<usize>, ) -> Result<Vec<Episode>>
Query episodes modified since a given timestamp
§Arguments
since- Timestamp to query fromlimit- Maximum number of episodes to return (default: 100, max: 1000)
Sourcepub async fn query_episodes_by_metadata(
&self,
key: &str,
value: &str,
limit: Option<usize>,
) -> Result<Vec<Episode>>
pub async fn query_episodes_by_metadata( &self, key: &str, value: &str, limit: Option<usize>, ) -> Result<Vec<Episode>>
Query episodes by metadata key-value pair
Uses json_extract for efficient querying of JSON metadata fields. Falls back to LIKE pattern matching if json_extract is not available.
§Arguments
key- Metadata key to search forvalue- Metadata value to matchlimit- Maximum number of episodes to return (default: 100, max: 1000)
Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn query_episodes_raw(&self, sql: &str) -> Result<Vec<Episode>>
pub async fn query_episodes_raw(&self, sql: &str) -> Result<Vec<Episode>>
Execute a raw SQL query for episodes
Convenience method for cache integration.
See RawEpisodeQuery for details.
Sourcepub async fn query_episodes_raw_with_params<P: IntoParams>(
&self,
sql: &str,
params: P,
) -> Result<Vec<Episode>>
pub async fn query_episodes_raw_with_params<P: IntoParams>( &self, sql: &str, params: P, ) -> Result<Vec<Episode>>
Execute a parameterized SQL query for episodes
Convenience method for cache integration with safe parameters.
Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn store_heuristic(&self, heuristic: &Heuristic) -> Result<()>
pub async fn store_heuristic(&self, heuristic: &Heuristic) -> Result<()>
Store a heuristic
Sourcepub async fn get_heuristic(&self, id: Uuid) -> Result<Option<Heuristic>>
pub async fn get_heuristic(&self, id: Uuid) -> Result<Option<Heuristic>>
Retrieve a heuristic by ID
Sourcepub async fn get_heuristics(&self) -> Result<Vec<Heuristic>>
pub async fn get_heuristics(&self) -> Result<Vec<Heuristic>>
Get all heuristics
Sourcepub async fn delete_heuristic(&self, id: Uuid) -> Result<()>
pub async fn delete_heuristic(&self, id: Uuid) -> Result<()>
Delete a heuristic by ID
Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn store_execution_record(
&self,
record: &ExecutionRecord,
) -> Result<()>
pub async fn store_execution_record( &self, record: &ExecutionRecord, ) -> Result<()>
Store an execution record
Sourcepub async fn store_agent_metrics(&self, metrics: &AgentMetrics) -> Result<()>
pub async fn store_agent_metrics(&self, metrics: &AgentMetrics) -> Result<()>
Store agent metrics
Sourcepub async fn store_task_metrics(&self, metrics: &TaskMetrics) -> Result<()>
pub async fn store_task_metrics(&self, metrics: &TaskMetrics) -> Result<()>
Store task metrics
Sourcepub async fn load_agent_metrics(
&self,
agent_name: &str,
) -> Result<Option<AgentMetrics>>
pub async fn load_agent_metrics( &self, agent_name: &str, ) -> Result<Option<AgentMetrics>>
Load agent metrics
Sourcepub async fn load_execution_records(
&self,
agent_name: Option<&str>,
limit: usize,
) -> Result<Vec<ExecutionRecord>>
pub async fn load_execution_records( &self, agent_name: Option<&str>, limit: usize, ) -> Result<Vec<ExecutionRecord>>
Load execution records
Sourcepub async fn load_task_metrics(
&self,
task_type: &str,
) -> Result<Option<TaskMetrics>>
pub async fn load_task_metrics( &self, task_type: &str, ) -> Result<Option<TaskMetrics>>
Load task metrics
Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn store_pattern(&self, pattern: &CorePattern) -> Result<()>
pub async fn store_pattern(&self, pattern: &CorePattern) -> Result<()>
Store a pattern
Sourcepub async fn get_pattern(
&self,
pattern_id: PatternId,
) -> Result<Option<CorePattern>>
pub async fn get_pattern( &self, pattern_id: PatternId, ) -> Result<Option<CorePattern>>
Retrieve a pattern by ID
Sourcepub async fn query_patterns(
&self,
query: &PatternQuery,
) -> Result<Vec<CorePattern>>
pub async fn query_patterns( &self, query: &PatternQuery, ) -> Result<Vec<CorePattern>>
Query patterns with filters
Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn query_patterns_raw(&self, sql: &str) -> Result<Vec<Pattern>>
pub async fn query_patterns_raw(&self, sql: &str) -> Result<Vec<Pattern>>
Execute a raw SQL query for patterns
Convenience method for cache integration.
See RawPatternQuery for details.
Sourcepub async fn query_patterns_raw_with_params<P: IntoParams>(
&self,
sql: &str,
params: P,
) -> Result<Vec<Pattern>>
pub async fn query_patterns_raw_with_params<P: IntoParams>( &self, sql: &str, params: P, ) -> Result<Vec<Pattern>>
Execute a parameterized SQL query for patterns
Convenience method for cache integration with safe parameters.
Source§impl TursoStorage
impl TursoStorage
pub async fn store_recommendation_session( &self, session: &RecommendationSession, ) -> Result<()>
pub async fn get_recommendation_session( &self, session_id: Uuid, ) -> Result<Option<RecommendationSession>>
pub async fn get_recommendation_session_for_episode( &self, episode_id: Uuid, ) -> Result<Option<RecommendationSession>>
pub async fn store_recommendation_feedback( &self, feedback: &RecommendationFeedback, ) -> Result<()>
pub async fn get_recommendation_feedback( &self, session_id: Uuid, ) -> Result<Option<RecommendationFeedback>>
pub async fn get_recommendation_stats(&self) -> Result<RecommendationStats>
Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn _store_embedding_internal(
&self,
item_id: &str,
item_type: &str,
embedding: &[f32],
) -> Result<()>
pub async fn _store_embedding_internal( &self, item_id: &str, item_type: &str, embedding: &[f32], ) -> Result<()>
Store an embedding (internal implementation)
When compression is enabled, embeddings are compressed using the configured algorithm (LZ4, Zstd, or Gzip) to reduce network bandwidth.
When turso_multi_dimension feature is enabled, routes to dimension-specific tables.
Sourcepub async fn _get_embedding_internal(
&self,
item_id: &str,
item_type: &str,
) -> Result<Option<Vec<f32>>>
pub async fn _get_embedding_internal( &self, item_id: &str, item_type: &str, ) -> Result<Option<Vec<f32>>>
Get an embedding (internal implementation)
Automatically decompresses embeddings if they were stored compressed.
Sourcepub async fn _delete_embedding_internal(&self, item_id: &str) -> Result<bool>
pub async fn _delete_embedding_internal(&self, item_id: &str) -> Result<bool>
Delete an embedding (internal implementation)
Sourcepub async fn _store_embeddings_batch_internal(
&self,
embeddings: Vec<(String, Vec<f32>)>,
) -> Result<()>
pub async fn _store_embeddings_batch_internal( &self, embeddings: Vec<(String, Vec<f32>)>, ) -> Result<()>
Store embeddings in batch (internal implementation)
Sourcepub async fn _get_embeddings_batch_internal(
&self,
item_ids: &[String],
) -> Result<Vec<Option<Vec<f32>>>>
pub async fn _get_embeddings_batch_internal( &self, item_ids: &[String], ) -> Result<Vec<Option<Vec<f32>>>>
Get embeddings in batch (internal implementation)
Sourcepub async fn migrate_embeddings_to_vector_format(&self) -> Result<usize>
pub async fn migrate_embeddings_to_vector_format(&self) -> Result<usize>
Migrate existing embeddings to populate embedding_vector column
This migration populates the embedding_vector F32_BLOB column for
embeddings that were stored before native vector support was added.
The vector column enables DiskANN-accelerated vector_top_k search.
Returns the number of embeddings migrated.
Sourcepub async fn has_vector_embeddings(&self) -> Result<bool>
pub async fn has_vector_embeddings(&self) -> Result<bool>
Check if embedding vector column is populated for vector_top_k search
Returns true if at least one embedding has the vector column populated.
Sourcepub async fn store_embedding_backend(
&self,
id: &str,
embedding: Vec<f32>,
) -> Result<()>
pub async fn store_embedding_backend( &self, id: &str, embedding: Vec<f32>, ) -> Result<()>
Store an embedding (backend API)
Sourcepub async fn get_embedding_backend(&self, id: &str) -> Result<Option<Vec<f32>>>
pub async fn get_embedding_backend(&self, id: &str) -> Result<Option<Vec<f32>>>
Get an embedding (backend API)
Sourcepub async fn delete_embedding_backend(&self, id: &str) -> Result<bool>
pub async fn delete_embedding_backend(&self, id: &str) -> Result<bool>
Delete an embedding (backend API)
Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn initialize_schema(&self) -> Result<()>
pub async fn initialize_schema(&self) -> Result<()>
Initialize the database schema
Creates tables and indexes if they don’t exist. Safe to call multiple times.
Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn new_with_adaptive_pool(
url: &str,
token: &str,
config: TursoConfig,
adaptive_config: AdaptivePoolConfig,
) -> Result<Self>
pub async fn new_with_adaptive_pool( url: &str, token: &str, config: TursoConfig, adaptive_config: AdaptivePoolConfig, ) -> Result<Self>
Create a new Turso storage instance with adaptive connection pool
The adaptive pool automatically adjusts its size based on load:
- Scales up when utilization exceeds threshold (default: 70%)
- Scales down during low utilization (default: <30%)
- Provides 20% better performance under variable load
§Arguments
url- Database URLtoken- Authentication tokenconfig- Turso configurationadaptive_config- Adaptive pool configuration
§Example
use do_memory_storage_turso::{TursoStorage, TursoConfig, AdaptivePoolConfig};
use std::time::Duration;
let config = TursoConfig::default();
let adaptive_config = AdaptivePoolConfig {
min_connections: 5,
max_connections: 50,
scale_up_threshold: 0.7,
scale_down_threshold: 0.3,
scale_up_cooldown: Duration::from_secs(10),
scale_down_cooldown: Duration::from_secs(30),
scale_up_increment: 5,
scale_down_decrement: 5,
check_interval: Duration::from_secs(5),
};
let storage = TursoStorage::new_with_adaptive_pool(
"libsql://localhost:8080",
"token",
config,
adaptive_config
).await?;Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn new(url: &str, token: &str) -> Result<Self>
pub async fn new(url: &str, token: &str) -> Result<Self>
Create a new Turso storage instance
§Arguments
url- Database URL (onlylibsql://,file:, or:memory:protocols allowed)token- Authentication token (required forlibsql://, empty for local files)
§Security
This method enforces secure connections:
- Remote connections must use
libsql://protocol with a valid token - HTTP/HTTPS protocols are rejected to prevent insecure connections
- Local
file:and:memory:databases are allowed without tokens
§Example
// Remote connection with authentication
let storage = TursoStorage::new("libsql://localhost:8080", "my-token").await?;
// Local file database
let local = TursoStorage::new("file:local.db", "").await?;Sourcepub fn from_database(db: Database) -> Result<Self>
pub fn from_database(db: Database) -> Result<Self>
Sourcepub async fn with_config(
url: &str,
token: &str,
config: TursoConfig,
) -> Result<Self>
pub async fn with_config( url: &str, token: &str, config: TursoConfig, ) -> Result<Self>
Create a new Turso storage instance with custom configuration
§Security
This method enforces the following security requirements:
- Only
libsql://,file:, and:memory:protocols are allowed - Remote connections (libsql://) require a non-empty authentication token
- Local file and memory databases do not require tokens
These checks prevent accidental use of insecure protocols and ensure proper authentication for remote Turso databases.
Source§impl TursoStorage
impl TursoStorage
Sourcepub async fn get_connection(&self) -> Result<Connection>
pub async fn get_connection(&self) -> Result<Connection>
Get a database connection
If connection pooling is enabled, this will use a pooled connection. If keep-alive pool is enabled, it will be used for reduced overhead. If adaptive pool is enabled, it will be used for variable load optimization. Otherwise, it creates a new connection each time.
Sourcepub async fn get_connection_with_id(&self) -> Result<(Connection, ConnectionId)>
pub async fn get_connection_with_id(&self) -> Result<(Connection, ConnectionId)>
Get a database connection with its cache ID
This method returns both the connection and a unique connection ID
for use with the prepared statement cache. The ID should be passed
to prepare_cached and clear_prepared_cache for proper cache management.
§Returns
A tuple of (Connection, ConnectionId)
§Example
let (conn, conn_id) = storage.get_connection_with_id().await?;
// Use conn and conn_id with prepare_cachedSourcepub async fn get_count(&self, conn: &Connection, table: &str) -> Result<usize>
pub async fn get_count(&self, conn: &Connection, table: &str) -> Result<usize>
Get count of records in a table
§Safety
The table parameter should be a validated table name from a fixed whitelist.
This function does not sanitize the table name, so callers must ensure
it comes from a trusted source (e.g., the fixed list in capacity.rs).
CodeQL may flag this as a potential SQL injection, but it is safe when
used with the predefined table names from the whitelist.
Sourcepub async fn execute_pragmas(&self, conn: &Connection) -> Result<()>
pub async fn execute_pragmas(&self, conn: &Connection) -> Result<()>
Execute PRAGMA statements for database configuration
PRAGMA statements may return rows, so we need to consume them before continuing.
Sourcepub async fn execute_with_retry(
&self,
conn: &Connection,
sql: &str,
) -> Result<()>
pub async fn execute_with_retry( &self, conn: &Connection, sql: &str, ) -> Result<()>
Execute a SQL statement with retry logic
Sourcepub async fn health_check(&self) -> Result<bool>
pub async fn health_check(&self) -> Result<bool>
Health check - verify database connectivity
Sourcepub fn with_cache_default(self) -> CachedTursoStorage
pub fn with_cache_default(self) -> CachedTursoStorage
Wrap this storage with a cache layer using default cache configuration
This provides transparent caching for episodes, patterns, and heuristics with adaptive TTL based on access patterns.
§Example
let storage = TursoStorage::new("file:test.db", "").await?;
let cached = storage.with_cache_default();Sourcepub fn with_cache(self, cache_config: CacheConfig) -> CachedTursoStorage
pub fn with_cache(self, cache_config: CacheConfig) -> CachedTursoStorage
Wrap this storage with a cache layer using custom cache configuration
§Arguments
config- Cache configuration to use
§Returns
A new CachedTursoStorage wrapping this storage
§Example
let storage = TursoStorage::new("file:test.db", "").await?;
let config = CacheConfig {
max_episodes: 1000,
episode_ttl: Duration::from_secs(3600),
..Default::default()
};
let cached = storage.with_cache(config);Sourcepub fn cache_config(&self) -> Option<&CacheConfig>
pub fn cache_config(&self) -> Option<&CacheConfig>
Get the cache configuration if set
Sourcepub fn prepared_cache_stats(&self) -> PreparedCacheStats
pub fn prepared_cache_stats(&self) -> PreparedCacheStats
Get prepared statement cache statistics
Sourcepub fn prepared_cache(&self) -> &PreparedStatementCache
pub fn prepared_cache(&self) -> &PreparedStatementCache
Get a reference to the prepared statement cache
Sourcepub async fn get_statistics(&self) -> Result<StorageStatistics>
pub async fn get_statistics(&self) -> Result<StorageStatistics>
Get database statistics
Sourcepub async fn pool_statistics(&self) -> Option<PoolStatistics>
pub async fn pool_statistics(&self) -> Option<PoolStatistics>
Get pool statistics if pooling is enabled
Sourcepub async fn pool_utilization(&self) -> Option<f32>
pub async fn pool_utilization(&self) -> Option<f32>
Get pool utilization if pooling is enabled
Sourcepub fn adaptive_pool_metrics(&self) -> Option<AdaptivePoolMetrics>
pub fn adaptive_pool_metrics(&self) -> Option<AdaptivePoolMetrics>
Get adaptive pool metrics if enabled
Sourcepub fn adaptive_pool_size(&self) -> Option<(u32, u32)>
pub fn adaptive_pool_size(&self) -> Option<(u32, u32)>
Get current adaptive pool size
Sourcepub async fn check_adaptive_pool_scale(&self)
pub async fn check_adaptive_pool_scale(&self)
Manually trigger adaptive pool scaling check
Sourcepub async fn prepare_cached(
&self,
conn_id: ConnectionId,
conn: &Connection,
sql: &str,
) -> Result<Statement>
pub async fn prepare_cached( &self, conn_id: ConnectionId, conn: &Connection, sql: &str, ) -> Result<Statement>
Prepare a SQL statement with cache tracking
This method prepares a SQL statement and tracks cache statistics. If the statement is already cached for this connection, it’s a cache hit. Otherwise, it’s a cache miss and the statement is prepared and tracked.
§Arguments
conn_id- Connection identifier for cache trackingconn- Database connection to prepare onsql- SQL statement to prepare
§Returns
The prepared statement
§Errors
Returns error if statement preparation fails
Sourcepub fn clear_prepared_cache(&self, conn_id: ConnectionId) -> usize
pub fn clear_prepared_cache(&self, conn_id: ConnectionId) -> usize
Trait Implementations§
Source§impl EmbeddingStorageBackend for TursoStorage
impl EmbeddingStorageBackend for TursoStorage
Source§fn store_episode_embedding<'life0, 'async_trait>(
&'life0 self,
episode_id: Uuid,
embedding: Vec<f32>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_episode_embedding<'life0, 'async_trait>(
&'life0 self,
episode_id: Uuid,
embedding: Vec<f32>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn store_pattern_embedding<'life0, 'async_trait>(
&'life0 self,
pattern_id: PatternId,
embedding: Vec<f32>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_pattern_embedding<'life0, 'async_trait>(
&'life0 self,
pattern_id: PatternId,
embedding: Vec<f32>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_episode_embedding<'life0, 'async_trait>(
&'life0 self,
episode_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_episode_embedding<'life0, 'async_trait>(
&'life0 self,
episode_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_pattern_embedding<'life0, 'async_trait>(
&'life0 self,
pattern_id: PatternId,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_pattern_embedding<'life0, 'async_trait>(
&'life0 self,
pattern_id: PatternId,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn find_similar_episodes<'life0, 'async_trait>(
&'life0 self,
query_embedding: Vec<f32>,
limit: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<SimilaritySearchResult<Episode>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_similar_episodes<'life0, 'async_trait>(
&'life0 self,
query_embedding: Vec<f32>,
limit: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<SimilaritySearchResult<Episode>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn find_similar_patterns<'life0, 'async_trait>(
&'life0 self,
query_embedding: Vec<f32>,
limit: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<SimilaritySearchResult<Pattern>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_similar_patterns<'life0, 'async_trait>(
&'life0 self,
query_embedding: Vec<f32>,
limit: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<SimilaritySearchResult<Pattern>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl MonitoringStorageBackend for TursoStorage
Implement the MonitoringStorageBackend trait for TursoStorage
impl MonitoringStorageBackend for TursoStorage
Implement the MonitoringStorageBackend trait for TursoStorage
fn store_execution_record<'life0, 'life1, 'async_trait>(
&'life0 self,
record: &'life1 ExecutionRecord,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_agent_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
metrics: &'life1 AgentMetrics,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_task_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
metrics: &'life1 TaskMetrics,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_agent_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentMetrics>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_execution_records<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_name: Option<&'life1 str>,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<ExecutionRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_task_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
task_type: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<TaskMetrics>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl StorageBackend for TursoStorage
Implement the unified StorageBackend trait for TursoStorage
impl StorageBackend for TursoStorage
Implement the unified StorageBackend trait for TursoStorage
Source§fn store_episode<'life0, 'life1, 'async_trait>(
&'life0 self,
episode: &'life1 Episode,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_episode<'life0, 'life1, 'async_trait>(
&'life0 self,
episode: &'life1 Episode,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_episode<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Episode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_episode<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Episode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn delete_episode<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_episode<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn store_pattern<'life0, 'life1, 'async_trait>(
&'life0 self,
pattern: &'life1 Pattern,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_pattern<'life0, 'life1, 'async_trait>(
&'life0 self,
pattern: &'life1 Pattern,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_pattern<'life0, 'async_trait>(
&'life0 self,
id: PatternId,
) -> Pin<Box<dyn Future<Output = Result<Option<Pattern>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_pattern<'life0, 'async_trait>(
&'life0 self,
id: PatternId,
) -> Pin<Box<dyn Future<Output = Result<Option<Pattern>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn store_heuristic<'life0, 'life1, 'async_trait>(
&'life0 self,
heuristic: &'life1 Heuristic,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_heuristic<'life0, 'life1, 'async_trait>(
&'life0 self,
heuristic: &'life1 Heuristic,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_heuristic<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Heuristic>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_heuristic<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Heuristic>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn query_episodes_since<'life0, 'async_trait>(
&'life0 self,
since: DateTime<Utc>,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Episode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn query_episodes_since<'life0, 'async_trait>(
&'life0 self,
since: DateTime<Utc>,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Episode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn query_episodes_by_metadata<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: &'life2 str,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Episode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn query_episodes_by_metadata<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: &'life2 str,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Episode>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn store_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
embedding: Vec<f32>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
embedding: Vec<f32>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn delete_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn store_embeddings_batch<'life0, 'async_trait>(
&'life0 self,
embeddings: Vec<(String, Vec<f32>)>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_embeddings_batch<'life0, 'async_trait>(
&'life0 self,
embeddings: Vec<(String, Vec<f32>)>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_embeddings_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Vec<f32>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_embeddings_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Vec<f32>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn store_relationship<'life0, 'life1, 'async_trait>(
&'life0 self,
relationship: &'life1 EpisodeRelationship,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_relationship<'life0, 'life1, 'async_trait>(
&'life0 self,
relationship: &'life1 EpisodeRelationship,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn remove_relationship<'life0, 'async_trait>(
&'life0 self,
relationship_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remove_relationship<'life0, 'async_trait>(
&'life0 self,
relationship_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_relationships<'life0, 'async_trait>(
&'life0 self,
episode_id: Uuid,
direction: Direction,
) -> Pin<Box<dyn Future<Output = Result<Vec<EpisodeRelationship>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_relationships<'life0, 'async_trait>(
&'life0 self,
episode_id: Uuid,
direction: Direction,
) -> Pin<Box<dyn Future<Output = Result<Vec<EpisodeRelationship>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn relationship_exists<'life0, 'async_trait>(
&'life0 self,
from_episode_id: Uuid,
to_episode_id: Uuid,
relationship_type: RelationshipType,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn relationship_exists<'life0, 'async_trait>(
&'life0 self,
from_episode_id: Uuid,
to_episode_id: Uuid,
relationship_type: RelationshipType,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn store_recommendation_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 RecommendationSession,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_recommendation_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 RecommendationSession,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_recommendation_session<'life0, 'async_trait>(
&'life0 self,
session_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<RecommendationSession>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_recommendation_session<'life0, 'async_trait>(
&'life0 self,
session_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<RecommendationSession>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_recommendation_session_for_episode<'life0, 'async_trait>(
&'life0 self,
episode_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<RecommendationSession>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_recommendation_session_for_episode<'life0, 'async_trait>(
&'life0 self,
episode_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<RecommendationSession>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn store_recommendation_feedback<'life0, 'life1, 'async_trait>(
&'life0 self,
feedback: &'life1 RecommendationFeedback,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_recommendation_feedback<'life0, 'life1, 'async_trait>(
&'life0 self,
feedback: &'life1 RecommendationFeedback,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_recommendation_feedback<'life0, 'async_trait>(
&'life0 self,
session_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<RecommendationFeedback>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_recommendation_feedback<'life0, 'async_trait>(
&'life0 self,
session_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<RecommendationFeedback>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn get_recommendation_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<RecommendationStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_recommendation_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<RecommendationStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn cleanup_episodes<'life0, 'life1, 'async_trait>(
&'life0 self,
policy: &'life1 EpisodeRetentionPolicy,
) -> Pin<Box<dyn Future<Output = Result<CleanupResult, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn cleanup_episodes<'life0, 'life1, 'async_trait>(
&'life0 self,
policy: &'life1 EpisodeRetentionPolicy,
) -> Pin<Box<dyn Future<Output = Result<CleanupResult, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Source§fn count_cleanup_candidates<'life0, 'life1, 'async_trait>(
&'life0 self,
policy: &'life1 EpisodeRetentionPolicy,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn count_cleanup_candidates<'life0, 'life1, 'async_trait>(
&'life0 self,
policy: &'life1 EpisodeRetentionPolicy,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations§
impl Freeze for TursoStorage
impl !RefUnwindSafe for TursoStorage
impl Send for TursoStorage
impl Sync for TursoStorage
impl Unpin for TursoStorage
impl UnsafeUnpin for TursoStorage
impl !UnwindSafe for TursoStorage
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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>
T in a tonic::RequestSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.