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:
@@ -376,6 +376,22 @@ type CompatibleRes interface {
|
||||
Merge(CompatibleRes) (CompatibleRes, error)
|
||||
}
|
||||
|
||||
// ExportableRes allows the resource to have its own implementation of resource
|
||||
// encoding, so that it can send data over the wire differently. It's unlikely
|
||||
// that you will want to implement this interface for most scenarios. It may be
|
||||
// useful to limit private data exposure, large data sizes, and to add more info
|
||||
// to what would normally be shared.
|
||||
type ExportableRes interface {
|
||||
Res
|
||||
|
||||
// ToB64 lets the resource provide an alternative implementation of the
|
||||
// usual ResToB64 method. This lets the resource omit, add, or modify
|
||||
// the parameter data before it goes out over the wire.
|
||||
ToB64() (string, error)
|
||||
|
||||
// TODO: Do we want to add a FromB64 method for decoding the Resource?
|
||||
}
|
||||
|
||||
// YAMLRes is a resource that supports creation by unmarshalling.
|
||||
type YAMLRes interface {
|
||||
Res
|
||||
|
||||
Reference in New Issue
Block a user