-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moving Cache and Staging responsibility into HolonSpace #165
Comments
@nphias : I wanted to capture my understanding of where we landed after yesterday's meeting and also share some thoughts that occurred to me since our meeting.
This eliminates the need to pass context to the Define the following traits to segregate different behaviors:HolonStagingBehavior traitThis trait should be implemented by Nursery, but we can elevate this API to HolonSpaceManager by also having it implement this trait and just delegate the calls defined by this trait to its nursery. This encapsulates knowledge of the Nursery within the HolonSpace Manager.
Trait HolonCacheBehaviorThis trait offers cache methods based on LocalId. It is implemented by
HolonSpaceBehavior trait.
ImplementationsHolonSpaceManager
Nursery
|
This enhancement shifts responsibility for both caching and staging holons to its owning HolonSpace. This allows the HolonCacheManager to be replaced and the scope of the CommitManager to be reduced.
Dependencies
None
Current State
Structural Changes
Cache Responsibility
new
function into HolonSpace'snew
function -- createlocal_cache
get_cache(holon_id: HolonId)->Result<Rc<RefCell<HolonCache>>, HolonError>
should return a reference to either its own cache or the cache of the appropriate inbound proxyfetch_local_holon(local_id: &LocalId) -> Result<Holon, HolonError>
get_rc_holon( &self, holon_id: &HolonId, ) -> Result<Rc<RefCell<Holon>>, HolonError>
Staging and Commit Responsibilities
Split the current functionality of the CommitManager as follows:
Nursery
object.NOTE: The above fields are private and, thus, only accessible via Nursery methods.
Define a
HolonsNursery
trait in the nursery.rs that defines the signatures for the set of methods used to access and update staged holonsget_holon_by_key
-- finds and returns a shared reference (Rc<RefCell>) to the staged holon matching the specified key. NOTE: Only staged holons are searched and some holon types do not define unique keys. This means that:None
a holon with the specified key may exist in the DHTget_holon(&self, reference: &StagedReference) -> Result<Ref<Holon>, HolonError>
get_mut_holon_internal
get_mut_holon
get_mut_holon_by_index
to_staged_reference
(by index)Implement HolonsNursery trait for Nursery
Move the implementation of the following methods to
Nursery
fromCommitManager
get_holon_by_key
-- finds and returns a shared reference (Rc<RefCell>) to the staged holon matching the specified key. NOTE: Only staged holons are searched and some holon types do not define unique keys. This means that:None
a holon with the specified key may exist in the DHTget_holon(&self, reference: &StagedReference) -> Result<Ref<Holon>, HolonError>
get_mut_holon_internal
get_mut_holon
get_mut_holon_by_index
to_staged_reference
(by index)Implement HolonsNursery trait in HolonSpace -- these implementations should just borrow the Nursery (possibly mutably) and then delegate the call to the nursery
Change definition of HolonSpace to:
[ ]
stage_new_holon
as a method on HolonSpace should include adescribed_by: HolonReference
parameter.Move all CommitManager methods to HolonSpaceManager except
commit()
CommitManager is just a service. It's only struct field is
context
:Elevate the
commit()
method to HolonSpace. This is the public interface forcommit
. HolonSpace should borrow its commit service and then delegate the commit call to its commit service.Testing
This enhancement does not introduce any new functionality, so no new test cases are required.
Definition of Done
The text was updated successfully, but these errors were encountered: