feat: use custom wire format

This commit is contained in:
Peter 2023-08-15 21:46:02 +02:00
parent 1f0c58b1c8
commit 3a2207290f
Signed by: prskr
GPG key ID: C1DB5D2E8DB512F9
26 changed files with 3756 additions and 1249 deletions

22
api.go
View file

@ -1,21 +1,22 @@
package sdk
import (
rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1"
"context"
"fmt"
"golang.org/x/exp/slog"
"io"
"time"
"golang.org/x/exp/slog"
rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1"
)
type Category = rpcv1.Category
const (
CategoryTool Category = rpcv1.Category_CategoryTool
CategoryTask Category = rpcv1.Category_CategoryTask
CategoryBuild Category = rpcv1.Category_CategoryBuild
CategoryPackage Category = rpcv1.Category_CategoryPackage
CategoryTool = rpcv1.Category_CategoryTool
CategoryTask = rpcv1.Category_CategoryTask
CategoryBuild = rpcv1.Category_CategoryBuild
CategoryPackage = rpcv1.Category_CategoryPackage
)
type StateMetadata struct {
@ -35,6 +36,13 @@ type ExecutionContext interface {
SetState(ctx context.Context, key string, value []byte) error
}
type TaskSpec[T Module] struct {
Module T
ModuleName string
Container *rpcv1.ContainerSpec
OutputDir string
}
type Module interface {
Execute(ctx ExecutionContext) error
Category() Category

View file

@ -18,11 +18,6 @@ message Buildr {
string out_dir = 4;
}
message ModuleReference {
Category module_category = 1;
string module_type = 2;
}
message TaskReference {
string id = 1;
string name = 2;
@ -32,7 +27,7 @@ message TaskReference {
message StartTaskRequest {
TaskReference reference = 1;
Buildr buildr = 2;
bytes raw_task = 3;
ModuleSpec spec = 3;
}
message TaskResult {

View file

@ -3,67 +3,98 @@ syntax = "proto3";
package buildr.rpc.v1;
enum Category {
CategoryUnknown = 0;
CategoryTool = 1;
CategoryTask = 2;
CategoryBuild = 3;
CategoryPackage = 4;
CategoryUnknown = 0;
CategoryTool = 1;
CategoryTask = 2;
CategoryBuild = 3;
CategoryPackage = 4;
}
message ModuleDescription {
message DescriptionValue {
string key = 1;
oneof value {
string string_value = 2;
int64 int_value = 3;
double double_value = 4;
bool bool_value = 5;
DescriptionValue nested_value = 6;
}
message ModuleReference {
Category module_category = 1;
string module_type = 2;
}
message ModuleSpec {
enum ValueKind {
ValueKindUnknown = 0;
ValueKindAttribute = 1;
ValueKindLabel = 2;
ValueKindBlock = 4;
}
enum ValueType {
ValueTypeUnknown = 0;
ValueTypeSingle = 1;
ValueTypeObject = 2;
ValueTypeMap = 3;
ValueTypeStringSlice = 4;
ValueTypeIntSlice = 5;
ValueTypeDoubleSlice = 6;
ValueTypeBoolSlice = 7;
}
message Value {
ValueType type = 1;
ValueKind kind = 2;
map<string, Value> complex_value = 10;
oneof single_value {
string string_value = 11;
int64 int_value = 12;
double double_value = 13;
bool bool_value = 14;
}
Category category = 1;
string type = 2;
repeated DescriptionValue description_values = 3;
repeated string string_values = 21;
repeated int64 int_values = 22;
repeated double double_values = 23;
repeated bool bool_values = 24;
}
Category category = 1;
string type = 2;
map<string, Value> values = 3;
}
message ContainerCapabilities {
repeated string add = 1;
repeated string drop = 2;
repeated string add = 1;
repeated string drop = 2;
}
message ContainerBindMount {
string target = 1;
string source = 2;
bool read_only = 3;
string target = 1;
string source = 2;
bool read_only = 3;
}
message ContainerTmpfsMount {
string target = 1;
int64 size = 2;
bool read_only = 3;
string target = 1;
int64 size = 2;
bool read_only = 3;
}
message ContainerVolumeMount {
string target = 1;
string name = 2;
bool read_only = 3;
bool no_copy = 4;
string target = 1;
string name = 2;
bool read_only = 3;
bool no_copy = 4;
}
message ContainerSpec {
string image = 1;
string user = 2;
bool privileged = 3;
ContainerCapabilities capabilities = 4;
repeated ContainerVolumeMount volume_mounts = 5;
repeated ContainerTmpfsMount tmpfs_mounts = 6;
repeated ContainerBindMount bind_mounts = 7;
string image = 1;
string user = 2;
bool privileged = 3;
ContainerCapabilities capabilities = 4;
repeated ContainerVolumeMount volume_mounts = 5;
repeated ContainerTmpfsMount tmpfs_mounts = 6;
repeated ContainerBindMount bind_mounts = 7;
}
message TaskSpec {
string module_name = 1;
ModuleDescription module_description = 2;
map<string,string> input_mapping = 3;
ContainerSpec container = 4;
string output_dir = 5;
}
string module_name = 1;
ModuleSpec module_spec = 2;
ContainerSpec container = 3;
string output_dir = 4;
}

View file

@ -2,6 +2,8 @@ syntax = "proto3";
package buildr.rpc.v1;
import "rpc/v1/spec.proto";
message ProcessStartRequest {
string command = 1;
repeated string args = 2;
@ -23,4 +25,20 @@ message LookupPathRequest {
message LookupPathResponse {
string path = 1;
string error = 2;
}
message HelpRequest {
ModuleReference module_reference = 1;
}
message TaskExample {
string name = 1;
string description = 2;
TaskSpec task_spec = 3;
}
message HelpResponse {
string name = 1;
string description = 2;
repeated TaskExample examples = 3;
}

View file

@ -2,11 +2,12 @@ package sdk
import (
"context"
"encoding/json"
"log/slog"
_ "github.com/tetratelabs/tinymem"
"code.icb4dc0.de/buildr/wasi-module-sdk-go/mem"
"code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol"
rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1"
)
@ -22,7 +23,7 @@ func Inventory() uint64 {
for _, t := range defaultRegistry.List() {
inventory.Modules = append(inventory.Modules, &rpcv1.ModuleReference{
ModuleCategory: t.Category.String(),
ModuleCategory: t.Category,
ModuleType: t.Type,
})
}
@ -45,11 +46,62 @@ func Run(specPtr, specSize uint32) {
executor := NewExecutor(startTask.Buildr.Repo.Root, startTask.Buildr.OutDir, startTask.Buildr.BinDir)
reference := startTask.GetReference().GetModule()
module := defaultRegistry.Get(Category(reference.GetModuleCategory()), reference.GetModuleType())
module := defaultRegistry.Get(reference.GetModuleCategory(), reference.GetModuleType())
if err := json.Unmarshal(startTask.RawTask, module); err != nil {
if err := protocol.Unmarshal(startTask.GetSpec(), module); err != nil {
executor.logger.Error("Failed to unmarshal spec", slog.String("error", err.Error()))
panic(err)
}
executor.Run(context.Background(), module)
}
//export help
func HelpFor(pecPtr, specSize uint32) uint64 {
var helpRequest rpcv1.HelpRequest
if err := helpRequest.UnmarshalVT(mem.DataFromPtr(pecPtr, specSize)); err != nil {
panic(err)
}
module := defaultRegistry.Get(helpRequest.ModuleReference.ModuleCategory, helpRequest.ModuleReference.ModuleType)
if module == nil {
return 0
}
helper, ok := module.(Helper)
if !ok {
return 0
}
modHelp := helper.Help()
var helpResponse = &rpcv1.HelpResponse{
Name: modHelp.Name,
Description: modHelp.Description,
Examples: make([]*rpcv1.TaskExample, 0, len(modHelp.Examples)),
}
for _, e := range modHelp.Examples {
modSpec, err := protocol.Marshal(e.Spec.Module)
if err != nil {
panic(err)
}
helpResponse.Examples = append(helpResponse.Examples, &rpcv1.TaskExample{
Name: e.Name,
Description: e.Description,
TaskSpec: &rpcv1.TaskSpec{
ModuleName: e.Spec.ModuleName,
Container: e.Spec.Container,
OutputDir: e.Spec.OutputDir,
ModuleSpec: modSpec,
},
})
}
data, err := helpResponse.MarshalVT()
if err != nil {
panic(err)
}
return mem.UnifyPtrSize(mem.DataToUnmanagedPtr(data))
}

View file

@ -3,66 +3,19 @@ module hello_world
go 1.20
require (
code.icb4dc0.de/buildr/buildr v0.0.0-00010101000000-000000000000
code.icb4dc0.de/buildr/wasi-module-sdk-go v0.0.0-20230629182727-3bf4797b6abd
code.icb4dc0.de/buildr/wasi-module-sdk-go v0.0.0-20230701111906-1f0c58b1c8a4
github.com/stretchr/testify v1.8.4
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
)
replace (
code.icb4dc0.de/buildr/buildr => ../../../buildr
code.icb4dc0.de/buildr/wasi-module-sdk-go => ../../
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819
)
require (
ariga.io/atlas v0.12.0 // indirect
entgo.io/ent v0.12.3 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230528122434-6f98819771a1 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/docker v24.0.2+incompatible // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/go-openapi/inflect v0.19.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-github/v53 v53.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/hcl/v2 v2.17.0 // indirect
github.com/jinzhu/copier v0.3.5 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/tetratelabs/tinymem v0.1.0 // indirect
github.com/tetratelabs/wazero v1.2.0 // indirect
github.com/zclconf/go-cty v1.13.2 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/tools v0.9.3 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/grpc v1.55.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/uint128 v1.3.0 // indirect
modernc.org/cc/v3 v3.41.0 // indirect
modernc.org/ccgo/v3 v3.16.14 // indirect
modernc.org/libc v1.24.1 // indirect
modernc.org/mathutil v1.5.0 // indirect
modernc.org/memory v1.6.0 // indirect
modernc.org/opt v0.1.3 // indirect
modernc.org/sqlite v1.23.1 // indirect
modernc.org/strutil v1.1.3 // indirect
modernc.org/token v1.1.0 // indirect
)

View file

@ -1,65 +1,17 @@
ariga.io/atlas v0.12.0 h1:jDfjxT3ppKhzqLS26lZv9ni7p9TVNrhy7SQquaF7bPs=
ariga.io/atlas v0.12.0/go.mod h1:+TR129FJZ5Lvzms6dvCeGWh1yR6hMvmXBhug4hrNIGk=
code.icb4dc0.de/prskr/go-pwgen v0.0.0-20230427131724-8ef26fd9749e h1:N+3hdfeHRf/ndLjiZoet6h+9eZ2Zr5O/Ia5G7b3oQXU=
entgo.io/ent v0.12.3 h1:N5lO2EOrHpCH5HYfiMOCHYbo+oh5M8GjT0/cx5x6xkk=
entgo.io/ent v0.12.3/go.mod h1:AigGGx+tbrBBYHAzGOg8ND661E5cxx1Uiu5o/otJ6Yg=
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
github.com/ProtonMail/go-crypto v0.0.0-20230528122434-6f98819771a1 h1:JMDGhoQvXNTqH6Y3MC0IUw6tcZvaUdujNqzK2HYWZc8=
github.com/ProtonMail/go-crypto v0.0.0-20230528122434-6f98819771a1/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs=
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
code.icb4dc0.de/buildr/wasi-module-sdk-go v0.0.0-20230701111906-1f0c58b1c8a4 h1:sDSOMWGtf/c+GGG+K6QR7sa7U+7PFJA5jzaQ2MgpE+8=
code.icb4dc0.de/buildr/wasi-module-sdk-go v0.0.0-20230701111906-1f0c58b1c8a4/go.mod h1:4oTtECbg97YmFN2UHoHj4D59Cgq8/GACMjWeRpcyX4o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg=
github.com/docker/docker v24.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github/v53 v53.0.0 h1:T1RyHbSnpHYnoF0ZYKiIPSgPtuJ8G6vgc0MKodXsQDQ=
github.com/google/go-github/v53 v53.0.0/go.mod h1:XhFRObz+m/l+UCm9b7KSIC3lT3NWSXGt7mOsAWEloao=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hashicorp/hcl/v2 v2.17.0 h1:z1XvSUyXd1HP10U4lrLg5e0JMVz6CPaJvAgxM0KNZVY=
github.com/hashicorp/hcl/v2 v2.17.0/go.mod h1:gJyW2PTShkJqQBKpAmPO3yxMxIuoXkOF2TpqXzrQyx4=
github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg=
github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI=
github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
@ -70,108 +22,12 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tetratelabs/tinymem v0.1.0 h1:Qza1JAg9lquPPJ/CIei5qQYx7t18KLie83O2WR6CM58=
github.com/tetratelabs/tinymem v0.1.0/go.mod h1:WFFTZFhLod6lTL+UetFAopVbGaB+KFsVcIY+RUv7NeY=
github.com/tetratelabs/wazero v1.2.0 h1:I/8LMf4YkCZ3r2XaL9whhA0VMyAvF6QE+O7rco0DCeQ=
github.com/tetratelabs/wazero v1.2.0/go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/zclconf/go-cty v1.13.2 h1:4GvrUxe/QUDYuJKAav4EYqdM47/kZa672LwmXFmEKT0=
github.com/zclconf/go-cty v1.13.2/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8=
golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM=
golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 h1:EDuYyU/MkFXllv9QF9819VlI9a4tzGuCbhG0ExK9o1U=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA=
google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag=
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
lukechampine.com/uint128 v1.3.0 h1:cDdUVfRwDUDovz610ABgFD17nXD4/uDgVHl2sC3+sbo=
lukechampine.com/uint128 v1.3.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
modernc.org/cc/v3 v3.41.0 h1:QoR1Sn3YWlmA1T4vLaKZfawdVtSiGx8H+cEojbC7v1Q=
modernc.org/cc/v3 v3.41.0/go.mod h1:Ni4zjJYJ04CDOhG7dn640WGfwBzfE0ecX8TyMB0Fv0Y=
modernc.org/ccgo/v3 v3.16.14 h1:af6KNtFgsVmnDYrWk3PQCS9XT6BXe7o3ZFJKkIKvXNQ=
modernc.org/ccgo/v3 v3.16.14/go.mod h1:mPDSujUIaTNWQSG4eqKw+atqLOEbma6Ncsa94WbC9zo=
modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk=
modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM=
modernc.org/libc v1.24.1 h1:uvJSeCKL/AgzBo2yYIPPTy82v21KgGnizcGYfBHaNuM=
modernc.org/libc v1.24.1/go.mod h1:FmfO1RLrU3MHJfyi9eYYmZBfi/R+tqZ6+hQ3yQQUkak=
modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ=
modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/memory v1.6.0 h1:i6mzavxrE9a30whzMfwf7XWVODx2r5OYXvU46cirX7o=
modernc.org/memory v1.6.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU=
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/sqlite v1.23.1 h1:nrSBg4aRQQwq59JpvGEQ15tNxoO5pX/kUjcRNwSAGQM=
modernc.org/sqlite v1.23.1/go.mod h1:OrDj17Mggn6MhE+iPbBNf7RGKODDE9NFT0f3EwDzJqk=
modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY=
modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw=
modernc.org/tcl v1.15.2 h1:C4ybAYCGJw968e+Me18oW55kD/FexcHbqH2xak1ROSY=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
modernc.org/z v1.7.3 h1:zDJf6iHjrnB+WRD88stbXokugjyc0/pB91ri1gO6LZY=

View file

@ -8,12 +8,10 @@ import (
"os"
"testing"
"code.icb4dc0.de/buildr/buildr/modules/plugin"
"github.com/stretchr/testify/mock"
"golang.org/x/exp/slog"
"code.icb4dc0.de/buildr/buildr/modules"
"github.com/stretchr/testify/mock"
mm "hello_world/mocks/modules"
)

View file

@ -5,13 +5,16 @@ import (
"os"
"code.icb4dc0.de/buildr/wasi-module-sdk-go/exec"
rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1"
"golang.org/x/exp/slog"
sdk "code.icb4dc0.de/buildr/wasi-module-sdk-go"
)
var _ sdk.Module = (*HelloWorld)(nil)
var (
_ sdk.Module = (*HelloWorld)(nil)
_ sdk.Helper = (*HelloWorld)(nil)
)
type HelloWorld struct {
Name string
@ -53,3 +56,35 @@ func (HelloWorld) Category() sdk.Category {
func (HelloWorld) Type() string {
return "hello_world"
}
func (h HelloWorld) Help() sdk.Help {
return sdk.Help{
Name: "Hello World",
Description: `Example to illustrate how to use the Buildr plugin API.`,
Examples: []sdk.Example{
{
Name: "Simple example",
Description: `well, you know, hello world`,
Spec: sdk.TaskSpec[sdk.Module]{
ModuleName: "hello_world",
Module: HelloWorld{
Name: "Ted Tester",
},
},
},
{
Name: "Container example",
Description: `well, you know, hello world, but in a container!`,
Spec: sdk.TaskSpec[sdk.Module]{
ModuleName: "hello_world",
Module: HelloWorld{
Name: "Paul Player",
},
Container: &rpcv1.ContainerSpec{
Image: "busybox",
},
},
},
},
}
}

View file

@ -1,10 +1,11 @@
package exec
import (
"code.icb4dc0.de/buildr/wasi-module-sdk-go/mem"
rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1"
"fmt"
"io"
"code.icb4dc0.de/buildr/wasi-module-sdk-go/mem"
rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1"
)
func NewCommand(name string, args ...string) *Command {
@ -23,6 +24,14 @@ type Command struct {
}
func (c *Command) AddEnv(envToAdd map[string]string) {
if envToAdd == nil {
return
}
if c.Env == nil {
c.Env = make(map[string]string)
}
for k, v := range envToAdd {
c.Env[k] = v
}

4
go.mod
View file

@ -4,8 +4,8 @@ go 1.20
require (
github.com/tetratelabs/tinymem v0.1.0
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
google.golang.org/protobuf v1.30.0
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819
google.golang.org/protobuf v1.31.0
)
require github.com/google/go-cmp v0.5.9 // indirect

8
go.sum
View file

@ -4,9 +4,9 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/tetratelabs/tinymem v0.1.0 h1:Qza1JAg9lquPPJ/CIei5qQYx7t18KLie83O2WR6CM58=
github.com/tetratelabs/tinymem v0.1.0/go.mod h1:WFFTZFhLod6lTL+UetFAopVbGaB+KFsVcIY+RUv7NeY=
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU=
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 h1:EDuYyU/MkFXllv9QF9819VlI9a4tzGuCbhG0ExK9o1U=
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=

View file

@ -1,7 +1,7 @@
package sdk
type Example struct {
Spec Module
Spec TaskSpec[Module]
Name string
Description string
}

View file

@ -6,10 +6,9 @@ import "C"
import (
"context"
"golang.org/x/exp/slog"
"code.icb4dc0.de/buildr/wasi-module-sdk-go/mem"
rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1"
"golang.org/x/exp/slog"
)
var _ slog.Handler = (*WASIHandler)(nil)

21
protocol/constraints.go Normal file
View file

@ -0,0 +1,21 @@
package protocol
type Signed interface {
~int | ~int8 | ~int16 | ~int32 | ~int64
}
type Unsigned interface {
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}
type Integer interface {
Signed | Unsigned
}
type Float interface {
~float32 | ~float64
}
type Numeric interface {
Integer | Float
}

View file

@ -91,61 +91,6 @@ func (x *Buildr) GetOutDir() string {
return ""
}
type ModuleReference struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ModuleCategory Category `protobuf:"varint,1,opt,name=module_category,json=moduleCategory,proto3,enum=buildr.rpc.v1.Category" json:"module_category,omitempty"`
ModuleType string `protobuf:"bytes,2,opt,name=module_type,json=moduleType,proto3" json:"module_type,omitempty"`
}
func (x *ModuleReference) Reset() {
*x = ModuleReference{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_executor_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ModuleReference) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ModuleReference) ProtoMessage() {}
func (x *ModuleReference) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_executor_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ModuleReference.ProtoReflect.Descriptor instead.
func (*ModuleReference) Descriptor() ([]byte, []int) {
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{1}
}
func (x *ModuleReference) GetModuleCategory() Category {
if x != nil {
return x.ModuleCategory
}
return Category_CategoryUnknown
}
func (x *ModuleReference) GetModuleType() string {
if x != nil {
return x.ModuleType
}
return ""
}
type TaskReference struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -159,7 +104,7 @@ type TaskReference struct {
func (x *TaskReference) Reset() {
*x = TaskReference{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_executor_proto_msgTypes[2]
mi := &file_rpc_v1_executor_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -172,7 +117,7 @@ func (x *TaskReference) String() string {
func (*TaskReference) ProtoMessage() {}
func (x *TaskReference) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_executor_proto_msgTypes[2]
mi := &file_rpc_v1_executor_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -185,7 +130,7 @@ func (x *TaskReference) ProtoReflect() protoreflect.Message {
// Deprecated: Use TaskReference.ProtoReflect.Descriptor instead.
func (*TaskReference) Descriptor() ([]byte, []int) {
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{2}
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{1}
}
func (x *TaskReference) GetId() string {
@ -216,13 +161,13 @@ type StartTaskRequest struct {
Reference *TaskReference `protobuf:"bytes,1,opt,name=reference,proto3" json:"reference,omitempty"`
Buildr *Buildr `protobuf:"bytes,2,opt,name=buildr,proto3" json:"buildr,omitempty"`
RawTask []byte `protobuf:"bytes,3,opt,name=raw_task,json=rawTask,proto3" json:"raw_task,omitempty"`
Spec *ModuleSpec `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec,omitempty"`
}
func (x *StartTaskRequest) Reset() {
*x = StartTaskRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_executor_proto_msgTypes[3]
mi := &file_rpc_v1_executor_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -235,7 +180,7 @@ func (x *StartTaskRequest) String() string {
func (*StartTaskRequest) ProtoMessage() {}
func (x *StartTaskRequest) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_executor_proto_msgTypes[3]
mi := &file_rpc_v1_executor_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -248,7 +193,7 @@ func (x *StartTaskRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use StartTaskRequest.ProtoReflect.Descriptor instead.
func (*StartTaskRequest) Descriptor() ([]byte, []int) {
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{3}
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{2}
}
func (x *StartTaskRequest) GetReference() *TaskReference {
@ -265,9 +210,9 @@ func (x *StartTaskRequest) GetBuildr() *Buildr {
return nil
}
func (x *StartTaskRequest) GetRawTask() []byte {
func (x *StartTaskRequest) GetSpec() *ModuleSpec {
if x != nil {
return x.RawTask
return x.Spec
}
return nil
}
@ -284,7 +229,7 @@ type TaskResult struct {
func (x *TaskResult) Reset() {
*x = TaskResult{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_executor_proto_msgTypes[4]
mi := &file_rpc_v1_executor_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -297,7 +242,7 @@ func (x *TaskResult) String() string {
func (*TaskResult) ProtoMessage() {}
func (x *TaskResult) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_executor_proto_msgTypes[4]
mi := &file_rpc_v1_executor_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -310,7 +255,7 @@ func (x *TaskResult) ProtoReflect() protoreflect.Message {
// Deprecated: Use TaskResult.ProtoReflect.Descriptor instead.
func (*TaskResult) Descriptor() ([]byte, []int) {
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{4}
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{3}
}
func (x *TaskResult) GetError() string {
@ -341,7 +286,7 @@ type TaskLog struct {
func (x *TaskLog) Reset() {
*x = TaskLog{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_executor_proto_msgTypes[5]
mi := &file_rpc_v1_executor_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -354,7 +299,7 @@ func (x *TaskLog) String() string {
func (*TaskLog) ProtoMessage() {}
func (x *TaskLog) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_executor_proto_msgTypes[5]
mi := &file_rpc_v1_executor_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -367,7 +312,7 @@ func (x *TaskLog) ProtoReflect() protoreflect.Message {
// Deprecated: Use TaskLog.ProtoReflect.Descriptor instead.
func (*TaskLog) Descriptor() ([]byte, []int) {
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{5}
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{4}
}
func (x *TaskLog) GetTime() int64 {
@ -410,7 +355,7 @@ type SetState struct {
func (x *SetState) Reset() {
*x = SetState{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_executor_proto_msgTypes[6]
mi := &file_rpc_v1_executor_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -423,7 +368,7 @@ func (x *SetState) String() string {
func (*SetState) ProtoMessage() {}
func (x *SetState) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_executor_proto_msgTypes[6]
mi := &file_rpc_v1_executor_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -436,7 +381,7 @@ func (x *SetState) ProtoReflect() protoreflect.Message {
// Deprecated: Use SetState.ProtoReflect.Descriptor instead.
func (*SetState) Descriptor() ([]byte, []int) {
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{6}
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{5}
}
func (x *SetState) GetKey() []byte {
@ -464,7 +409,7 @@ type GetStateRequest struct {
func (x *GetStateRequest) Reset() {
*x = GetStateRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_executor_proto_msgTypes[7]
mi := &file_rpc_v1_executor_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -477,7 +422,7 @@ func (x *GetStateRequest) String() string {
func (*GetStateRequest) ProtoMessage() {}
func (x *GetStateRequest) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_executor_proto_msgTypes[7]
mi := &file_rpc_v1_executor_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -490,7 +435,7 @@ func (x *GetStateRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetStateRequest.ProtoReflect.Descriptor instead.
func (*GetStateRequest) Descriptor() ([]byte, []int) {
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{7}
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{6}
}
func (x *GetStateRequest) GetKey() []byte {
@ -512,7 +457,7 @@ type GetStateResponse struct {
func (x *GetStateResponse) Reset() {
*x = GetStateResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_executor_proto_msgTypes[8]
mi := &file_rpc_v1_executor_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -525,7 +470,7 @@ func (x *GetStateResponse) String() string {
func (*GetStateResponse) ProtoMessage() {}
func (x *GetStateResponse) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_executor_proto_msgTypes[8]
mi := &file_rpc_v1_executor_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -538,7 +483,7 @@ func (x *GetStateResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetStateResponse.ProtoReflect.Descriptor instead.
func (*GetStateResponse) Descriptor() ([]byte, []int) {
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{8}
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{7}
}
func (x *GetStateResponse) GetKey() []byte {
@ -567,7 +512,7 @@ type Result struct {
func (x *Result) Reset() {
*x = Result{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_executor_proto_msgTypes[9]
mi := &file_rpc_v1_executor_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -580,7 +525,7 @@ func (x *Result) String() string {
func (*Result) ProtoMessage() {}
func (x *Result) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_executor_proto_msgTypes[9]
mi := &file_rpc_v1_executor_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -593,7 +538,7 @@ func (x *Result) ProtoReflect() protoreflect.Message {
// Deprecated: Use Result.ProtoReflect.Descriptor instead.
func (*Result) Descriptor() ([]byte, []int) {
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{9}
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{8}
}
func (x *Result) GetSuccess() bool {
@ -621,7 +566,7 @@ type PluginInventory struct {
func (x *PluginInventory) Reset() {
*x = PluginInventory{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_executor_proto_msgTypes[10]
mi := &file_rpc_v1_executor_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -634,7 +579,7 @@ func (x *PluginInventory) String() string {
func (*PluginInventory) ProtoMessage() {}
func (x *PluginInventory) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_executor_proto_msgTypes[10]
mi := &file_rpc_v1_executor_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -647,7 +592,7 @@ func (x *PluginInventory) ProtoReflect() protoreflect.Message {
// Deprecated: Use PluginInventory.ProtoReflect.Descriptor instead.
func (*PluginInventory) Descriptor() ([]byte, []int) {
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{10}
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{9}
}
func (x *PluginInventory) GetModules() []*ModuleReference {
@ -668,7 +613,7 @@ type Buildr_Repo struct {
func (x *Buildr_Repo) Reset() {
*x = Buildr_Repo{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_executor_proto_msgTypes[11]
mi := &file_rpc_v1_executor_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -681,7 +626,7 @@ func (x *Buildr_Repo) String() string {
func (*Buildr_Repo) ProtoMessage() {}
func (x *Buildr_Repo) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_executor_proto_msgTypes[11]
mi := &file_rpc_v1_executor_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -715,7 +660,7 @@ type Buildr_GitHub struct {
func (x *Buildr_GitHub) Reset() {
*x = Buildr_GitHub{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_executor_proto_msgTypes[12]
mi := &file_rpc_v1_executor_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -728,7 +673,7 @@ func (x *Buildr_GitHub) String() string {
func (*Buildr_GitHub) ProtoMessage() {}
func (x *Buildr_GitHub) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_executor_proto_msgTypes[12]
mi := &file_rpc_v1_executor_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -763,7 +708,7 @@ type TaskLog_LogAttribute struct {
func (x *TaskLog_LogAttribute) Reset() {
*x = TaskLog_LogAttribute{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_executor_proto_msgTypes[13]
mi := &file_rpc_v1_executor_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -776,7 +721,7 @@ func (x *TaskLog_LogAttribute) String() string {
func (*TaskLog_LogAttribute) ProtoMessage() {}
func (x *TaskLog_LogAttribute) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_executor_proto_msgTypes[13]
mi := &file_rpc_v1_executor_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -789,7 +734,7 @@ func (x *TaskLog_LogAttribute) ProtoReflect() protoreflect.Message {
// Deprecated: Use TaskLog_LogAttribute.ProtoReflect.Descriptor instead.
func (*TaskLog_LogAttribute) Descriptor() ([]byte, []int) {
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{5, 0}
return file_rpc_v1_executor_proto_rawDescGZIP(), []int{4, 0}
}
func (x *TaskLog_LogAttribute) GetKey() string {
@ -827,79 +772,73 @@ var file_rpc_v1_executor_proto_rawDesc = []byte{
0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x1a, 0x25, 0x0a, 0x06, 0x47, 0x69, 0x74, 0x48,
0x75, 0x62, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x70, 0x69, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x69, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22,
0x74, 0x0a, 0x0f, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
0x63, 0x65, 0x12, 0x40, 0x0a, 0x0f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x63, 0x61, 0x74,
0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x62, 0x75,
0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x74, 0x65,
0x67, 0x6f, 0x72, 0x79, 0x52, 0x0e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x43, 0x61, 0x74, 0x65,
0x67, 0x6f, 0x72, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x74,
0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x6b, 0x0a, 0x0d, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x66,
0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x36, 0x0a, 0x06, 0x6d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x69,
0x6b, 0x0a, 0x0d, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x36, 0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70,
0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72,
0x65, 0x6e, 0x63, 0x65, 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x22, 0xac, 0x01, 0x0a,
0x10, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x3a, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70,
0x63, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2d, 0x0a,
0x06, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e,
0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75,
0x69, 0x6c, 0x64, 0x72, 0x52, 0x06, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x12, 0x2d, 0x0a, 0x04,
0x73, 0x70, 0x65, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x62, 0x75, 0x69,
0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x22, 0x98, 0x01, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x61, 0x73, 0x6b,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72,
0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x62, 0x75, 0x69,
0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x52,
0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65,
0x6e, 0x63, 0x65, 0x12, 0x2d, 0x0a, 0x06, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63,
0x2e, 0x76, 0x31, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x52, 0x06, 0x62, 0x75, 0x69, 0x6c,
0x64, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x61, 0x77, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x61, 0x77, 0x54, 0x61, 0x73, 0x6b, 0x22, 0x61, 0x0a,
0x0a, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65,
0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f,
0x72, 0x12, 0x3d, 0x0a, 0x1b, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x66, 0x69,
0x6c, 0x65, 0x73, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64,
0x46, 0x69, 0x6c, 0x65, 0x73, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68,
0x22, 0xca, 0x01, 0x0a, 0x07, 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x6f, 0x67, 0x12, 0x12, 0x0a, 0x04,
0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65,
0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65,
0x76, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c,
0x12, 0x43, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x04,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70,
0x63, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x6f, 0x67, 0x2e, 0x4c, 0x6f, 0x67,
0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69,
0x62, 0x75, 0x74, 0x65, 0x73, 0x1a, 0x36, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x41, 0x74, 0x74, 0x72,
0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x30, 0x0a,
0x08, 0x53, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x64,
0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22,
0x23, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52,
0x03, 0x6b, 0x65, 0x79, 0x22, 0x38, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61,
0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x38,
0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63,
0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65,
0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x4b, 0x0a, 0x0f, 0x50, 0x6c, 0x75, 0x67,
0x69, 0x6e, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x38, 0x0a, 0x07, 0x6d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62,
0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x07, 0x6d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x73, 0x42, 0xb9, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75,
0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x42, 0x0d, 0x45, 0x78, 0x65,
0x63, 0x75, 0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3f, 0x63, 0x6f,
0x64, 0x65, 0x2e, 0x69, 0x63, 0x62, 0x34, 0x64, 0x63, 0x30, 0x2e, 0x64, 0x65, 0x2f, 0x62, 0x75,
0x69, 0x6c, 0x64, 0x72, 0x2f, 0x77, 0x61, 0x73, 0x69, 0x2d, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
0x2f, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x3b, 0x72, 0x70, 0x63, 0x76, 0x31, 0xa2, 0x02, 0x03,
0x42, 0x52, 0x58, 0xaa, 0x02, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x52, 0x70, 0x63,
0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x5c, 0x52, 0x70, 0x63,
0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x5c, 0x52, 0x70, 0x63,
0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea,
0x02, 0x0f, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x3a, 0x3a, 0x52, 0x70, 0x63, 0x3a, 0x3a, 0x56,
0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x65, 0x53, 0x70, 0x65, 0x63, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x22, 0x61, 0x0a, 0x0a, 0x54,
0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72,
0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12,
0x3d, 0x0a, 0x1b, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65,
0x73, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x46, 0x69,
0x6c, 0x65, 0x73, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x22, 0xca,
0x01, 0x0a, 0x07, 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x6f, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69,
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18,
0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65,
0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x43,
0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e,
0x76, 0x31, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x6f, 0x67, 0x2e, 0x4c, 0x6f, 0x67, 0x41, 0x74,
0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75,
0x74, 0x65, 0x73, 0x1a, 0x36, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62,
0x75, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x30, 0x0a, 0x08, 0x53,
0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74,
0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x23, 0x0a,
0x0f, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b,
0x65, 0x79, 0x22, 0x38, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x38, 0x0a, 0x06,
0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73,
0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73,
0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x4b, 0x0a, 0x0f, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e,
0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x38, 0x0a, 0x07, 0x6d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x75, 0x69,
0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x07, 0x6d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x73, 0x42, 0xb9, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x69, 0x6c,
0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x42, 0x0d, 0x45, 0x78, 0x65, 0x63, 0x75,
0x74, 0x6f, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3f, 0x63, 0x6f, 0x64, 0x65,
0x2e, 0x69, 0x63, 0x62, 0x34, 0x64, 0x63, 0x30, 0x2e, 0x64, 0x65, 0x2f, 0x62, 0x75, 0x69, 0x6c,
0x64, 0x72, 0x2f, 0x77, 0x61, 0x73, 0x69, 0x2d, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2d, 0x73,
0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x72,
0x70, 0x63, 0x2f, 0x76, 0x31, 0x3b, 0x72, 0x70, 0x63, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x42, 0x52,
0x58, 0xaa, 0x02, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x52, 0x70, 0x63, 0x2e, 0x56,
0x31, 0xca, 0x02, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x5c, 0x52, 0x70, 0x63, 0x5c, 0x56,
0x31, 0xe2, 0x02, 0x19, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x5c, 0x52, 0x70, 0x63, 0x5c, 0x56,
0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f,
0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x3a, 0x3a, 0x52, 0x70, 0x63, 0x3a, 0x3a, 0x56, 0x31, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -914,33 +853,33 @@ func file_rpc_v1_executor_proto_rawDescGZIP() []byte {
return file_rpc_v1_executor_proto_rawDescData
}
var file_rpc_v1_executor_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
var file_rpc_v1_executor_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_rpc_v1_executor_proto_goTypes = []interface{}{
(*Buildr)(nil), // 0: buildr.rpc.v1.Buildr
(*ModuleReference)(nil), // 1: buildr.rpc.v1.ModuleReference
(*TaskReference)(nil), // 2: buildr.rpc.v1.TaskReference
(*StartTaskRequest)(nil), // 3: buildr.rpc.v1.StartTaskRequest
(*TaskResult)(nil), // 4: buildr.rpc.v1.TaskResult
(*TaskLog)(nil), // 5: buildr.rpc.v1.TaskLog
(*SetState)(nil), // 6: buildr.rpc.v1.SetState
(*GetStateRequest)(nil), // 7: buildr.rpc.v1.GetStateRequest
(*GetStateResponse)(nil), // 8: buildr.rpc.v1.GetStateResponse
(*Result)(nil), // 9: buildr.rpc.v1.Result
(*PluginInventory)(nil), // 10: buildr.rpc.v1.PluginInventory
(*Buildr_Repo)(nil), // 11: buildr.rpc.v1.Buildr.Repo
(*Buildr_GitHub)(nil), // 12: buildr.rpc.v1.Buildr.GitHub
(*TaskLog_LogAttribute)(nil), // 13: buildr.rpc.v1.TaskLog.LogAttribute
(Category)(0), // 14: buildr.rpc.v1.Category
(*TaskReference)(nil), // 1: buildr.rpc.v1.TaskReference
(*StartTaskRequest)(nil), // 2: buildr.rpc.v1.StartTaskRequest
(*TaskResult)(nil), // 3: buildr.rpc.v1.TaskResult
(*TaskLog)(nil), // 4: buildr.rpc.v1.TaskLog
(*SetState)(nil), // 5: buildr.rpc.v1.SetState
(*GetStateRequest)(nil), // 6: buildr.rpc.v1.GetStateRequest
(*GetStateResponse)(nil), // 7: buildr.rpc.v1.GetStateResponse
(*Result)(nil), // 8: buildr.rpc.v1.Result
(*PluginInventory)(nil), // 9: buildr.rpc.v1.PluginInventory
(*Buildr_Repo)(nil), // 10: buildr.rpc.v1.Buildr.Repo
(*Buildr_GitHub)(nil), // 11: buildr.rpc.v1.Buildr.GitHub
(*TaskLog_LogAttribute)(nil), // 12: buildr.rpc.v1.TaskLog.LogAttribute
(*ModuleReference)(nil), // 13: buildr.rpc.v1.ModuleReference
(*ModuleSpec)(nil), // 14: buildr.rpc.v1.ModuleSpec
}
var file_rpc_v1_executor_proto_depIdxs = []int32{
11, // 0: buildr.rpc.v1.Buildr.repo:type_name -> buildr.rpc.v1.Buildr.Repo
12, // 1: buildr.rpc.v1.Buildr.github:type_name -> buildr.rpc.v1.Buildr.GitHub
14, // 2: buildr.rpc.v1.ModuleReference.module_category:type_name -> buildr.rpc.v1.Category
1, // 3: buildr.rpc.v1.TaskReference.module:type_name -> buildr.rpc.v1.ModuleReference
2, // 4: buildr.rpc.v1.StartTaskRequest.reference:type_name -> buildr.rpc.v1.TaskReference
0, // 5: buildr.rpc.v1.StartTaskRequest.buildr:type_name -> buildr.rpc.v1.Buildr
13, // 6: buildr.rpc.v1.TaskLog.attributes:type_name -> buildr.rpc.v1.TaskLog.LogAttribute
1, // 7: buildr.rpc.v1.PluginInventory.modules:type_name -> buildr.rpc.v1.ModuleReference
10, // 0: buildr.rpc.v1.Buildr.repo:type_name -> buildr.rpc.v1.Buildr.Repo
11, // 1: buildr.rpc.v1.Buildr.github:type_name -> buildr.rpc.v1.Buildr.GitHub
13, // 2: buildr.rpc.v1.TaskReference.module:type_name -> buildr.rpc.v1.ModuleReference
1, // 3: buildr.rpc.v1.StartTaskRequest.reference:type_name -> buildr.rpc.v1.TaskReference
0, // 4: buildr.rpc.v1.StartTaskRequest.buildr:type_name -> buildr.rpc.v1.Buildr
14, // 5: buildr.rpc.v1.StartTaskRequest.spec:type_name -> buildr.rpc.v1.ModuleSpec
12, // 6: buildr.rpc.v1.TaskLog.attributes:type_name -> buildr.rpc.v1.TaskLog.LogAttribute
13, // 7: buildr.rpc.v1.PluginInventory.modules:type_name -> buildr.rpc.v1.ModuleReference
8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
@ -968,18 +907,6 @@ func file_rpc_v1_executor_proto_init() {
}
}
file_rpc_v1_executor_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ModuleReference); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_v1_executor_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TaskReference); i {
case 0:
return &v.state
@ -991,7 +918,7 @@ func file_rpc_v1_executor_proto_init() {
return nil
}
}
file_rpc_v1_executor_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
file_rpc_v1_executor_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StartTaskRequest); i {
case 0:
return &v.state
@ -1003,7 +930,7 @@ func file_rpc_v1_executor_proto_init() {
return nil
}
}
file_rpc_v1_executor_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
file_rpc_v1_executor_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TaskResult); i {
case 0:
return &v.state
@ -1015,7 +942,7 @@ func file_rpc_v1_executor_proto_init() {
return nil
}
}
file_rpc_v1_executor_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
file_rpc_v1_executor_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TaskLog); i {
case 0:
return &v.state
@ -1027,7 +954,7 @@ func file_rpc_v1_executor_proto_init() {
return nil
}
}
file_rpc_v1_executor_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
file_rpc_v1_executor_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SetState); i {
case 0:
return &v.state
@ -1039,7 +966,7 @@ func file_rpc_v1_executor_proto_init() {
return nil
}
}
file_rpc_v1_executor_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
file_rpc_v1_executor_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetStateRequest); i {
case 0:
return &v.state
@ -1051,7 +978,7 @@ func file_rpc_v1_executor_proto_init() {
return nil
}
}
file_rpc_v1_executor_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
file_rpc_v1_executor_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetStateResponse); i {
case 0:
return &v.state
@ -1063,7 +990,7 @@ func file_rpc_v1_executor_proto_init() {
return nil
}
}
file_rpc_v1_executor_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
file_rpc_v1_executor_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Result); i {
case 0:
return &v.state
@ -1075,7 +1002,7 @@ func file_rpc_v1_executor_proto_init() {
return nil
}
}
file_rpc_v1_executor_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
file_rpc_v1_executor_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PluginInventory); i {
case 0:
return &v.state
@ -1087,7 +1014,7 @@ func file_rpc_v1_executor_proto_init() {
return nil
}
}
file_rpc_v1_executor_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
file_rpc_v1_executor_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Buildr_Repo); i {
case 0:
return &v.state
@ -1099,7 +1026,7 @@ func file_rpc_v1_executor_proto_init() {
return nil
}
}
file_rpc_v1_executor_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
file_rpc_v1_executor_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Buildr_GitHub); i {
case 0:
return &v.state
@ -1111,7 +1038,7 @@ func file_rpc_v1_executor_proto_init() {
return nil
}
}
file_rpc_v1_executor_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
file_rpc_v1_executor_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TaskLog_LogAttribute); i {
case 0:
return &v.state
@ -1130,7 +1057,7 @@ func file_rpc_v1_executor_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_rpc_v1_executor_proto_rawDesc,
NumEnums: 0,
NumMessages: 14,
NumMessages: 13,
NumExtensions: 0,
NumServices: 0,
},

View file

@ -164,51 +164,6 @@ func (m *Buildr) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *ModuleReference) MarshalVT() (dAtA []byte, err error) {
if m == nil {
return nil, nil
}
size := m.SizeVT()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBufferVT(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ModuleReference) MarshalToVT(dAtA []byte) (int, error) {
size := m.SizeVT()
return m.MarshalToSizedBufferVT(dAtA[:size])
}
func (m *ModuleReference) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
if m == nil {
return 0, nil
}
i := len(dAtA)
_ = i
var l int
_ = l
if m.unknownFields != nil {
i -= len(m.unknownFields)
copy(dAtA[i:], m.unknownFields)
}
if len(m.ModuleType) > 0 {
i -= len(m.ModuleType)
copy(dAtA[i:], m.ModuleType)
i = encodeVarint(dAtA, i, uint64(len(m.ModuleType)))
i--
dAtA[i] = 0x12
}
if m.ModuleCategory != 0 {
i = encodeVarint(dAtA, i, uint64(m.ModuleCategory))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *TaskReference) MarshalVT() (dAtA []byte, err error) {
if m == nil {
return nil, nil
@ -296,10 +251,13 @@ func (m *StartTaskRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
i -= len(m.unknownFields)
copy(dAtA[i:], m.unknownFields)
}
if len(m.RawTask) > 0 {
i -= len(m.RawTask)
copy(dAtA[i:], m.RawTask)
i = encodeVarint(dAtA, i, uint64(len(m.RawTask)))
if m.Spec != nil {
size, err := m.Spec.MarshalToSizedBufferVT(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarint(dAtA, i, uint64(size))
i--
dAtA[i] = 0x1a
}
@ -765,23 +723,6 @@ func (m *Buildr) SizeVT() (n int) {
return n
}
func (m *ModuleReference) SizeVT() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ModuleCategory != 0 {
n += 1 + sov(uint64(m.ModuleCategory))
}
l = len(m.ModuleType)
if l > 0 {
n += 1 + l + sov(uint64(l))
}
n += len(m.unknownFields)
return n
}
func (m *TaskReference) SizeVT() (n int) {
if m == nil {
return 0
@ -818,8 +759,8 @@ func (m *StartTaskRequest) SizeVT() (n int) {
l = m.Buildr.SizeVT()
n += 1 + l + sov(uint64(l))
}
l = len(m.RawTask)
if l > 0 {
if m.Spec != nil {
l = m.Spec.SizeVT()
n += 1 + l + sov(uint64(l))
}
n += len(m.unknownFields)
@ -1324,108 +1265,6 @@ func (m *Buildr) UnmarshalVT(dAtA []byte) error {
}
return nil
}
func (m *ModuleReference) UnmarshalVT(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ModuleReference: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ModuleReference: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ModuleCategory", wireType)
}
m.ModuleCategory = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ModuleCategory |= Category(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ModuleType", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLength
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ModuleType = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skip(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLength
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *TaskReference) UnmarshalVT(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@ -1680,9 +1519,9 @@ func (m *StartTaskRequest) UnmarshalVT(dAtA []byte) error {
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RawTask", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType)
}
var byteLen int
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
@ -1692,24 +1531,26 @@ func (m *StartTaskRequest) UnmarshalVT(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
if msglen < 0 {
return ErrInvalidLength
}
postIndex := iNdEx + byteLen
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLength
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.RawTask = append(m.RawTask[:0], dAtA[iNdEx:postIndex]...)
if m.RawTask == nil {
m.RawTask = []byte{}
if m.Spec == nil {
m.Spec = &ModuleSpec{}
}
if err := m.Spec.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -264,55 +264,250 @@ func (x *LookupPathResponse) GetError() string {
return ""
}
type HelpRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ModuleReference *ModuleReference `protobuf:"bytes,1,opt,name=module_reference,json=moduleReference,proto3" json:"module_reference,omitempty"`
}
func (x *HelpRequest) Reset() {
*x = HelpRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_wasi_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *HelpRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HelpRequest) ProtoMessage() {}
func (x *HelpRequest) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_wasi_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HelpRequest.ProtoReflect.Descriptor instead.
func (*HelpRequest) Descriptor() ([]byte, []int) {
return file_rpc_v1_wasi_proto_rawDescGZIP(), []int{4}
}
func (x *HelpRequest) GetModuleReference() *ModuleReference {
if x != nil {
return x.ModuleReference
}
return nil
}
type TaskExample struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
TaskSpec *TaskSpec `protobuf:"bytes,3,opt,name=task_spec,json=taskSpec,proto3" json:"task_spec,omitempty"`
}
func (x *TaskExample) Reset() {
*x = TaskExample{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_wasi_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TaskExample) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TaskExample) ProtoMessage() {}
func (x *TaskExample) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_wasi_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TaskExample.ProtoReflect.Descriptor instead.
func (*TaskExample) Descriptor() ([]byte, []int) {
return file_rpc_v1_wasi_proto_rawDescGZIP(), []int{5}
}
func (x *TaskExample) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *TaskExample) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *TaskExample) GetTaskSpec() *TaskSpec {
if x != nil {
return x.TaskSpec
}
return nil
}
type HelpResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
Examples []*TaskExample `protobuf:"bytes,3,rep,name=examples,proto3" json:"examples,omitempty"`
}
func (x *HelpResponse) Reset() {
*x = HelpResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_rpc_v1_wasi_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *HelpResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HelpResponse) ProtoMessage() {}
func (x *HelpResponse) ProtoReflect() protoreflect.Message {
mi := &file_rpc_v1_wasi_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HelpResponse.ProtoReflect.Descriptor instead.
func (*HelpResponse) Descriptor() ([]byte, []int) {
return file_rpc_v1_wasi_proto_rawDescGZIP(), []int{6}
}
func (x *HelpResponse) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *HelpResponse) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *HelpResponse) GetExamples() []*TaskExample {
if x != nil {
return x.Examples
}
return nil
}
var File_rpc_v1_wasi_proto protoreflect.FileDescriptor
var file_rpc_v1_wasi_proto_rawDesc = []byte{
0x0a, 0x11, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x61, 0x73, 0x69, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e,
0x76, 0x31, 0x22, 0x9d, 0x02, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74,
0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f,
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d,
0x6d, 0x61, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03,
0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x77, 0x6f, 0x72, 0x6b,
0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x52, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x44, 0x69, 0x72, 0x65,
0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x55, 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,
0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x62, 0x75, 0x69,
0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65,
0x73, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x45,
0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05,
0x73, 0x74, 0x64, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x74, 0x64,
0x69, 0x6e, 0x1a, 0x3e, 0x0a, 0x10, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,
0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
0x38, 0x01, 0x22, 0x61, 0x0a, 0x14, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61,
0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x78,
0x69, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x65,
0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x16, 0x0a,
0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73,
0x74, 0x64, 0x65, 0x72, 0x72, 0x22, 0x2d, 0x0a, 0x11, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x50,
0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f,
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d,
0x6d, 0x61, 0x6e, 0x64, 0x22, 0x3e, 0x0a, 0x12, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x50, 0x61,
0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61,
0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x14,
0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65,
0x72, 0x72, 0x6f, 0x72, 0x42, 0xb5, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x69,
0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x42, 0x09, 0x57, 0x61, 0x73, 0x69,
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3f, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x69, 0x63,
0x62, 0x34, 0x64, 0x63, 0x30, 0x2e, 0x64, 0x65, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2f,
0x77, 0x61, 0x73, 0x69, 0x2d, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2d, 0x73, 0x64, 0x6b, 0x2d,
0x67, 0x6f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x72, 0x70, 0x63, 0x2f,
0x76, 0x31, 0x3b, 0x72, 0x70, 0x63, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x42, 0x52, 0x58, 0xaa, 0x02,
0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x52, 0x70, 0x63, 0x2e, 0x56, 0x31, 0xca, 0x02,
0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x5c, 0x52, 0x70, 0x63, 0x5c, 0x56, 0x31, 0xe2, 0x02,
0x19, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x5c, 0x52, 0x70, 0x63, 0x5c, 0x56, 0x31, 0x5c, 0x47,
0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x42, 0x75, 0x69,
0x6c, 0x64, 0x72, 0x3a, 0x3a, 0x52, 0x70, 0x63, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
0x76, 0x31, 0x1a, 0x11, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x70, 0x65, 0x63, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9d, 0x02, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73,
0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a,
0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18,
0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x77,
0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x44,
0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x55, 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69,
0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e,
0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72,
0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x74,
0x72, 0x79, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12,
0x14, 0x0a, 0x05, 0x73, 0x74, 0x64, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05,
0x73, 0x74, 0x64, 0x69, 0x6e, 0x1a, 0x3e, 0x0a, 0x10, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,
0x6d, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x61, 0x0a, 0x14, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73,
0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a,
0x09, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x08, 0x65, 0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72,
0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72,
0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x22, 0x2d, 0x0a, 0x11, 0x4c, 0x6f, 0x6f, 0x6b,
0x75, 0x70, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a,
0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x22, 0x3e, 0x0a, 0x12, 0x4c, 0x6f, 0x6f, 0x6b, 0x75,
0x70, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a,
0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74,
0x68, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x58, 0x0a, 0x0b, 0x48, 0x65, 0x6c, 0x70, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x49, 0x0a, 0x10, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x1e, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31,
0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65,
0x52, 0x0f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
0x65, 0x22, 0x79, 0x0a, 0x0b, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65,
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x0a, 0x09, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x73,
0x70, 0x65, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x75, 0x69, 0x6c,
0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x70,
0x65, 0x63, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x70, 0x65, 0x63, 0x22, 0x7c, 0x0a, 0x0c,
0x48, 0x65, 0x6c, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x18, 0x03,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70,
0x63, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65,
0x52, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x42, 0xb5, 0x01, 0x0a, 0x11, 0x63,
0x6f, 0x6d, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31,
0x42, 0x09, 0x57, 0x61, 0x73, 0x69, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3f, 0x63,
0x6f, 0x64, 0x65, 0x2e, 0x69, 0x63, 0x62, 0x34, 0x64, 0x63, 0x30, 0x2e, 0x64, 0x65, 0x2f, 0x62,
0x75, 0x69, 0x6c, 0x64, 0x72, 0x2f, 0x77, 0x61, 0x73, 0x69, 0x2d, 0x6d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x2d, 0x73, 0x64, 0x6b, 0x2d, 0x67, 0x6f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61,
0x6c, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x76, 0x31, 0x3b, 0x72, 0x70, 0x63, 0x76, 0x31, 0xa2, 0x02,
0x03, 0x42, 0x52, 0x58, 0xaa, 0x02, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x2e, 0x52, 0x70,
0x63, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x5c, 0x52, 0x70,
0x63, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x5c, 0x52, 0x70,
0x63, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
0xea, 0x02, 0x0f, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x72, 0x3a, 0x3a, 0x52, 0x70, 0x63, 0x3a, 0x3a,
0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -327,21 +522,29 @@ func file_rpc_v1_wasi_proto_rawDescGZIP() []byte {
return file_rpc_v1_wasi_proto_rawDescData
}
var file_rpc_v1_wasi_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_rpc_v1_wasi_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_rpc_v1_wasi_proto_goTypes = []interface{}{
(*ProcessStartRequest)(nil), // 0: buildr.rpc.v1.ProcessStartRequest
(*ProcessStartResponse)(nil), // 1: buildr.rpc.v1.ProcessStartResponse
(*LookupPathRequest)(nil), // 2: buildr.rpc.v1.LookupPathRequest
(*LookupPathResponse)(nil), // 3: buildr.rpc.v1.LookupPathResponse
nil, // 4: buildr.rpc.v1.ProcessStartRequest.EnvironmentEntry
(*HelpRequest)(nil), // 4: buildr.rpc.v1.HelpRequest
(*TaskExample)(nil), // 5: buildr.rpc.v1.TaskExample
(*HelpResponse)(nil), // 6: buildr.rpc.v1.HelpResponse
nil, // 7: buildr.rpc.v1.ProcessStartRequest.EnvironmentEntry
(*ModuleReference)(nil), // 8: buildr.rpc.v1.ModuleReference
(*TaskSpec)(nil), // 9: buildr.rpc.v1.TaskSpec
}
var file_rpc_v1_wasi_proto_depIdxs = []int32{
4, // 0: buildr.rpc.v1.ProcessStartRequest.environment:type_name -> buildr.rpc.v1.ProcessStartRequest.EnvironmentEntry
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
7, // 0: buildr.rpc.v1.ProcessStartRequest.environment:type_name -> buildr.rpc.v1.ProcessStartRequest.EnvironmentEntry
8, // 1: buildr.rpc.v1.HelpRequest.module_reference:type_name -> buildr.rpc.v1.ModuleReference
9, // 2: buildr.rpc.v1.TaskExample.task_spec:type_name -> buildr.rpc.v1.TaskSpec
5, // 3: buildr.rpc.v1.HelpResponse.examples:type_name -> buildr.rpc.v1.TaskExample
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_rpc_v1_wasi_proto_init() }
@ -349,6 +552,7 @@ func file_rpc_v1_wasi_proto_init() {
if File_rpc_v1_wasi_proto != nil {
return
}
file_rpc_v1_spec_proto_init()
if !protoimpl.UnsafeEnabled {
file_rpc_v1_wasi_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ProcessStartRequest); i {
@ -398,6 +602,42 @@ func file_rpc_v1_wasi_proto_init() {
return nil
}
}
file_rpc_v1_wasi_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HelpRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_v1_wasi_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TaskExample); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rpc_v1_wasi_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HelpResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -405,7 +645,7 @@ func file_rpc_v1_wasi_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_rpc_v1_wasi_proto_rawDesc,
NumEnums: 0,
NumMessages: 5,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},

View file

@ -238,6 +238,165 @@ func (m *LookupPathResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *HelpRequest) MarshalVT() (dAtA []byte, err error) {
if m == nil {
return nil, nil
}
size := m.SizeVT()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBufferVT(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *HelpRequest) MarshalToVT(dAtA []byte) (int, error) {
size := m.SizeVT()
return m.MarshalToSizedBufferVT(dAtA[:size])
}
func (m *HelpRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
if m == nil {
return 0, nil
}
i := len(dAtA)
_ = i
var l int
_ = l
if m.unknownFields != nil {
i -= len(m.unknownFields)
copy(dAtA[i:], m.unknownFields)
}
if m.ModuleReference != nil {
size, err := m.ModuleReference.MarshalToSizedBufferVT(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarint(dAtA, i, uint64(size))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *TaskExample) MarshalVT() (dAtA []byte, err error) {
if m == nil {
return nil, nil
}
size := m.SizeVT()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBufferVT(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *TaskExample) MarshalToVT(dAtA []byte) (int, error) {
size := m.SizeVT()
return m.MarshalToSizedBufferVT(dAtA[:size])
}
func (m *TaskExample) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
if m == nil {
return 0, nil
}
i := len(dAtA)
_ = i
var l int
_ = l
if m.unknownFields != nil {
i -= len(m.unknownFields)
copy(dAtA[i:], m.unknownFields)
}
if m.TaskSpec != nil {
size, err := m.TaskSpec.MarshalToSizedBufferVT(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarint(dAtA, i, uint64(size))
i--
dAtA[i] = 0x1a
}
if len(m.Description) > 0 {
i -= len(m.Description)
copy(dAtA[i:], m.Description)
i = encodeVarint(dAtA, i, uint64(len(m.Description)))
i--
dAtA[i] = 0x12
}
if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarint(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *HelpResponse) MarshalVT() (dAtA []byte, err error) {
if m == nil {
return nil, nil
}
size := m.SizeVT()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBufferVT(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *HelpResponse) MarshalToVT(dAtA []byte) (int, error) {
size := m.SizeVT()
return m.MarshalToSizedBufferVT(dAtA[:size])
}
func (m *HelpResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
if m == nil {
return 0, nil
}
i := len(dAtA)
_ = i
var l int
_ = l
if m.unknownFields != nil {
i -= len(m.unknownFields)
copy(dAtA[i:], m.unknownFields)
}
if len(m.Examples) > 0 {
for iNdEx := len(m.Examples) - 1; iNdEx >= 0; iNdEx-- {
size, err := m.Examples[iNdEx].MarshalToSizedBufferVT(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarint(dAtA, i, uint64(size))
i--
dAtA[i] = 0x1a
}
}
if len(m.Description) > 0 {
i -= len(m.Description)
copy(dAtA[i:], m.Description)
i = encodeVarint(dAtA, i, uint64(len(m.Description)))
i--
dAtA[i] = 0x12
}
if len(m.Name) > 0 {
i -= len(m.Name)
copy(dAtA[i:], m.Name)
i = encodeVarint(dAtA, i, uint64(len(m.Name)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *ProcessStartRequest) SizeVT() (n int) {
if m == nil {
return 0
@ -327,6 +486,66 @@ func (m *LookupPathResponse) SizeVT() (n int) {
return n
}
func (m *HelpRequest) SizeVT() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ModuleReference != nil {
l = m.ModuleReference.SizeVT()
n += 1 + l + sov(uint64(l))
}
n += len(m.unknownFields)
return n
}
func (m *TaskExample) SizeVT() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Name)
if l > 0 {
n += 1 + l + sov(uint64(l))
}
l = len(m.Description)
if l > 0 {
n += 1 + l + sov(uint64(l))
}
if m.TaskSpec != nil {
l = m.TaskSpec.SizeVT()
n += 1 + l + sov(uint64(l))
}
n += len(m.unknownFields)
return n
}
func (m *HelpResponse) SizeVT() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Name)
if l > 0 {
n += 1 + l + sov(uint64(l))
}
l = len(m.Description)
if l > 0 {
n += 1 + l + sov(uint64(l))
}
if len(m.Examples) > 0 {
for _, e := range m.Examples {
l = e.SizeVT()
n += 1 + l + sov(uint64(l))
}
}
n += len(m.unknownFields)
return n
}
func (m *ProcessStartRequest) UnmarshalVT(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@ -969,3 +1188,390 @@ func (m *LookupPathResponse) UnmarshalVT(dAtA []byte) error {
}
return nil
}
func (m *HelpRequest) UnmarshalVT(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: HelpRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: HelpRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ModuleReference", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLength
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLength
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.ModuleReference == nil {
m.ModuleReference = &ModuleReference{}
}
if err := m.ModuleReference.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skip(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLength
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *TaskExample) UnmarshalVT(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: TaskExample: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: TaskExample: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLength
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Name = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLength
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Description = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field TaskSpec", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLength
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLength
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.TaskSpec == nil {
m.TaskSpec = &TaskSpec{}
}
if err := m.TaskSpec.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skip(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLength
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *HelpResponse) UnmarshalVT(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: HelpResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: HelpResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLength
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Name = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLength
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Description = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Examples", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLength
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLength
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Examples = append(m.Examples, &TaskExample{})
if err := m.Examples[len(m.Examples)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skip(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLength
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}

189
protocol/marshal.go Normal file
View file

@ -0,0 +1,189 @@
package protocol
import (
"errors"
"fmt"
"reflect"
rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1"
)
var ErrExpectedStruct = errors.New("expected struct")
func Marshal(in any) (*rpcv1.ModuleSpec, error) {
val := reflect.ValueOf(in)
if val.Kind() == reflect.Ptr {
val = val.Elem()
}
if val.Kind() != reflect.Struct {
return nil, fmt.Errorf("%w: got %T", ErrExpectedStruct, in)
}
return marshal(val)
}
func marshal(in reflect.Value) (*rpcv1.ModuleSpec, error) {
numField := in.NumField()
out := &rpcv1.ModuleSpec{
Values: make(map[string]*rpcv1.ModuleSpec_Value, numField),
}
inputType := in.Type()
for i := 0; i < numField; i++ {
structField := inputType.Field(i)
if !structField.IsExported() {
continue
}
out.Values[structField.Name] = mapReflectValueToSpecValue(in.Field(i))
}
return out, nil
}
func mapReflectValueToSpecValue(in reflect.Value) *rpcv1.ModuleSpec_Value {
switch in.Kind() {
case reflect.Bool:
return boolValue(in.Bool())
case reflect.String:
return stringValue(in.String())
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return intValue(in.Int())
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
return intValue(in.Uint())
case reflect.Float32, reflect.Float64:
return floatValue(in.Float())
case reflect.Struct:
return structValue(in)
case reflect.Slice, reflect.Array:
switch in.Type().Elem().Kind() {
case reflect.Bool:
return boolSliceValue(in)
case reflect.String:
return stringSliceValue(in)
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return intSliceValue(in, reflect.Value.Int)
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
return intSliceValue(in, func(v reflect.Value) int64 {
return int64(v.Uint())
})
case reflect.Float32, reflect.Float64:
return floatSliceValue(in)
default:
return nil
}
default:
return nil
}
}
func structValue(in reflect.Value) *rpcv1.ModuleSpec_Value {
inputType := in.Type()
numFields := inputType.NumField()
result := &rpcv1.ModuleSpec_Value{
Type: rpcv1.ModuleSpec_ValueTypeObject,
ComplexValue: make(map[string]*rpcv1.ModuleSpec_Value, numFields),
}
for i := 0; i < numFields; i++ {
structField := inputType.Field(i)
if !structField.IsExported() {
continue
}
result.ComplexValue[structField.Name] = mapReflectValueToSpecValue(in.Field(i))
}
return result
}
func boolValue(in bool) *rpcv1.ModuleSpec_Value {
return &rpcv1.ModuleSpec_Value{
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_BoolValue{
BoolValue: in,
},
}
}
func boolSliceValue(val reflect.Value) *rpcv1.ModuleSpec_Value {
result := &rpcv1.ModuleSpec_Value{
Type: rpcv1.ModuleSpec_ValueTypeBoolSlice,
BoolValues: make([]bool, 0, val.Len()),
}
for i := 0; i < val.Len(); i++ {
result.BoolValues = append(result.BoolValues, val.Index(i).Bool())
}
return result
}
func intValue[T Integer](in T) *rpcv1.ModuleSpec_Value {
return &rpcv1.ModuleSpec_Value{
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_IntValue{
IntValue: int64(in),
},
}
}
func intSliceValue(val reflect.Value, selector func(v reflect.Value) int64) *rpcv1.ModuleSpec_Value {
result := &rpcv1.ModuleSpec_Value{
Type: rpcv1.ModuleSpec_ValueTypeIntSlice,
IntValues: make([]int64, 0, val.Len()),
}
for i := 0; i < val.Len(); i++ {
result.IntValues = append(result.IntValues, selector(val.Index(i)))
}
return result
}
func floatValue[T Float](in T) *rpcv1.ModuleSpec_Value {
return &rpcv1.ModuleSpec_Value{
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_DoubleValue{
DoubleValue: float64(in),
},
}
}
func floatSliceValue(val reflect.Value) *rpcv1.ModuleSpec_Value {
result := &rpcv1.ModuleSpec_Value{
Type: rpcv1.ModuleSpec_ValueTypeIntSlice,
DoubleValues: make([]float64, 0, val.Len()),
}
for i := 0; i < val.Len(); i++ {
result.DoubleValues = append(result.DoubleValues, val.Index(i).Float())
}
return result
}
func stringValue(in string) *rpcv1.ModuleSpec_Value {
return &rpcv1.ModuleSpec_Value{
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_StringValue{
StringValue: in,
},
}
}
func stringSliceValue(val reflect.Value) *rpcv1.ModuleSpec_Value {
result := &rpcv1.ModuleSpec_Value{
Type: rpcv1.ModuleSpec_ValueTypeIntSlice,
StringValues: make([]string, 0, val.Len()),
}
for i := 0; i < val.Len(); i++ {
result.StringValues = append(result.StringValues, val.Index(i).String())
}
return result
}

220
protocol/marshal_test.go Normal file
View file

@ -0,0 +1,220 @@
package protocol_test
import (
"testing"
"code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol"
rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1"
)
func TestMarshal_Bool_Success(t *testing.T) {
input := struct {
IsDeleted bool
}{
IsDeleted: true,
}
spec, err := protocol.Marshal(input)
if err != nil {
t.Fatal(err)
}
nameVal, ok := spec.Values["IsDeleted"]
if !ok {
t.Fatal("IsDeleted not found")
}
if nameVal.Type != rpcv1.ModuleSpec_ValueTypeSingle {
t.Fatalf("Expected single value type, got %v", nameVal.Type)
}
if s, ok := nameVal.SingleValue.(*rpcv1.ModuleSpec_Value_BoolValue); !ok {
t.Fatalf("Expected string value, got %v", nameVal.SingleValue)
} else if !s.BoolValue {
t.Errorf("Expected bool value to be true, got %t", s.BoolValue)
}
}
func TestMarshal_BoolSlice_Success(t *testing.T) {
input := struct {
IsDeleted []bool
}{
IsDeleted: []bool{true},
}
spec, err := protocol.Marshal(input)
if err != nil {
t.Fatal(err)
}
nameVal, ok := spec.Values["IsDeleted"]
if !ok {
t.Fatal("IsDeleted not found")
}
if nameVal.Type != rpcv1.ModuleSpec_ValueTypeBoolSlice {
t.Fatalf("Expected bool slice value type, got %v", nameVal.Type)
}
if len(nameVal.BoolValues) < 1 {
t.Fatalf("Expected at least one bool value, got %d", len(nameVal.BoolValues))
}
if !nameVal.BoolValues[0] {
t.Errorf("Expected bool value to be true, got %t", nameVal.BoolValues[0])
}
}
func TestMarshal_Int_Success(t *testing.T) {
input := struct {
Age int
}{
Age: 42,
}
spec, err := protocol.Marshal(input)
if err != nil {
t.Fatal(err)
}
nameVal, ok := spec.Values["Age"]
if !ok {
t.Fatal("Age not found")
}
if nameVal.Type != rpcv1.ModuleSpec_ValueTypeSingle {
t.Fatalf("Expected single value type, got %v", nameVal.Type)
}
if s, ok := nameVal.SingleValue.(*rpcv1.ModuleSpec_Value_IntValue); !ok {
t.Fatalf("Expected string value, got %v", nameVal.SingleValue)
} else if s.IntValue != 42 {
t.Errorf("Expected int value to be 42, got %d", s.IntValue)
}
}
func TestMarshal_IntSlice_Success(t *testing.T) {
input := struct {
Ages []int
}{
Ages: []int{42},
}
spec, err := protocol.Marshal(input)
if err != nil {
t.Fatal(err)
}
nameVal, ok := spec.Values["Ages"]
if !ok {
t.Fatal("Ages not found")
}
if nameVal.Type != rpcv1.ModuleSpec_ValueTypeIntSlice {
t.Fatalf("Expected int slice value type, got %v", nameVal.Type)
}
if len(nameVal.IntValues) < 1 {
t.Fatalf("Expected at least one bool value, got %d", len(nameVal.BoolValues))
}
if nameVal.IntValues[0] != 42 {
t.Errorf("Expected int value to be 52, got %d", nameVal.IntValues[0])
}
}
func TestMarshal_StringField_Success(t *testing.T) {
input := struct {
Name string
}{
Name: "John Doe",
}
spec, err := protocol.Marshal(input)
if err != nil {
t.Fatal(err)
}
nameVal, ok := spec.Values["Name"]
if !ok {
t.Fatal("Name not found")
}
if nameVal.Type != rpcv1.ModuleSpec_ValueTypeSingle {
t.Fatalf("Expected single value type, got %v", nameVal.Type)
}
if s, ok := nameVal.SingleValue.(*rpcv1.ModuleSpec_Value_StringValue); !ok {
t.Fatalf("Expected string value, got %v", nameVal.SingleValue)
} else if s.StringValue != "John Doe" {
t.Errorf("Expected string value to be John Doe, got %s", s.StringValue)
}
}
func TestMarshal_Float64_Success(t *testing.T) {
input := struct {
Pi float64
}{
Pi: 3.14,
}
spec, err := protocol.Marshal(input)
if err != nil {
t.Fatal(err)
}
nameVal, ok := spec.Values["Pi"]
if !ok {
t.Fatal("Pi not found")
}
if nameVal.Type != rpcv1.ModuleSpec_ValueTypeSingle {
t.Fatalf("Expected single value type, got %v", nameVal.Type)
}
if s, ok := nameVal.SingleValue.(*rpcv1.ModuleSpec_Value_DoubleValue); !ok {
t.Fatalf("Expected double value, got %v", nameVal.SingleValue)
} else if s.DoubleValue-3.14 > 0.000001 {
t.Errorf("Expected double value to be 3.14, got %f", s.DoubleValue)
}
}
func TestMarshal_NestedStruct_Success(t *testing.T) {
type Address struct {
City string
}
input := struct {
Address Address
}{
Address: Address{
City: "New York",
},
}
spec, err := protocol.Marshal(input)
if err != nil {
t.Fatal(err)
}
addressVal, ok := spec.Values["Address"]
if !ok {
t.Fatal("Address not found")
}
if addressVal.Type != rpcv1.ModuleSpec_ValueTypeObject {
t.Fatalf("Expected object value type, got %v", addressVal.Type)
}
cityVal, ok := addressVal.ComplexValue["City"]
if !ok {
t.Fatal("City not found")
}
if cityVal.Type != rpcv1.ModuleSpec_ValueTypeSingle {
t.Fatalf("Expected single value type, got %v", cityVal.Type)
}
if cityVal.SingleValue.(*rpcv1.ModuleSpec_Value_StringValue).StringValue != "New York" {
t.Errorf("Expected string value to be New York, got %s", cityVal.SingleValue.(*rpcv1.ModuleSpec_Value_StringValue).StringValue)
}
}

208
protocol/unmarshal.go Normal file
View file

@ -0,0 +1,208 @@
package protocol
import (
"errors"
"fmt"
"reflect"
"strings"
rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1"
)
var (
ErrUnmatchingType = errors.New("field type does not match wire value")
)
func Unmarshal(input *rpcv1.ModuleSpec, into any) error {
cfg := unmarshalConfig{
TagName: "hcl",
}
val := reflect.ValueOf(into)
if val.Kind() != reflect.Ptr {
return errors.New("into value must be a pointer")
}
return cfg.unmarshal(input.Values, val.Elem(), reflect.TypeOf(into).Elem())
}
type unmarshalConfig struct {
TagName string
}
func (cfg unmarshalConfig) unmarshal(input map[string]*rpcv1.ModuleSpec_Value, into reflect.Value, intoType reflect.Type) error {
for i := 0; i < intoType.NumField(); i++ {
tf := intoType.Field(i)
if !tf.IsExported() {
continue
}
fieldName := cfg.fieldName(tf)
val, ok := input[fieldName]
if !ok {
continue
}
if mapped, err := cfg.mapSpecValueTo(val, tf.Type); err != nil {
return fmt.Errorf("failed to map value for field %s: %w", tf.Name, err)
} else if into.Type().Kind() == reflect.Pointer {
into.Elem().Field(i).Set(mapped)
} else {
into.Field(i).Set(mapped)
}
delete(input, fieldName)
}
if len(input) > 0 {
keys := make([]string, 0, len(input))
for k := range input {
keys = append(keys, k)
}
return fmt.Errorf("unknown fields: %v", keys)
}
return nil
}
func (cfg unmarshalConfig) mapSpecValueTo(val *rpcv1.ModuleSpec_Value, targetType reflect.Type) (reflect.Value, error) {
switch val.Type {
case rpcv1.ModuleSpec_ValueTypeUnknown:
return reflect.Value{}, ErrUnmatchingType
case rpcv1.ModuleSpec_ValueTypeObject:
if targetType.Kind() == reflect.Struct {
structVal := reflect.New(targetType)
if err := cfg.unmarshal(val.ComplexValue, structVal, targetType); err != nil {
return reflect.Value{}, err
} else {
return structVal.Elem(), nil
}
} else if targetType.Kind() == reflect.Pointer && targetType.Elem().Kind() == reflect.Struct {
structVal := reflect.New(targetType.Elem())
if err := cfg.unmarshal(val.ComplexValue, structVal, targetType.Elem()); err != nil {
return reflect.Value{}, err
} else {
return structVal, nil
}
} else if targetType.Kind() != reflect.Map {
return reflect.Value{}, fmt.Errorf("%w: expected struct, got %s", ErrUnmatchingType, targetType.String())
}
fallthrough
case rpcv1.ModuleSpec_ValueTypeMap:
if targetType.Kind() != reflect.Map {
return reflect.Value{}, fmt.Errorf("%w: expected map, got %v", ErrUnmatchingType, targetType)
}
mapVal := reflect.MakeMap(targetType)
for k, v := range val.ComplexValue {
if mappedVal, err := cfg.mapSpecValueTo(v, targetType.Elem()); err != nil {
return reflect.Value{}, err
} else {
mapVal.SetMapIndex(reflect.ValueOf(k), mappedVal)
}
}
return mapVal, nil
case rpcv1.ModuleSpec_ValueTypeSingle:
switch sv := val.SingleValue.(type) {
case *rpcv1.ModuleSpec_Value_BoolValue:
if targetType.Kind() != reflect.Bool {
return reflect.Value{}, fmt.Errorf("%w: expected bool, got %v", ErrUnmatchingType, targetType)
}
return reflect.ValueOf(sv.BoolValue), nil
case *rpcv1.ModuleSpec_Value_StringValue:
if targetType.Kind() != reflect.String {
return reflect.Value{}, fmt.Errorf("%w: expected string, got %v", ErrUnmatchingType, targetType)
}
return reflect.ValueOf(sv.StringValue), nil
case *rpcv1.ModuleSpec_Value_IntValue:
if targetType.Kind() != reflect.Int {
return reflect.Value{}, fmt.Errorf("%w: expected int, got %v", ErrUnmatchingType, targetType)
}
return reflect.ValueOf(int(sv.IntValue)), nil
case *rpcv1.ModuleSpec_Value_DoubleValue:
if targetType.Kind() != reflect.Float64 {
return reflect.Value{}, fmt.Errorf("%w: expected float64, got %v", ErrUnmatchingType, targetType)
}
return reflect.ValueOf(sv.DoubleValue), nil
}
case rpcv1.ModuleSpec_ValueTypeBoolSlice:
if targetType.Kind() != reflect.Slice {
return reflect.Value{}, fmt.Errorf("%w: expected slice, got %v", ErrUnmatchingType, targetType)
} else if targetType.Elem().Kind() != reflect.Bool {
return reflect.Value{}, fmt.Errorf("%w: expected bool, got %v", ErrUnmatchingType, targetType.Elem())
}
return reflect.ValueOf(val.BoolValues), nil
case rpcv1.ModuleSpec_ValueTypeStringSlice:
if targetType.Kind() != reflect.Slice {
return reflect.Value{}, fmt.Errorf("%w: expected slice, got %v", ErrUnmatchingType, targetType)
} else if targetType.Elem().Kind() != reflect.String {
return reflect.Value{}, fmt.Errorf("%w: expected string, got %v", ErrUnmatchingType, targetType.Elem())
}
return reflect.ValueOf(val.StringValues), nil
case rpcv1.ModuleSpec_ValueTypeIntSlice:
if targetType.Kind() != reflect.Slice {
return reflect.Value{}, fmt.Errorf("%w: expected slice, got %v", ErrUnmatchingType, targetType)
}
switch targetType.Elem().Kind() {
case reflect.Int:
return reflect.ValueOf(convertNumericSlice[int64, int](val.IntValues)), nil
case reflect.Int8:
return reflect.ValueOf(convertNumericSlice[int64, int8](val.IntValues)), nil
case reflect.Int16:
return reflect.ValueOf(convertNumericSlice[int64, int16](val.IntValues)), nil
case reflect.Int32:
return reflect.ValueOf(convertNumericSlice[int64, int32](val.IntValues)), nil
case reflect.Int64:
return reflect.ValueOf(val.IntValues), nil
default:
return reflect.Value{}, fmt.Errorf("%w: expected int, got %v", ErrUnmatchingType, targetType.Elem())
}
case rpcv1.ModuleSpec_ValueTypeDoubleSlice:
if targetType.Kind() != reflect.Slice {
return reflect.Value{}, fmt.Errorf("%w: expected slice, got %v", ErrUnmatchingType, targetType)
}
switch targetType.Elem().Kind() {
case reflect.Float32:
return reflect.ValueOf(convertNumericSlice[float64, float32](val.DoubleValues)), nil
case reflect.Float64:
return reflect.ValueOf(val.DoubleValues), nil
default:
return reflect.Value{}, fmt.Errorf("%w: expected int, got %v", ErrUnmatchingType, targetType.Elem())
}
}
return reflect.Value{}, nil
}
func (cfg unmarshalConfig) fieldName(field reflect.StructField) string {
tagVal, ok := field.Tag.Lookup(cfg.TagName)
if !ok {
return field.Name
}
split := strings.Split(tagVal, ",")
switch {
case len(split) == 0:
fallthrough
case split[0] == "":
return strings.ToLower(field.Name)
default:
return strings.ToLower(split[0])
}
}
type numeric interface {
Integer | Float
}
func convertNumericSlice[TIn numeric, TOut numeric](input []TIn) []TOut {
output := make([]TOut, len(input))
for i, v := range input {
output[i] = TOut(v)
}
return output
}

515
protocol/unmarshal_test.go Normal file
View file

@ -0,0 +1,515 @@
package protocol_test
import (
"testing"
"code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol"
rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1"
)
func TestUnmarshal_Bool_Success(t *testing.T) {
target := struct {
Delete bool
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Delete": {
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_BoolValue{
BoolValue: true,
},
},
},
}
if err := protocol.Unmarshal(spec, &target); err != nil {
t.Errorf("Failed to unmarshal: %v", err)
}
if !target.Delete {
t.Errorf("Expected Delete to be true")
}
}
func TestUnmarshal_Bool_Err(t *testing.T) {
target := struct {
Delete string
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Delete": {
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_BoolValue{
BoolValue: true,
},
},
},
}
if err := protocol.Unmarshal(spec, &target); err == nil {
t.Errorf("Expected error")
} else {
t.Log(err.Error())
}
}
func TestUnmarshal_Bool_Slice_Success(t *testing.T) {
target := struct {
Delete []bool
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Delete": {
Type: rpcv1.ModuleSpec_ValueTypeBoolSlice,
BoolValues: []bool{true},
},
},
}
if err := protocol.Unmarshal(spec, &target); err != nil {
t.Errorf("Failed to unmarshal: %v", err)
}
if len(target.Delete) < 1 {
t.Errorf("Expected Delete to have at least one element")
} else if !target.Delete[0] {
t.Errorf("Expected Delete[0] to be true")
}
}
func TestUnmarshal_Bool_Slice_Err(t *testing.T) {
target := struct {
Delete []string
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Delete": {
Type: rpcv1.ModuleSpec_ValueTypeBoolSlice,
BoolValues: []bool{true},
},
},
}
if err := protocol.Unmarshal(spec, &target); err == nil {
t.Errorf("Expected error")
} else {
t.Log(err.Error())
}
}
func TestUnmarshal_String_Success(t *testing.T) {
target := struct {
Name string
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Name": {
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_StringValue{
StringValue: "Ted",
},
},
},
}
if err := protocol.Unmarshal(spec, &target); err != nil {
t.Errorf("Failed to unmarshal: %v", err)
}
if target.Name != "Ted" {
t.Errorf("Expected Name to be 'Ted'")
}
}
func TestUnmarshal_String_Err(t *testing.T) {
target := struct {
Name int
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Name": {
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_StringValue{
StringValue: "Ted",
},
},
},
}
if err := protocol.Unmarshal(spec, &target); err == nil {
t.Errorf("Expected error")
} else {
t.Log(err.Error())
}
}
func TestUnmarshal_String_Slice_Success(t *testing.T) {
target := struct {
Names []string
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Names": {
Type: rpcv1.ModuleSpec_ValueTypeStringSlice,
StringValues: []string{"Ted"},
},
},
}
if err := protocol.Unmarshal(spec, &target); err != nil {
t.Errorf("Failed to unmarshal: %v", err)
}
if len(target.Names) < 1 {
t.Errorf("Expected Names to have at least one element")
} else if target.Names[0] != "Ted" {
t.Errorf("Expected Names[0] to be 'Ted'")
}
}
func TestUnmarshal_String_Slice_Err(t *testing.T) {
target := struct {
Names []int
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Names": {
Type: rpcv1.ModuleSpec_ValueTypeStringSlice,
StringValues: []string{"Ted"},
},
},
}
if err := protocol.Unmarshal(spec, &target); err == nil {
t.Errorf("Expected error")
} else {
t.Log(err.Error())
}
}
func TestUnmarshal_Int_Success(t *testing.T) {
target := struct {
Age int
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Age": {
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_IntValue{
IntValue: 42,
},
},
},
}
if err := protocol.Unmarshal(spec, &target); err != nil {
t.Errorf("Failed to unmarshal: %v", err)
}
if target.Age != 42 {
t.Errorf("Expected Age to be 42")
}
}
func TestUnmarshal_Int_Err(t *testing.T) {
target := struct {
Age string
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Age": {
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_IntValue{
IntValue: 42,
},
},
},
}
if err := protocol.Unmarshal(spec, &target); err == nil {
t.Errorf("Expected error")
} else {
t.Log(err.Error())
}
}
func TestUnmarshal_Int_Slice_Success(t *testing.T) {
target := struct {
Ages []int
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Ages": {
Type: rpcv1.ModuleSpec_ValueTypeIntSlice,
IntValues: []int64{42},
},
},
}
if err := protocol.Unmarshal(spec, &target); err != nil {
t.Errorf("Failed to unmarshal: %v", err)
}
if len(target.Ages) < 1 {
t.Errorf("Expected Ages to have at least one element")
} else if target.Ages[0] != 42 {
t.Errorf("Expected Ages[0] to be 42")
}
}
func TestUnmarshal_Int_Slice_Err(t *testing.T) {
target := struct {
Ages []string
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Ages": {
Type: rpcv1.ModuleSpec_ValueTypeIntSlice,
IntValues: []int64{42},
},
},
}
if err := protocol.Unmarshal(spec, &target); err == nil {
t.Errorf("Expected error")
} else {
t.Log(err.Error())
}
}
func TestUnmarshal_Double_Success(t *testing.T) {
target := struct {
Pi float64
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Pi": {
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_DoubleValue{
DoubleValue: 3.14,
},
},
},
}
if err := protocol.Unmarshal(spec, &target); err != nil {
t.Errorf("Failed to unmarshal: %v", err)
}
if target.Pi-3.14 > 0.0000001 {
t.Errorf("Expected Pi to be 3.14")
}
}
func TestUnmarshal_Double_Err(t *testing.T) {
target := struct {
Pi string
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Pi": {
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_DoubleValue{
DoubleValue: 3.14,
},
},
},
}
if err := protocol.Unmarshal(spec, &target); err == nil {
t.Errorf("Expected error")
} else {
t.Log(err.Error())
}
}
func TestUnmarshal_Double_Slice_Success(t *testing.T) {
target := struct {
Pis []float64
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Pis": {
Type: rpcv1.ModuleSpec_ValueTypeDoubleSlice,
DoubleValues: []float64{3.14},
},
},
}
if err := protocol.Unmarshal(spec, &target); err != nil {
t.Errorf("Failed to unmarshal: %v", err)
}
if len(target.Pis) < 1 {
t.Errorf("Expected Pis to have at least one element")
} else if target.Pis[0]-3.14 > 0.0000001 {
t.Errorf("Expected Pis[0] to be 3.14")
}
}
func TestUnmarshal_Double_Slice_Err(t *testing.T) {
target := struct {
Pis []string
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Pis": {
Type: rpcv1.ModuleSpec_ValueTypeDoubleSlice,
DoubleValues: []float64{3.14},
},
},
}
if err := protocol.Unmarshal(spec, &target); err == nil {
t.Errorf("Expected error")
} else {
t.Log(err.Error())
}
}
func TestUnmarshal_NestedStruct_Success(t *testing.T) {
target := struct {
Address struct {
City string
}
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Address": {
Type: rpcv1.ModuleSpec_ValueTypeObject,
ComplexValue: map[string]*rpcv1.ModuleSpec_Value{
"City": {
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_StringValue{
StringValue: "New York",
},
},
},
},
},
}
if err := protocol.Unmarshal(spec, &target); err != nil {
t.Errorf("Failed to unmarshal: %v", err)
}
if target.Address.City != "New York" {
t.Errorf("Expected City to be 'New York'")
}
}
func TestUnmarshal_NestedStructPointer_Success(t *testing.T) {
target := struct {
Address *struct {
City string
}
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Address": {
Type: rpcv1.ModuleSpec_ValueTypeObject,
ComplexValue: map[string]*rpcv1.ModuleSpec_Value{
"City": {
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_StringValue{
StringValue: "New York",
},
},
},
},
},
}
if err := protocol.Unmarshal(spec, &target); err != nil {
t.Errorf("Failed to unmarshal: %v", err)
}
if target.Address.City != "New York" {
t.Errorf("Expected City to be 'New York'")
}
}
func TestUnmarshal_Map_Success(t *testing.T) {
target := struct {
Values map[string]string
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"Values": {
Type: rpcv1.ModuleSpec_ValueTypeMap,
ComplexValue: map[string]*rpcv1.ModuleSpec_Value{
"City": {
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_StringValue{
StringValue: "New York",
},
},
},
},
},
}
if err := protocol.Unmarshal(spec, &target); err != nil {
t.Errorf("Failed to unmarshal: %v", err)
}
if target.Values["City"] != "New York" {
t.Errorf("Expected City to be 'New York'")
}
}
func TestUnmarshal_NestedMap_Success(t *testing.T) {
target := struct {
City struct {
Labels map[string]string
}
}{}
spec := &rpcv1.ModuleSpec{
Values: map[string]*rpcv1.ModuleSpec_Value{
"City": {
Type: rpcv1.ModuleSpec_ValueTypeObject,
ComplexValue: map[string]*rpcv1.ModuleSpec_Value{
"Labels": {
Type: rpcv1.ModuleSpec_ValueTypeMap,
ComplexValue: map[string]*rpcv1.ModuleSpec_Value{
"Region": {
Type: rpcv1.ModuleSpec_ValueTypeSingle,
SingleValue: &rpcv1.ModuleSpec_Value_StringValue{
StringValue: "west",
},
},
},
},
},
},
},
}
if err := protocol.Unmarshal(spec, &target); err != nil {
t.Errorf("Failed to unmarshal: %v", err)
}
if target.City.Labels["Region"] != "west" {
t.Errorf("Expected 'Region' to be 'west'")
}
}

View file

@ -1,8 +1,6 @@
package sdk
import (
"fmt"
"strings"
"sync"
)
@ -23,28 +21,21 @@ func (f RegistrationFunc) RegisterAt(registry *TypeRegistry) {
func NewTypeRegistry() *TypeRegistry {
return &TypeRegistry{
registrations: make(map[string]Factory),
registrations: make(map[Reference]Factory),
}
}
type TypeRegistry struct {
lock sync.Mutex
registrations map[string]Factory
registrations map[Reference]Factory
}
func (r *TypeRegistry) List() (refs []Reference) {
refs = make([]Reference, 0, len(r.registrations))
for k := range r.registrations {
split := strings.SplitN(k, "/", 2)
if len(split) < 2 {
continue
}
refs = append(refs, Reference{
Category: Category(split[0]),
Type: split[1],
})
refs = append(refs, k)
}
return refs
@ -66,6 +57,9 @@ func (r *TypeRegistry) Get(cat Category, moduleName string) Module {
return f.Create()
}
func specOf(cat Category, moduleName string) string {
return fmt.Sprintf("%s/%s", cat.String(), moduleName)
func specOf(cat Category, moduleName string) Reference {
return Reference{
Category: cat,
Type: moduleName,
}
}