@Test public void add_all() { final int COUNT = 7; fill_(COUNT); final StreamedCollection<TimeSeriesCollection> tsdata = create_tsdata_().skip(COUNT + 1).limit(20); assertTrue(tsdata.noneMatch(fd::contains)); fd.addAll(tsdata); assertTrue(fd.containsAll(tsdata)); }
@Override public boolean addAll(@NonNull Collection<? extends TimeSeriesCollection> e) { if (e.isEmpty()) return false; final ReentrantReadWriteLock.WriteLock lock = guard.writeLock(); lock.lock(); try { DateTime ts = e.iterator().next().getTimestamp(); return getAppendFileForWriting(ts).getTsdata().addAll(e); } catch (IOException ex) { throw new RuntimeException(ex); } finally { lock.unlock(); } }
TSDataFileChain extends SequenceTSData { @Override public boolean addAll(@NonNull Collection<? extends TimeSeriesCollection> e) { if (e.isEmpty()) return false; final ReentrantReadWriteLock.WriteLock lock = guard.writeLock(); lock.lock(); try { DateTime ts = e.iterator().next().getTimestamp(); return getAppendFileForWriting(ts).getTsdata().addAll(e); } catch (IOException ex) { throw new RuntimeException(ex); } finally { lock.unlock(); } } }
TSDataFileChain extends SequenceTSData { @Override public boolean addAll(@NonNull Collection<? extends TimeSeriesCollection> e) { if (e.isEmpty()) return false; final ReentrantReadWriteLock.WriteLock lock = guard.writeLock(); lock.lock(); try { DateTime ts = e.iterator().next().getTimestamp(); return getAppendFileForWriting(ts).getTsdata().addAll(e); } catch (IOException ex) { throw new RuntimeException(ex); } finally { lock.unlock(); } } private  TSDataFileChain(@NonNull Path dir, @NonNull Optional<Path> wfile, @NonNull Collection<MetaData> rfiles, long max_filesize); }
TSDataFileChain extends SequenceTSData { @Override public boolean addAll(@NonNull Collection<? extends TimeSeriesCollection> e) { if (e.isEmpty()) return false; final ReentrantReadWriteLock.WriteLock lock = guard.writeLock(); lock.lock(); try { DateTime ts = e.iterator().next().getTimestamp(); return getAppendFileForWriting(ts).getTsdata().addAll(e); } catch (IOException ex) { throw new RuntimeException(ex); } finally { lock.unlock(); } } private  TSDataFileChain(@NonNull Path dir, @NonNull Optional<Path> wfile, @NonNull Collection<MetaData> rfiles, long max_filesize); synchronized boolean hasPendingTasks(); void waitPendingTasks(); static Optional<TSDataFileChain> openDirExisting(@NonNull TSDataScanDir scandir); static Optional<TSDataFileChain> openDirExisting(@NonNull TSDataScanDir scandir, long max_filesize); static TSDataFileChain openDir(@NonNull TSDataScanDir scandir); static TSDataFileChain openDir(@NonNull TSDataScanDir scandir, long max_filesize); static Optional<TSDataFileChain> openDirExisting(@NonNull Path dir); static Optional<TSDataFileChain> openDirExisting(@NonNull Path dir, long max_filesize); static TSDataFileChain openDir(@NonNull Path dir); static TSDataFileChain openDir(@NonNull Path dir, long max_filesize); @Override ObjectSequence<TimeSeriesCollection> getSequence(); @Override boolean canAddSingleRecord(); @Override boolean isOptimized(); @Override long getFileSize(); @Override DateTime getBegin(); @Override DateTime getEnd(); @Override short getMajor(); @Override short getMinor(); CompletableFuture<?> optimizeOldFiles(); @Override boolean add(@NonNull TimeSeriesCollection e); @Override boolean addAll(@NonNull Collection<? extends TimeSeriesCollection> e); Set<Key> getKeys(); void delete(@NonNull Key key); Collection<SequenceTSData> getRawCollections(); @Override Optional<GCCloseable<FileChannel>> getFileChannel(); BatchAdd batchAdd(); }
TSDataFileChain extends SequenceTSData { @Override public boolean addAll(@NonNull Collection<? extends TimeSeriesCollection> e) { if (e.isEmpty()) return false; final ReentrantReadWriteLock.WriteLock lock = guard.writeLock(); lock.lock(); try { DateTime ts = e.iterator().next().getTimestamp(); return getAppendFileForWriting(ts).getTsdata().addAll(e); } catch (IOException ex) { throw new RuntimeException(ex); } finally { lock.unlock(); } } private  TSDataFileChain(@NonNull Path dir, @NonNull Optional<Path> wfile, @NonNull Collection<MetaData> rfiles, long max_filesize); synchronized boolean hasPendingTasks(); void waitPendingTasks(); static Optional<TSDataFileChain> openDirExisting(@NonNull TSDataScanDir scandir); static Optional<TSDataFileChain> openDirExisting(@NonNull TSDataScanDir scandir, long max_filesize); static TSDataFileChain openDir(@NonNull TSDataScanDir scandir); static TSDataFileChain openDir(@NonNull TSDataScanDir scandir, long max_filesize); static Optional<TSDataFileChain> openDirExisting(@NonNull Path dir); static Optional<TSDataFileChain> openDirExisting(@NonNull Path dir, long max_filesize); static TSDataFileChain openDir(@NonNull Path dir); static TSDataFileChain openDir(@NonNull Path dir, long max_filesize); @Override ObjectSequence<TimeSeriesCollection> getSequence(); @Override boolean canAddSingleRecord(); @Override boolean isOptimized(); @Override long getFileSize(); @Override DateTime getBegin(); @Override DateTime getEnd(); @Override short getMajor(); @Override short getMinor(); CompletableFuture<?> optimizeOldFiles(); @Override boolean add(@NonNull TimeSeriesCollection e); @Override boolean addAll(@NonNull Collection<? extends TimeSeriesCollection> e); Set<Key> getKeys(); void delete(@NonNull Key key); Collection<SequenceTSData> getRawCollections(); @Override Optional<GCCloseable<FileChannel>> getFileChannel(); BatchAdd batchAdd(); static long MAX_FILESIZE; static int MAX_FILERECORDS; }