mirror of
https://github.com/usatiuk/dhfs.git
synced 2025-10-28 20:47:49 +01:00
remove tryQuickDelete
not much need for it when we have a dedicated thread with delay smaller than writeback delay
This commit is contained in:
@@ -15,8 +15,5 @@ public interface JObjectManager {
|
||||
// Get an object with a name if it exists, otherwise create new one based on metadata
|
||||
JObject<?> getOrPut(String name, Optional<String> parent);
|
||||
|
||||
void tryQuickDelete(JObject<?> object);
|
||||
|
||||
void notifySent(String key);
|
||||
|
||||
}
|
||||
|
||||
@@ -200,39 +200,6 @@ public class JObjectManagerImpl implements JObjectManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tryQuickDelete(JObject<?> object) {
|
||||
object.runWriteLocked(JObject.ResolutionStrategy.NO_RESOLUTION, (m, d, b, i) -> {
|
||||
if (m.getRefcount() > 0) return false;
|
||||
if (m.isSeen()) {
|
||||
jobjectRefProcessor.putDeletionCandidate(object.getName());
|
||||
return false;
|
||||
}
|
||||
|
||||
object.tryResolve(JObject.ResolutionStrategy.LOCAL_ONLY);
|
||||
|
||||
Log.trace("Quick delete of " + m.getName());
|
||||
m.delete();
|
||||
|
||||
Stream<String> refs = Stream.empty();
|
||||
|
||||
if (m.getSavedRefs() != null)
|
||||
refs = m.getSavedRefs().stream();
|
||||
if (object.getData() != null)
|
||||
refs = Streams.concat(refs, object.getData().extractRefs().stream());
|
||||
|
||||
object.discardData();
|
||||
|
||||
refs.forEach(c -> get(c)
|
||||
.ifPresent(ref -> ref.runWriteLocked(JObject.ResolutionStrategy.NO_RESOLUTION, (mc, dc, bc, ic) -> {
|
||||
mc.removeRef(object.getName());
|
||||
return null;
|
||||
})));
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifySent(String key) {
|
||||
//FIXME:
|
||||
|
||||
@@ -93,10 +93,7 @@ public class JObjectResolver {
|
||||
|
||||
if (self.getMeta().getRefcount() <= 0)
|
||||
if (!self.isDeleted())
|
||||
if (self.getMeta().isSeen())
|
||||
jObjectRefProcessor.putDeletionCandidate(self.getName());
|
||||
else
|
||||
jobjectManager.tryQuickDelete(self);
|
||||
jObjectRefProcessor.putDeletionCandidate(self.getName());
|
||||
}
|
||||
|
||||
public <T extends JObjectData> Optional<T> resolveDataLocal(JObject<T> jObject) {
|
||||
|
||||
Reference in New Issue
Block a user