-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace shm.map with separate create() and open() #794
Conversation
Currently shm.map() will create the file and any containing directories if it does not exist. This is not so great, so I split it into separate open() and create() functions, adapt all callers, and remove map() from the public interface of the shm module.
"hierarchical", "brevity", "artefact", "bureaucracy"... damn these words :) |
I fail to see why. Can you elaborate? As far as I am concerned this changes the API around file system semantics that are not relevant to the API. E.g. before you could first map an object read only, then another process could map that object, write to it, and it would work. Now you need to make sure that you open an object only after it was created by another process. Correct me if I am wrong. |
I should consider whether this helps solve the problem with #767. |
This is correct. It could be that we always want to be using create(). It seems wrong to me though in some deep way :) Like, a process that is just reading data doesn't want to create it if it doesn't exist. The fact that a counter doesn't exist could be interesting information that would be perturbed by the reader. For example if there is counter data that has some kind of complicated interior structure I would want to be sure to initialize it correctly; dunno. Concretely Perhaps this is worrying too much though; other thoughts are welcome. |
Added on a couple commits I found while porting the histogram to use this. |
I would like to have the histogram stuff off my plate by the end of the week, so review here would be appreciated @eugeneia :) |
@wingo Sorry, somehow I missed the previous comments. I gave this a lot of thought and while I generally feel bad about extending an API based on gut feeling, I do share the same gut feeling and feel that this new API is more hygienic. What is missing though is the adaption of |
Thanks for the review. I am not sure how snabb top would break; it does seem to work for me in #795, but I will check tomorrow to make sure. |
It works because #795 updates |
Hmm, OK. I don't see the change you refer to in #795; would you mind pointing it out? I do try to keep these things atomic but I occasionally make mistakes :) |
@wingo Oops, my bad. Somehow I was absolutely sure that |
Thanks very much for the review and merge; cheers :) |
Update lwaftr-kristian with lwaftr branch
Currently shm.map() will create the file and any containing directories
if it does not exist. This is not so great, so I split it into separate
open() and create() functions, adapt all callers, and remove map() from
the public interface of the shm module.