Package org.lilyproject.repository.api

Examples of org.lilyproject.repository.api.AbsoluteRecordId


    @Override
    public AbsoluteRecordId next() throws IOException {
        synchronized (this) { // to protect setting/resetting the next value from race conditions
            if (next != null) {
                // the next was already set, but not yet used
                AbsoluteRecordId nextToReturn = next;
                next = null;
                return nextToReturn;
            } else {
                // try setting a next value
                next = getNextFromQueryResult();
View Full Code Here


    private final IdGenerator idGenerator = new IdGeneratorImpl();

    @Test
    public void testSerializationRoundTrip() {
        AbsoluteRecordId id = new AbsoluteRecordIdImpl("mytable", idGenerator.fromString("USER.myId"));
        byte[] bytes = id.toBytes();
        AbsoluteRecordId deserialized = AbsoluteRecordIdImpl.fromBytes(bytes, idGenerator);

        assertEquals(id, deserialized);
    }
View Full Code Here

        assertEquals(id, deserialized);
    }

    @Test
    public void testEquals() {
        AbsoluteRecordId idA1 = new AbsoluteRecordIdImpl("mytable", idGenerator.fromString("USER.myId"));
        AbsoluteRecordId idA2 = new AbsoluteRecordIdImpl("mytable", idGenerator.fromString("USER.myId"));
        AbsoluteRecordId idB = new AbsoluteRecordIdImpl("othertable", idGenerator.fromString("USER.myId"));
        AbsoluteRecordId idC = new AbsoluteRecordIdImpl("mytable", idGenerator.fromString("USER.otherId"));

        assertEquals(idA1, idA2);
        assertFalse(idA1.equals(idB));
        assertFalse(idA1.equals(idC));
    }
View Full Code Here

            recordEvent = event.getRecordEvent();
        } catch (IOException e) {
            log.error("Error reading record event, processing of message cancelled", e);
            return;
        }
        AbsoluteRecordId absoluteRecordId = event.getAbsoluteRecordId();
        update(absoluteRecordId, recordEvent);
    }
View Full Code Here

        // check that both dependant1 and dependant2 are found as dependants of the dependency
        final DependantRecordIdsIterator dependants =
                derefMap.findDependantsOf(absId(dependency), dependencyField, dummyVtag);
        assertTrue(dependants.hasNext());
        final AbsoluteRecordId firstFoundDependant = dependants.next();
        assertTrue(dependants.hasNext());
        final AbsoluteRecordId secondFoundDependant = dependants.next();
        assertFalse(dependants.hasNext());

        // check that the two found dependants are dependant1 and dependant2 (order doesn't matter)
        assertTrue((absId(dependant1).equals(firstFoundDependant) && absId(dependant2).equals(secondFoundDependant)) ||
                (absId(dependant2).equals(firstFoundDependant) && absId(dependant1).equals(secondFoundDependant)));
View Full Code Here

        // dereferenced into multiple vtagged versions of another record, and we don't know what the [indexed]
        // vtags of that other record are.
        for (SchemaId vtag : allVTags) {
            if ((changedVTagFields != null && changedVTagFields.contains(vtag)) || updatedFieldsByScope == null) {
                // changed vtags or delete: reindex regardless of fields
                AbsoluteRecordId absRecordId = new AbsoluteRecordIdImpl(table, recordId);
                DependantRecordIdsIterator dependants = derefMap.findDependantsOf(absRecordId);
                if (log.isDebugEnabled()) {
                    log.debug("changed vtag: dependants of " + recordId + ": " +
                            depIds(derefMap.findDependantsOf(absRecordId)));
                }
                while (dependants.hasNext()) {
                    referrersAndVTags.put(dependants.next(), vtag);
                }
            } else {
                // vtag didn't change, but some fields did change:
                Set<SchemaId> fields = new HashSet<SchemaId>();
                for (Scope scope : updatedFieldsByScope.keySet()) {
                    fields.addAll(toSchemaIds(updatedFieldsByScope.get(scope)));
                }
                AbsoluteRecordId absRecordId = new AbsoluteRecordIdImpl(table, recordId);
                final DependantRecordIdsIterator dependants = derefMap.findDependantsOf(absRecordId, fields, vtag);
                while (dependants.hasNext()) {
                    referrersAndVTags.put(dependants.next(), vtag);
                }
            }
View Full Code Here

TOP

Related Classes of org.lilyproject.repository.api.AbsoluteRecordId

Copyright © 2018 www.massapicom. 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.