public class TPS extends Object implements ITPS, Externalizable, IRowStoreConstants
Modifier and Type | Class and Description |
---|---|
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.
|
Modifier and Type | Field and Description |
---|---|
protected static org.apache.log4j.Logger |
log |
AUTO_TIMESTAMP, AUTO_TIMESTAMP_UNIQUE, CURRENT_ROW, MAX_TIMESTAMP, MIN_TIMESTAMP
Constructor and Description |
---|
TPS()
De-serialization constructor.
|
TPS(Schema schema,
long timestamp) |
Modifier and Type | Method and Description |
---|---|
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 . |
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).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 ITPS
null
if there
is no property value bound for the property named by
Schema.getName()
.public long getWriteTimestamp()
ITPS
getWriteTimestamp
in interface ITPS
public int size()
ITPS
ITPV
.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
public ITPV get(String name)
ITPS
get
in interface ITPS
name
- 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 Iterator<ITPV> iterator()
ITPS
public 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
public Map<String,Object> asMap(long timestamp)
ITPS
asMap
in interface ITPS
timestamp
- 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 ITPS
timestamp
- 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 Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.