You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm just sharing that CUE is turning out to be very useful for Antler, a network testing tool that helps with congestion control work.
Antler uses CUE for configuring tests with "runners" that perform various testing related tasks. From CUE, one can specify lists of flows to run in serial or parallel, packet release timings, congestion control algorithms, etc. Antler's config needs are complex enough that I was almost to the point of making the interface to it an API, to avoid configuration woes, but CUE is robust enough to handle it. :)
I do have a few things I hope to improve some day...
In Antler's config, users need to generate lists of numbers from statistical distributions. Right now, I give them the option to use a Go template, which in turn generates the CUE file. The Go template has a few functions that use the gonum stats library, i.e. to take numbers from exponential or lognormal distributions. I would love it if I could provide CUE functions for people to do that. Otherwise once in template space, they're unable to use CUE variables, interpolations, etc. But, I understand this discussion about the hermetic nature of CUE.
I often need to specify an interface implementation in CUE. What I end up doing is making each type a field in CUE, then I write boilerplate "enum" structs in Go, like the Runners struct in run.go. Then, using CUE disjunctions, I enforce that only one of the fields in the enum is set. I suppose I could instead have a Type field that selects the type, somehow add schema that switches on that field, and somehow use the CUE API to select the implementation. I haven't figured out yet if there's a better way.
Sometimes the error messages for invalid syntax under disjunction types are unclear. For example, if deep inside a Test I have an incorrect field name, which should be called FlowLabel but is instead called FlowLabel2, I get an error message that doesn't point to where the problem is:
antler: Run: 1 errors in empty disjunction:
Run: field not allowed: Test:
/home/heistp/go/src/github.com/heistp/antler/examples/tcpstream/tcpstream.cue:26:2
config.cue:11:6
config.cue:23:11
config.cue:24:2
If I remove the enum-enforcing disjunctions from the schema, the error messages improve. I should boil the above down into a simple example so it's clearer, so perhaps I'll do that in a separate post.
Anyway, the above are minor issues compared to the number of ways in which CUE has helped, so thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I'm just sharing that CUE is turning out to be very useful for Antler, a network testing tool that helps with congestion control work.
Antler uses CUE for configuring tests with "runners" that perform various testing related tasks. From CUE, one can specify lists of flows to run in serial or parallel, packet release timings, congestion control algorithms, etc. Antler's config needs are complex enough that I was almost to the point of making the interface to it an API, to avoid configuration woes, but CUE is robust enough to handle it. :)
I do have a few things I hope to improve some day...
In Antler's config, users need to generate lists of numbers from statistical distributions. Right now, I give them the option to use a Go template, which in turn generates the CUE file. The Go template has a few functions that use the gonum stats library, i.e. to take numbers from exponential or lognormal distributions. I would love it if I could provide CUE functions for people to do that. Otherwise once in template space, they're unable to use CUE variables, interpolations, etc. But, I understand this discussion about the hermetic nature of CUE.
I often need to specify an interface implementation in CUE. What I end up doing is making each type a field in CUE, then I write boilerplate "enum" structs in Go, like the Runners struct in run.go. Then, using CUE disjunctions, I enforce that only one of the fields in the enum is set. I suppose I could instead have a Type field that selects the type, somehow add schema that switches on that field, and somehow use the CUE API to select the implementation. I haven't figured out yet if there's a better way.
Sometimes the error messages for invalid syntax under disjunction types are unclear. For example, if deep inside a Test I have an incorrect field name, which should be called FlowLabel but is instead called FlowLabel2, I get an error message that doesn't point to where the problem is:
If I remove the enum-enforcing disjunctions from the schema, the error messages improve. I should boil the above down into a simple example so it's clearer, so perhaps I'll do that in a separate post.
Anyway, the above are minor issues compared to the number of ways in which CUE has helped, so thanks!
Pete
Beta Was this translation helpful? Give feedback.
All reactions