@Override public boolean exists() { return repository.getRepositoryKey() != null; }
@Override public boolean exists() { return repository.getRepositoryKey() != null; }
private Set<Map.Entry<RefKey, RefData>> scan() throws DhtException, TimeoutException { // TODO(spearce) Do we need to perform READ_REPAIR here? RepositoryKey repo = repository.getRepositoryKey(); return db.ref().getAll(Context.LOCAL, repo).entrySet(); }
private Set<Map.Entry<RefKey, RefData>> scan() throws DhtException, TimeoutException { // TODO(spearce) Do we need to perform READ_REPAIR here? RepositoryKey repo = repository.getRepositoryKey(); return db.ref().getAll(Context.LOCAL, repo).entrySet(); }
DhtInserter(DhtObjDatabase objdb) { this.objdb = objdb; this.repo = objdb.getRepository().getRepositoryKey(); this.db = objdb.getDatabase(); this.options = objdb.getInserterOptions(); }
DhtInserter(DhtObjDatabase objdb) { this.objdb = objdb; this.repo = objdb.getRepository().getRepositoryKey(); this.db = objdb.getDatabase(); this.options = objdb.getInserterOptions(); }
private void cachePeeledState(Ref oldLeaf, Ref newLeaf) { // TODO(spearce) Use an ExecutorService here try { RepositoryKey repo = repository.getRepositoryKey(); RefKey key = RefKey.create(repo, newLeaf.getName()); RefData oldData = ((DhtRef) oldLeaf).getRefData(); RefData newData = ((DhtRef) newLeaf).getRefData(); db.ref().compareAndPut(key, oldData, newData); } catch (TimeoutException e) { // Ignore a timeout here, we were only trying to update // a cached value to save peeling costs in the future. } catch (DhtException e) { // Ignore a database error, this was only an attempt to // fix a value that could be cached to save time later. } }
this.repo = objdb.getRepository().getRepositoryKey(); this.db = objdb.getDatabase(); this.options = objdb.getInserterOptions();
private void cachePeeledState(Ref oldLeaf, Ref newLeaf) { // TODO(spearce) Use an ExecutorService here try { RepositoryKey repo = repository.getRepositoryKey(); RefKey key = RefKey.create(repo, newLeaf.getName()); RefData oldData = ((DhtRef) oldLeaf).getRefData(); RefData newData = ((DhtRef) newLeaf).getRefData(); db.ref().compareAndPut(key, oldData, newData); } catch (TimeoutException e) { // Ignore a timeout here, we were only trying to update // a cached value to save peeling costs in the future. } catch (DhtException e) { // Ignore a database error, this was only an attempt to // fix a value that could be cached to save time later. } }
this.repo = objdb.getRepository().getRepositoryKey(); this.db = objdb.getDatabase(); this.options = objdb.getInserterOptions();
DhtReader(DhtObjDatabase objdb) { this.repository = objdb.getRepository(); this.repo = objdb.getRepository().getRepositoryKey(); this.db = objdb.getDatabase(); this.readerOptions = objdb.getReaderOptions(); this.inserterOptions = objdb.getInserterOptions(); this.stats = new Statistics(); this.recentInfo = new RecentInfoCache(getOptions()); this.recentChunks = new RecentChunks(this); this.deltaBaseCache = new DeltaBaseCache(this); }
DhtReader(DhtObjDatabase objdb) { this.repository = objdb.getRepository(); this.repo = objdb.getRepository().getRepositoryKey(); this.db = objdb.getDatabase(); this.readerOptions = objdb.getReaderOptions(); this.inserterOptions = objdb.getInserterOptions(); this.stats = new Statistics(); this.recentInfo = new RecentInfoCache(getOptions()); this.recentChunks = new RecentChunks(this); this.deltaBaseCache = new DeltaBaseCache(this); }
@Override public DhtRefUpdate newUpdate(String refName, boolean detach) throws IOException { boolean detachingSymbolicRef = false; DhtRef ref = getOneRef(refName); if (ref == null) ref = new DhtObjectIdRef(refName, NONE); else detachingSymbolicRef = detach && ref.isSymbolic(); if (detachingSymbolicRef) { RefData src = ((DhtRef) ref.getLeaf()).getRefData(); RefData.Builder b = RefData.newBuilder(ref.getRefData()); b.clearSymref(); b.setTarget(src.getTarget()); ref = new DhtObjectIdRef(refName, b.build()); } RepositoryKey repo = repository.getRepositoryKey(); DhtRefUpdate update = new DhtRefUpdate(this, repo, db, ref); if (detachingSymbolicRef) update.setDetachingSymbolicRef(); return update; }
@Override public DhtRefUpdate newUpdate(String refName, boolean detach) throws IOException { boolean detachingSymbolicRef = false; DhtRef ref = getOneRef(refName); if (ref == null) ref = new DhtObjectIdRef(refName, NONE); else detachingSymbolicRef = detach && ref.isSymbolic(); if (detachingSymbolicRef) { RefData src = ((DhtRef) ref.getLeaf()).getRefData(); RefData.Builder b = RefData.newBuilder(ref.getRefData()); b.clearSymref(); b.setTarget(src.getTarget()); ref = new DhtObjectIdRef(refName, b.build()); } RepositoryKey repo = repository.getRepositoryKey(); DhtRefUpdate update = new DhtRefUpdate(this, repo, db, ref); if (detachingSymbolicRef) update.setDetachingSymbolicRef(); return update; }