/** * Returns {@link LabelScanWriter} capable of making changes to this {@link LabelScanStore}. * Only a single writer is allowed at any given point in time. * * @return {@link LabelScanWriter} capable of making changes to this {@link LabelScanStore}. * @throws IllegalStateException if someone else has already acquired a writer and hasn't yet * called {@link LabelScanWriter#close()}. */ @Override public LabelScanWriter newWriter() { if ( readOnly ) { throw new UnsupportedOperationException( "Can't create index writer in read only mode." ); } try { return writer(); } catch ( IOException e ) { throw new UncheckedIOException( e ); } }
/** * Starts the store and makes it available for queries and updates. * Any required recovery must take place before calling this method. * * @throws IOException on {@link PageCache} exceptions. */ @Override public void start() throws IOException { if ( needsRebuild && !readOnly ) { monitor.rebuilding(); long numberOfNodes; // Intentionally ignore read-only flag here when rebuilding. try ( LabelScanWriter writer = writer() ) { numberOfNodes = fullStoreChangeStream.applyTo( writer ); } index.checkpoint( IOLimiter.UNLIMITED, writeClean ); monitor.rebuilt( numberOfNodes ); needsRebuild = false; } }
/** * Returns {@link LabelScanWriter} capable of making changes to this {@link LabelScanStore}. * Only a single writer is allowed at any given point in time. * * @return {@link LabelScanWriter} capable of making changes to this {@link LabelScanStore}. * @throws IllegalStateException if someone else has already acquired a writer and hasn't yet * called {@link LabelScanWriter#close()}. */ @Override public LabelScanWriter newWriter() { if ( readOnly ) { throw new UnsupportedOperationException( "Can't create index writer in read only mode." ); } try { return writer(); } catch ( IOException e ) { throw new UncheckedIOException( e ); } }
/** * Starts the store and makes it available for queries and updates. * Any required recovery must take place before calling this method. * * @throws IOException on {@link PageCache} exceptions. */ @Override public void start() throws IOException { if ( needsRebuild && !readOnly ) { monitor.rebuilding(); long numberOfNodes; // Intentionally ignore read-only flag here when rebuilding. try ( LabelScanWriter writer = writer() ) { numberOfNodes = fullStoreChangeStream.applyTo( writer ); } index.checkpoint( IOLimiter.UNLIMITED, writeClean ); monitor.rebuilt( numberOfNodes ); needsRebuild = false; } }