Repository navigation
Storage In Memory Architecture
SolaceCore provides a set of concrete in-memory implementations for the storage interfaces, primarily useful for development, testing, or scenarios where persistence across application restarts is not required. These implementations reside in the io.github.solaceharmony.core.storage package.
This open class serves as the base generic in-memory storage solution.
-
Implements:
Storage<K, V>. -
Internal Structure:
- Uses a
protected val storage = mutableMapOf<K, Pair<V, MutableMap<String, Any>>>()to hold key-value pairs along with their metadata. - Employs a
protected val mutex = Mutex()fromkotlinx.coroutines.syncto ensure thread-safe concurrent access to the internalstoragemap.
- Uses a
-
Functionality:
- Provides straightforward implementations for all methods defined in the
Storage<K, V>interface (store,retrieve,listKeys,delete,exists,updateMetadata), performing operations on the internal map under the protection of the mutex. - Includes an additional
suspend fun clear(): Booleanmethod to remove all entries from this specific storage instance.
- Provides straightforward implementations for all methods defined in the
This open class extends InMemoryStorage to provide transactional capabilities.
-
Implements:
TransactionalStorage<K, V>(and by extension,Storage<K, V>andTransaction). -
Inheritance: Extends
InMemoryStorage<K, V>. -
Transactional Logic:
- Maintains a
private var transactionActive = falseflag. - Uses a separate
private val transactionMutex = Mutex()for managing transaction state. - Keeps pending changes in:
-
private val transactionStorage = mutableMapOf<K, Pair<V, MutableMap<String, Any>>>(): For new or updated entries. -
private val transactionDeletes = mutableSetOf<K>(): For keys marked for deletion.
-
-
begin(): SetstransactionActiveto true and clearstransactionStorageandtransactionDeletes. -
commit(): If a transaction is active, it acquires the parentInMemoryStorage.mutex, applies all deletes fromtransactionDeletesto the parentstorage, then applies all stores/updates fromtransactionStorageto the parentstorage. Finally, it resets the transaction state. -
rollback(): If a transaction is active, it simply clearstransactionStorageandtransactionDeletesand resetstransactionActive. -
isActive(): Returns the state oftransactionActiveundertransactionMutex. - Transactional operations (
storeInTransaction,deleteInTransaction,updateMetadataInTransaction) modifytransactionStorageandtransactionDeletesif a transaction is active; otherwise, they delegate to the parentInMemoryStoragemethods. - Read operations (
retrieve,listKeys,exists) are overridden to first consult thetransactionStorageandtransactionDeletesif a transaction is active, before falling back to the parentInMemoryStorage's data, thus providing a consistent view within a transaction.
- Maintains a
Provides an in-memory implementation for storing actor states.
-
Implements:
ActorStateStorage. -
Inheritance: Extends
InMemoryStorage<String, Map<String, Any>>. -
Functionality:
- Leverages the base
InMemoryStorageto store actor data, where each actor's entire state (including core state, ports, metrics, custom data) is aMap<String, Any>keyed by theactorId. - The specialized methods (
getActorState,setActorState,getActorPorts, etc.) interact with this map by accessing/modifying specific keys within it (e.g., "state", "ports", "metrics", "customState"). - The
setActorStatemethod handles the serialization of theActorStatesealed class instances (e.g.,ActorState.Running,ActorState.Error) into a map structure (e.g.,mapOf("type" to "Running")) before storing.getActorStateperforms the reverse deserialization.
- Leverages the base
Provides an in-memory implementation for storing configuration data.
-
Implements:
ConfigurationStorage. -
Inheritance: Extends
InMemoryStorage<String, Map<String, Any>>. -
Functionality:
- Uses the base
InMemoryStorageto store configuration maps. -
getComponentConfigandsetComponentConfiguse keys like"component:<componentId>". -
getSystemConfigandsetSystemConfiguse the key"system". - The path-based methods (
getConfigValue,setConfigValue) include logic to parse dot-separated paths (e.g.,"database.connection.url") and navigate the nested map structures representing the configuration. Helper methodsgetValueFromPath,setValueAtPath, andisValidPathfacilitate this.
- Uses the base
The in-memory implementation of the central storage coordinator.
-
Implements:
StorageManager(and thereforeLifecycleandDisposable). -
Internal Structure:
- Directly instantiates
InMemoryConfigurationStorageandInMemoryActorStateStoragefor the dedicatedgetConfigurationStorage()andgetActorStateStorage()methods. - Maintains a
private val storageMap = mutableMapOf<Triple<String, String, String>, Storage<*, *>>()to hold other registered genericStorageinstances. The key for this map is aTripleof (key class name, value class name, storage name). - Uses a
Mutexfor thread-safe access tostorageMapand itsisActivelifecycle flag.
- Directly instantiates
-
Functionality:
-
getStorage,registerStorage,unregisterStorageoperate on thestorageMap. -
flushAll()is a no-op for in-memory implementations. -
clearAll()iterates through all managedInMemoryStorageinstances (including the dedicated configuration and actor state storages, and those instorageMapif they areInMemoryStorageinstances) and calls their respectiveclear()methods. - Implements
start(),stop(),isActive(), anddispose()(which callsstop()andclearAll()) for lifecycle management.
-
These in-memory classes provide a fully functional, albeit volatile, persistence layer for SolaceCore, crucial for ease of development and testing.
SolaceCore SSOT wiki · published from wiki/ by .github/workflows/publish-wiki.yml · edit the source in the repo, not the wiki.
Orientation
- Architectural Deep Dive
- Architecture Overview
- Design vs Implementation
- Framework Actor System
- Framework Architectural Vision
- Framework Concurrency and Communication
- Framework Data Storage and Management
- Framework Deployment and Containerization
- Framework Development Roadmap
- Framework Hot-Pluggable System
- Framework Implementation Status
- Framework Observability and Monitoring
- Framework Port System
- Framework System Architecture
- Framework Workflow Management
- Project Status
- Project Status Report
- Quick Status
- Solace Core Framework Architecture
- SolaceCore Architecture Overview
- Vision & Solace AI
Runtime
- Actor Builder
- Actor Communication Sequence Diagram
- Actor Core Definitions
- Actor Graph View
- Actor Metrics
- Actor Module Architecture
- Actor Queue Hibernation and Correlation
- Actor Roadmap
- Actor State Recovery Subsystem
- Actor State Serialization Subsystem
- Actor Supervision Module
- Actor System Architecture
- Actor System Class Diagram
- Actor Usage Examples
- Compose App Features
- JVM Scripting Implementations
- Kernel & Ports
- Kernel Channel System
- Kernel Future Enhancements
- Kernel Module Architecture
- Kernel Port Implementations and Exceptions
- Kernel Port Usage Example
- Kernel Testing Strategy
- Lifecycle Class Diagram
- Lifecycle Management Architecture
- Pipeline DSL
- Real-Time UI Implementation
- Scripting Module Architecture
- Scripting Module Design
- Scripting Supporting Components
- Shared Memory
- Storage & Persistence
- Storage Abstractions Architecture
- Storage Caching Subsystem
- Storage Checklist
- Storage Compression Subsystem
- Storage Core Interfaces
- Storage Encryption Subsystem
- Storage File-Based Architecture
- Storage File-Based Implementations
- Storage In-Memory Architecture
- Storage In-Memory Implementations
- Storage JVM Serialization Utilities
- Storage Module Architecture
- Storage Serialization Compression Encryption
- Storage Specialized Interfaces Architecture
- Storage Status and Future Plans
- Storage Testing
- Storage Thread Safety Guide
- Storage Thread Safety and Deadlock Prevention
- Storage Transactions
- Storage Usage Examples
- Supervisor and Hot Swap
- SupervisorActor
- System Architecture Diagram
- Workflow Management Architecture
- Workflow Management Design Concept
- Workflow Orchestration
Solace AI
- Confusion Corrector
- Inference Cube
- Inference Cube Technical Architecture
- Long-Term Memory
- MCP and Tool Format
- Memory & Reflection
- Memory Compression
- Memory Feature Overview
- Memory Retrieval
- Mood & Emotional Model
- Mood Module Implementation
- Mouth Tool Technical Spec
- Multimodal Nudging
- Perception Actors
- Provider Specs
- Reflection Memory
- Solace AI Overview
- Supervisor AI
- Supervisor Emotional Model Integration
- Time Actor
- Voice & Mouth Tool
- Working Memory
- Zoom Level Technical Spec
- Zoom Levels
Reference
- Advanced Workflow Example
- Basic Actor Usage
- Build System and Dependencies
- Development Tooling and Practices
- Documentation Catalog
- Documentation Index
- Feature Index
- Glossary
- How the Wiki Publishes
- JVM Utilities
- Kotlin Implementation Details
- Kotlin-Aligned Architecture Overview
- Kotlin-Aligned Contributing
- Kotlin-Aligned Core Architectural Principles
- Kotlin-Aligned Daily Development Workflow
- Kotlin-Aligned Development Examples
- Kotlin-Aligned Development Workflow
- Kotlin-Aligned Documentation
- Kotlin-Aligned Implementation Status
- Kotlin-Aligned Key Concepts
- Kotlin-Aligned Known Issues
- Kotlin-Aligned Quick Start
- Kotlin-Aligned Running the System
- Kotlin-Aligned System Architecture
- LangChain Actor Code Changes
- LangChain Actor Usage Improvements
- LangChain ActorInterface Code Changes
- LangChain Best Practices
- LangChain Bugs
- LangChain Chain Implementation
- LangChain Code Changes
- LangChain Code Changes Rollout and Impact
- LangChain Configuration Management Improvements
- LangChain Configuration Recommendations
- LangChain Core Architecture Recommendations
- LangChain Directory Structure Changes
- LangChain Documentation Improvements
- LangChain Dynamic Wiring Rollout Notes
- LangChain Fix Proposal
- LangChain Implementation Priorities
- LangChain Lifecycle Management Improvements
- LangChain Memory Integration Recommendations
- LangChain Metrics and Observability Recommendations
- LangChain Migration Strategy
- LangChain New Files Needed
- LangChain New Packages to Add
- LangChain Package-by-Package Improvements
- LangChain Patterns
- LangChain Port Code Changes
- LangChain Port System Recommendations
- LangChain Port Usability Improvements
- LangChain Prompt Management Recommendations
- LangChain Recommendations
- LangChain Recommendations Rollout Plan
- LangChain Required Interface Changes
- LangChain Testing Changes
- LangChain Testing Improvements
- LangChain Testing Recommendations
- LangChain Tool Integration Recommendations
- LangChain Type-Safe Dynamic Wiring
- LangChain Type-Safe Dynamic Wiring System
- LangChain Usage Design Improvements
- Master Checklist
- Roadmap
- Roadmap Issues
- Roadmap Phase 1 Stability and Testing
- Roadmap Phase 2 Production Infrastructure
- Roadmap Phase 3 Documentation and Developer Experience
- Roadmap Phase 4 Graph Database Integration
- Roadmap Phase 5 Security Framework
- Roadmap Phase 6 Distributed System
- Roadmap Phase 7 Advanced Features
- Roadmap Phase 8 Ecosystem Development
- Roadmap Timeline and Success Metrics
- Setup Instructions
- Sketch Architecture
- Status Documentation
- Task 1 Core Tests
- Task 2 Connection Wiring
- Task 3 Concurrency Issues
- Task 4 Dynamic Registration
- Task 5 Integration Tests
- Task 6 Deadlock Detection
- Task Documentation
- Test Coverage Checklist
- Testing Strategy