Federation
HoloSphere Federation
HoloSphere's federation system allows different holons (spaces) to share and access data from each other. Federation creates a relationship between spaces that enables data propagation and cross-space access.
Key Concepts
Federation Relationship: A connection between two spaces that allows data to flow between them.
Soul References: Lightweight references that point to data in its original location (single source of truth).
Notification Flow: Data notifications flow from source spaces to target spaces that are in the notify list.
Source-Target Relationship: Each federation sets up a source space (federation list) and a target space (notify list).
Federation Data Flow
The HoloSphere federation system works with a clear source-target relationship:
Federation List: When space A federates with space B, space A adds B to its federation list.
Notify List: Space B adds space A to its notify list.
Data Flow: When space A changes, space B gets notified (but not vice versa unless bidirectional).
Creating Federation
Create federation relationships between spaces:
The bidirectional parameter is largely unused in the current implementation since the federation system naturally sets up the correct notification flow. The default relationship allows space2 to be notified of changes in space1.
Storing and Propagating Data
Data must be explicitly propagated to federated spaces:
You can also enable automatic propagation in the put() method:
Accessing Federated Data
Direct Retrieval
You can access data directly from any space:
Aggregate Federated Data
Use getFederated() to get data from multiple federated spaces:
Soul References
HoloSphere uses a simplified reference system based on soul paths:
A reference contains only an
idand asoulpropertyThe soul path is in the format:
appname/holon/lens/keyWhen resolving a reference, HoloSphere follows the soul path to retrieve the original data
By default, federation propagation uses references instead of duplicating data. This can be controlled:
Removing Federation
Complete Example
Here's a complete example showing the proper way to set up and use federation:
Troubleshooting
Common Issues
Federation Relationship: Make sure to check both the federation list and notify list to understand data flow.
Data Propagation: If data isn't appearing in federated spaces, check:
The federation relationship was created correctly
The data was propagated explicitly or
autoPropagatewas set totrueThe notify list includes the target space
Reference Resolution: If you're getting reference objects instead of the actual data:
Make sure
resolveReferencesis set totrue(it's the default)Check that the original data still exists at the referenced location
Timing Issues: Data propagation is asynchronous. Add small delays (500-1000ms) between operations to allow propagation to complete.
Best Practices
Verify Federation Structure: After creating a federation, check both spaces to ensure:
Source space has the target in its federation list
Target space has the source in its notify list
Explicit Propagation: Unless you're using
autoPropagate, always callpropagate()explicitly after storing data that should be shared.Choose the Right Propagation Method:
Use
useReferences: true(default) to keep a single source of truthUse
useReferences: falseonly when you need independent copies
Cleanup: Always close the HoloSphere instance when done to prevent resource leaks.
Last updated
Was this helpful?