Search in sources :

Example 1 with RecordConsumer

use of org.apache.jackrabbit.oak.segment.Segment.RecordConsumer in project jackrabbit-oak by apache.

the class AbstractFileStore method readBinaryReferences.

static Set<String> readBinaryReferences(final Segment segment) {
    final Set<String> binaryReferences = new HashSet<>();
    segment.forEachRecord(new RecordConsumer() {

        @Override
        public void consume(int number, RecordType type, int offset) {
            if (type == RecordType.BLOB_ID) {
                binaryReferences.add(SegmentBlob.readBlobId(segment, number));
            }
        }
    });
    return binaryReferences;
}
Also used : RecordType(org.apache.jackrabbit.oak.segment.RecordType) RecordConsumer(org.apache.jackrabbit.oak.segment.Segment.RecordConsumer) HashSet(java.util.HashSet)

Example 2 with RecordConsumer

use of org.apache.jackrabbit.oak.segment.Segment.RecordConsumer in project jackrabbit-oak by apache.

the class DebugStore method analyseSegment.

private static void analyseSegment(final Segment segment, final RecordUsageAnalyser analyser) {
    final List<RecordId> ids = newArrayList();
    segment.forEachRecord(new RecordConsumer() {

        @Override
        public void consume(int number, RecordType type, int offset) {
            if (type == NODE) {
                ids.add(new RecordId(segment.getSegmentId(), number));
            }
        }
    });
    for (RecordId id : ids) {
        try {
            analyser.analyseNode(id);
        } catch (Exception e) {
            System.err.format("Error while processing node at %s", id);
            e.printStackTrace();
        }
    }
}
Also used : RecordType(org.apache.jackrabbit.oak.segment.RecordType) RecordId(org.apache.jackrabbit.oak.segment.RecordId) RecordConsumer(org.apache.jackrabbit.oak.segment.Segment.RecordConsumer)

Example 3 with RecordConsumer

use of org.apache.jackrabbit.oak.segment.Segment.RecordConsumer in project jackrabbit-oak by apache.

the class AbstractFileStore method populateTarBinaryReferences.

static void populateTarBinaryReferences(final Segment segment, final TarWriter w) {
    final int generation = segment.getGcGeneration();
    final UUID id = segment.getSegmentId().asUUID();
    segment.forEachRecord(new RecordConsumer() {

        @Override
        public void consume(int number, RecordType type, int offset) {
            if (type == RecordType.BLOB_ID) {
                w.addBinaryReference(generation, id, SegmentBlob.readBlobId(segment, number));
            }
        }
    });
}
Also used : RecordType(org.apache.jackrabbit.oak.segment.RecordType) UUID(java.util.UUID) RecordConsumer(org.apache.jackrabbit.oak.segment.Segment.RecordConsumer)

Aggregations

RecordType (org.apache.jackrabbit.oak.segment.RecordType)3 RecordConsumer (org.apache.jackrabbit.oak.segment.Segment.RecordConsumer)3 HashSet (java.util.HashSet)1 UUID (java.util.UUID)1 RecordId (org.apache.jackrabbit.oak.segment.RecordId)1