1 /*******************************************************************************
2 * Copyright (c) 2010, 2016 Ericsson, École Polytechnique de Montréal, and others
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.internal
.statesystem
.core
.backend
.historytree
;
13 import java
.io
.FileInputStream
;
14 import java
.nio
.channels
.ClosedChannelException
;
15 import java
.util
.Collection
;
17 import org
.eclipse
.tracecompass
.statesystem
.core
.exceptions
.TimeRangeException
;
20 * Meta-container for the History Tree. This structure contains all the
21 * high-level data relevant to the tree.
23 * @author Alexandre Montplaisir
25 public interface IHistoryTree
{
28 * Size of the "tree header" in the tree-file The nodes will use this offset
29 * to know where they should be in the file. This should always be a
32 int TREE_HEADER_SIZE
= 4096;
35 * "Save" the tree to disk. This method will cause the treeIO object to
36 * commit all nodes to disk and then return the RandomAccessFile descriptor
37 * so the Tree object can save its configuration into the header of the
40 * @param requestedEndTime
41 * The greatest timestamp present in the history tree
43 void closeTree(long requestedEndTime
);
45 // ------------------------------------------------------------------------
47 // ------------------------------------------------------------------------
50 * Get the start time of this tree.
52 * @return The start time
57 * Get the current end time of this tree.
59 * @return The end time
64 * Get the number of nodes in this tree.
66 * @return The number of nodes
71 * Get the current root node of this tree
73 * @return The root node
77 // ------------------------------------------------------------------------
79 // ------------------------------------------------------------------------
82 * Return the FileInputStream reader with which we will read an attribute
83 * tree (it will be sought to the correct position).
85 * @return The FileInputStream indicating the file and position from which
86 * the attribute tree can be read.
88 FileInputStream
supplyATReader();
91 * Return the file to which we will write the attribute tree.
93 * @return The file to which we will write the attribute tree
95 File
supplyATWriterFile();
98 * Return the position in the file (given by {@link #supplyATWriterFile})
99 * where to start writing the attribute tree.
101 * @return The position in the file where to start writing
103 long supplyATWriterFilePos();
106 * Read a node from the tree.
109 * The sequence number of the node to read
111 * @throws ClosedChannelException
112 * If the tree IO is unavailable
114 HTNode
readNode(int seqNumber
) throws ClosedChannelException
;
117 * Write a node object to the history file.
120 * The node to write to disk
122 void writeNode(HTNode node
);
125 * Close the history file.
130 * Delete the history file.
134 // ------------------------------------------------------------------------
136 // ------------------------------------------------------------------------
139 * Insert an interval in the tree.
142 * The interval to be inserted
143 * @throws TimeRangeException
144 * If the start of end time of the interval are invalid
146 void insertInterval(HTInterval interval
) throws TimeRangeException
;
149 * Inner method to select the next children of the current node intersecting
150 * the given timestamp. Useful for moving down the tree following one
154 * The node on which the request is made
156 * The timestamp to choose which child is the next one
157 * @return The child nodes intersecting t
158 * @throws ClosedChannelException
159 * If the file channel was closed while we were reading the tree
161 Collection
<HTNode
> selectNextChildren(CoreNode currentNode
, long t
) throws ClosedChannelException
;
164 * Get the current size of the history file.
166 * @return The history file size
This page took 0.045564 seconds and 6 git commands to generate.