Varlink – A plain-text, type-safe, discoverable, self-documenting interface
varlink.org
varlink.org
It seems like it might be a nice middle ground between Protobuf (strongly-typed, specified) and JSON-RPC (human-readable, doesn't need a special library). But requiring clients to use a new RPC format is still a tough sell. What are the main advantages of Varlink over more mainstream RPC formats?
I don't think it does anything _much_ different than protobuf or JSON-RPC but simply IMO tries to create a common interface to interact with software or daemons. Protobuf is by itself just a protocol and encoding format, while Varlink wants to create a generic network-independent RPC interface you can easily access from your shell.
I'm not sure I understand what's the underlying transport protocol (HTTP? custom one?) but having JSON as encoding format is pretty nice, any shell script could talk with it and it's eas(ier) to inspect.
It looks like a generalised version of DBus, without requiring a central daemon. I think it looks pretty cool.
EDIT: also it seems to natively handle subscriptions/polling for changes.
EDIT 2: the transport protocol is just read/writing raw JSON to the file descriptor/socket, see the strace snippet at the bottom of https://github.com/varlink/linux-varlink
1: https://github.com/containers/libpod/blob/master/cmd/podman/...
Why do people say things like this? The only format unix shell can reliably understand is tab-separated value.
To be fair, I have jq installed and I have no idea how to use it.
If you want something that is just a good query language then I would highly recommend JMESPath. It's a little harder to grok initially but the spec is extremely detailed, comes with examples, and there's libraries for all the 'popular' programming languages.
A good CLI tool that wraps the Go library is https://github.com/jmespath/jp
https://lwn.net/Articles/742675/
It would be interesting for the shell to open a varlink connection to commands to allow progress updates. I could also see shells command completion interface being greatly simplified by using varlink.
I feel that leveraging an existing language with good DSL support, along with an existing IDE (e.g. IntelliJ) would be a lot more pragmatic, easier to support and to potentially maintain.
There is absolutely no reason for a text format here, especially one as naive and inefficient as this. Binary messages that include size and version _at the beginning_ would be the expected solution.