|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.sparse.TPS
public class TPS
Default implementation.
| Nested Class Summary | |
|---|---|
protected static class |
TPS.TP
A {property, timestamp} tuple. |
static class |
TPS.TPV
Helper class models a single property value as of a given timestamp. |
protected static class |
TPS.TPVComparator
Imposes ordering based on schema, property name, and timestamp. |
| Field Summary | |
|---|---|
protected static boolean |
DEBUG
|
protected static boolean |
INFO
|
protected static org.apache.log4j.Logger |
log
|
| Fields inherited from interface com.bigdata.sparse.IRowStoreConstants |
|---|
AUTO_TIMESTAMP, AUTO_TIMESTAMP_UNIQUE, CURRENT_ROW, MAX_TIMESTAMP, MIN_TIMESTAMP |
| Constructor Summary | |
|---|---|
TPS()
De-serialization constructor. |
|
TPS(Schema schema,
long timestamp)
|
|
| Method Summary | |
|---|---|
Map<String,Object> |
asMap()
Return a copy of the tuples showing only the most recent value for each property. |
Map<String,Object> |
asMap(long timestamp)
Return a copy of the tuples showing only the most recent value for each property whose timestamp is not greater than the given timestamp. |
LinkedHashMap<String,Object> |
asMap(long timestamp,
INameFilter filter)
Note: A LinkedHashMap is returned to reduce the overhead with
iterators while preserving the ordering imposed by tuples. |
TPS |
currentRow()
Filters for the current row (most recent bindings) |
TPS |
currentRow(INameFilter filter)
Filters for the current row (most recent bindings) |
TPS |
filter(INameFilter filter)
Filters for only those bindings that satisify the given filter. |
TPS |
filter(long fromTime,
long toTime)
Filters for only those bindings whose timestamp is GTE to the given timestamp. |
TPS |
filter(long fromTime,
long toTime,
INameFilter filter)
Filters for only those bindings whose timestamp is GTE to the given timestamp and which satisify the optional property name filter. |
ITPV |
get(String name)
Return the most recent value for the named property. |
ITPV |
get(String name,
long timestamp)
Return the most recent value for the named property whose timestamp is not greater than the specified timestamp. |
Object |
getPrimaryKey()
The value of the primary key. |
Schema |
getSchema()
The Schema name. |
long |
getWriteTimestamp()
The timestamp assigned by an atomic write operation (for atomic readback only). |
boolean |
isPreconditionOk()
true unless an atomic write operation specified an
IPrecondition and that IPrecondition was not satisified. |
Iterator<ITPV> |
iterator()
Visits all tuples in order by ascending timestamp. |
void |
readExternal(ObjectInput in)
|
void |
set(String name,
long timestamp,
Object value)
Set the value of the named property as of the specified timestamp. |
int |
size()
The #of tuples - each tuple is an ITPV. |
String |
toString()
|
void |
writeExternal(ObjectOutput out)
FIXME use compression for the names and timestamps, refactoring the logic already in AbstractKeyArrayIndexProcedure. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final transient org.apache.log4j.Logger log
protected static final transient boolean INFO
protected static final transient boolean DEBUG
| Constructor Detail |
|---|
public TPS()
public TPS(Schema schema,
long timestamp)
schema - The schema.timestamp - When the data were read back as part of an atomic write, then
this MUST be the timestamp of the atomic write. That can be
either a caller given timestamp or a server assigned
timestamp. Regardless the value will be returned by
getWriteTimestamp(). When the operation was an atomic
read, then the timestamp MUST be ZERO (0L).| Method Detail |
|---|
public boolean isPreconditionOk()
true unless an atomic write operation specified an
IPrecondition and that IPrecondition was not satisified.
public Object getPrimaryKey()
Note: This looks up and returns the value of the
Schema.getPrimaryKeyName() property
getPrimaryKey in interface ITPSnull if there
is no property value bound for the property named by
Schema.getName().public long getWriteTimestamp()
ITPS
getWriteTimestamp in interface ITPSpublic int size()
ITPSITPV.
size in interface ITPS
public void set(String name,
long timestamp,
Object value)
name - The property name.timestamp - The timestamp.value - The property value -or- null if the property
was deleted as of the given timestamp.
public ITPV get(String name,
long timestamp)
ITPS
get in interface ITPSname - The property name.timestamp - The timestamp.
null.public ITPV get(String name)
ITPS
get in interface ITPSname - The propery name.
null. If no value was found
for the named property, then ITPV.getValue() will return
null and ITPV.getTimestamp() will return
0L.public Schema getSchema()
ITPSSchema name.
getSchema in interface ITPSpublic Iterator<ITPV> iterator()
ITPS
iterator in interface ITPSpublic TPS currentRow()
public TPS currentRow(INameFilter filter)
filter - An optional property name filter.
public TPS filter(long fromTime,
long toTime)
public TPS filter(INameFilter filter)
filter - An optional filter.
public TPS filter(long fromTime,
long toTime,
INameFilter filter)
public Map<String,Object> asMap()
ITPS
asMap in interface ITPSpublic Map<String,Object> asMap(long timestamp)
ITPS
asMap in interface ITPStimestamp - The timestamp (use Long.MAX_VALUE to read the most
recent value for each property).
public LinkedHashMap<String,Object> asMap(long timestamp,
INameFilter filter)
LinkedHashMap is returned to reduce the overhead with
iterators while preserving the ordering imposed by tuples.
asMap in interface ITPStimestamp - The timestamp (use Long.MAX_VALUE to read the most
recent value for each property).filter - An optional filter that may be used to select only specific
property names.
public void writeExternal(ObjectOutput out)
throws IOException
AbstractKeyArrayIndexProcedure.
writeExternal in interface ExternalizableIOException
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizableIOException
ClassNotFoundExceptionpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||