2e4be6a6594251bffd946911cbfe5bcc9b64f08e
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.segmentstore.core / src / org / eclipse / tracecompass / segmentstore / core / ISegmentStore.java
1 /*******************************************************************************
2 * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir
3 *
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Alexandre Montplaisir - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.tracecompass.segmentstore.core;
14
15 import java.util.Collection;
16
17 /**
18 * Interface for segment-storing backends.
19 *
20 * @param <E>
21 * The type of {@link ISegment} element that will be stored in this
22 * database.
23 *
24 * @author Alexandre Montplaisir
25 */
26 public interface ISegmentStore<E extends ISegment> extends Collection<E> {
27
28 /**
29 * Retrieve all elements that inclusively cross the given position.
30 *
31 * @param position
32 * The target position. This would represent a timestamp, if the
33 * tree's X axis represents time.
34 * @return The intervals that cross this position
35 */
36 Iterable<E> getIntersectingElements(long position);
37
38 /**
39 * Retrieve all elements that inclusively cross another segment. We define
40 * this target segment by its start and end positions.
41 *
42 * This effectively means, all elements that respect *both* conditions:
43 *
44 * <ul>
45 * <li>Their end is after the 'start' parameter</li>
46 * <li>Their start is before the 'end' parameter</li>
47 * </ul>
48 *
49 * @param start
50 * The target start position
51 * @param end
52 * The target end position
53 * @return The elements overlapping with this segment
54 */
55 Iterable<E> getIntersectingElements(long start, long end);
56
57 /**
58 * Dispose the data structure and release any system resources associated
59 * with it.
60 */
61 void dispose();
62
63 /**
64 * Method to close off the segment store. This happens for example when we
65 * are done reading an off-line trace. Implementers can use this method to
66 * save the segment store on disk
67 *
68 * @param deleteFiles
69 * Whether to delete any file that was created while building the
70 * segment store
71 */
72 default void close(boolean deleteFiles) {
73
74 }
75 }
This page took 0.033923 seconds and 4 git commands to generate.