@Test(expected = IllegalArgumentException.class) public void remove_non_existing_key() throws Exception { final int COUNT = LARGE_COUNT; fill_(COUNT); final TSDataFileChain.Key bad_key = new TSDataFileChain.Key(tmpdir.resolve("I-am-not-here.tsd"), DateTime.now(DateTimeZone.UTC).minusDays(1), DateTime.now(DateTimeZone.UTC), true); fd.delete(bad_key); }
public void delete(@NonNull Key key) { final ReentrantReadWriteLock.WriteLock lock = guard.writeLock(); lock.lock(); try { if (!readKeys.remove(key)) throw new IllegalArgumentException("key does not exist"); Files.delete(key.getFile()); } catch (IOException ex) { LOG.log(Level.WARNING, "unable to remove file " + key.getFile(), ex); } finally { lock.unlock(); } }
TSDataFileChain extends SequenceTSData { public void delete(@NonNull Key key) { final ReentrantReadWriteLock.WriteLock lock = guard.writeLock(); lock.lock(); try { if (!readKeys.remove(key)) throw new IllegalArgumentException("key does not exist"); Files.delete(key.getFile()); } catch (IOException ex) { LOG.log(Level.WARNING, "unable to remove file " + key.getFile(), ex); } finally { lock.unlock(); } } }
TSDataFileChain extends SequenceTSData { public void delete(@NonNull Key key) { final ReentrantReadWriteLock.WriteLock lock = guard.writeLock(); lock.lock(); try { if (!readKeys.remove(key)) throw new IllegalArgumentException("key does not exist"); Files.delete(key.getFile()); } catch (IOException ex) { LOG.log(Level.WARNING, "unable to remove file " + key.getFile(), ex); } finally { lock.unlock(); } } private  TSDataFileChain(@NonNull Path dir, @NonNull Optional<Path> wfile, @NonNull Collection<MetaData> rfiles, long max_filesize); }
TSDataFileChain extends SequenceTSData { public void delete(@NonNull Key key) { final ReentrantReadWriteLock.WriteLock lock = guard.writeLock(); lock.lock(); try { if (!readKeys.remove(key)) throw new IllegalArgumentException("key does not exist"); Files.delete(key.getFile()); } catch (IOException ex) { LOG.log(Level.WARNING, "unable to remove file " + key.getFile(), 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 { public void delete(@NonNull Key key) { final ReentrantReadWriteLock.WriteLock lock = guard.writeLock(); lock.lock(); try { if (!readKeys.remove(key)) throw new IllegalArgumentException("key does not exist"); Files.delete(key.getFile()); } catch (IOException ex) { LOG.log(Level.WARNING, "unable to remove file " + key.getFile(), 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; }