/** * @param key * @return the key */ public static CachedPackKey fromString(String key) { int d = key.indexOf('.'); ObjectId name = ObjectId.fromString(key.substring(0, d)); ObjectId vers = ObjectId.fromString(key.substring(d + 1)); return new CachedPackKey(name, vers); }
@Override public String toString() { return "cached-pack:" + asString(); } }
/** * @param key * @return the key */ public static CachedPackKey fromBytes(byte[] key) { return fromBytes(key, 0, key.length); }
info.setVersion(ObjectId.fromRaw(version.digest()).name()); cachedPackKey = CachedPackKey.fromInfo(info.build()); for (List<ChunkKey> list : chunkByOrder) { if (list == null) GitStore.ChunkInfo.Builder b = GitStore.ChunkInfo.newBuilder(oldInfo.getData()); b.setCachedPackKey(cachedPackKey.asString()); ChunkInfo newInfo = new ChunkInfo(key, b.build()); infoByKey.put(key, newInfo);
public void remove(RepositoryKey repo, CachedPackKey key, WriteBuffer buffer) throws DhtException { table.delete(repo.asBytes(), colCachedPack.append(key.asBytes())); } }
info.setVersion(ObjectId.fromRaw(version.digest()).name()); cachedPackKey = CachedPackKey.fromInfo(info.build()); for (List<ChunkKey> list : chunkByOrder) { if (list == null) GitStore.ChunkInfo.Builder b = GitStore.ChunkInfo.newBuilder(oldInfo.getData()); b.setCachedPackKey(cachedPackKey.asString()); ChunkInfo newInfo = new ChunkInfo(key, b.build()); infoByKey.put(key, newInfo);
public void remove(RepositoryKey repo, CachedPackKey key, WriteBuffer buffer) throws DhtException { table.delete(repo.asBytes(), colCachedPack.append(key.asBytes())); } }
/** * @param key * @return the key */ public static CachedPackKey fromString(String key) { int d = key.indexOf('.'); ObjectId name = ObjectId.fromString(key.substring(0, d)); ObjectId vers = ObjectId.fromString(key.substring(d + 1)); return new CachedPackKey(name, vers); }
/** * @param key * @return the key */ public static CachedPackKey fromBytes(byte[] key) { return fromBytes(key, 0, key.length); }
@Override public String toString() { return "cached-pack:" + asString(); } }
/** * @param key * @param ptr * @param len * @return the key */ public static CachedPackKey fromBytes(byte[] key, int ptr, int len) { if (len != KEYLEN) throw new IllegalArgumentException(MessageFormat.format( DhtText.get().invalidChunkKey, decode(key, ptr, ptr + len))); ObjectId name = ObjectId.fromString(key, ptr); ObjectId vers = ObjectId.fromString(key, ptr + 41); return new CachedPackKey(name, vers); }
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; }
/** * @param key * @param ptr * @param len * @return the key */ public static CachedPackKey fromBytes(byte[] key, int ptr, int len) { if (len != KEYLEN) throw new IllegalArgumentException(MessageFormat.format( DhtText.get().invalidChunkKey, decode(key, ptr, ptr + len))); ObjectId name = ObjectId.fromString(key, ptr); ObjectId vers = ObjectId.fromString(key, ptr + 41); return new CachedPackKey(name, vers); }
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; }
/** * @param info * @return the key */ public static CachedPackKey fromInfo(CachedPackInfo info) { ObjectId name = ObjectId.fromString(info.getName()); ObjectId vers = ObjectId.fromString(info.getVersion()); return new CachedPackKey(name, vers); }
/** * @param info * @return the key */ public static CachedPackKey fromInfo(CachedPackInfo info) { ObjectId name = ObjectId.fromString(info.getName()); ObjectId vers = ObjectId.fromString(info.getVersion()); return new CachedPackKey(name, vers); }