Chronicle chronicle = ChronicleQueueBuilder.indexed(cl.getOptionValue("path")).build(); ExcerptTailer ex = chronicle.createTailer();
public void startExcerpt(long capacity) { checkNotClosed(); // in case there is more than one appender :P if (index != size()) { super.toEndForAppend0(); } if (capacity >= IndexedChronicle.this.builder.dataBlockSize()) { throw new IllegalArgumentException( "Capacity too large " + capacity + " >= " + IndexedChronicle.this.builder.dataBlockSize()); } // if the capacity is to large, roll the previous entry, and there was one if (positionAddr + capacity > dataStartAddr + dataBlockSize) { // check we are the start of a block. checkNewIndexLine(); writePaddedEntry(); try { loadNextDataBuffer(); } catch (IOException e) { throw new IllegalStateException(e); } } // check we are the start of a block. checkNewIndexLine(); // update the soft limitAddr startAddr = positionAddr; limitAddr = positionAddr + capacity; finished = false; nextSynchronous = IndexedChronicle.this.builder.synchronous(); }
/** * Creates a new instance of IndexedChronicle as specified by the provided {@link * net.openhft.chronicle.ChronicleQueueBuilder} and having the specified <tt>basePath</tt> (the * base name of the two backing files). * * @param builder the builder u * @throws FileNotFoundException if the <tt>basePath</tt> string does not denote an existing, * writable regular file and a new regular file of that name * cannot be created, or if some other error occurs while opening * or creating the file */ IndexedChronicle(@NotNull ChronicleQueueBuilder.IndexedChronicleQueueBuilder builder) throws IOException { this.builder = builder.clone(); this.basePath = builder.path().getAbsolutePath(); File parentFile = builder.path().getParentFile(); if (parentFile != null) { parentFile.mkdirs(); } this.indexFileCache = VanillaMappedBlocks.readWrite(new File(basePath + ".index"), builder.indexBlockSize(), builder.fileLifecycleListener()); this.dataFileCache = VanillaMappedBlocks.readWrite(new File(basePath + ".data"), builder.dataBlockSize(), builder.fileLifecycleListener()); findTheLastIndex(); }
Chronicle chronicle = ChronicleQueueBuilder.indexed(cl.getOptionValue("path")).build(); ExcerptTailer ex = chronicle.createTailer();
int indexBlockSize = builder.indexBlockSize(); for (long block = size / indexBlockSize - 1; block >= 0; block--) { VanillaMappedBytes mbb = null; int cacheLineSize = builder.cacheLineSize(); for (int pos = 0; pos < indexBlockSize; pos += cacheLineSize) {
Chronicle ic = ChronicleQueueBuilder.indexed(basePath).build(); ExcerptTailer excerpt = ic.createTailer();
protected AbstractIndexedExcerpt() throws IOException { //super(new VanillaBytesMarshallerFactory(), NO_PAGE, NO_PAGE, null); super( BytesMarshallableSerializer.create( new VanillaBytesMarshallerFactory(), builder.useCompressedObjectSerializer() ? JDKZObjectSerializer.INSTANCE : JDKObjectSerializer.INSTANCE), NO_PAGE, NO_PAGE, null ); cacheLineSize = IndexedChronicle.this.builder.cacheLineSize(); cacheLineMask = (cacheLineSize - 1); dataBlockSize = IndexedChronicle.this.builder.dataBlockSize(); indexBlockSize = IndexedChronicle.this.builder.indexBlockSize(); indexEntriesPerLine = (cacheLineSize - 8) / 4; indexEntriesPerBlock = indexBlockSize * indexEntriesPerLine / cacheLineSize; loadIndexBuffer(); loadDataBuffer(); finished = true; }
public static IndexedChronicleQueueBuilder indexed(File path) { return new IndexedChronicleQueueBuilder(path); }
/** * Create a chronicle dispatcher * * @param name The name of the dispatcher. */ public ChronicleReaderStream(String name) throws IOException { this(name, ChronicleQueueBuilder.indexed(PersistentQueueSpec.DEFAULT_BASE_PATH, name).build() ); }
public ChronicleStream(String name, int messageSizeHint) throws IOException { this(name, messageSizeHint, ChronicleQueueBuilder.indexed(PersistentQueueSpec.DEFAULT_BASE_PATH, name).build() ); }
/** * A pre-defined ChronicleBuilder for small {@link net.openhft.chronicle.Chronicle} * instances. * <p> * It has the following params: <ul> <li>data block size <b>16M</b></li> </ul> */ public IndexedChronicleQueueBuilder small() { dataBlockSize(16 * 1024 * 1024); return this; }
@Override public void finish() { super.finish(); if (IndexedChronicle.this.builder.synchronous()) { if (dataBuffer != null) { dataBuffer.force(); } if (indexBuffer != null) { indexBuffer.force(); } } }
@Override protected void doStart() { ChronicleTools.warmup(); this.basePath = (this.basePath.endsWith("/") ? this.basePath + getName() : this.basePath + "/" + getName()); try { chronicle = ChronicleQueueBuilder.indexed(basePath).synchronous(true).build(); appender = chronicle.createAppender(); } catch (Throwable t) { addError(t.getMessage(), t); } }
/** * A pre-defined ChronicleBuilder for medium {@link net.openhft.chronicle.Chronicle} * instances. * <p> * It has the following params: <ul> <li>data block size <b>128M</b></li> </ul> */ public IndexedChronicleQueueBuilder medium() { dataBlockSize(128 * 1024 * 1024); return this; }
/** * A pre-defined ChronicleBuilder for test {@link net.openhft.chronicle.Chronicle} * instances. * <p> * It has the following params: <ul> <li>data block size <b>8k</b></li> </ul> */ IndexedChronicleQueueBuilder test() { dataBlockSize(8 * 1024); return this; }
/** * A pre-defined ChronicleBuilder for large {@link net.openhft.chronicle.Chronicle} * instances. * <p> * It has the following params: <ul> <li>data block size <b>512M</b></li> </ul> */ public IndexedChronicleQueueBuilder large() { dataBlockSize(512 * 1024 * 1024); return this; }
@Override protected void doStart() { ChronicleTools.warmup(); this.basePath = (this.basePath.endsWith("/") ? this.basePath + getName() : this.basePath + "/" + getName()); try { chronicle = ChronicleQueueBuilder.indexed(basePath).synchronous(true).build(); appender = chronicle.createAppender(); } catch (Throwable t) { addError(t.getMessage(), t); } }
public ChronicleStream(String name, int messageSizeHint) throws IOException { this(name, messageSizeHint, ChronicleQueueBuilder.indexed(PersistentQueueSpec.DEFAULT_BASE_PATH, name).build() ); }
/** * Create a chronicle dispatcher * * @param name The name of the dispatcher. */ public ChronicleReaderStream(String name) throws IOException { this(name, ChronicleQueueBuilder.indexed(PersistentQueueSpec.DEFAULT_BASE_PATH, name).build() ); }