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
.io
.IOException
;
15 import java
.nio
.channels
.ClosedChannelException
;
16 import org
.eclipse
.tracecompass
.statesystem
.core
.exceptions
.TimeRangeException
;
19 * Meta-container for the History Tree. This structure contains all the
20 * high-level data relevant to the tree.
22 * @author Alexandre Montplaisir
23 * @author Geneviève Bastien
25 public interface IHistoryTree
{
28 * Interface for history to create the various HTNodes
30 interface IHTNodeFactory
{
33 * Creates a new core node for the specific history tree
36 * Configuration of the History Tree
38 * The (unique) sequence number assigned to this particular
40 * @param parentSeqNumber
41 * The sequence number of this node's parent node
43 * The earliest timestamp stored in this node
44 * @return The new core node
46 * any exception occurring while trying to read/create the
49 HTNode
createCoreNode(HTConfig config
, int seqNumber
, int parentSeqNumber
, long start
) throws IOException
;
52 * Creates a new core node for the specific history tree
55 * Configuration of the History Tree
57 * The (unique) sequence number assigned to this particular
59 * @param parentSeqNumber
60 * The sequence number of this node's parent node
62 * The earliest timestamp stored in this node
63 * @return The new core node
65 * any exception occurring while trying to read/create the
68 HTNode
createLeafNode(HTConfig config
, int seqNumber
, int parentSeqNumber
, long start
) throws IOException
;
72 * Size of the "tree header" in the tree-file The nodes will use this offset
73 * to know where they should be in the file. This should always be a
76 int TREE_HEADER_SIZE
= 4096;
79 * "Save" the tree to disk. This method will cause the treeIO object to
80 * commit all nodes to disk and then return the RandomAccessFile descriptor
81 * so the Tree object can save its configuration into the header of the
84 * @param requestedEndTime
85 * The greatest timestamp present in the history tree
87 void closeTree(long requestedEndTime
);
89 // ------------------------------------------------------------------------
91 // ------------------------------------------------------------------------
94 * Get the start time of this tree.
96 * @return The start time
101 * Get the current end time of this tree.
103 * @return The end time
108 * Get the number of nodes in this tree.
110 * @return The number of nodes
115 * Get the current root node of this tree
117 * @return The root node
119 HTNode
getRootNode();
121 // ------------------------------------------------------------------------
123 // ------------------------------------------------------------------------
126 * Return the FileInputStream reader with which we will read an attribute
127 * tree (it will be sought to the correct position).
129 * @return The FileInputStream indicating the file and position from which
130 * the attribute tree can be read.
132 FileInputStream
supplyATReader();
135 * Return the file to which we will write the attribute tree.
137 * @return The file to which we will write the attribute tree
139 File
supplyATWriterFile();
142 * Return the position in the file (given by {@link #supplyATWriterFile})
143 * where to start writing the attribute tree.
145 * @return The position in the file where to start writing
147 long supplyATWriterFilePos();
150 * Read a node from the tree.
153 * The sequence number of the node to read
155 * @throws ClosedChannelException
156 * If the tree IO is unavailable
158 HTNode
readNode(int seqNumber
) throws ClosedChannelException
;
161 * Write a node object to the history file.
164 * The node to write to disk
166 void writeNode(HTNode node
);
169 * Close the history file.
174 * Delete the history file.
178 // ------------------------------------------------------------------------
180 // ------------------------------------------------------------------------
183 * Insert an interval in the tree.
186 * The interval to be inserted
187 * @throws TimeRangeException
188 * If the start of end time of the interval are invalid
190 void insertInterval(HTInterval interval
) throws TimeRangeException
;
193 * Get the current size of the history file.
195 * @return The history file size
This page took 0.035795 seconds and 5 git commands to generate.