@Test public void insert() { List<TtlBucket> expired = getSortedExpiredBuckets(BUCKET1_START); Assert.assertTrue(expired.isEmpty()); mBucketList.insert(BUCKET1_FILE1); expired = getSortedExpiredBuckets(BUCKET1_END); assertExpired(expired, 0, BUCKET1_FILE1); mBucketList.insert(BUCKET1_FILE2); for (long end = BUCKET2_START; end < BUCKET2_END; end++) { expired = getSortedExpiredBuckets(end); assertExpired(expired, 0, BUCKET1_FILE1, BUCKET1_FILE2); } mBucketList.insert(BUCKET2_FILE); expired = getSortedExpiredBuckets(BUCKET2_END); assertExpired(expired, 0, BUCKET1_FILE1, BUCKET1_FILE2); assertExpired(expired, 1, BUCKET2_FILE); }
public void insert(Inode inode) { if (inode.getTtl() == Constants.NO_TTL) { return; } TtlBucket bucket; while (true) { bucket = getBucketContaining(inode); if (bucket != null) { break; } long ttlEndTimeMs = inode.getCreationTimeMs() + inode.getTtl(); long interval = TtlBucket.getTtlIntervalMs(); bucket = new TtlBucket(interval == 0 ? ttlEndTimeMs : ttlEndTimeMs / interval * interval); if (mBucketList.add(bucket)) { break; } } bucket.addInode(inode); }
TtlBucketList implements Checkpointed { public void insert(Inode inode) { if (inode.getTtl() == Constants.NO_TTL) { return; } TtlBucket bucket; while (true) { bucket = getBucketContaining(inode); if (bucket != null) { break; } long ttlEndTimeMs = inode.getCreationTimeMs() + inode.getTtl(); long interval = TtlBucket.getTtlIntervalMs(); bucket = new TtlBucket(interval == 0 ? ttlEndTimeMs : ttlEndTimeMs / interval * interval); if (mBucketList.add(bucket)) { break; } } bucket.addInode(inode); } }
TtlBucketList implements Checkpointed { public void insert(Inode inode) { if (inode.getTtl() == Constants.NO_TTL) { return; } TtlBucket bucket; while (true) { bucket = getBucketContaining(inode); if (bucket != null) { break; } long ttlEndTimeMs = inode.getCreationTimeMs() + inode.getTtl(); long interval = TtlBucket.getTtlIntervalMs(); bucket = new TtlBucket(interval == 0 ? ttlEndTimeMs : ttlEndTimeMs / interval * interval); if (mBucketList.add(bucket)) { break; } } bucket.addInode(inode); } TtlBucketList(ReadOnlyInodeStore inodeStore); }
TtlBucketList implements Checkpointed { public void insert(Inode inode) { if (inode.getTtl() == Constants.NO_TTL) { return; } TtlBucket bucket; while (true) { bucket = getBucketContaining(inode); if (bucket != null) { break; } long ttlEndTimeMs = inode.getCreationTimeMs() + inode.getTtl(); long interval = TtlBucket.getTtlIntervalMs(); bucket = new TtlBucket(interval == 0 ? ttlEndTimeMs : ttlEndTimeMs / interval * interval); if (mBucketList.add(bucket)) { break; } } bucket.addInode(inode); } TtlBucketList(ReadOnlyInodeStore inodeStore); void insert(Inode inode); void remove(InodeView inode); Set<TtlBucket> getExpiredBuckets(long time); void removeBuckets(Set<TtlBucket> buckets); @Override CheckpointName getCheckpointName(); @Override void writeToCheckpoint(OutputStream output); @Override void restoreFromCheckpoint(CheckpointInputStream input); }
TtlBucketList implements Checkpointed { public void insert(Inode inode) { if (inode.getTtl() == Constants.NO_TTL) { return; } TtlBucket bucket; while (true) { bucket = getBucketContaining(inode); if (bucket != null) { break; } long ttlEndTimeMs = inode.getCreationTimeMs() + inode.getTtl(); long interval = TtlBucket.getTtlIntervalMs(); bucket = new TtlBucket(interval == 0 ? ttlEndTimeMs : ttlEndTimeMs / interval * interval); if (mBucketList.add(bucket)) { break; } } bucket.addInode(inode); } TtlBucketList(ReadOnlyInodeStore inodeStore); void insert(Inode inode); void remove(InodeView inode); Set<TtlBucket> getExpiredBuckets(long time); void removeBuckets(Set<TtlBucket> buckets); @Override CheckpointName getCheckpointName(); @Override void writeToCheckpoint(OutputStream output); @Override void restoreFromCheckpoint(CheckpointInputStream input);  }