@SuppressWarnings("unchecked") public SourceExcerpt() { super(InProcessChronicleSource.this.chronicle.createExcerpt()); }
public PackedHashedTable(String basePath, int hashBucketBits, int hashCapacityBits, int maxRecordSize) throws IOException { this.basePath = basePath; this.maxRecordSize = maxRecordSize; hash = new IntIndexedChronicle(basePath + ".hash", Math.min(24, hashCapacityBits - 4)); hashRecord = new HashRecord(hash.createExcerpt(), hashBucketBits, hashCapacityBits); while (hash.size() < 1 << hashBucketBits) hashRecord.addEntry(); records = new IntIndexedChronicle(basePath + ".record", Math.min(26, hashCapacityBits - 2)); recordsExcerpt = records.createExcerpt(); }
public InProcessChronicleSink(@NotNull Chronicle chronicle, String hostname, int port) { this.chronicle = chronicle; this.address = new InetSocketAddress(hostname, port); logger = Logger.getLogger(getClass().getName() + '.' + chronicle); excerpt = chronicle.createExcerpt(); readBuffer = TcpUtil.createBuffer(256 * 1024, chronicle.byteOrder()); }
ChronicleTools.deleteOnExit(basePath); final Chronicle chronicle = new IntIndexedChronicle(basePath); final Excerpt excerpt = chronicle.createExcerpt(); final int[] consolidates = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; int repeats = 10000; int[] nbcs = new int[repeats]; int count = 0; final Excerpt excerpt2 = chronicle.createExcerpt(); while (excerpt2.nextIndex()) { final long timestamp = excerpt2.readLong(); System.out.println("nbConsolidates: " + nbcs[i]); chronicle.close();
@Override public long size() { return chronicle.size(); }
private void readNextExcerpt(@NotNull SocketChannel sc) { ByteBuffer bb = TcpUtil.createBuffer(1, chronicle.byteOrder()); // minimum size try { if (!closed) { long index = bb.getLong(0); long size = bb.getInt(8); if (index != chronicle.size()) throw new StreamCorruptedException("Expected index " + chronicle.size() + " but got " + index); if (size > Integer.MAX_VALUE || size < 0) throw new StreamCorruptedException("size was " + size);
@NotNull @Override public String name() { return chronicle.name(); }
@Nullable @Override public <E> EnumeratedMarshaller<E> getMarshaller(@NotNull Class<E> eClass) { return chronicle.getMarshaller(eClass); }
@Override public ByteOrder byteOrder() { return chronicle.byteOrder(); }
@Override public void multiThreaded(boolean multiThreaded) { chronicle.multiThreaded(multiThreaded); }
try { long index = readIndex(socket); Excerpt excerpt = chronicle.createExcerpt(); ByteBuffer bb = TcpUtil.createBuffer(1, chronicle.byteOrder()); // minimum size long sendInSync = 0; boolean first = true;
@Override public long size() { return chronicle.size(); }
private void readNextExcerpt(@NotNull SocketChannel sc) { ByteBuffer bb = TcpUtil.createBuffer(1, chronicle.byteOrder()); // minimum size try { if (!closed) { long index = bb.getLong(0); long size = bb.getInt(8); if (index != chronicle.size()) throw new StreamCorruptedException("Expected index " + chronicle.size() + " but got " + index); if (size > Integer.MAX_VALUE || size < 0) throw new StreamCorruptedException("size was " + size);
@NotNull @Override public String name() { return chronicle.name(); }
@Nullable @Override public <E> EnumeratedMarshaller<E> getMarshaller(@NotNull Class<E> eClass) { return chronicle.getMarshaller(eClass); }
@Override public ByteOrder byteOrder() { return chronicle.byteOrder(); }
@Override public void multiThreaded(boolean multiThreaded) { chronicle.multiThreaded(multiThreaded); }
@SuppressWarnings("unchecked") public SinkExcerpt() { super(chronicle.createExcerpt()); }
public InProcessChronicleSink(@NotNull Chronicle chronicle, String hostname, int port) { this.chronicle = chronicle; this.address = new InetSocketAddress(hostname, port); logger = Logger.getLogger(getClass().getName() + '.' + chronicle); excerpt = chronicle.createExcerpt(); readBuffer = TcpUtil.createBuffer(256 * 1024, chronicle.byteOrder()); }