@Test public void testStart() throws IOException { initializeCacheFolder(); await(cacheRemote.start()); MemSize cacheSize = await(cacheRemote.getTotalCacheSize()); assertTrue(cacheSize.toLong() < cacheRemote.getCacheSizeLimit().toLong()); }
@NotNull @Override public Promise<Void> start() { checkState(cacheSizeLimit != null, "Cannot start cached client without specifying cache size limit"); return getTotalCacheSize() .then(size -> { totalCacheSize = size.toLong(); return ensureSpace(); }); }
CachedFsClient implements FsClient, EventloopService { @NotNull @Override public Promise<Void> start() { checkState(cacheSizeLimit != null, "Cannot start cached client without specifying cache size limit"); return getTotalCacheSize() .then(size -> { totalCacheSize = size.toLong(); return ensureSpace(); }); } }
CachedFsClient implements FsClient, EventloopService { @NotNull @Override public Promise<Void> start() { checkState(cacheSizeLimit != null, "Cannot start cached client without specifying cache size limit"); return getTotalCacheSize() .then(size -> { totalCacheSize = size.toLong(); return ensureSpace(); }); } private  CachedFsClient(Eventloop eventloop, FsClient mainClient, FsClient cacheClient, Comparator<FullCacheStat> comparator); }
CachedFsClient implements FsClient, EventloopService { @NotNull @Override public Promise<Void> start() { checkState(cacheSizeLimit != null, "Cannot start cached client without specifying cache size limit"); return getTotalCacheSize() .then(size -> { totalCacheSize = size.toLong(); return ensureSpace(); }); } private  CachedFsClient(Eventloop eventloop, FsClient mainClient, FsClient cacheClient, Comparator<FullCacheStat> comparator); static CachedFsClient create(FsClient mainClient, FsClient cacheClient, Comparator<FullCacheStat> comparator); CachedFsClient with(@NotNull MemSize cacheSizeLimit); CachedFsClient with(@NotNull CurrentTimeProvider timeProvider); Promise<Void> setCacheSizeLimit(@NotNull MemSize cacheSizeLimit); MemSize getCacheSizeLimit(); Promise<MemSize> getTotalCacheSize(); @NotNull @Override Eventloop getEventloop(); @NotNull @Override Promise<Void> start(); @Override Promise<ChannelConsumer<ByteBuf>> upload(@NotNull String name, long offset); @Override Promise<ChannelConsumer<ByteBuf>> upload(@NotNull String name, long offset, long revision); @Override Promise<ChannelSupplier<ByteBuf>> download(@NotNull String name, long offset, long length); }
CachedFsClient implements FsClient, EventloopService { @NotNull @Override public Promise<Void> start() { checkState(cacheSizeLimit != null, "Cannot start cached client without specifying cache size limit"); return getTotalCacheSize() .then(size -> { totalCacheSize = size.toLong(); return ensureSpace(); }); } private  CachedFsClient(Eventloop eventloop, FsClient mainClient, FsClient cacheClient, Comparator<FullCacheStat> comparator); static CachedFsClient create(FsClient mainClient, FsClient cacheClient, Comparator<FullCacheStat> comparator); CachedFsClient with(@NotNull MemSize cacheSizeLimit); CachedFsClient with(@NotNull CurrentTimeProvider timeProvider); Promise<Void> setCacheSizeLimit(@NotNull MemSize cacheSizeLimit); MemSize getCacheSizeLimit(); Promise<MemSize> getTotalCacheSize(); @NotNull @Override Eventloop getEventloop(); @NotNull @Override Promise<Void> start(); @Override Promise<ChannelConsumer<ByteBuf>> upload(@NotNull String name, long offset); @Override Promise<ChannelConsumer<ByteBuf>> upload(@NotNull String name, long offset, long revision); @Override Promise<ChannelSupplier<ByteBuf>> download(@NotNull String name, long offset, long length);  }