Search in sources :

Example 66 with TObject

use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.

the class LargeDataFileDetectionLocalTest method main.

// NOTE: This is designed to be run locally in an IDE or the command line
// where the heap size can be set sufficiently large
public static void main(String... args) throws SegmentLoadingException {
    String directory = FileOps.tempDir("test");
    Segment segment = Segment.create();
    Assert.assertTrue(FileSystem.ls(Paths.get(directory)).count() == 0);
    String str = FileOps.read(Resources.getAbsolutePath("/long-string.txt"));
    TObject value = Convert.javaToThrift(Tag.create(str));
    int expected = 0;
    while (segment.table().length() <= Integer.MAX_VALUE) {
        System.out.println(segment.table().length());
        segment.acquire(Write.add(Random.getSimpleString(), value, 1));
        ++expected;
    }
    System.out.println(segment.table().length() + " vs " + Integer.MAX_VALUE);
    Path file = Paths.get(directory).resolve(UUID.randomUUID().toString());
    segment.transfer(file);
    System.out.println(file);
    Assert.assertTrue(FileSystem.ls(Paths.get(directory)).count() > 0);
    segment = Segment.load(file);
    long actual = segment.writes().count();
    System.out.println("Expected " + expected + " revisions and there are actually " + actual);
    Assert.assertEquals(expected, actual);
}
Also used : Path(java.nio.file.Path) TObject(com.cinchapi.concourse.thrift.TObject)

Example 67 with TObject

use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.

the class WriteTest method testEqualsDiffType.

@Test
public void testEqualsDiffType() {
    String key = TestData.getString();
    TObject value = TestData.getTObject();
    long record = TestData.getLong();
    Assert.assertEquals(Write.add(key, value, record), Write.remove(key, value, record));
    Assert.assertEquals(Write.add(key, value, record), Write.notStorable(key, value, record));
    Assert.assertEquals(Write.remove(key, value, record), Write.notStorable(key, value, record));
}
Also used : TObject(com.cinchapi.concourse.thrift.TObject) ByteableTest(com.cinchapi.concourse.server.io.ByteableTest) Test(org.junit.Test)

Example 68 with TObject

use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.

the class WriteTest method testHashSameType.

@Test
public void testHashSameType() {
    String key = TestData.getString();
    TObject value = TestData.getTObject();
    long record = TestData.getLong();
    long version = CommitVersions.next();
    Write w1 = Write.add(key, value, record).rewrite(version);
    Write w2 = Write.add(key, value, record).rewrite(version);
    Assert.assertEquals(w1.hash(), w2.hash());
}
Also used : TObject(com.cinchapi.concourse.thrift.TObject) ByteableTest(com.cinchapi.concourse.server.io.ByteableTest) Test(org.junit.Test)

Example 69 with TObject

use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.

the class LazyTrackingTObjectResultDataset method deserialize.

@Override
public void deserialize(Buffer buffer) {
    while (buffer.hasRemaining()) {
        long entity = buffer.readLong();
        int entries = buffer.readInt();
        for (int h = 0; h < entries; ++h) {
            String attribute = buffer.readUTF8();
            int values = buffer.readInt();
            for (int i = 0; i < values; ++i) {
                TObject value = deserializeValue(buffer);
                insert(entity, attribute, value);
            }
        }
    }
}
Also used : TObject(com.cinchapi.concourse.thrift.TObject)

Example 70 with TObject

use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.

the class ObjectResultDataset method deserializeValue.

@Override
protected Object deserializeValue(Buffer buffer) {
    Type type = Type.values()[buffer.readByte()];
    int length = buffer.readInt();
    byte[] data = new byte[length];
    buffer.read(data);
    TObject value = new TObject(ByteBuffer.wrap(data), type);
    return Convert.thriftToJava(value);
}
Also used : Type(com.cinchapi.concourse.thrift.Type) TObject(com.cinchapi.concourse.thrift.TObject)

Aggregations

TObject (com.cinchapi.concourse.thrift.TObject)242 Test (org.junit.Test)100 ComplexTObject (com.cinchapi.concourse.thrift.ComplexTObject)98 Set (java.util.Set)98 AtomicSupport (com.cinchapi.concourse.server.storage.AtomicSupport)96 TranslateClientExceptions (com.cinchapi.concourse.server.aop.TranslateClientExceptions)91 VerifyAccessToken (com.cinchapi.concourse.server.aop.VerifyAccessToken)91 VerifyReadPermission (com.cinchapi.concourse.server.aop.VerifyReadPermission)88 Map (java.util.Map)76 AbstractSyntaxTree (com.cinchapi.ccl.syntax.AbstractSyntaxTree)72 SortableTable (com.cinchapi.concourse.data.sort.SortableTable)71 Store (com.cinchapi.concourse.server.storage.Store)66 Order (com.cinchapi.concourse.lang.sort.Order)63 SortableColumn (com.cinchapi.concourse.data.sort.SortableColumn)61 SortableSet (com.cinchapi.concourse.data.sort.SortableSet)60 ByteBuffer (java.nio.ByteBuffer)60 Operator (com.cinchapi.concourse.thrift.Operator)59 Entry (java.util.Map.Entry)59 Convert (com.cinchapi.concourse.util.Convert)57 Sets (com.google.common.collect.Sets)57