public void get(Context options, Set<ObjectIndexKey> objects, AsyncCallback<Map<ObjectIndexKey, Collection<ObjectInfo>>> callback) { List<CacheKey> toFind = new ArrayList<CacheKey>(objects.size()); for (ObjectIndexKey k : objects) toFind.add(ns.key(k)); client.get(toFind, new LoaderFromCache(options, objects, callback)); }
public void get(Context options, Set<ChunkKey> keys, AsyncCallback<Collection<PackChunk.Members>> callback) { List<CacheKey> toFind = new ArrayList<CacheKey>(keys.size()); for (ChunkKey k : keys) toFind.add(nsChunk.key(k)); client.get(toFind, new ChunkFromCache(options, keys, callback)); }
public void getMeta(Context options, Set<ChunkKey> keys, AsyncCallback<Map<ChunkKey, ChunkMeta>> callback) { List<CacheKey> toFind = new ArrayList<CacheKey>(keys.size()); for (ChunkKey k : keys) toFind.add(nsMeta.key(k)); client.get(toFind, new MetaFromCache(options, keys, callback)); }
public void get(Context options, Set<ObjectIndexKey> objects, AsyncCallback<Map<ObjectIndexKey, Collection<ObjectInfo>>> callback) { List<CacheKey> toFind = new ArrayList<CacheKey>(objects.size()); for (ObjectIndexKey k : objects) toFind.add(ns.key(k)); client.get(toFind, new LoaderFromCache(options, objects, callback)); }
public void get(Context options, Set<ChunkKey> keys, AsyncCallback<Collection<PackChunk.Members>> callback) { List<CacheKey> toFind = new ArrayList<CacheKey>(keys.size()); for (ChunkKey k : keys) toFind.add(nsChunk.key(k)); client.get(toFind, new ChunkFromCache(options, keys, callback)); }
public void getMeta(Context options, Set<ChunkKey> keys, AsyncCallback<Map<ChunkKey, ChunkMeta>> callback) { List<CacheKey> toFind = new ArrayList<CacheKey>(keys.size()); for (ChunkKey k : keys) toFind.add(nsMeta.key(k)); client.get(toFind, new MetaFromCache(options, keys, callback)); }
public RepositoryKey get(RepositoryName name) throws DhtException, TimeoutException { CacheKey memKey = ns.key(name); Sync<Map<CacheKey, byte[]>> sync = Sync.create(); client.get(singleton(memKey), sync); Map<CacheKey, byte[]> result; try { result = sync.get(options.getTimeout()); } catch (InterruptedException e) { throw new TimeoutException(); } catch (TimeoutException timeout) { // Fall through and read the database directly. result = emptyMap(); } byte[] data = result.get(memKey); if (data != null) { if (data.length == 0) return null; return RepositoryKey.fromBytes(data); } RepositoryKey key = db.get(name); data = key != null ? key.asBytes() : new byte[0]; client.modify(singleton(Change.put(memKey, data)), none); return key; }
public RepositoryKey get(RepositoryName name) throws DhtException, TimeoutException { CacheKey memKey = ns.key(name); Sync<Map<CacheKey, byte[]>> sync = Sync.create(); client.get(singleton(memKey), sync); Map<CacheKey, byte[]> result; try { result = sync.get(options.getTimeout()); } catch (InterruptedException e) { throw new TimeoutException(); } catch (TimeoutException timeout) { // Fall through and read the database directly. result = emptyMap(); } byte[] data = result.get(memKey); if (data != null) { if (data.length == 0) return null; return RepositoryKey.fromBytes(data); } RepositoryKey key = db.get(name); data = key != null ? key.asBytes() : new byte[0]; client.modify(singleton(Change.put(memKey, data)), none); return key; }
CacheKey memKey = nsCachedPack.key(repo); Sync<Map<CacheKey, byte[]>> sync = Sync.create(); client.get(singleton(memKey), sync);
CacheKey memKey = nsCachedPack.key(repo); Sync<Map<CacheKey, byte[]>> sync = Sync.create(); client.get(singleton(memKey), sync);