public void run() { for (Map.Entry<ChunkKey, ChunkMeta> ent : toPutIntoCache.entrySet()) { ChunkKey key = ent.getKey(); Change op = Change.put(nsMeta.key(key), ent.getValue().toByteArray()); client.modify(singleton(op), none); } } });
public void run() { for (Map.Entry<ChunkKey, ChunkMeta> ent : toPutIntoCache.entrySet()) { ChunkKey key = ent.getKey(); Change op = Change.put(nsMeta.key(key), ent.getValue().toByteArray()); client.modify(singleton(op), none); } } });
public void run() { List<Change> ops = new ArrayList<Change>(toPut.size()); for (Map.Entry<ObjectIndexKey, Collection<ObjectInfo>> e : all(toPut)) { List<ObjectInfo> items = copy(e.getValue()); ObjectInfo.sort(items); ops.add(Change.put(ns.key(e.getKey()), encode(items))); } client.modify(ops, Sync.<Void> none()); }
list.addAllPack(r); client.modify( singleton(Change.put(memKey, list.build().toByteArray())), none); return r;
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; }
list.addAllPack(r); client.modify( singleton(Change.put(memKey, list.build().toByteArray())), none); return r;
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; }
/** * Schedule storing (or replacing) a key in the cache. * * @param key * key to store. * @param value * new value to store. * @throws DhtException * a prior flush failed. */ public void put(CacheKey key, byte[] value) throws DhtException { modify(CacheService.Change.put(key, value)); }
public void putUnique(RepositoryName name, RepositoryKey key) throws DhtException, TimeoutException { db.putUnique(name, key); Sync<Void> sync = Sync.create(); CacheKey memKey = ns.key(name); byte[] data = key.asBytes(); client.modify(singleton(Change.put(memKey, data)), sync); try { sync.get(options.getTimeout()); } catch (InterruptedException e) { throw new TimeoutException(); } }
public void putUnique(RepositoryName name, RepositoryKey key) throws DhtException, TimeoutException { db.putUnique(name, key); Sync<Void> sync = Sync.create(); CacheKey memKey = ns.key(name); byte[] data = key.asBytes(); client.modify(singleton(Change.put(memKey, data)), sync); try { sync.get(options.getTimeout()); } catch (InterruptedException e) { throw new TimeoutException(); } }
public void run() { for (PackChunk.Members members : toPutIntoCache) { ChunkKey key = members.getChunkKey(); Change op = Change.put(nsChunk.key(key), encode(members)); client.modify(singleton(op), none); } } });
/** * Schedule storing (or replacing) a key in the cache. * * @param key * key to store. * @param value * new value to store. * @throws DhtException * a prior flush failed. */ public void put(CacheKey key, byte[] value) throws DhtException { modify(CacheService.Change.put(key, value)); }
public void run() { for (PackChunk.Members members : toPutIntoCache) { ChunkKey key = members.getChunkKey(); Change op = Change.put(nsChunk.key(key), encode(members)); client.modify(singleton(op), none); } } });
public void run() { List<Change> ops = new ArrayList<Change>(toPut.size()); for (Map.Entry<ObjectIndexKey, Collection<ObjectInfo>> e : all(toPut)) { List<ObjectInfo> items = copy(e.getValue()); ObjectInfo.sort(items); ops.add(Change.put(ns.key(e.getKey()), encode(items))); } client.modify(ops, Sync.<Void> none()); }