Package org.lilyproject.repository.api

Examples of org.lilyproject.repository.api.RecordId.toBytes()


            RecordId recordId = record.getId();
            if (recordId == null) {
                recordId = idGenerator.newRecordId();
            }

            byte[] rowId = recordId.toBytes();

            try {
                FieldTypes fieldTypes = typeManager.getFieldTypesSnapshot();

                long version = 1L;
View Full Code Here


                originalNextFields = filterMutableFields(originalNextRecord.getFields(), fieldTypes);
            } catch (VersionNotFoundException e) {
                // There is no next version of the record
            }

            Put put = new Put(recordId.toBytes());
            Set<BlobReference> referencedBlobs = new HashSet<BlobReference>();
            Set<BlobReference> unReferencedBlobs = new HashSet<BlobReference>();

            RecordEvent recordEvent = new RecordEvent();
            recordEvent.setType(Type.UPDATE);
View Full Code Here

                                                       SchemaId vtag) throws IOException {

        final RecordId master = parentRecordId.getRecordId().getMaster();

        final Query query = new Query();
        query.addEqualsCondition("dependency_masterrecordid", master.toBytes());
        if (vtag != null) {
            query.addEqualsCondition("dependant_vtag", vtag.getBytes());
        }

        query.setIndexFilter(new DerefMapIndexFilter(parentRecordId.getRecordId().getVariantProperties(), fields));
View Full Code Here

        if (filter.getRecordId() == null) {
            throw new IllegalArgumentException("Record ID should be specified in RecordIdPrefixFilter");
        }

        RecordId recordId = filter.getRecordId();
        byte[] rowKeyPrefix = recordId.toBytes();

        return new PrefixFilter(rowKeyPrefix);
    }
}
View Full Code Here

        // Type manager
        zk = new StateWatchingZooKeeper(zkConnectionString, zkSessionTimeout);
        typeMgr = new HBaseTypeManager(idGenerator, conf, zk, new HBaseTableFactoryImpl(conf));

        Get get = new Get(recordId.toBytes());
        get.setMaxVersions();
        Result row = table.get(get);

        NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long,byte[]>>> root = row.getMap();
View Full Code Here

    @Test
    public void testIdGeneratorDefault() {
        IdGenerator idGenerator = new IdGeneratorImpl();
        RecordId recordId = idGenerator.newRecordId();
        assertEquals(recordId, idGenerator.fromBytes(recordId.toBytes()));
        assertEquals(recordId, idGenerator.fromString(recordId.toString()));
    }

    @Test
    public void testUUID() {
View Full Code Here

        // Test string representation
        assertEquals(newRecordId, idGenerator.fromString(userRecordIDString));
        assertEquals(userRecordIDString, idGenerator.fromString(userRecordIDString).toString());

        // Test bytes representation cycle
        byte[] userRecordIdBytes = newRecordId.toBytes();
        assertArrayEquals(userRecordIdBytes, idGenerator.fromBytes(userRecordIdBytes).toBytes());

        assertEquals(userRecordIDString, idGenerator.fromBytes(userRecordIdBytes).toString());

        // Test the bytes representation is really what we expect it to be
View Full Code Here

        assertEquals(variantRecordIdString, variantRecordId.toString());
        assertEquals(variantRecordId, idGenerator.fromString(variantRecordIdString));

        // Test round-trip string & bytes conversion
        assertEquals(variantRecordId, idGenerator.fromString(variantRecordId.toString()));
        assertEquals(variantRecordId, idGenerator.fromBytes(variantRecordId.toBytes()));

        // Test bytes representation is really what we expect it to be
        byte[] masterIdBytes = new byte[] {
                /* uuid type marker */1,
                /* uuid bytes */-46, 124, -37, 110, -82, 109, 17, -49, -106, -72, 68, 69, 83, 84, 0, 0 };
View Full Code Here

                /* length of value (vint) */, 3
                /* the value (ABC) */, 65, 66, 67 };

        RecordId variantId = idGenerator.newRecordId(idGenerator.fromBytes(masterIdBytes),
                Collections.singletonMap("X", "ABC"));
        assertArrayEquals(variantIdBytes, variantId.toBytes());
    }

    @Test
    public void testUUUIDWithMultipleProperties() {
        IdGenerator idGenerator = new IdGeneratorImpl();
View Full Code Here

        assertEquals(variantRecordIdString, variantRecordId.toString());
        assertEquals(variantRecordId, idGenerator.fromString(variantRecordIdString));

        // Test round-trip string & bytes conversion
        assertEquals(variantRecordId, idGenerator.fromString(variantRecordIdString));
        assertEquals(variantRecordId, idGenerator.fromBytes(variantRecordId.toBytes()));
    }

    @Test
    public void testUserIdWithVariantProperties() {
        IdGenerator idGenerator = new IdGeneratorImpl();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.