use of org.apache.jackrabbit.oak.segment.SegmentStore in project jackrabbit-oak by apache.
the class StandbyStoreService method activate.
@Activate
private void activate(ComponentContext context) {
SegmentStore segmentStore = storeProvider.getSegmentStore();
if (!(segmentStore instanceof FileStore)) {
throw new IllegalArgumentException("Unexpected SegmentStore implementation");
}
FileStore fileStore = (FileStore) segmentStore;
String mode = valueOf(context.getProperties().get(MODE));
if (MODE_PRIMARY.equals(mode)) {
bootstrapMaster(context, fileStore);
return;
}
if (MODE_STANDBY.equals(mode)) {
bootstrapSlave(context, fileStore);
return;
}
throw new IllegalArgumentException(String.format("Unexpected mode property, got '%s'", mode));
}
use of org.apache.jackrabbit.oak.segment.SegmentStore in project jackrabbit-oak by apache.
the class StandbyTestUtils method mockSegment.
public static Segment mockSegment(UUID uuid, byte[] buffer) {
SegmentStore store = mock(SegmentStore.class);
SegmentIdProvider idProvider = mock(SegmentIdProvider.class);
SegmentReader reader = mock(SegmentReader.class);
long msb = uuid.getMostSignificantBits();
long lsb = uuid.getLeastSignificantBits();
SegmentId id = new SegmentId(store, msb, lsb);
ByteBuffer data = ByteBuffer.wrap(buffer);
return new Segment(idProvider, reader, id, data);
}
Aggregations