com.thinkaurelius.titan.diskstorage.log

## Class ReadMarker

- java.lang.Object
- - com.thinkaurelius.titan.diskstorage.log.ReadMarker

-     public class ReadMarker
      extends Object

  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ReadMarker` | `fromIdentifierOrNow(String id)` Like `fromIdentifierOrTime(String, long, java.util.concurrent.TimeUnit)` but uses the current time point as the starting timestamp if the log has no record of the id.
    `static ReadMarker` | `fromIdentifierOrTime(String id, long timestamp, TimeUnit unit)` Starts reading the log from the last recorded point in the log for the given id.
    `static ReadMarker` | `fromNow()` Starts reading the log such that it will start with the first entry written after now.
    `static ReadMarker` | `fromTime(long timestamp, TimeUnit unit)` Starts reading the log from the given timestamp onward.
    `String` | `getIdentifier()` Returns the configured identifier of this marker or throws an exception if none exists.
    `Timepoint` | `getStartTime(TimestampProvider times)` Returns the start time of this marker if such has been defined or the current time if not
    `boolean` | `hasIdentifier()` Whether this read marker has a configured identifier
    `boolean` | `hasStartTime()`
    `boolean` | `isCompatible(ReadMarker newMarker)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### hasIdentifier

          public boolean hasIdentifier()

      Whether this read marker has a configured identifier
      Returns:

    - #### getIdentifier

          public String getIdentifier()

      Returns the configured identifier of this marker or throws an exception if none exists.
      Returns:

    - #### hasStartTime

          public boolean hasStartTime()

    - #### getStartTime

          public Timepoint getStartTime(TimestampProvider times)

      Returns the start time of this marker if such has been defined or the current time if not
      Returns:

    - #### isCompatible

          public boolean isCompatible(ReadMarker newMarker)

      Parameters:
        `newMarker` -
      Returns:

    - #### fromNow

          public static ReadMarker fromNow()

      Starts reading the log such that it will start with the first entry written after now.
      Returns:

    - #### fromTime

          public static ReadMarker fromTime(long timestamp,
                            TimeUnit unit)

      Starts reading the log from the given timestamp onward. The specified timestamp is included.
      Parameters:
        `timestamp` -
      Returns:

    - #### fromIdentifierOrTime

          public static ReadMarker fromIdentifierOrTime(String id,
                                        long timestamp,
                                        TimeUnit unit)

      Starts reading the log from the last recorded point in the log for the given id. If the log has a record of such an id, it will use it as the starting point. If not, it will start from the given timestamp and set it as the first read record for the given id.

      Identified read markers of this kind are useful to continuously read from the log. In the case of failure, the last read record can be recovered for the id and log reading can be resumed from there. Note, that some records might be read twice in that event depending on the guarantees made by a particular implementation.
      Parameters:
        `id` -
        `timestamp` -
      Returns:

    - #### fromIdentifierOrNow

          public static ReadMarker fromIdentifierOrNow(String id)

      Like `fromIdentifierOrTime(String, long, java.util.concurrent.TimeUnit)` but uses the current time point as the starting timestamp if the log has no record of the id.
      Parameters:
        `id` -
      Returns:

Copyright © 2012–2014. All rights reserved.