public void remove(ObjectIndexKey objId, ChunkKey chunk, WriteBuffer buffer) throws DhtException { table.delete(objId.asBytes(), colInfo.append(chunk.asBytes())); } }
public void remove(ChunkKey key, WriteBuffer buffer) throws DhtException { table.deleteRow(key.asBytes()); } }
public void put(PackChunk.Members chunk, WriteBuffer buffer) throws DhtException { byte[] row = chunk.getChunkKey().asBytes(); if (chunk.hasChunkData()) table.put(row, colData.name(), chunk.getChunkData()); if (chunk.hasChunkIndex()) table.put(row, colIndex.name(), chunk.getChunkIndex()); if (chunk.hasMeta()) table.put(row, colMeta.name(), chunk.getMeta().toByteArray()); }
public void putUnique(RepositoryName name, RepositoryKey key) throws DhtException, TimeoutException { boolean ok = table.compareAndSet( // name.asBytes(), // colId.name(), // null, // key.asBytes()); if (!ok) throw new DhtException(MessageFormat.format( DhtText.get().repositoryAlreadyExists, name.asString())); }
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 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; }
if (!same(oldCell, oldVal)) { if (r.isEmpty()) map.remove(rowKey);
public void remove(RepositoryName name, RepositoryKey key) throws DhtException, TimeoutException { boolean ok = table.compareAndSet( name.asBytes(), colId.name(), key.asBytes(), null); if (!ok) throw new DhtException(MessageFormat.format( DhtText.get().repositoryAlreadyExists, name.asString())); } }
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 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; }
if (!same(oldCell, oldVal)) { if (r.isEmpty()) map.remove(rowKey);
public void putUnique(RepositoryName name, RepositoryKey key) throws DhtException, TimeoutException { boolean ok = table.compareAndSet( // name.asBytes(), // colId.name(), // null, // key.asBytes()); if (!ok) throw new DhtException(MessageFormat.format( DhtText.get().repositoryAlreadyExists, name.asString())); }
public void put(PackChunk.Members chunk, WriteBuffer buffer) throws DhtException { byte[] row = chunk.getChunkKey().asBytes(); if (chunk.hasChunkData()) table.put(row, colData.name(), chunk.getChunkData()); if (chunk.hasChunkIndex()) table.put(row, colIndex.name(), chunk.getChunkIndex()); if (chunk.hasMeta()) table.put(row, colMeta.name(), chunk.getMeta().toByteArray()); }
public void remove(RepositoryKey repo, ChunkKey chunk, WriteBuffer buffer) throws DhtException { table.delete(repo.asBytes(), colChunkInfo.append(chunk.asBytes())); }
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 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 remove(ChunkKey key, WriteBuffer buffer) throws DhtException { table.deleteRow(key.asBytes()); } }
public void remove(RepositoryName name, RepositoryKey key) throws DhtException, TimeoutException { boolean ok = table.compareAndSet( name.asBytes(), colId.name(), key.asBytes(), null); if (!ok) throw new DhtException(MessageFormat.format( DhtText.get().repositoryAlreadyExists, name.asString())); } }
public void put(RepositoryKey repo, CachedPackInfo info, WriteBuffer buffer) throws DhtException { CachedPackKey key = CachedPackKey.fromInfo(info); table.put(repo.asBytes(), colCachedPack.append(key.asBytes()), info.toByteArray()); }
public void remove(RepositoryKey repo, CachedPackKey key, WriteBuffer buffer) throws DhtException { table.delete(repo.asBytes(), colCachedPack.append(key.asBytes())); } }