Repository navigation
Echo each invalidation path back on stdout once it has been applied - #9
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A client writing invalidation paths to stdin has no way to tell when one has taken effect: the write only reports that the path was queued. A client that orders work after an invalidation — re-reading a file it expects to have changed — races the notifications.
A request is now
inval <id> <path>, and gets exactly one reply on stdout:ok <id>once that path'sinval_entryandinval_inodehave been issued, orerr <id> <reason>if the path could not be decoded, so a client always learns the outcome rather than waiting out a timeout. A path that resolves to nothing is still applied and replied to, since that is the ordinary case for a delete or a rename. The id means a client matches a reply to the request that produced it instead of relying on position, and the tag means anything else that ever reaches stdout is not mistaken for a reply.The path is percent-encoded, decoded here with
percent-encoding— a filename may contain the newline that ends a request, and nothing on a Linux filesystem forbids it. The crate brings no further dependencies. The unit tests pin the encoded forms a client is expected to send, since the encoder is a separate library in a separate language.A line with no
invalprefix is still read as a bare unencoded path and replied to withok <path>, so a client that predates this keeps working.