Over the last few years, I've worked on open source distributed systems in Go at Google. 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 Virgo configuration file then parses into an adjacency list. You can clearly achieve similar results from adding additional conventions and restrictions on YAML or JSON. Much like YAML optimized for human readability, Virgo optimizes for 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 allow developers to replicate this feature easily.
There are two entrypoints to parsing the Virgo file. You can use the Go library found in the same repository to parse the file into a native Go struct. There is also a published CLI binary that exposes the parsing function for other environments.
One operation we frequently want to perform on graphs is a topological sort. A topological sorting is a linear ordering of vertices such that for every directed edge u -> v, vertex u comes before v in the ordering.
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 full documentation on the language and features of Virgo, visit the GitHub page https://github.com/r2d4/virgo.