/** * @param reverseId * @return the key */ public static RepositoryKey fromInt(int reverseId) { return new RepositoryKey(reverseId); }
public String asString() { return decode(asBytes()); }
public byte[] asBytes() { byte[] r = new byte[8]; format32(r, 0, asInt()); return r; }
public RepositoryKey get(RepositoryName name) throws DhtException, TimeoutException { CacheKey memKey = ns.key(name); Sync<Map<CacheKey, byte[]>> sync = Sync.create(); client.get(singleton(memKey), sync); Map<CacheKey, byte[]> result; try { result = sync.get(options.getTimeout()); } catch (InterruptedException e) { throw new TimeoutException(); } catch (TimeoutException timeout) { // Fall through and read the database directly. result = emptyMap(); } byte[] data = result.get(memKey); if (data != null) { if (data.length == 0) return null; return RepositoryKey.fromBytes(data); } RepositoryKey key = db.get(name); data = key != null ? key.asBytes() : new byte[0]; client.modify(singleton(Change.put(memKey, data)), none); return key; }
/** @return the repository that contains the chunk. */ public RepositoryKey getRepositoryKey() { return RepositoryKey.fromInt(repo); }
@Override public String toString() { return "repository:" + 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 RepositoryKey nextKey() throws DhtException { return RepositoryKey.create(nextId.incrementAndGet()); }
public RepositoryKey get(RepositoryName name) throws DhtException, TimeoutException { CacheKey memKey = ns.key(name); Sync<Map<CacheKey, byte[]>> sync = Sync.create(); client.get(singleton(memKey), sync); Map<CacheKey, byte[]> result; try { result = sync.get(options.getTimeout()); } catch (InterruptedException e) { throw new TimeoutException(); } catch (TimeoutException timeout) { // Fall through and read the database directly. result = emptyMap(); } byte[] data = result.get(memKey); if (data != null) { if (data.length == 0) return null; return RepositoryKey.fromBytes(data); } RepositoryKey key = db.get(name); data = key != null ? key.asBytes() : new byte[0]; client.modify(singleton(Change.put(memKey, data)), none); return key; }
/** @return the repository that contains the object. */ public RepositoryKey getRepositoryKey() { return RepositoryKey.fromInt(repo); }
@Override public String toString() { return "repository:" + 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 RepositoryKey nextKey() throws DhtException { return RepositoryKey.create(nextId.incrementAndGet()); }
public String asString() { return decode(asBytes()); }
/** * @param repo * @param name * @return the key */ public static RefKey create(RepositoryKey repo, String name) { return new RefKey(repo.asInt(), name); }
/** * @param reverseId * @return the key */ public static RepositoryKey fromInt(int reverseId) { return new RepositoryKey(reverseId); }
/** @return the repository that contains the chunk. */ public RepositoryKey getRepositoryKey() { return RepositoryKey.fromInt(repo); }
public String asString() { return getRepositoryKey().asString() + ":" + name; }
public void remove(RepositoryKey repo, CachedPackKey key, WriteBuffer buffer) throws DhtException { table.delete(repo.asBytes(), colCachedPack.append(key.asBytes())); } }
/** * @param repo * @param chunk * @return the key */ public static ChunkKey create(RepositoryKey repo, ObjectId chunk) { return new ChunkKey(repo.asInt(), chunk); }