public RepositoryKey get(RepositoryName name) throws DhtException, TimeoutException { Cell cell = table.get(name.asBytes(), colId.name()); if (cell == null) return null; return RepositoryKey.fromBytes(cell.getValue()); }
public RepositoryKey get(RepositoryName name) throws DhtException, TimeoutException { Cell cell = table.get(name.asBytes(), colId.name()); if (cell == null) return null; return RepositoryKey.fromBytes(cell.getValue()); }
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<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); }