use of org.apache.jackrabbit.oak.segment.RecordType 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;
}
use of org.apache.jackrabbit.oak.segment.RecordType in project jackrabbit-oak by apache.
the class SegmentTarFactory method hasExternalBlobReferences.
@Override
public boolean hasExternalBlobReferences() throws IOException {
final FileStoreBuilder builder = fileStoreBuilder(new File(dir, "segmentstore"));
builder.withMaxFileSize(256);
builder.withMemoryMapping(false);
ReadOnlyFileStore fs;
try {
fs = builder.buildReadOnly();
} catch (InvalidFileStoreVersionException e) {
throw new IOException(e);
}
try {
for (SegmentId id : fs.getSegmentIds()) {
if (!id.isDataSegmentId()) {
continue;
}
id.getSegment().forEachRecord(new Segment.RecordConsumer() {
@Override
public void consume(int number, RecordType type, int offset) {
// see java.nio.file.FileVisitor
if (type == RecordType.BLOB_ID) {
throw new ExternalBlobFound();
}
}
});
}
return false;
} catch (ExternalBlobFound e) {
return true;
} finally {
fs.close();
}
}
use of org.apache.jackrabbit.oak.segment.RecordType 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();
}
}
}
use of org.apache.jackrabbit.oak.segment.RecordType 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));
}
}
});
}
Aggregations