pub struct RelationStore { /* private fields */ }Expand description
Storage for named relations as GPU buffers
RelationStore manages a collection of named relations, each stored as a
CudaBuffer. It provides CRUD operations for relation management during
query execution.
§Thread Safety
This implementation is NOT thread-safe. It is designed for single-threaded runtime execution in the MVP.
§Example
use xlog_runtime::RelationStore;
use xlog_cuda::CudaBuffer;
use xlog_core::Schema;
let mut store = RelationStore::new(provider);
// Add a relation
store.put("edge", buffer);
// Check if relation exists
if store.contains("edge") {
let edge = store.get("edge").unwrap();
}
// Remove a relation
let removed = store.remove("edge");Implementations§
Source§impl RelationStore
impl RelationStore
Sourcepub fn new(provider: Arc<CudaKernelProvider>) -> Self
pub fn new(provider: Arc<CudaKernelProvider>) -> Self
Create a new empty relation store
Sourcepub fn get(&self, name: &str) -> Option<&CudaBuffer>
pub fn get(&self, name: &str) -> Option<&CudaBuffer>
Sourcepub fn get_mut(&mut self, name: &str) -> Option<&mut CudaBuffer>
pub fn get_mut(&mut self, name: &str) -> Option<&mut CudaBuffer>
Sourcepub fn get_with_version(&self, name: &str) -> Option<(&CudaBuffer, u64)>
pub fn get_with_version(&self, name: &str) -> Option<(&CudaBuffer, u64)>
Get a relation by name along with its current version.
Sourcepub fn put(&mut self, name: &str, buffer: CudaBuffer)
pub fn put(&mut self, name: &str, buffer: CudaBuffer)
Store a relation with the given name
If a relation with the same name already exists, it will be replaced.
§Arguments
name- The name of the relationbuffer- The GPU buffer containing the relation data
Sourcepub fn put_owned(&mut self, name: String, buffer: CudaBuffer)
pub fn put_owned(&mut self, name: String, buffer: CudaBuffer)
Store a relation using an already-owned name.
This has the same replacement and versioning behavior as Self::put,
but avoids allocating a second copy of a name that the caller already
owns. Call Self::try_reserve_relations before a sequence of inserts
when that sequence must not grow the relation map.
Sourcepub fn try_reserve_relations(&mut self, additional: usize) -> Result<()>
pub fn try_reserve_relations(&mut self, additional: usize) -> Result<()>
Reserve map capacity for additional new relation names.
This operation is fallible and changes capacity only: relation contents
and versions remain unchanged. Callers should count only names that are
not already present before choosing additional.
Sourcepub fn get_or_insert_empty(
&mut self,
name: &str,
schema: &Schema,
) -> Result<&CudaBuffer>
pub fn get_or_insert_empty( &mut self, name: &str, schema: &Schema, ) -> Result<&CudaBuffer>
Get a relation by name, or insert an empty buffer with the given schema
This is useful for semi-naive evaluation where delta relations may not exist yet on the first iteration. If the relation doesn’t exist, an empty buffer with the given schema is inserted into the store.
§Arguments
name- The name of the relationschema- The schema to use if creating an empty buffer
§Returns
A reference to the existing buffer, or the newly inserted empty buffer
Sourcepub fn get_or_insert_empty_mut(
&mut self,
name: &str,
schema: &Schema,
) -> Result<&mut CudaBuffer>
pub fn get_or_insert_empty_mut( &mut self, name: &str, schema: &Schema, ) -> Result<&mut CudaBuffer>
Get a mutable reference to a relation, or insert an empty buffer with the given schema
This is useful for semi-naive evaluation where delta relations may not exist yet on the first iteration. If the relation doesn’t exist, an empty buffer with the given schema is inserted into the store.
§Arguments
name- The name of the relationschema- The schema to use if creating an empty buffer
§Returns
A mutable reference to the existing buffer, or the newly inserted empty buffer