public void onSuccess(Map<ObjectIndexKey, Collection<ObjectInfo>> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { normalCallback.onSuccess(all); } }
public void onSuccess(Map<ChunkKey, ChunkMeta> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { normalCallback.onSuccess(all); } }
public void onSuccess(T result) { try { callback.onSuccess(result); } finally { done(); } }
public void onSuccess(Collection<PackChunk.Members> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { normalCallback.onSuccess(all); } }
public void onSuccess(Collection<PackChunk.Members> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { normalCallback.onSuccess(all); } }
public void onSuccess(T result) { try { callback.onSuccess(result); } finally { done(); } }
public void onSuccess(Map<ObjectIndexKey, Collection<ObjectInfo>> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { normalCallback.onSuccess(all); } }
public void onSuccess(Map<ChunkKey, ChunkMeta> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { normalCallback.onSuccess(all); } }
public void onSuccess(Map<CacheKey, byte[]> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { if (remaining.isEmpty() || options == Context.FAST_MISSING_OK) { normalCallback.onSuccess(all); } else { db.get(options, remaining, new ChunkFromDatabase(all, normalCallback, streamingCallback)); } } }
public void onSuccess(Map<CacheKey, byte[]> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { if (remaining.isEmpty() || options == Context.FAST_MISSING_OK) { normalCallback.onSuccess(all); } else { db.getMeta(options, remaining, new MetaFromDatabase(all, normalCallback, streamingCallback)); } } }
public void onSuccess(Map<CacheKey, byte[]> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { if (remaining.isEmpty() || options == Context.FAST_MISSING_OK) { normalCallback.onSuccess(all); } else { db.get(options, remaining, new ChunkFromDatabase(all, normalCallback, streamingCallback)); } } }
public void onSuccess(Map<CacheKey, byte[]> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { if (remaining.isEmpty() || options == Context.FAST_MISSING_OK) { normalCallback.onSuccess(all); } else { db.get(options, remaining, new LoaderFromDatabase(all, normalCallback, streamingCallback)); } } }
public void onSuccess(Map<CacheKey, byte[]> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { if (remaining.isEmpty() || options == Context.FAST_MISSING_OK) { normalCallback.onSuccess(all); } else { db.get(options, remaining, new LoaderFromDatabase(all, normalCallback, streamingCallback)); } } }
public void onSuccess(Map<CacheKey, byte[]> result) { if (result != null && !result.isEmpty()) onPartialResult(result); synchronized (lock) { if (remaining.isEmpty() || options == Context.FAST_MISSING_OK) { normalCallback.onSuccess(all); } else { db.getMeta(options, remaining, new MetaFromDatabase(all, normalCallback, streamingCallback)); } } }
public void getMeta(Context options, Set<ChunkKey> keys, AsyncCallback<Map<ChunkKey, ChunkMeta>> callback) { Map<ChunkKey, ChunkMeta> out = new HashMap<ChunkKey, ChunkMeta>(); for (ChunkKey chunk : keys) { byte[] row = chunk.asBytes(); MemTable.Cell cell = table.get(row, colMeta.name()); if (cell != null) { try { out.put(chunk, ChunkMeta.parseFrom(cell.getValue())); } catch (InvalidProtocolBufferException err) { callback.onFailure(new DhtException(MessageFormat.format( DhtText.get().invalidChunkMeta, chunk), err)); return; } } } callback.onSuccess(out); }
public void getMeta(Context options, Set<ChunkKey> keys, AsyncCallback<Map<ChunkKey, ChunkMeta>> callback) { Map<ChunkKey, ChunkMeta> out = new HashMap<ChunkKey, ChunkMeta>(); for (ChunkKey chunk : keys) { byte[] row = chunk.asBytes(); MemTable.Cell cell = table.get(row, colMeta.name()); if (cell != null) { try { out.put(chunk, ChunkMeta.parseFrom(cell.getValue())); } catch (InvalidProtocolBufferException err) { callback.onFailure(new DhtException(MessageFormat.format( DhtText.get().invalidChunkMeta, chunk), err)); return; } } } callback.onSuccess(out); }
public void get(Context options, Set<ObjectIndexKey> objects, AsyncCallback<Map<ObjectIndexKey, Collection<ObjectInfo>>> callback) { Map<ObjectIndexKey, Collection<ObjectInfo>> out = new HashMap<ObjectIndexKey, Collection<ObjectInfo>>(); for (ObjectIndexKey objId : objects) { for (MemTable.Cell cell : table.scanFamily(objId.asBytes(), colInfo)) { Collection<ObjectInfo> chunks = out.get(objId); ChunkKey chunkKey; if (chunks == null) { chunks = new ArrayList<ObjectInfo>(4); out.put(objId, chunks); } chunkKey = ChunkKey.fromBytes(colInfo.suffix(cell.getName())); try { chunks.add(new ObjectInfo( chunkKey, cell.getTimestamp(), GitStore.ObjectInfo.parseFrom(cell.getValue()))); } catch (InvalidProtocolBufferException badCell) { callback.onFailure(new DhtException(MessageFormat.format( DhtText.get().invalidObjectInfo, objId, chunkKey), badCell)); return; } } } callback.onSuccess(out); }
public void get(Context options, Set<ObjectIndexKey> objects, AsyncCallback<Map<ObjectIndexKey, Collection<ObjectInfo>>> callback) { Map<ObjectIndexKey, Collection<ObjectInfo>> out = new HashMap<ObjectIndexKey, Collection<ObjectInfo>>(); for (ObjectIndexKey objId : objects) { for (MemTable.Cell cell : table.scanFamily(objId.asBytes(), colInfo)) { Collection<ObjectInfo> chunks = out.get(objId); ChunkKey chunkKey; if (chunks == null) { chunks = new ArrayList<ObjectInfo>(4); out.put(objId, chunks); } chunkKey = ChunkKey.fromBytes(colInfo.suffix(cell.getName())); try { chunks.add(new ObjectInfo( chunkKey, cell.getTimestamp(), GitStore.ObjectInfo.parseFrom(cell.getValue()))); } catch (InvalidProtocolBufferException badCell) { callback.onFailure(new DhtException(MessageFormat.format( DhtText.get().invalidObjectInfo, objId, chunkKey), badCell)); return; } } } callback.onSuccess(out); }
public void get(Context options, Set<ChunkKey> keys, AsyncCallback<Collection<PackChunk.Members>> callback) { int cnt = keys.size(); List<PackChunk.Members> out = new ArrayList<PackChunk.Members>(cnt); for (ChunkKey chunk : keys) { byte[] row = chunk.asBytes(); MemTable.Cell cell; cell = table.get(row, colData.name()); if (cell == null) continue; PackChunk.Members m = new PackChunk.Members(); m.setChunkKey(chunk); m.setChunkData(cell.getValue()); cell = table.get(row, colIndex.name()); if (cell != null) m.setChunkIndex(cell.getValue()); cell = table.get(row, colMeta.name()); if (cell != null) { try { m.setMeta(ChunkMeta.parseFrom(cell.getValue())); } catch (InvalidProtocolBufferException err) { callback.onFailure(new DhtException(MessageFormat.format( DhtText.get().invalidChunkMeta, chunk), err)); return; } } out.add(m); } callback.onSuccess(out); }
public void get(Context options, Set<ChunkKey> keys, AsyncCallback<Collection<PackChunk.Members>> callback) { int cnt = keys.size(); List<PackChunk.Members> out = new ArrayList<PackChunk.Members>(cnt); for (ChunkKey chunk : keys) { byte[] row = chunk.asBytes(); MemTable.Cell cell; cell = table.get(row, colData.name()); if (cell == null) continue; PackChunk.Members m = new PackChunk.Members(); m.setChunkKey(chunk); m.setChunkData(cell.getValue()); cell = table.get(row, colIndex.name()); if (cell != null) m.setChunkIndex(cell.getValue()); cell = table.get(row, colMeta.name()); if (cell != null) { try { m.setMeta(ChunkMeta.parseFrom(cell.getValue())); } catch (InvalidProtocolBufferException err) { callback.onFailure(new DhtException(MessageFormat.format( DhtText.get().invalidChunkMeta, chunk), err)); return; } } out.add(m); } callback.onSuccess(out); }