engine, lang: Modern exported resources

I've been waiting to write this patch for a long time. I firmly believe
that the idea of "exported resources" was truly a brilliant one, but
which was never even properly understood by its original inventors! This
patch set aims to show how it should have been done.

The main differences are:

* Real-time modelling, since "once per run" makes no sense.
* Filter with code/functions not language syntax.
* Directed exporting to limit the intended recipients.

The next step is to add more "World" reading and filtering functions to
make it easy and expressive to make your selection of resources to
collect!
This commit is contained in:
James Shubin
2025-03-24 18:54:06 -04:00
parent 955112f64f
commit 045b29291e
24 changed files with 2367 additions and 312 deletions

View File

@@ -1014,6 +1014,22 @@ func (obj *Main) Run() error {
continue // stay paused
}
// XXX: Should we do this right before Commit?
// Don't obj.ge.Apply(...), that works on the old graph!
timing = time.Now()
//if !obj.ge.IsClosing() { // XXX: do we need to do this?
// skip prune when we're closing
//}
// FIXME: is this the right ctx?
if err := obj.ge.Exporter.Prune(exitCtx, obj.ge.Graph()); err != nil {
// XXX: This should just cause a permanent error
// here which turns into a shutdown. Refactor!
obj.ge.Abort() // delete graph
Logf("error running the exporter Prune: %+v", err)
continue
}
Logf("export cleanup took: %s", time.Since(timing))
// Start needs to be synchronous because we don't want
// to loop around and cause a pause before we unpaused.
// Commit already starts things, but we still need to