use of com.cinchapi.concourse.server.model.Text in project concourse by cinchapi.
the class Buffer method chronologize.
@Override
public Map<Long, Set<TObject>> chronologize(String key, long record, long start, long end, Map<Long, Set<TObject>> context) {
Set<TObject> snapshot = Iterables.getLast(context.values(), Sets.<TObject>newLinkedHashSet());
if (snapshot.isEmpty() && !context.isEmpty()) {
// CON-474: Empty set is placed in the context if it was the last
// snapshot known to the database
context.remove(Time.NONE);
}
Iterator<Write> it = iterator(key, record, end - 1);
try {
while (it.hasNext()) {
Write write = it.next();
long timestamp = write.getVersion();
Text $key = write.getKey();
long $record = write.getRecord().longValue();
Action action = write.getType();
if ($key.toString().equals(key) && $record == record) {
snapshot = Sets.newLinkedHashSet(snapshot);
Value value = write.getValue();
if (action == Action.ADD) {
snapshot.add(value.getTObject());
} else if (action == Action.REMOVE) {
snapshot.remove(value.getTObject());
}
if (timestamp >= start) {
context.put(timestamp, snapshot);
}
}
}
return Maps.filterValues(context, emptySetFilter);
} finally {
Iterators.close(it);
}
}
use of com.cinchapi.concourse.server.model.Text in project concourse by cinchapi.
the class Database method explore.
@Override
public Map<Long, Set<TObject>> explore(String key, Aliases aliases, long timestamp) {
Text L = Text.wrapCached(key);
IndexRecord index = getIndexRecord(L);
Value[] Ks = Transformers.transformArray(aliases.values(), Value::wrap, Value.class);
Map<Identifier, Set<Value>> map = index.findAndGet(timestamp, aliases.operator(), Ks);
return Transformers.transformTreeMapSet(map, Identifier::longValue, Value::getTObject, Long::compare);
}
use of com.cinchapi.concourse.server.model.Text in project concourse by cinchapi.
the class Database method verify.
@Override
public boolean verify(Write write, long timestamp) {
Identifier L = write.getRecord();
Text K = write.getKey();
Value V = write.getValue();
TableRecord table = getTableRecord(L, K);
return table.contains(K, V, timestamp);
}
use of com.cinchapi.concourse.server.model.Text in project concourse by cinchapi.
the class Database method gather.
@Override
public Set<TObject> gather(String key, long record, long timestamp) {
Text L = Text.wrapCached(key);
Identifier V = Identifier.of(record);
IndexRecord index = getIndexRecord(L);
Set<Value> Ks = index.gather(V, timestamp);
return Transformers.transformSet(Ks, Value::getTObject);
}
use of com.cinchapi.concourse.server.model.Text in project concourse by cinchapi.
the class Database method verify.
@Override
public boolean verify(Write write) {
Identifier L = write.getRecord();
Text K = write.getKey();
Value V = write.getValue();
Record<Identifier, Text, Value> table = ENABLE_VERIFY_BY_LOOKUP ? getLookupRecord(L, K, V) : getTableRecord(L, K);
return table.contains(K, V);
}
Aggregations