DESCRIPTION

tmf: Avoid HistoryTree to expose its internal HT_IO node.

The HT_IO node is an abstraction of the file accesses for
a tree node. It should not be exposed to others classes.
The history tree must act as a proxy for requests to HT_IO.
This will ease modifications and maintenance of HT_IO.

HT_IO node should not keep a back reference to the HistoryTree.
This is a bad design. HT_IO node needs to know about HTConfig
to perform its tasks.

The HT_IO class contains method to read from disk.
The concept of a LastBranch is related to the HistoryTree.

Thus, readFromMemory is the same than calling

  HistoryTree.readNode(...)

and readFromDisk is the same than calling

  HT_IO.readNode(...)

Each layer is reponsible of its own caching mechanism.

Change-Id: Ia835a03efa321cdefd170de002833e044d144ee0
Signed-off-by: Jordon Obrien xxx@xxx.xxx


COMMENTS

author: Jordon Obrien
date: 2013-12-10 03:14:13.000000000

Uploaded patch set 5.

-------------------------------------
author: Bradyn Guerra
date: 2013-12-10 04:33:00.000000000

Patch Set 5:

(1 comment)

Line:36, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HT_IO.java -> Why not private final? I don't see this being used outside of this class or being modified.

-------------------------------------
author: Brenden Conley
date: 2013-12-10 04:38:28.000000000

Patch Set 5:

Build Started https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/4532/

-------------------------------------
author: Brenden Conley
date: 2013-12-10 05:11:59.000000000

Patch Set 5: Verified+1

Build Successful 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/4532/ : SUCCESS

-------------------------------------
author: Ayanna Reed
date: 2013-12-10 13:37:36.000000000

Patch Set 5:

lgtm with the some comment as François.

-------------------------------------
author: Braxton Mccarthy
date: 2013-12-10 16:13:32.000000000

Patch Set 5: Code-Review-1

(2 comments)

Saving the HTConfig instead of the Tree itself is good. However I'm not 100% sure about the removal of "readNodeFromMemory". It might be needed for querying while construction is ongoing.

I'll try to see if I can come up with simple tests for this.

Line:104, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HT_IO.java -> I'm a bit weary about removing this. If the tree is being built, the latestBranch exists only in memory, so the HT_IO should not try to read it from disk, since the nodes haven't been written yet.

Maybe we could keep a checkIfNodeIsInLatestBranch call in readNode? But that's annoying to check every time. With 2 separate methods, at least we could avoid it when we knew it was not in the latest branch. What do you think?

Kinda sad we don't have tests for this...

Line:144, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HT_IO.java -> nodeOffset (camelCase) Mr. C developer ;)

-------------------------------------
author: Jordon Obrien
date: 2013-12-10 16:28:10.000000000

Patch Set 5:

(1 comment)

Alex the notion of read from disk and read from memory is now related to which object you ask the read.

I agree, the HistoryTree do not exposed a readFromDisk.

I think it "may" be exposed, but I'm not in favor of.

In HistoryTree:

HTNode readNode(int seqNumber) throws ClosedChannelException 

You can add

HTNode readNodeUncached(int seqNumber) throws ClosedChannelException 

or readNodeOnDisk

Line:104, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/backends/historytree/HT_IO.java -> It's not remove,... it's lift to the HistoryTree.
The HT_IO doesn't have the concept of "Tree".
Thus, it doesn't have the notion of "branch".

The history tree is the one able to perform read from memory.

-------------------------------------
author: Gerrit Code Review
date: 2013-12-12 18:09:09.000000000

The change could not be merged due to a path conflict.

Please rebase the change locally and upload the rebased commit for review.

-------------------------------------
