From 25ec63d3507d98298908d35a7bae4afd9016fac5 Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Sat, 13 May 2023 17:46:09 +0200 Subject: [PATCH] feat: provide plugin inventory --- api/rpc/v1/executor.proto | 18 +- entrypoint.go | 23 +- integration/mem_mgr.go | 5 + integration/test_host.go | 62 ++- internal/mem/unmanaged.go | 24 +- protocol/generated/rpc/v1/executor.pb.go | 338 ++++++++++----- .../generated/rpc/v1/executor_vtproto.pb.go | 398 +++++++++++++++--- registry.go | 24 ++ 8 files changed, 718 insertions(+), 174 deletions(-) diff --git a/api/rpc/v1/executor.proto b/api/rpc/v1/executor.proto index 5cb795a..a3bea5a 100644 --- a/api/rpc/v1/executor.proto +++ b/api/rpc/v1/executor.proto @@ -15,14 +15,18 @@ message Buildr { } message ModuleReference { - string task_id = 1; - string module_category = 2; - string module_type = 3; - string module_name = 4; + string module_category = 1; + string module_type = 2; +} + +message TaskReference { + string id = 1; + string name = 2; + ModuleReference module = 3; } message StartTaskRequest { - ModuleReference reference = 1; + TaskReference reference = 1; Buildr buildr = 2; bytes raw_task = 3; } @@ -61,4 +65,8 @@ message GetStateResponse { message Result { bool success = 1; string error = 2; +} + +message PluginInventory { + repeated ModuleReference modules = 1; } \ No newline at end of file diff --git a/entrypoint.go b/entrypoint.go index ef0229e..6b0ad5f 100644 --- a/entrypoint.go +++ b/entrypoint.go @@ -14,6 +14,25 @@ func Register(cat Category, moduleName string, factory Factory) { defaultRegistry.Add(cat, moduleName, factory) } +//export inventory +func Inventory() uint64 { + var inventory rpcv1.PluginInventory + + for _, t := range defaultRegistry.List() { + inventory.Modules = append(inventory.Modules, &rpcv1.ModuleReference{ + ModuleCategory: t.Category.String(), + ModuleType: t.Type, + }) + } + + data, err := inventory.MarshalVT() + if err != nil { + panic(err) + } + + return mem.UnifyPtrSize(mem.DataToUnmanagedPtr(data)) +} + //export run func Run(specPtr, specSize uint32) { var startTask rpcv1.StartTaskRequest @@ -23,12 +42,12 @@ func Run(specPtr, specSize uint32) { } executor := NewExecutor(startTask.Buildr.Repo.Root, "", "") - reference := startTask.GetReference() + reference := startTask.GetReference().GetModule() module := defaultRegistry.Get(Category(reference.GetModuleCategory()), reference.GetModuleType()) if err := easyjson.Unmarshal(startTask.RawTask, module); err != nil { panic(err) } - executor.Run(context.Background(), startTask.Reference.ModuleName, module) + executor.Run(context.Background(), startTask.GetReference().GetName(), module) } diff --git a/integration/mem_mgr.go b/integration/mem_mgr.go index becc6b4..f262d09 100644 --- a/integration/mem_mgr.go +++ b/integration/mem_mgr.go @@ -24,6 +24,11 @@ type memoryManager struct { danglingAllocations []uint64 } +func (m *memoryManager) Deallocate(ctx context.Context, ptr uint64) error { + _, err := m.deallocate.Call(ctx, ptr) + return err +} + func (m *memoryManager) WriteMessage(ctx context.Context, mod api.Module, msg Message) (uint64, error) { data, err := msg.MarshalVT() if err != nil { diff --git a/integration/test_host.go b/integration/test_host.go index 5e3d7a5..ccdcee8 100644 --- a/integration/test_host.go +++ b/integration/test_host.go @@ -1,9 +1,11 @@ package integration import ( + "code.icb4dc0.de/buildr/wasi-module-sdk/internal/mem" "context" "crypto/md5" "errors" + "fmt" "os" "time" @@ -102,12 +104,25 @@ func (h *Host) Run(ctx context.Context, wasiPayload []byte, spec TestSpec) (err return err } + h.memMgr = newMemoryManager(mod) + + inv, err := h.getInventory(ctx, mod) + if err != nil { + return err + } + + for _, ref := range inv { + fmt.Printf("%s/%s/n", ref.Category, ref.Type) + } + startTask := &rpcv1.StartTaskRequest{ - Reference: &rpcv1.ModuleReference{ - TaskId: uuid.NewString(), - ModuleCategory: spec.ModuleCategory.String(), - ModuleType: spec.ModuleType, - ModuleName: spec.ModuleName, + Reference: &rpcv1.TaskReference{ + Id: uuid.NewString(), + Module: &rpcv1.ModuleReference{ + ModuleCategory: spec.ModuleCategory.String(), + ModuleType: spec.ModuleType, + }, + Name: spec.ModuleName, }, Buildr: &rpcv1.Buildr{ Repo: &rpcv1.Buildr_Repo{ @@ -123,7 +138,6 @@ func (h *Host) Run(ctx context.Context, wasiPayload []byte, spec TestSpec) (err } run := mod.ExportedFunction("run") - h.memMgr = newMemoryManager(mod) defer func() { err = errors.Join(err, h.memMgr.Close()) @@ -142,6 +156,42 @@ func (h *Host) Run(ctx context.Context, wasiPayload []byte, spec TestSpec) (err return err } +func (h *Host) getInventory(ctx context.Context, mod api.Module) (refs []sdk.Reference, err error) { + result, err := mod.ExportedFunction("inventory").Call(ctx) + if err != nil { + return nil, err + } + + ptr, size := mem.UnifiedPtrToSizePtr(result[0]) + if ptr == 0 { + return nil, errors.New("failed to get inventory - 0 pointer") + } + + defer func() { + err = errors.Join(err, h.memMgr.Deallocate(ctx, uint64(ptr))) + }() + + data, ok := mod.Memory().Read(ptr, size) + if !ok { + return nil, errors.New("failed to get inventory") + } + + var inventory rpcv1.PluginInventory + if err = inventory.UnmarshalVT(data); err != nil { + return nil, err + } + + refs = make([]sdk.Reference, 0, len(inventory.Modules)) + for _, m := range inventory.Modules { + refs = append(refs, sdk.Reference{ + Category: sdk.Category(m.GetModuleCategory()), + Type: m.GetModuleType(), + }) + } + + return refs, nil +} + func (h *Host) getState(ctx context.Context, m api.Module, offset, byteCount uint32) uint64 { if h.state == nil { h.state = make(map[string][]byte) diff --git a/internal/mem/unmanaged.go b/internal/mem/unmanaged.go index 650077e..608c79b 100644 --- a/internal/mem/unmanaged.go +++ b/internal/mem/unmanaged.go @@ -1,10 +1,20 @@ package mem +// #include +import "C" + import "unsafe" -func DataToManagedPtr(data []byte) (uint32, uint32) { - ptr := unsafe.Pointer(unsafe.SliceData(data)) - return uint32(uintptr(ptr)), uint32(len(data)) +func DataToManagedPtr(data []byte) (ptr uint32, size uint32) { + uptr := unsafe.Pointer(unsafe.SliceData(data)) + return uint32(uintptr(uptr)), uint32(len(data)) +} + +func DataToUnmanagedPtr(data []byte) (uint32, uint32) { + size := C.ulong(len(data)) + ptr := unsafe.Pointer(C.malloc(size)) + copy(unsafe.Slice((*byte)(ptr), len(data)), data) + return uint32(uintptr(ptr)), uint32(size) } func DataFromPtr(ptr, size uint32) []byte { @@ -15,3 +25,11 @@ func DataFromPtr(ptr, size uint32) []byte { func PtrToData(ptr uint32, size uint32) []byte { return unsafe.Slice((*byte)(unsafe.Pointer(uintptr(ptr))), size) } + +func UnifyPtrSize(ptr, size uint32) uint64 { + return (uint64(ptr) << uint64(32)) | uint64(size) +} + +func UnifiedPtrToSizePtr(uint64ptr uint64) (ptr uint32, size uint32) { + return uint32(uint64ptr >> 32), uint32(uint64ptr) +} diff --git a/protocol/generated/rpc/v1/executor.pb.go b/protocol/generated/rpc/v1/executor.pb.go index acc7455..c517572 100644 --- a/protocol/generated/rpc/v1/executor.pb.go +++ b/protocol/generated/rpc/v1/executor.pb.go @@ -80,10 +80,8 @@ type ModuleReference struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` - ModuleCategory string `protobuf:"bytes,2,opt,name=module_category,json=moduleCategory,proto3" json:"module_category,omitempty"` - ModuleType string `protobuf:"bytes,3,opt,name=module_type,json=moduleType,proto3" json:"module_type,omitempty"` - ModuleName string `protobuf:"bytes,4,opt,name=module_name,json=moduleName,proto3" json:"module_name,omitempty"` + ModuleCategory string `protobuf:"bytes,1,opt,name=module_category,json=moduleCategory,proto3" json:"module_category,omitempty"` + ModuleType string `protobuf:"bytes,2,opt,name=module_type,json=moduleType,proto3" json:"module_type,omitempty"` } func (x *ModuleReference) Reset() { @@ -118,13 +116,6 @@ func (*ModuleReference) Descriptor() ([]byte, []int) { return file_rpc_v1_executor_proto_rawDescGZIP(), []int{1} } -func (x *ModuleReference) GetTaskId() string { - if x != nil { - return x.TaskId - } - return "" -} - func (x *ModuleReference) GetModuleCategory() string { if x != nil { return x.ModuleCategory @@ -139,27 +130,83 @@ func (x *ModuleReference) GetModuleType() string { return "" } -func (x *ModuleReference) GetModuleName() string { +type TaskReference struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Module *ModuleReference `protobuf:"bytes,3,opt,name=module,proto3" json:"module,omitempty"` +} + +func (x *TaskReference) Reset() { + *x = TaskReference{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_v1_executor_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TaskReference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TaskReference) ProtoMessage() {} + +func (x *TaskReference) ProtoReflect() protoreflect.Message { + mi := &file_rpc_v1_executor_proto_msgTypes[2] + 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 TaskReference.ProtoReflect.Descriptor instead. +func (*TaskReference) Descriptor() ([]byte, []int) { + return file_rpc_v1_executor_proto_rawDescGZIP(), []int{2} +} + +func (x *TaskReference) GetId() string { if x != nil { - return x.ModuleName + return x.Id } return "" } +func (x *TaskReference) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *TaskReference) GetModule() *ModuleReference { + if x != nil { + return x.Module + } + return nil +} + type StartTaskRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Reference *ModuleReference `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"` + 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"` } func (x *StartTaskRequest) Reset() { *x = StartTaskRequest{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_v1_executor_proto_msgTypes[2] + mi := &file_rpc_v1_executor_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -172,7 +219,7 @@ func (x *StartTaskRequest) String() string { func (*StartTaskRequest) ProtoMessage() {} func (x *StartTaskRequest) ProtoReflect() protoreflect.Message { - mi := &file_rpc_v1_executor_proto_msgTypes[2] + mi := &file_rpc_v1_executor_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -185,10 +232,10 @@ 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{2} + return file_rpc_v1_executor_proto_rawDescGZIP(), []int{3} } -func (x *StartTaskRequest) GetReference() *ModuleReference { +func (x *StartTaskRequest) GetReference() *TaskReference { if x != nil { return x.Reference } @@ -221,7 +268,7 @@ type TaskResult struct { func (x *TaskResult) Reset() { *x = TaskResult{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_v1_executor_proto_msgTypes[3] + mi := &file_rpc_v1_executor_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -234,7 +281,7 @@ func (x *TaskResult) String() string { func (*TaskResult) ProtoMessage() {} func (x *TaskResult) ProtoReflect() protoreflect.Message { - mi := &file_rpc_v1_executor_proto_msgTypes[3] + mi := &file_rpc_v1_executor_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -247,7 +294,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{3} + return file_rpc_v1_executor_proto_rawDescGZIP(), []int{4} } func (x *TaskResult) GetError() string { @@ -278,7 +325,7 @@ type TaskLog struct { func (x *TaskLog) Reset() { *x = TaskLog{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_v1_executor_proto_msgTypes[4] + mi := &file_rpc_v1_executor_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -291,7 +338,7 @@ func (x *TaskLog) String() string { func (*TaskLog) ProtoMessage() {} func (x *TaskLog) ProtoReflect() protoreflect.Message { - mi := &file_rpc_v1_executor_proto_msgTypes[4] + mi := &file_rpc_v1_executor_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -304,7 +351,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{4} + return file_rpc_v1_executor_proto_rawDescGZIP(), []int{5} } func (x *TaskLog) GetTime() int64 { @@ -347,7 +394,7 @@ type SetState struct { func (x *SetState) Reset() { *x = SetState{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_v1_executor_proto_msgTypes[5] + mi := &file_rpc_v1_executor_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -360,7 +407,7 @@ func (x *SetState) String() string { func (*SetState) ProtoMessage() {} func (x *SetState) ProtoReflect() protoreflect.Message { - mi := &file_rpc_v1_executor_proto_msgTypes[5] + mi := &file_rpc_v1_executor_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -373,7 +420,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{5} + return file_rpc_v1_executor_proto_rawDescGZIP(), []int{6} } func (x *SetState) GetKey() []byte { @@ -401,7 +448,7 @@ type GetStateRequest struct { func (x *GetStateRequest) Reset() { *x = GetStateRequest{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_v1_executor_proto_msgTypes[6] + mi := &file_rpc_v1_executor_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -414,7 +461,7 @@ func (x *GetStateRequest) String() string { func (*GetStateRequest) ProtoMessage() {} func (x *GetStateRequest) ProtoReflect() protoreflect.Message { - mi := &file_rpc_v1_executor_proto_msgTypes[6] + mi := &file_rpc_v1_executor_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -427,7 +474,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{6} + return file_rpc_v1_executor_proto_rawDescGZIP(), []int{7} } func (x *GetStateRequest) GetKey() []byte { @@ -449,7 +496,7 @@ type GetStateResponse struct { func (x *GetStateResponse) Reset() { *x = GetStateResponse{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_v1_executor_proto_msgTypes[7] + mi := &file_rpc_v1_executor_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -462,7 +509,7 @@ func (x *GetStateResponse) String() string { func (*GetStateResponse) ProtoMessage() {} func (x *GetStateResponse) ProtoReflect() protoreflect.Message { - mi := &file_rpc_v1_executor_proto_msgTypes[7] + mi := &file_rpc_v1_executor_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -475,7 +522,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{7} + return file_rpc_v1_executor_proto_rawDescGZIP(), []int{8} } func (x *GetStateResponse) GetKey() []byte { @@ -504,7 +551,7 @@ type Result struct { func (x *Result) Reset() { *x = Result{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_v1_executor_proto_msgTypes[8] + mi := &file_rpc_v1_executor_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -517,7 +564,7 @@ func (x *Result) String() string { func (*Result) ProtoMessage() {} func (x *Result) ProtoReflect() protoreflect.Message { - mi := &file_rpc_v1_executor_proto_msgTypes[8] + mi := &file_rpc_v1_executor_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -530,7 +577,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{8} + return file_rpc_v1_executor_proto_rawDescGZIP(), []int{9} } func (x *Result) GetSuccess() bool { @@ -547,6 +594,53 @@ func (x *Result) GetError() string { return "" } +type PluginInventory struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Modules []*ModuleReference `protobuf:"bytes,1,rep,name=modules,proto3" json:"modules,omitempty"` +} + +func (x *PluginInventory) Reset() { + *x = PluginInventory{} + if protoimpl.UnsafeEnabled { + mi := &file_rpc_v1_executor_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PluginInventory) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PluginInventory) ProtoMessage() {} + +func (x *PluginInventory) ProtoReflect() protoreflect.Message { + mi := &file_rpc_v1_executor_proto_msgTypes[10] + 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 PluginInventory.ProtoReflect.Descriptor instead. +func (*PluginInventory) Descriptor() ([]byte, []int) { + return file_rpc_v1_executor_proto_rawDescGZIP(), []int{10} +} + +func (x *PluginInventory) GetModules() []*ModuleReference { + if x != nil { + return x.Modules + } + return nil +} + type Buildr_Repo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -558,7 +652,7 @@ type Buildr_Repo struct { func (x *Buildr_Repo) Reset() { *x = Buildr_Repo{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_v1_executor_proto_msgTypes[9] + mi := &file_rpc_v1_executor_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -571,7 +665,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[9] + mi := &file_rpc_v1_executor_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -605,7 +699,7 @@ type Buildr_GitHub struct { func (x *Buildr_GitHub) Reset() { *x = Buildr_GitHub{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_v1_executor_proto_msgTypes[10] + mi := &file_rpc_v1_executor_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -618,7 +712,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[10] + mi := &file_rpc_v1_executor_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -653,7 +747,7 @@ type TaskLog_LogAttribute struct { func (x *TaskLog_LogAttribute) Reset() { *x = TaskLog_LogAttribute{} if protoimpl.UnsafeEnabled { - mi := &file_rpc_v1_executor_proto_msgTypes[11] + mi := &file_rpc_v1_executor_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -666,7 +760,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[11] + mi := &file_rpc_v1_executor_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -679,7 +773,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{4, 0} + return file_rpc_v1_executor_proto_rawDescGZIP(), []int{5, 0} } func (x *TaskLog_LogAttribute) GetKey() string { @@ -712,21 +806,24 @@ var file_rpc_v1_executor_proto_rawDesc = []byte{ 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 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, 0x95, 0x01, 0x0a, 0x0f, 0x4d, - 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x17, - 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, - 0x65, 0x5f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 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, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x4e, 0x61, - 0x6d, 0x65, 0x22, 0x9a, 0x01, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x61, 0x73, 0x6b, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x09, 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, 0x09, 0x72, 0x65, 0x66, 0x65, + 0x52, 0x08, 0x61, 0x70, 0x69, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x5b, 0x0a, 0x0f, 0x4d, 0x6f, + 0x64, 0x75, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x27, 0x0a, + 0x0f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 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, 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, @@ -763,19 +860,24 @@ var file_rpc_v1_executor_proto_rawDesc = []byte{ 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, 0x42, 0xb6, 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, 0x3c, 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, 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, + 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, 0xb6, 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, 0x3c, + 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, 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 ( @@ -790,32 +892,36 @@ 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, 12) +var file_rpc_v1_executor_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_rpc_v1_executor_proto_goTypes = []interface{}{ (*Buildr)(nil), // 0: buildr.rpc.v1.Buildr (*ModuleReference)(nil), // 1: buildr.rpc.v1.ModuleReference - (*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 - (*Buildr_Repo)(nil), // 9: buildr.rpc.v1.Buildr.Repo - (*Buildr_GitHub)(nil), // 10: buildr.rpc.v1.Buildr.GitHub - (*TaskLog_LogAttribute)(nil), // 11: buildr.rpc.v1.TaskLog.LogAttribute + (*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 } var file_rpc_v1_executor_proto_depIdxs = []int32{ - 9, // 0: buildr.rpc.v1.Buildr.repo:type_name -> buildr.rpc.v1.Buildr.Repo - 10, // 1: buildr.rpc.v1.Buildr.github:type_name -> buildr.rpc.v1.Buildr.GitHub - 1, // 2: buildr.rpc.v1.StartTaskRequest.reference:type_name -> buildr.rpc.v1.ModuleReference - 0, // 3: buildr.rpc.v1.StartTaskRequest.buildr:type_name -> buildr.rpc.v1.Buildr - 11, // 4: buildr.rpc.v1.TaskLog.attributes:type_name -> buildr.rpc.v1.TaskLog.LogAttribute - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 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 + 1, // 2: buildr.rpc.v1.TaskReference.module:type_name -> buildr.rpc.v1.ModuleReference + 2, // 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 + 13, // 5: buildr.rpc.v1.TaskLog.attributes:type_name -> buildr.rpc.v1.TaskLog.LogAttribute + 1, // 6: buildr.rpc.v1.PluginInventory.modules:type_name -> buildr.rpc.v1.ModuleReference + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_rpc_v1_executor_proto_init() } @@ -849,7 +955,7 @@ func file_rpc_v1_executor_proto_init() { } } file_rpc_v1_executor_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StartTaskRequest); i { + switch v := v.(*TaskReference); i { case 0: return &v.state case 1: @@ -861,7 +967,7 @@ func file_rpc_v1_executor_proto_init() { } } file_rpc_v1_executor_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TaskResult); i { + switch v := v.(*StartTaskRequest); i { case 0: return &v.state case 1: @@ -873,7 +979,7 @@ func file_rpc_v1_executor_proto_init() { } } file_rpc_v1_executor_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TaskLog); i { + switch v := v.(*TaskResult); i { case 0: return &v.state case 1: @@ -885,7 +991,7 @@ func file_rpc_v1_executor_proto_init() { } } file_rpc_v1_executor_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SetState); i { + switch v := v.(*TaskLog); i { case 0: return &v.state case 1: @@ -897,7 +1003,7 @@ func file_rpc_v1_executor_proto_init() { } } file_rpc_v1_executor_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetStateRequest); i { + switch v := v.(*SetState); i { case 0: return &v.state case 1: @@ -909,7 +1015,7 @@ func file_rpc_v1_executor_proto_init() { } } file_rpc_v1_executor_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetStateResponse); i { + switch v := v.(*GetStateRequest); i { case 0: return &v.state case 1: @@ -921,7 +1027,7 @@ func file_rpc_v1_executor_proto_init() { } } file_rpc_v1_executor_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Result); i { + switch v := v.(*GetStateResponse); i { case 0: return &v.state case 1: @@ -933,7 +1039,7 @@ func file_rpc_v1_executor_proto_init() { } } file_rpc_v1_executor_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Buildr_Repo); i { + switch v := v.(*Result); i { case 0: return &v.state case 1: @@ -945,7 +1051,7 @@ func file_rpc_v1_executor_proto_init() { } } file_rpc_v1_executor_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Buildr_GitHub); i { + switch v := v.(*PluginInventory); i { case 0: return &v.state case 1: @@ -957,6 +1063,30 @@ func file_rpc_v1_executor_proto_init() { } } file_rpc_v1_executor_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Buildr_Repo); 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[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Buildr_GitHub); 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[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TaskLog_LogAttribute); i { case 0: return &v.state @@ -975,7 +1105,7 @@ func file_rpc_v1_executor_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_rpc_v1_executor_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 14, NumExtensions: 0, NumServices: 0, }, diff --git a/protocol/generated/rpc/v1/executor_vtproto.pb.go b/protocol/generated/rpc/v1/executor_vtproto.pb.go index d2ff18b..6d62793 100644 --- a/protocol/generated/rpc/v1/executor_vtproto.pb.go +++ b/protocol/generated/rpc/v1/executor_vtproto.pb.go @@ -181,31 +181,74 @@ func (m *ModuleReference) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if len(m.ModuleName) > 0 { - i -= len(m.ModuleName) - copy(dAtA[i:], m.ModuleName) - i = encodeVarint(dAtA, i, uint64(len(m.ModuleName))) - i-- - dAtA[i] = 0x22 - } 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] = 0x1a + dAtA[i] = 0x12 } if len(m.ModuleCategory) > 0 { i -= len(m.ModuleCategory) copy(dAtA[i:], m.ModuleCategory) i = encodeVarint(dAtA, i, uint64(len(m.ModuleCategory))) i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TaskReference) 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 *TaskReference) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *TaskReference) 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.Module != nil { + size, err := m.Module.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + 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] = 0x12 } - if len(m.TaskId) > 0 { - i -= len(m.TaskId) - copy(dAtA[i:], m.TaskId) - i = encodeVarint(dAtA, i, uint64(len(m.TaskId))) + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarint(dAtA, i, uint64(len(m.Id))) i-- dAtA[i] = 0xa } @@ -612,6 +655,51 @@ func (m *Result) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PluginInventory) 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 *PluginInventory) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *PluginInventory) 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.Modules) > 0 { + for iNdEx := len(m.Modules) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Modules[iNdEx].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 encodeVarint(dAtA []byte, offset int, v uint64) int { offset -= sov(v) base := offset @@ -675,10 +763,6 @@ func (m *ModuleReference) SizeVT() (n int) { } var l int _ = l - l = len(m.TaskId) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } l = len(m.ModuleCategory) if l > 0 { n += 1 + l + sov(uint64(l)) @@ -687,10 +771,28 @@ func (m *ModuleReference) SizeVT() (n int) { if l > 0 { n += 1 + l + sov(uint64(l)) } - l = len(m.ModuleName) + n += len(m.unknownFields) + return n +} + +func (m *TaskReference) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) if l > 0 { n += 1 + l + sov(uint64(l)) } + l = len(m.Name) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.Module != nil { + l = m.Module.SizeVT() + n += 1 + l + sov(uint64(l)) + } n += len(m.unknownFields) return n } @@ -846,6 +948,22 @@ func (m *Result) SizeVT() (n int) { return n } +func (m *PluginInventory) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Modules) > 0 { + for _, e := range m.Modules { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + func sov(x uint64) (n int) { return (bits.Len64(x|1) + 6) / 7 } @@ -1171,38 +1289,6 @@ func (m *ModuleReference) UnmarshalVT(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TaskId", 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.TaskId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ModuleCategory", wireType) } @@ -1234,7 +1320,7 @@ func (m *ModuleReference) UnmarshalVT(dAtA []byte) error { } m.ModuleCategory = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ModuleType", wireType) } @@ -1266,9 +1352,60 @@ func (m *ModuleReference) UnmarshalVT(dAtA []byte) error { } m.ModuleType = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + 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 + 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: TaskReference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TaskReference: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ModuleName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1296,7 +1433,75 @@ func (m *ModuleReference) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ModuleName = string(dAtA[iNdEx:postIndex]) + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Module", 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.Module == nil { + m.Module = &ModuleReference{} + } + if err := m.Module.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -1379,7 +1584,7 @@ func (m *StartTaskRequest) UnmarshalVT(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Reference == nil { - m.Reference = &ModuleReference{} + m.Reference = &TaskReference{} } if err := m.Reference.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2288,6 +2493,91 @@ func (m *Result) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *PluginInventory) 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: PluginInventory: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PluginInventory: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Modules", 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.Modules = append(m.Modules, &ModuleReference{}) + if err := m.Modules[len(m.Modules)-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 +} func skip(dAtA []byte) (n int, err error) { l := len(dAtA) diff --git a/registry.go b/registry.go index f9bb151..0821a6c 100644 --- a/registry.go +++ b/registry.go @@ -2,9 +2,15 @@ package sdk import ( "fmt" + "strings" "sync" ) +type Reference struct { + Category Category + Type string +} + type Registration interface { RegisterAt(registry *TypeRegistry) } @@ -26,6 +32,24 @@ type TypeRegistry struct { registrations map[string]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], + }) + } + + return refs +} + func (r *TypeRegistry) Add(cat Category, moduleName string, factory Factory) { r.lock.Lock() defer r.lock.Unlock()