Over the last few years, I've worked on open-source distributed systems in Go at Google. As a result, I've thought a lot about dependency management, systems configuration, programming languages, and compilers.
Again and again, I saw the same fundamental data structure underpinning these technologies: the directed acyclic graph. The most frustrating part was modeling graph-based configuration in languages that optimized for hierarchical data structures. That's why I created Virgo.
Virgo is a graph-based configuration language. It has two main features: edge definitions and vertex definitions. The vgo configuration file then parses into an adjacency list. You can achieve similar results by adding additional conventions and restrictions on YAML or JSON. Much like YAML optimized for human readability, Virgo optimizes natural graph readability, editability, and representation.
// config.vgo a -> b, c, d -> e <- f, g
Virgo is open to proposals and language changes. Please open up an issue to start a discussion at https://github.com/r2d4/virgo.
Graphs are everywhere in configuration management. One graph that engineers may be familiar with is the
Makefile target graph. The
make tool topologically sorts the targets that it resolves, which lets it build the files in order. Virgo's CLI or Go library allows developers to replicate this feature easily.
There are three entry points to parsing the Virgo file. First, you can use the Go library found in the same repository to parse the file into a native Go struct. Second, there is also a published CLI binary that exposes the parsing function for other environments. Finally, someone from the community has written a binding in Python https://github.com/jwg4/pyvirgo.
One operation we frequently want to perform on graphs is a topological sort. Topological sorting is a linear ordering of vertices such that for every directed edge u -> v, vertex u comes before v in the sequence.
The CLI tool topologically sorts the graph and can even start from a particular vertex (analogous to a Make target).
$ virgo run build.vgo:parser
Build systems are not the only type of configuration schema that can benefit from a graphical representation. Some other examples include:
- deployment of microservices
- docker build instructions
- continuous-integration pipelines
- package dependencies
- git commits
For complete documentation on the language and features of Virgo, visit the GitHub page https://github.com/r2d4/virgo.