/** * Update the cached peeled state of a reference * <p> * The ref database invokes this method after it peels a reference that had * not been peeled before. This allows the storage to cache the peel state * of the reference, and if it is actually peelable, the target that it * peels to, so that on-the-fly peeling doesn't have to happen on the next * reference read. * * @param oldLeaf * the old reference. * @param newLeaf * the new reference, with peel information. */ protected void cachePeeledState(Ref oldLeaf, Ref newLeaf) { try { compareAndPut(oldLeaf, newLeaf); } catch (IOException e) { // Ignore an exception during caching. } }
/** {@inheritDoc} */ @Override protected Result doLink(String target) throws IOException { final SymbolicRef newRef = new SymbolicRef( dstRef.getName(), new ObjectIdRef.Unpeeled( Storage.NEW, target, null)); if (getRefDatabase().compareAndPut(dstRef, newRef)) { getRefDatabase().stored(newRef); if (dstRef.getStorage() == Ref.Storage.NEW) return Result.NEW; return Result.FORCED; } return Result.LOCK_FAILURE; } }
/** * Update the cached peeled state of a reference * <p> * The ref database invokes this method after it peels a reference that had * not been peeled before. This allows the storage to cache the peel state * of the reference, and if it is actually peelable, the target that it * peels to, so that on-the-fly peeling doesn't have to happen on the next * reference read. * * @param oldLeaf * the old reference. * @param newLeaf * the new reference, with peel information. */ protected void cachePeeledState(Ref oldLeaf, Ref newLeaf) { try { compareAndPut(oldLeaf, newLeaf); } catch (IOException e) { // Ignore an exception during caching. } }
/** * Update the cached peeled state of a reference * <p> * The ref database invokes this method after it peels a reference that had * not been peeled before. This allows the storage to cache the peel state * of the reference, and if it is actually peelable, the target that it * peels to, so that on-the-fly peeling doesn't have to happen on the next * reference read. * * @param oldLeaf * the old reference. * @param newLeaf * the new reference, with peel information. */ protected void cachePeeledState(Ref oldLeaf, Ref newLeaf) { try { compareAndPut(oldLeaf, newLeaf); } catch (IOException e) { // Ignore an exception during caching. } }
/** {@inheritDoc} */ @Override protected Result doUpdate(Result desiredResult) throws IOException { ObjectIdRef newRef; RevObject obj = rw.parseAny(getNewObjectId()); if (obj instanceof RevTag) { newRef = new ObjectIdRef.PeeledTag( Storage.PACKED, dstRef.getName(), getNewObjectId(), rw.peel(obj).copy()); } else { newRef = new ObjectIdRef.PeeledNonTag( Storage.PACKED, dstRef.getName(), getNewObjectId()); } if (getRefDatabase().compareAndPut(dstRef, newRef)) { getRefDatabase().stored(newRef); return desiredResult; } return Result.LOCK_FAILURE; }
@Override protected Result doLink(String target) throws IOException { final SymbolicRef newRef = new SymbolicRef( dstRef.getName(), new ObjectIdRef.Unpeeled( Storage.NEW, target, null)); if (getRefDatabase().compareAndPut(dstRef, newRef)) { getRefDatabase().stored(newRef); if (dstRef.getStorage() == Ref.Storage.NEW) return Result.NEW; return Result.FORCED; } return Result.LOCK_FAILURE; } }
/** {@inheritDoc} */ @Override protected Result doLink(String target) throws IOException { final SymbolicRef newRef = new SymbolicRef( dstRef.getName(), new ObjectIdRef.Unpeeled( Storage.NEW, target, null)); if (getRefDatabase().compareAndPut(dstRef, newRef)) { getRefDatabase().stored(newRef); if (dstRef.getStorage() == Ref.Storage.NEW) return Result.NEW; return Result.FORCED; } return Result.LOCK_FAILURE; } }
/** {@inheritDoc} */ @Override protected Result doUpdate(Result desiredResult) throws IOException { ObjectIdRef newRef; RevObject obj = rw.parseAny(getNewObjectId()); if (obj instanceof RevTag) { newRef = new ObjectIdRef.PeeledTag( Storage.PACKED, dstRef.getName(), getNewObjectId(), rw.peel(obj).copy()); } else { newRef = new ObjectIdRef.PeeledNonTag( Storage.PACKED, dstRef.getName(), getNewObjectId()); } if (getRefDatabase().compareAndPut(dstRef, newRef)) { getRefDatabase().stored(newRef); return desiredResult; } return Result.LOCK_FAILURE; }
@Override protected Result doUpdate(Result desiredResult) throws IOException { ObjectIdRef newRef; RevObject obj = rw.parseAny(getNewObjectId()); if (obj instanceof RevTag) { newRef = new ObjectIdRef.PeeledTag( Storage.PACKED, dstRef.getName(), getNewObjectId(), rw.peel(obj).copy()); } else { newRef = new ObjectIdRef.PeeledNonTag( Storage.PACKED, dstRef.getName(), getNewObjectId()); } if (getRefDatabase().compareAndPut(dstRef, newRef)) { getRefDatabase().stored(newRef); return desiredResult; } return Result.LOCK_FAILURE; }