-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add minimalist DHT API for scripting #165
Comments
Wouldn't it be better to use |
The basic problem is that we need an easy way to modify records in a DHT, for testing. (Read a record, deserialize the struct, change some fields, serialize, write back.) There's no easy way to do this with dhtcli. We did discuss using some kind of struct <-> json converter, say, but I think that'd be a lot more work to develop than the above suggestion would. |
What I did back in the day for a very similar use case was:
That utility was less than 100 LoCs (but only handled deserialization). @christoph-wasicki-sociomantic might still have it hanging around. |
Right, the point is that it requires knowledge of the serialized struct, though, right? That alone locks us into the D domain. |
Sorry, I don't understand your point here. |
My point is that it always requires D code that knows the type of the struct to be deserialized, either to implement a DHT client API that automatically deserializes or a struct -> json deserializer. I guess you weren't suggesting otherwise, though. It's really a question of what is simpler to implement and more convenient to use.
|
I agree that a solution that works via json would be more generic, of course, but we have to think about what is more directly convenient to us right now. (We can also implement both solutions, down the line. There's no reason to have to choose one or the other.) |
Currently, initialising and using a DHT client involves a lot of boilerplate, making it unsuitable for use in quick D scripts.
The ideal would be for things like this to work:
The text was updated successfully, but these errors were encountered: