Last updated at 9:32 pm UTC on 8 December 2011
A single physical Magma repository permits collaboration of a large, centralized domain model. But it is not necessary and, in some cases, even advisable, that the model be kept in one physical repository. It need not be necessary for a geo-map repository with Streets and Citys to be in the same physical repository as the PointsOfInterest database. Logical "links", as capable proxys, allow the perceived repository to stretch infinitely, even possibly manifesting in a sort of "Magma web" of linked repositories that might foster community interaction.
Succinctly, a MagmaForwardingProxy is a "bookmark" to an object in another repository, and transparently behaves as that object. This results in a number of beneficial "side-effects":
- server scalability is increased since each physical repository is supported by its own thread.
- separate physical repositories can be managed (i.e., backed up) independently.
- repositories may be used by multiple disparate applications, without affecting each other.
- can save memory in web servers (Magma clients) by allowing a single copy of a shared domain (instead of one copy per web client).
How to create the proxy
A bookmark to any object may be created very easily:
Magma is able to find the session someObject belongs to and gives you back a MagmaForwardingProxy (the bookmark) that you then attach somewhere to your domain model. This is the "bridge" from your repository to the other. You may, for the most part, treat the proxy as the actual object, it will create a session and ensure a connection to its originating repository, then cache the actual object and forward the message.
What if repositories move?
The user must maintain their MagmaLocations by simply commiting a change to them (ip and port). Since these MagmaLocation objects are shared, a particular location should only need to be updated in one place when a repository moves.
If an object is de-referenced from the main root, it will continue to be accessible from its ForwardingProxy's as long as the file is not compressed with MagmaCompressor. After that time, however, it will no longer be available and a MagmaInvalidOid will be signaled.