public Collection<CachedPackInfo> getCachedPacks(RepositoryKey repo) throws DhtException, TimeoutException { List<CachedPackInfo> out = new ArrayList<CachedPackInfo>(4); for (MemTable.Cell cell : table.scanFamily(repo.asBytes(), colCachedPack)) { try { out.add(CachedPackInfo.parseFrom(cell.getValue())); } catch (InvalidProtocolBufferException e) { throw new DhtException(MessageFormat.format( DhtText.get().invalidCachedPackInfo, repo, CachedPackKey.fromBytes(cell.getName())), e); } } return out; }
public Collection<CachedPackInfo> getCachedPacks(RepositoryKey repo) throws DhtException, TimeoutException { List<CachedPackInfo> out = new ArrayList<CachedPackInfo>(4); for (MemTable.Cell cell : table.scanFamily(repo.asBytes(), colCachedPack)) { try { out.add(CachedPackInfo.parseFrom(cell.getValue())); } catch (InvalidProtocolBufferException e) { throw new DhtException(MessageFormat.format( DhtText.get().invalidCachedPackInfo, repo, CachedPackKey.fromBytes(cell.getName())), e); } } return out; }
public Map<RefKey, RefData> getAll(Context options, RepositoryKey repository) throws DhtException, TimeoutException { Map<RefKey, RefData> out = new HashMap<RefKey, RefData>(); for (MemTable.Cell cell : table.scanFamily(repository.asBytes(), colRef)) { RefKey ref = RefKey.fromBytes(colRef.suffix(cell.getName())); try { out.put(ref, RefData.parseFrom(cell.getValue())); } catch (InvalidProtocolBufferException badCell) { throw new DhtException(MessageFormat.format( DhtText.get().invalidRefData, ref), badCell); } } return out; }
public Map<RefKey, RefData> getAll(Context options, RepositoryKey repository) throws DhtException, TimeoutException { Map<RefKey, RefData> out = new HashMap<RefKey, RefData>(); for (MemTable.Cell cell : table.scanFamily(repository.asBytes(), colRef)) { RefKey ref = RefKey.fromBytes(colRef.suffix(cell.getName())); try { out.put(ref, RefData.parseFrom(cell.getValue())); } catch (InvalidProtocolBufferException badCell) { throw new DhtException(MessageFormat.format( DhtText.get().invalidRefData, ref), badCell); } } return 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); }