tmf: Bump plugins version to 2.0 for Kepler branch
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / trace / ITmfTraceIndexer.java
CommitLineData
20658947
FC
1/*******************************************************************************
2 * Copyright (c) 2012 Ericsson
9b749023 3 *
20658947
FC
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
9b749023 8 *
20658947
FC
9 * Contributors:
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.linuxtools.tmf.core.trace;
14
15import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
16import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
9e0640dc 17import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
20658947
FC
18
19/**
9e0640dc 20 * The generic trace indexer in TMF with support for incremental indexing.
9b749023 21 *
0283f7ff
FC
22 * @param <T> The trace event type
23 *
f7703ed6
FC
24 * @version 1.0
25 * @author Francois Chouinard
26 *
27 * @see ITmfTrace
28 * @see ITmfEvent
20658947
FC
29 */
30public interface ITmfTraceIndexer<T extends ITmfTrace<ITmfEvent>> {
31
32 /**
33 * Start an asynchronous index building job and waits for the job completion
34 * if required. Typically, the indexing job sends notifications at regular
35 * intervals to indicate its progress.
9e0640dc
FC
36 * <p>
37 * <b>Example 1</b>: Index a whole trace asynchronously
063f0d27 38 *
9e0640dc
FC
39 * <pre>
40 * trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, false);
41 * </pre>
063f0d27 42 *
9e0640dc 43 * <b>Example 2</b>: Index a whole trace synchronously
063f0d27 44 *
9e0640dc
FC
45 * <pre>
46 * trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, true);
47 * </pre>
063f0d27 48 *
9e0640dc 49 * <b>Example 3</b>: Index a trace asynchronously, starting at rank 100
063f0d27 50 *
9e0640dc
FC
51 * <pre>
52 * trace.getIndexer().buildIndex(100, TmfTimeRange.ETERNITY, false);
53 * </pre>
063f0d27
AM
54 *
55 * <b>Example 4</b>: Index a trace asynchronously, starting at rank 100 for
56 * events between T1 and T2 (inclusive). This is used for incremental
57 * indexing.
58 *
9e0640dc
FC
59 * <pre>
60 * TmfTimeRange range = new TmfTimeRange(T1, T2);
61 * trace.getIndexer().buildIndex(100, range, false);
62 * </pre>
9b749023 63 *
063f0d27
AM
64 * @param offset
65 * The offset of the first event to consider
66 * @param range
67 * The time range to consider
20658947 68 * @param waitForCompletion
063f0d27
AM
69 * Should we block the calling thread until the build is
70 * complete?
20658947 71 */
9e0640dc 72 public void buildIndex(long offset, TmfTimeRange range, boolean waitForCompletion);
9b749023 73
9e0640dc
FC
74 /**
75 * Indicates that the indexer is busy indexing the trace.
9b749023
AM
76 * Will always return false if the indexing is done synchronously.
77 *
9e0640dc
FC
78 * @return the state of the indexer (indexing or not)
79 */
80 public boolean isIndexing();
9b749023 81
20658947 82 /**
9b749023
AM
83 * Adds an entry to the trace index.
84 *
063f0d27
AM
85 * @param context The trace context to save
86 * @param timestamp The timestamp matching this context
20658947 87 */
d337369a 88 public void updateIndex(ITmfContext context, ITmfTimestamp timestamp);
9b749023 89
20658947
FC
90 /**
91 * Returns the context of the checkpoint immediately preceding the requested
92 * timestamp (or at the timestamp if it coincides with a checkpoint).
9b749023 93 *
20658947
FC
94 * @param timestamp the requested timestamp
95 * @return the checkpoint context
96 */
97 public ITmfContext seekIndex(ITmfTimestamp timestamp);
98
99 /**
100 * Returns the context of the checkpoint immediately preceding the requested
101 * rank (or at rank if it coincides with a checkpoint).
9b749023 102 *
20658947
FC
103 * @param rank the requested event rank
104 * @return the checkpoint context
105 */
106 public ITmfContext seekIndex(long rank);
107
b5ee6881
FC
108 /**
109 * Perform cleanup when the indexer is no longer required.
110 */
111 public void dispose();
112
20658947 113}
This page took 0.033538 seconds and 5 git commands to generate.