API or Plugin For Cluster

Curious if there are ever plans to expose the cluster functionality for other uses via an API or plugin system.

I’m thinking use cases like the “Redis over CockroachDB” experiment you published on your blog: https://www.cockroachlabs.com/blog/could-cockroachdb-ever-replace-redis-a-free-fridays-experiment/ Or even simpler, but much lighter examples, like creating your own http/json endpoint that shows cluster/db status.

That was interesting to me, but the implementation had to be a fork of the entire codebase since there’s no entry point for that kind of functionality.

Are there any future plans for some sort of plugin or api that lets you inject your own functionality that gets the benefit of the built-in cluster?

Indeed, plugins seem like a really exciting way to let developers build new and interesting things on top of CockroachDB or extend its functionality in areas that we might not yet be ready to merge into the core.

We’ve discussed adding plugin support a few times informally, but we’re currently waiting on Go’s official plugin support to stabilize across platforms before we start any concrete work (some of the other options, like co-processes and local RPCs, aren’t exactly appealing). Sadly Go has pushed it back a couple releases in a row now, but we’re watching for updates on https://github.com/golang/go/issues/18104.

When plugin support does land in Go, we’ll certainly be evaluating if/where it makes sense to support it in Cockroach – some of the ideas that have been thrown around are custom SQL functions or even query plan nodes, and in fact that redis example you mention, where a plugin could open a port (or register in our existing port mux somehow) and provide a new service backed by our existing storage, network gossip, etc. Again though, those are just off-hand ideas – we’re holding off on concrete plans until we see what Go gives us to work with.

There’s a tracking issue for this too at https://github.com/cockroachdb/cockroach/issues/13901 in case you want to ensure any specific suggestions are recorded.


Perfect…appreciate the insight and links to the Go and CockroachDB tracking issues.