You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Stefan Guggisberg <sg...@adobe.com> on 2012/10/17 14:03:33 UTC

Re: Staged vs. Stored node

hi mete

i'm copying the oak-dev list since this might be of interest to others.
comments follow inline...

On Tue, Oct 16, 2012 at 8:30 PM, Mete Atamel <ma...@adobe.com> wrote:
> Hi Stefan,
>
> One thing that I've been wanting to ask you is the distinction between
> StagedNode vs. StoredNode. I see in StagedNodeTree, you use both but I
> don't understand when one is used vs. other.

the naming (staged nodes) is git-inspired. in git changes need to be 'staged'
('git add') before they can be committed.

StagedNode represents a mutable node instance whereas a StoredNode is
immutable. StagedNodeTree is used to build and collect changes to the
node tree.

e.g.

+/foo : { baz : "blah" }

results in 2 StagedNode instances:

1. new root node "/" with a new child node entry "baz" pointing to 2.
2. new child node "/baz"

those changes can then be committed by persisting all StagedNode
instances recursively (bottom up), resulting in a new revision pointing
to the new root node.

please note that is specific to the default mk's versioning model
(git-like contenthash-based identifiers).

cheers
stefan

> In MongoMK, we have one
> notion of Node and that seems to work fine but I'm curious why you made
> staged vs. stored node distinction in your implementation and see if it's
> something we need to think about as well.
>
> Thanks!
> Mete
>