feat(upload): [OCISDEV-1382] let the coordinator serve the orphaned session - #726
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
| } | ||
|
|
||
| // IsOrphaned reports whether the referenced resource exists but its metadata is unreadable. | ||
| func (f *FS) IsOrphaned(ctx context.Context, ref *provider.Reference) bool { |
There was a problem hiding this comment.
Here in the middleware, if the driver does not support IsOrphaned it would panic. The coordinator check sees that the middleware supports IsOrphaned, so does not return NotSupported. But then afterwards, this method would panic.
It's only a practical risk, since middleware always has decomposedfs, which always has IsOrphaned. If we want to be extra safe, we can do something like this:
func (f *FS) IsOrphaned(ctx context.Context, ref *provider.Reference) bool {
if checker, ok := f.next.(storage.OrphanChecker); ok {
return checker.IsOrphaned(ctx, ref)
}
return false // inner driver doesn't support it
}
There was a problem hiding this comment.
Yeah, good point. The middleware satisfies OrphanChecker either way, so the check doesn't really tell you much. But Not sure about returning false though. There's no error to return, so false just means "healthy", so you'd run --orphaned, get an empty list, and think there's nothing to clean up. I'd rather it blow up than quietly report everything as fine
…