Skip to main content

GenomeStorage

Trait GenomeStorage 

Source
pub trait GenomeStorage: Send + Sync {
    // Required methods
    fn load_genome(
        &self,
        genome_id: &str,
    ) -> Pin<Box<dyn Future<Output = Result<String, StorageError>> + Send + '_>>;
    fn save_genome(
        &self,
        genome_id: &str,
        genome_json: &str,
    ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + '_>>;
    fn list_genomes(
        &self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StorageError>> + Send + '_>>;
    fn delete_genome(
        &self,
        genome_id: &str,
    ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + '_>>;
}
Expand description

Platform-agnostic genome storage trait

This trait abstracts genome persistence across platforms:

  • Desktop: File system storage
  • WASM: IndexedDB storage

All operations are async to support both blocking (file I/O) and non-blocking (IndexedDB) storage backends.

Required Methods§

Source

fn load_genome( &self, genome_id: &str, ) -> Pin<Box<dyn Future<Output = Result<String, StorageError>> + Send + '_>>

Load a genome by ID

§Arguments
  • genome_id - Unique identifier for the genome
§Returns

Ok(String) with genome JSON if found, Err(StorageError::NotFound) if genome doesn’t exist, Err(StorageError::IOError) for I/O failures

Source

fn save_genome( &self, genome_id: &str, genome_json: &str, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + '_>>

Save a genome by ID

§Arguments
  • genome_id - Unique identifier for the genome
  • genome_json - Genome JSON string to save
§Returns

Ok(()) on success, Err(StorageError::IOError) for I/O failures, Err(StorageError::SerializationError) for invalid JSON

Source

fn list_genomes( &self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StorageError>> + Send + '_>>

List all available genome IDs

§Returns

Ok(Vec<String>) with all genome IDs, Err(StorageError::IOError) for I/O failures

Source

fn delete_genome( &self, genome_id: &str, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + '_>>

Delete a genome by ID

§Arguments
  • genome_id - Unique identifier for the genome to delete
§Returns

Ok(()) on success, Err(StorageError::NotFound) if genome doesn’t exist, Err(StorageError::IOError) for I/O failures

Implementors§