use of com.cinchapi.concourse.server.model.Text in project concourse by cinchapi.
the class AtomicOperation method browse.
@Override
public final Map<TObject, Set<Long>> browse(String key) throws AtomicStateException {
checkState();
Text key0 = Text.wrapCached(key);
RangeToken rangeToken = RangeToken.forReading(key0, Operator.BETWEEN, Value.NEGATIVE_INFINITY, Value.POSITIVE_INFINITY);
source.addVersionChangeListener(rangeToken, this);
Iterable<Range<Value>> ranges = RangeTokens.convertToRange(rangeToken);
for (Range<Value> range : ranges) {
rangeReads2Lock.put(key0, range);
}
return super.browse(key);
}
use of com.cinchapi.concourse.server.model.Text in project concourse by cinchapi.
the class AtomicOperation method explore.
@Override
public Map<Long, Set<TObject>> explore(String key, Aliases aliases) {
checkState();
Operator operator = aliases.operator();
TObject[] values = aliases.values();
Text key0 = Text.wrapCached(key);
RangeToken rangeToken = RangeToken.forReading(key0, operator, Transformers.transformArray(values, Value::wrap, Value.class));
source.addVersionChangeListener(rangeToken, this);
Iterable<Range<Value>> ranges = RangeTokens.convertToRange(rangeToken);
for (Range<Value> range : ranges) {
rangeReads2Lock.put(key0, range);
}
return super.explore(key, aliases);
}
use of com.cinchapi.concourse.server.model.Text in project concourse by cinchapi.
the class TableChunkTest method testInsertLocatorWithTrailingWhiteSpace.
@Test
public void testInsertLocatorWithTrailingWhiteSpace() {
Identifier locator = Identifier.of(1);
Text key = Text.wrap("Youtube Embed Link ");
Value value = Value.wrap(Convert.javaToThrift("http://youtube.com"));
chunk.insert(locator, key, value, Time.now(), Action.ADD);
TableRecord record = TableRecord.createPartial(locator, key);
chunk.transfer(file);
chunk = load(file, filter, chunk.manifest());
chunk.seek(Composite.create(locator, key), record);
Assert.assertTrue(record.get(key).contains(value));
}
use of com.cinchapi.concourse.server.model.Text in project concourse by cinchapi.
the class OffHeapTextSetTest method testContains.
@Test
public void testContains() {
List<String> corpus = new ArrayList<>();
for (int i = 0; i < 5 * TestData.getScaleCount(); ++i) {
corpus.add(Random.getString());
}
Set<Text> ohts = OffHeapTextSet.test();
Set<Text> control = new HashSet<>();
Iterator<String> it = corpus.iterator();
while (it.hasNext()) {
Text string = Text.wrap(it.next());
if (TestData.getScaleCount() % 3 == 0) {
control.add(string);
ohts.add(string);
}
}
it = corpus.iterator();
while (it.hasNext()) {
Text string = Text.wrap(it.next());
Assert.assertEquals(control.contains(string), ohts.contains(string));
}
}
use of com.cinchapi.concourse.server.model.Text in project concourse by cinchapi.
the class OffHeapTextSetTest method testAdd.
@Test
public void testAdd() {
List<String> corpus = new ArrayList<>();
for (int i = 0; i < 5 * TestData.getScaleCount(); ++i) {
corpus.add(Random.getString());
}
Set<Text> ohts = OffHeapTextSet.test();
Set<Text> control = new HashSet<>();
Iterator<String> it = corpus.iterator();
while (it.hasNext()) {
Text string = Text.wrap(it.next());
if (TestData.getScaleCount() % 3 == 0) {
control.add(string);
ohts.add(string);
}
}
it = corpus.iterator();
while (it.hasNext()) {
Text string = Text.wrap(it.next());
if (TestData.getScaleCount() % 2 == 0) {
Assert.assertEquals(control.add(string), ohts.add(string));
}
}
}
Aggregations