pub trait Collection<T>{
// Required methods
fn collection_details_graph_query(id_list: &[T]) -> Query;
fn put_graph_query(&self) -> Result<Query, DynError>;
fn extend_on_index_miss<'life0, 'async_trait>(
elements: &'life0 [Option<Self>],
) -> Pin<Box<dyn Future<Output = Result<(), DynError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn get_by_ids<'life0, 'async_trait>(
ids: &'life0 [T],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Self>>, DynError>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn get_from_graph<'life0, 'async_trait>(
ids: &'life0 [T],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Self>>, DynError>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn get_from_index<'life0, 'life1, 'async_trait>(
keys: Vec<&'life0 [&'life1 str]>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Self>>, DynError>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn put_to_index<'life0, 'async_trait>(
ids: &'life0 [T],
records: Vec<Option<Self>>,
) -> Pin<Box<dyn Future<Output = Result<(), DynError>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn put_to_graph<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), DynError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn reindex<'life0, 'async_trait>(
collection_ids: &'life0 [T],
) -> Pin<Box<dyn Future<Output = Result<(), DynError>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
}Required Methods§
Sourcefn collection_details_graph_query(id_list: &[T]) -> Query
fn collection_details_graph_query(id_list: &[T]) -> Query
Returns the neo4j query to return a list records by passing a list of ids. The query should return each record in the “record” attribute of the node.
Sourcefn put_graph_query(&self) -> Result<Query, DynError>
fn put_graph_query(&self) -> Result<Query, DynError>
Returns the neo4j query to put a record into the graph.
fn extend_on_index_miss<'life0, 'async_trait>(
elements: &'life0 [Option<Self>],
) -> Pin<Box<dyn Future<Output = Result<(), DynError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Provided Methods§
Sourcefn get_by_ids<'life0, 'async_trait>(
ids: &'life0 [T],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Self>>, DynError>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn get_by_ids<'life0, 'async_trait>(
ids: &'life0 [T],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Self>>, DynError>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Retrieves records by their IDs, first attempting to fetch them from a cache (e.g., Redis), and then querying a graph database (e.g., Neo4j) if necessary.
§Arguments
ids- A slice of id slices representing the IDs to query.
§Returns
This function returns a Result containing a vector of Option<Self>. Each Option corresponds to
a queried ID, containing Some(record) if the record was found in either the cache or the graph database,
or None if it was not found in either.
Sourcefn get_from_graph<'life0, 'async_trait>(
ids: &'life0 [T],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Self>>, DynError>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn get_from_graph<'life0, 'async_trait>(
ids: &'life0 [T],
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Self>>, DynError>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Queries a Neo4j graph database to retrieve records based on the provided IDs and collection type.
§Arguments
ids- A slice of string slices representing the IDs.
§Returns
This function returns a Result containing a vector of Option<Self>. Each Option corresponds to
a queried ID, containing Some(record) if the record was found in the graph database, or None if it was not found.
fn get_from_index<'life0, 'life1, 'async_trait>(
keys: Vec<&'life0 [&'life1 str]>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Option<Self>>, DynError>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn put_to_index<'life0, 'async_trait>(
ids: &'life0 [T],
records: Vec<Option<Self>>,
) -> Pin<Box<dyn Future<Output = Result<(), DynError>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
fn put_to_index<'life0, 'async_trait>(
ids: &'life0 [T],
records: Vec<Option<Self>>,
) -> Pin<Box<dyn Future<Output = Result<(), DynError>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Indexes collection of records in Redis for faster access in future queries.
§Arguments
ids- A slice of id slices representing the IDs of the records to index.records- A vector ofOption<Self>containing the records to be indexed. EachOptioncorresponds to an ID.
§Returns
This function returns a Result indicating success or failure. A successful result indicates that the
records were successfully indexed in the cache.
fn put_to_graph<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), DynError>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn reindex<'life0, 'async_trait>(
collection_ids: &'life0 [T],
) -> Pin<Box<dyn Future<Output = Result<(), DynError>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".