@Override public void sync() throws IOException { currentWriter.sync(); } }
/** * Writes an entry to the record file. This write is not guaranteed to be persisted * unless {@link #flushWriter(java.util.Map)} is called. * * @param op operation to write * @return address operation was written to * @throws IOException if an I/O error occurs */ protected long writeOperation(final T op) throws IOException { lastPosition = writer.append(op); return lastPosition; }
public void roll() throws IOException { currentWriter.sync(); currentWriter.close(); final File segmentFile = getSegmentPath(path, currentSegmentNum, true); currentWriterPath.renameTo(segmentFile); currentWriter = createWriter(++currentSegmentNum); lastRollTime = System.currentTimeMillis(); }
@Export(name = "current-segment-timestamp", doc = "Timestamp of the current segment being read") public long getCurrentSegmentTimestamp() throws IOException { return recordLogDirectory.getSegmentTimestamp(getCurrentSegmentNum()); }
@Export(name = "max-segment-timestamp", doc = "Timestamp of the max segment that exists in directory") public long getMaxSegmentTimestamp() throws IOException { return recordLogDirectory.getSegmentTimestamp(getMaxSegmentNum()); }
public static <E> Writer<E> create( File file, Serializer<E> serializer, CompressionCodec codec, final long rollFrequency, int blockSize, int fileIndexBits, int recordIndexBits, int padBits ) throws IOException { return new Writer(file, serializer, codec, rollFrequency, blockSize, fileIndexBits, recordIndexBits, padBits, -1); }
@Override public RecordFile.Reader<E> reader() throws IOException { return new Reader(); }
/** * @param segment segment number * @return a file pointing at the segment */ public File getSegmentPath(int segment) { return RecordLogDirectory.getSegmentPath(file, segment); }
public RecordLogDirectory<E> build() { return new RecordLogDirectory(dir, serializer, maxCachedFiles, codec, blockSize, fileIndexBits, recordIndexBits, padBits, mlockFiles); } }
@Override public void close() throws IOException { fileCache.close(); }
@Override public RecordFile.Reader<E> reader() throws IOException { return new Reader(); }
public void roll() throws IOException { currentWriter.sync(); currentWriter.close(); final File segmentFile = getSegmentPath(path, currentSegmentNum, true); currentWriterPath.renameTo(segmentFile); currentWriter = createWriter(++currentSegmentNum); lastRollTime = System.currentTimeMillis(); }
public static <E> Writer<E> create( File file, Serializer<E> serializer, CompressionCodec codec, final long rollFrequency, int blockSize, int fileIndexBits, int recordIndexBits, int padBits, int maxSegment ) throws IOException { return new Writer(file, serializer, codec, rollFrequency, blockSize, fileIndexBits, recordIndexBits, padBits, maxSegment); }
@Override public void sync() throws IOException { currentWriter.sync(); } }
/** * Writes an entry to the record file. This write is not guaranteed to be persisted * unless {@link #flushWriter(java.util.Map)} is called. * * @param op operation to write * @return address operation was written to * @throws IOException if an I/O error occurs */ protected long writeOperation(final T op) throws IOException { lastPosition = writer.append(op); return lastPosition; }
@Override public RecordFile.Reader<E> reader(long address) throws IOException { return new Reader(address); }
/** * @param segment segment number * @return a file pointing at the segment */ public File getSegmentPath(int segment) { return RecordLogDirectory.getSegmentPath(file, segment); }
public static <E> Writer<E> create( File file, Serializer<E> serializer, CompressionCodec codec, final long rollFrequency, int blockSize, int fileIndexBits, int recordIndexBits, int padBits ) throws IOException { return new Writer(file, serializer, codec, rollFrequency, blockSize, fileIndexBits, recordIndexBits, padBits, -1); }