/** * Construct a MemKey within this namespace. * * @param key * the key to include. * @return key within this namespace. */ public CacheKey key(byte[] key) { return new CacheKey(this, key); }
public void onPartialResult(Map<CacheKey, byte[]> result) { for (Map.Entry<CacheKey, byte[]> ent : result.entrySet()) { ChunkKey key = ChunkKey.fromBytes(ent.getKey().getBytes()); PackChunk.Members members = decode(key, ent.getValue()); if (streamingCallback != null) { streamingCallback.onPartialResult(singleton(members)); synchronized (lock) { remaining.remove(key); } } else { synchronized (lock) { all.add(members); remaining.remove(key); } } } }
public void onPartialResult(Map<CacheKey, byte[]> result) { for (Map.Entry<CacheKey, byte[]> ent : result.entrySet()) { ChunkKey key = ChunkKey.fromBytes(ent.getKey().getBytes()); PackChunk.Members members = decode(key, ent.getValue()); if (streamingCallback != null) { streamingCallback.onPartialResult(singleton(members)); synchronized (lock) { remaining.remove(key); } } else { synchronized (lock) { all.add(members); remaining.remove(key); } } } }
public void onPartialResult(Map<CacheKey, byte[]> result) { for (Map.Entry<CacheKey, byte[]> ent : result.entrySet()) { ChunkKey key = ChunkKey.fromBytes(ent.getKey().getBytes()); ChunkMeta meta; try { meta = ChunkMeta.parseFrom(ent.getValue()); } catch (InvalidProtocolBufferException e) { // Invalid meta message, remove the cell from cache. client.modify(singleton(Change.remove(ent.getKey())), Sync.<Void> none()); continue; } if (streamingCallback != null) { streamingCallback.onPartialResult(singletonMap(key, meta)); synchronized (lock) { remaining.remove(key); } } else { synchronized (lock) { all.put(key, meta); remaining.remove(key); } } } }
/** * Construct a MemKey within this namespace. * * @param key * the key to include. * @return key within this namespace. */ public CacheKey key(RowKey key) { return new CacheKey(this, key); }
continue; objKey = ObjectIndexKey.fromBytes(e.getKey().getBytes());
/** * Construct a MemKey within this namespace. * * @param key * the key to include. * @return key within this namespace. */ public CacheKey key(byte[] key) { return new CacheKey(this, key); }
public void onPartialResult(Map<CacheKey, byte[]> result) { for (Map.Entry<CacheKey, byte[]> ent : result.entrySet()) { ChunkKey key = ChunkKey.fromBytes(ent.getKey().getBytes()); ChunkMeta meta; try { meta = ChunkMeta.parseFrom(ent.getValue()); } catch (InvalidProtocolBufferException e) { // Invalid meta message, remove the cell from cache. client.modify(singleton(Change.remove(ent.getKey())), Sync.<Void> none()); continue; } if (streamingCallback != null) { streamingCallback.onPartialResult(singletonMap(key, meta)); synchronized (lock) { remaining.remove(key); } } else { synchronized (lock) { all.put(key, meta); remaining.remove(key); } } } }
/** * Construct a MemKey within this namespace. * * @param key * the key to include. * @return key within this namespace. */ public CacheKey key(RowKey key) { return new CacheKey(this, key); }
continue; objKey = ObjectIndexKey.fromBytes(e.getKey().getBytes());
/** * Schedule any cache change. * * @param op * the cache operation. * @throws DhtException * a prior flush failed. */ public void modify(CacheService.Change op) throws DhtException { int sz = op.getKey().getBytes().length; if (op.getData() != null) sz += op.getData().length; if (add(sz)) { if (pending == null) pending = newList(); pending.add(op); queued(sz); } else { client.modify(singleton(op), wrap(none, sz)); } }
/** * Schedule any cache change. * * @param op * the cache operation. * @throws DhtException * a prior flush failed. */ public void modify(CacheService.Change op) throws DhtException { int sz = op.getKey().getBytes().length; if (op.getData() != null) sz += op.getData().length; if (add(sz)) { if (pending == null) pending = newList(); pending.add(op); queued(sz); } else { client.modify(singleton(op), wrap(none, sz)); } }