@NotNull private static DirectBitSet createModIterBitSet() { return ATSDirectBitSet.wrap(new DirectStore(null, DIRTY_WORD_COUNT * 8, true).bytes()); }
long size = 1L << 40; // 1 TB DirectStore store = DirectStore.allocate(size); DirectBytes slice = store.createSlice(); slice.writeLong(0, size); slice.writeLong(size - 8, size); store.free();
public static BytesStore allocateLazy(long sizeInBytes, ObjectSerializer objectSerializer) { return new DirectStore(objectSerializer, sizeInBytes, false); }
final DirectStore store = DirectStore.allocate(128L << 32); // give me 128 GB final DirectBytes slice = store.createSlice(); // every record has say 128 bytes and a lock at the start so they can be locked individually for(long l = 0; l < store.size(); l += 128) { slice.positionAndSize(l, 128); slice.busyLock(0L); // change something slive.writeLong(4L, l); slice.unlock(0L); } // when finished with the store store.free(); // still no GCs.
private T createRef() { T ref = DataValueClasses.newDirectReference(tClass); ((Byteable) ref).bytes(store.bytes(), 0L); return ref; }
/** * calls free */ @Override public void close() { free(); }
public static BytesStore allocateLazy(long sizeInBytes, ObjectSerializer objectSerializer) { return new DirectStore(objectSerializer, sizeInBytes, false); }
private T createRef() { T ref = DataValueClasses.newDirectReference(tClass); ((Byteable) ref).bytes(store.bytes(), 0L); return ref; }
/** * calls free */ @Override public void close() { free(); }
public DailyRollingChronicle(String filename, DailyRollingConfig config) throws IOException { this.config = config; this.file = new File(filename); file.mkdirs(); if (!file.isDirectory()) throw new IOException("Failed to create directory " + file); master = new MasterIndexFile(new File(file, "master")); bytes = new DirectStore(config.getBytesMarshallerFactory(), config.getMaxEntrySize(), false).bytes(); SimpleDateFormat dateFormat = new SimpleDateFormat(config.getFileFormat()); dateFormat.setTimeZone(config.getTimeZone()); String currentFilename = dateFormat.format(new Date()); int index = master.append(currentFilename); filesList = new CopyOnWriteArrayList<DRFiles>(); while (filesList.size() < index) filesList.add(null); DRFiles indexFiles = new DRFiles(file, currentFilename); filesList.add(indexFiles); // worker = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory(file.getName() + "-worker", true)); }
@NotNull public static DirectStore allocateLazy(long size) { return new DirectStore(new VanillaBytesMarshallerFactory(), size, false); }
@NotNull public static DirectStore allocate(long size) { return new DirectStore(new VanillaBytesMarshallerFactory(), size); }
@NotNull public static DirectStore allocate(long size) { return new DirectStore(new VanillaBytesMarshallerFactory(), size); }
@NotNull public static DirectStore allocateLazy(long size) { return new DirectStore(new VanillaBytesMarshallerFactory(), size, false); }