1 /*******************************************************************************
2 * Copyright (c) 2013 Ericsson
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
10 * Marc-Andre Laperle - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.core
.trace
.indexer
.checkpoint
;
15 import java
.util
.Collections
;
17 import org
.eclipse
.linuxtools
.tmf
.core
.timestamp
.TmfTimeRange
;
20 * A trace index contains the data (checkpoints) needed by the indexer so that it can perform
21 * its operations. Implementors can store checkpoints in various ways and
22 * optionally restore them later, see ({@link #isCreatedFromScratch})
25 * @author Marc-Andre Laperle
27 public interface ITmfCheckpointIndex
{
30 * Add a checkpoint to the index
33 * the checkpoint to add
35 void insert(ITmfCheckpoint checkpoint
);
38 * Get a checkpoint by checkpoint rank
40 * @param checkpointRank
41 * the checkpoint rank to search for
42 * @return the checkpoint found for the given checkpoint rank
44 ITmfCheckpoint
get(long checkpointRank
);
47 * Find the checkpoint rank of a checkpoint. Implementors must respect the
48 * contract of {@link Collections#binarySearch}
51 * the checkpoint to search for
52 * @return the checkpoint rank of the searched checkpoint, if it is
53 * contained in the index; otherwise, (-(insertion point) - 1).
55 long binarySearch(ITmfCheckpoint checkpoint
);
58 * Returns whether or not the index is empty
60 * @return true if empty false otherwise
65 * Returns the number of checkpoints in the index
67 * @return the number of checkpoints
72 * Dispose the index and its resources
77 * Returns whether or not the index was created from scratch. An index not
78 * created from scratch was typically loaded from disk.
80 * @return true if the index was created from scratch, false otherwise
82 boolean isCreatedFromScratch();
85 * Set trace time range to be stored in the index
88 * the time range to be stored in the index
90 void setTimeRange(TmfTimeRange timeRange
);
93 * Set the total number of events in the trace to be stored in the index
96 * the total number of events
98 void setNbEvents(long nbEvents
);
101 * Get the trace time range stored in the index
103 * @return the trace time range
105 TmfTimeRange
getTimeRange();
108 * Get the total number of events in the trace stored in the index
110 * @return the total number of events
115 * Set the index as complete. No more checkpoints will be inserted.
117 void setIndexComplete();