analysis: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / trace / indexer / checkpoint / ITmfCheckpointIndex.java
CommitLineData
032ecd45 1/*******************************************************************************
ed902a2b 2 * Copyright (c) 2013, 2014 Ericsson
032ecd45
MAL
3 *
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 *
9 * Contributors:
10 * Marc-Andre Laperle - Initial API and implementation
11 *******************************************************************************/
12
2bdf0193 13package org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint;
032ecd45
MAL
14
15import java.util.Collections;
16
2bdf0193 17import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
032ecd45
MAL
18
19/**
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})
23 *
032ecd45
MAL
24 * @author Marc-Andre Laperle
25 */
26public interface ITmfCheckpointIndex {
27
28 /**
29 * Add a checkpoint to the index
30 *
31 * @param checkpoint
32 * the checkpoint to add
33 */
34 void insert(ITmfCheckpoint checkpoint);
35
36 /**
37 * Get a checkpoint by checkpoint rank
38 *
39 * @param checkpointRank
40 * the checkpoint rank to search for
41 * @return the checkpoint found for the given checkpoint rank
42 */
43 ITmfCheckpoint get(long checkpointRank);
44
45 /**
46 * Find the checkpoint rank of a checkpoint. Implementors must respect the
47 * contract of {@link Collections#binarySearch}
48 *
49 * @param checkpoint
50 * the checkpoint to search for
51 * @return the checkpoint rank of the searched checkpoint, if it is
52 * contained in the index; otherwise, (-(insertion point) - 1).
53 */
54 long binarySearch(ITmfCheckpoint checkpoint);
55
56 /**
57 * Returns whether or not the index is empty
58 *
59 * @return true if empty false otherwise
60 */
61 boolean isEmpty();
62
63 /**
64 * Returns the number of checkpoints in the index
65 *
66 * @return the number of checkpoints
67 */
68 int size();
69
70 /**
71 * Dispose the index and its resources
72 */
73 void dispose();
74
75 /**
76 * Returns whether or not the index was created from scratch. An index not
77 * created from scratch was typically loaded from disk.
78 *
79 * @return true if the index was created from scratch, false otherwise
80 */
81 boolean isCreatedFromScratch();
82
83 /**
84 * Set trace time range to be stored in the index
85 *
86 * @param timeRange
87 * the time range to be stored in the index
88 */
89 void setTimeRange(TmfTimeRange timeRange);
90
91 /**
92 * Set the total number of events in the trace to be stored in the index
93 *
94 * @param nbEvents
95 * the total number of events
96 */
97 void setNbEvents(long nbEvents);
98
99 /**
100 * Get the trace time range stored in the index
101 *
102 * @return the trace time range
103 */
104 TmfTimeRange getTimeRange();
105
106 /**
107 * Get the total number of events in the trace stored in the index
108 *
109 * @return the total number of events
110 */
111 long getNbEvents();
112
113 /**
114 * Set the index as complete. No more checkpoints will be inserted.
115 */
116 void setIndexComplete();
117}
This page took 0.068294 seconds and 5 git commands to generate.