net.conquiris.api.index
Class IndexInfo

java.lang.Object
  extended by net.conquiris.api.index.IndexInfo

@Immutable
public final class IndexInfo
extends Object

Conquiris index info at a certain commit point.

Author:
Andres Rodriguez

Field Summary
static String CHECKPOINT
          Checkpoint property.
static String CHECKPOINT_NAME
          Checkpoint property unqualified name.
static String RESERVED_PREFIX
          Reserved commit properties prefix.
static String SEQUENCE
          Sequence property.
static String SEQUENCE_NAME
          Sequence property unqualified name.
static String TARGET_CHECKPOINT
          Target checkpoint property.
static String TARGET_CHECKPOINT_NAME
          Target checkpoint property unqualified name.
static String TIMESTAMP
          Timestamp property.
static String TIMESTAMP_NAME
          Timestamp property unqualified name.
 
Method Summary
 IndexInfo asBasic()
          Returns a basic version without user properties.
static IndexInfo empty()
          Returns the empty object.
 boolean equals(Object obj)
           
static IndexInfo fromMap(Map<String,String> data)
          Creates a new index info object from a string map.
 String getCheckpoint()
          Returns the checkpoint.
 com.google.common.collect.ImmutableMap<String,String> getProperties()
          Returns the commit properties.
 long getSequence()
          Returns the commit sequence.
 String getTargetCheckpoint()
          Returns the last known target checkpoint.
 long getTimestamp()
          Returns the commit timestamp.
 int hashCode()
           
static com.google.common.base.Predicate<String> isReserved()
          Returns the reserved property name predicate.
static boolean isReserved(String key)
          Returns whether a property name is reserved.
static com.google.common.base.Predicate<Map.Entry<String,String>> isUserProperty()
          Returns the valid user property predicate.
static boolean isUserProperty(Map.Entry<String,String> entry)
          Returns whether the provided entry is a valid user property.
static boolean isUserProperty(String key, String value)
          Returns whether the provided entry is a valid user property.
static IndexInfo of(String checkpoint, String targetCheckpoint, long timestamp, long sequence, Map<String,String> properties)
          Creates a new index info object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RESERVED_PREFIX

public static final String RESERVED_PREFIX
Reserved commit properties prefix.

See Also:
Constant Field Values

CHECKPOINT_NAME

public static final String CHECKPOINT_NAME
Checkpoint property unqualified name.

See Also:
Constant Field Values

TARGET_CHECKPOINT_NAME

public static final String TARGET_CHECKPOINT_NAME
Target checkpoint property unqualified name.

See Also:
Constant Field Values

TIMESTAMP_NAME

public static final String TIMESTAMP_NAME
Timestamp property unqualified name.

See Also:
Constant Field Values

SEQUENCE_NAME

public static final String SEQUENCE_NAME
Sequence property unqualified name.

See Also:
Constant Field Values

CHECKPOINT

public static final String CHECKPOINT
Checkpoint property.

See Also:
Constant Field Values

TARGET_CHECKPOINT

public static final String TARGET_CHECKPOINT
Target checkpoint property.

See Also:
Constant Field Values

TIMESTAMP

public static final String TIMESTAMP
Timestamp property.

See Also:
Constant Field Values

SEQUENCE

public static final String SEQUENCE
Sequence property.

See Also:
Constant Field Values
Method Detail

isReserved

public static boolean isReserved(String key)
Returns whether a property name is reserved.


isReserved

public static com.google.common.base.Predicate<String> isReserved()
Returns the reserved property name predicate.


isUserProperty

public static boolean isUserProperty(String key,
                                     String value)
Returns whether the provided entry is a valid user property.


isUserProperty

public static boolean isUserProperty(Map.Entry<String,String> entry)
Returns whether the provided entry is a valid user property.


isUserProperty

public static com.google.common.base.Predicate<Map.Entry<String,String>> isUserProperty()
Returns the valid user property predicate.


empty

public static IndexInfo empty()
Returns the empty object.


of

public static IndexInfo of(@Nullable
                           String checkpoint,
                           @Nullable
                           String targetCheckpoint,
                           long timestamp,
                           long sequence,
                           Map<String,String> properties)
Creates a new index info object.

Parameters:
checkpoint - Checkpoint.
timestamp - Commit timestamp. Must be >= 0.
sequence - Commit sequence. Must be >= 0.
properties - User properties. Must be non-null and contain no reserved properties.
Returns:
The created object.
Throws:
IllegalArgumentException - if any of the arguments is invalid.

fromMap

public static IndexInfo fromMap(Map<String,String> data)
Creates a new index info object from a string map. Reserved properties are extracted with default values provided if needed. Invalid user properties are filtered out.

Parameters:
data - Commit data.
Returns:
The created object.

asBasic

public IndexInfo asBasic()
Returns a basic version without user properties.


getCheckpoint

public String getCheckpoint()
Returns the checkpoint.


getTargetCheckpoint

public String getTargetCheckpoint()
Returns the last known target checkpoint.


getTimestamp

public long getTimestamp()
Returns the commit timestamp.


getSequence

public long getSequence()
Returns the commit sequence.


getProperties

public com.google.common.collect.ImmutableMap<String,String> getProperties()
Returns the commit properties.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012 Derquinse Projects.. All Rights Reserved.