From 8e152f7ff91bc77c7bc9b0d6c2373ec49313258b Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Fri, 6 Dec 2024 15:31:18 +0100 Subject: [PATCH] feature: move all deps to github Signed-off-by: Valery Piashchynski --- .golangci.yml | 1 - api/events.go | 1 + api/module.go | 2 +- cmd/main.go | 11 ++--- component/component.go | 1 + component/eventbus/events_test.go | 3 +- component/eventbus/subscriber.go | 3 +- component/hub.go | 1 + component/hub_test.go | 3 +- component/maps.go | 3 +- config/json/loader.go | 3 +- go.mod | 32 +++++++------- go.sum | 42 +++++++++++++++---- runtime/lua/engine/engine.go | 5 ++- runtime/lua/engine/helpers.go | 2 +- runtime/lua/luapool/pool.go | 16 +++---- runtime/lua/luapool/pool_test.go | 6 +-- runtime/lua/luapool/vm/vm.go | 14 +++---- runtime/lua/modules/base64/base64.go | 2 +- runtime/lua/modules/datacore/branch.go | 4 +- runtime/lua/modules/datacore/data.go | 4 +- runtime/lua/modules/datacore/datacore_test.go | 2 +- runtime/lua/modules/datacore/loader.go | 2 +- runtime/lua/modules/datacore/module.go | 4 +- runtime/lua/modules/datacore/node.go | 6 +-- runtime/lua/modules/datacore/project.go | 4 +- runtime/lua/modules/env/env.go | 6 +-- runtime/lua/modules/env/loader.go | 2 +- runtime/lua/modules/http/http.go | 2 +- runtime/lua/modules/http/response.go | 2 +- runtime/lua/modules/json/json.go | 2 +- runtime/lua/modules/sql/db.go | 2 +- runtime/lua/modules/sql/execute.go | 2 +- runtime/lua/modules/sql/loader.go | 2 +- runtime/lua/modules/sql/module.go | 2 +- runtime/lua/modules/sql/prepare.go | 2 +- runtime/lua/modules/sql/query.go | 2 +- runtime/lua/modules/sql/sql_test.go | 2 +- runtime/lua/modules/sql/transaction.go | 2 +- runtime/lua/modules/treesitter/loader.go | 2 +- runtime/lua/modules/treesitter/module.go | 2 +- runtime/runtime_hub.go | 5 ++- server/http/server.go | 3 +- 43 files changed, 129 insertions(+), 90 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 5552d124c..856c4db9c 100755 --- a/.golangci.yml +++ b/.golangci.yml @@ -38,7 +38,6 @@ linters: # All available linters list: script // module - scriptID -> []Modules ? -func NewLuaPool(log *zap.Logger, scripts map[string]*PoolCfg, options ...Options) (*Pool, error) { +func NewLuaPool(log *zap.Logger, scripts map[string]*Config, options ...Options) (*Pool, error) { lp := &Pool{} // apply options @@ -63,10 +63,10 @@ func NewLuaPool(log *zap.Logger, scripts map[string]*PoolCfg, options ...Options } // AFTER INITIALIZATION THIS MAP IS READ-ONLY - vms := make(map[string]chan *vm.Vm) + vms := make(map[string]chan *vm.VM) for scriptID, cfg := range scripts { log.Debug("creating vms pool", zap.String("scriptID", scriptID), zap.Int("number of VMs to create", cfg.numVMs)) - ch := make(chan *vm.Vm, cfg.numVMs) + ch := make(chan *vm.VM, cfg.numVMs) for i := 0; i < cfg.numVMs; i++ { log.Debug("creating vm", zap.String("scriptID", scriptID), zap.String("script", cfg.script), zap.String("main", cfg.mainFnName)) vm, err := vm.New(log, cfg.script, cfg.mainFnName, lp.modules...) @@ -110,7 +110,7 @@ func (w *Pool) Queue(task *Task) <-chan string { } // here is the actual work happens -func (w *Pool) do(v *vm.Vm, task *Task) error { +func (w *Pool) do(v *vm.VM, task *Task) error { if task == nil { w.logger.Error("task is nil") return nil diff --git a/runtime/lua/luapool/pool_test.go b/runtime/lua/luapool/pool_test.go index 846099da0..262e2325f 100644 --- a/runtime/lua/luapool/pool_test.go +++ b/runtime/lua/luapool/pool_test.go @@ -80,7 +80,7 @@ func TestPool(t *testing.T) { ` scriptId := "foo" - scripts := make(map[string]*PoolCfg) + scripts := make(map[string]*Config) scripts[scriptId] = NewPoolCfg(2, script, "hello") p, err := NewLuaPool(l, scripts, WithModules(base64M.New()), WithPollTimeout(time.Second*2)) require.NoError(t, err) @@ -106,7 +106,7 @@ func TestPoolConcurrent(t *testing.T) { ` scriptId := "foo" - scripts := make(map[string]*PoolCfg) + scripts := make(map[string]*Config) scripts[scriptId] = NewPoolCfg(10, script, "hello") p, err := NewLuaPool(l, scripts, WithModules(base64M.New()), WithPollTimeout(time.Second*10)) @@ -146,7 +146,7 @@ func BenchmarkPool(b *testing.B) { ` scriptId := "foo" - scripts := make(map[string]*PoolCfg) + scripts := make(map[string]*Config) scripts[scriptId] = NewPoolCfg(10, script, "hello") p, err := NewLuaPool(l, scripts, WithModules(base64M.New()), WithPollTimeout(time.Second*2)) require.NoError(b, err) diff --git a/runtime/lua/luapool/vm/vm.go b/runtime/lua/luapool/vm/vm.go index acc446dd9..c4a4f7c5e 100644 --- a/runtime/lua/luapool/vm/vm.go +++ b/runtime/lua/luapool/vm/vm.go @@ -4,21 +4,21 @@ import ( "context" "strings" - "git.spiralscout.com/estimation-engine/go-lua" - "git.spiralscout.com/estimation-engine/go-lua/parse" + "github.com/ponyruntime/go-lua" + "github.com/ponyruntime/go-lua/parse" "github.com/ponyruntime/pony/api" "github.com/ponyruntime/pony/runtime/lua/engine" "go.uber.org/zap" ) -type Vm struct { +type VM struct { log *zap.Logger state *lua.LState fn lua.LValue } // TODO options with modules -func New(log *zap.Logger, script, main string, modules ...api.Module) (*Vm, error) { +func New(log *zap.Logger, script, main string, modules ...api.Module) (*VM, error) { state := lua.NewState(lua.Options{}) for _, module := range modules { @@ -39,7 +39,7 @@ func New(log *zap.Logger, script, main string, modules ...api.Module) (*Vm, erro } // ----------------------------- END parse and compile - // intialize the function + // initialize the function fn := state.NewFunctionFromProto(fnProto) state.Push(fn) @@ -52,14 +52,14 @@ func New(log *zap.Logger, script, main string, modules ...api.Module) (*Vm, erro // precompile modules // save moduleName -> functions names - return &Vm{ + return &VM{ log: log, state: state, fn: state.GetGlobal(main), }, nil } -func (v *Vm) Execute(ctx context.Context, args any) (string, error) { +func (v *VM) Execute(ctx context.Context, args any) (string, error) { v.log.Debug("executing on VM", zap.Any("args", args)) v.state.SetContext(ctx) v.state.Push(v.fn) diff --git a/runtime/lua/modules/base64/base64.go b/runtime/lua/modules/base64/base64.go index aeaae556a..839acb5d7 100644 --- a/runtime/lua/modules/base64/base64.go +++ b/runtime/lua/modules/base64/base64.go @@ -3,7 +3,7 @@ package base64 import ( "encoding/base64" - lua "git.spiralscout.com/estimation-engine/go-lua" + lua "github.com/ponyruntime/go-lua" ) type Module struct{} diff --git a/runtime/lua/modules/datacore/branch.go b/runtime/lua/modules/datacore/branch.go index 7eef9d355..277f2e921 100644 --- a/runtime/lua/modules/datacore/branch.go +++ b/runtime/lua/modules/datacore/branch.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - branchReq "git.spiralscout.com/estimation-engine/api/gen/go/core/request/branch/v1" - "git.spiralscout.com/estimation-engine/go-lua" + branchReq "github.com/ponyruntime/api/gen/go/core/request/branch/v1" + "github.com/ponyruntime/go-lua" "github.com/ponyruntime/pony/runtime/lua/engine" "go.uber.org/zap" "google.golang.org/grpc/metadata" diff --git a/runtime/lua/modules/datacore/data.go b/runtime/lua/modules/datacore/data.go index f9d98a973..dfc598321 100644 --- a/runtime/lua/modules/datacore/data.go +++ b/runtime/lua/modules/datacore/data.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - dataReq "git.spiralscout.com/estimation-engine/api/gen/go/core/request/data/v1" - "git.spiralscout.com/estimation-engine/go-lua" + dataReq "github.com/ponyruntime/api/gen/go/core/request/data/v1" + "github.com/ponyruntime/go-lua" "github.com/ponyruntime/pony/runtime/lua/engine" "go.uber.org/zap" "google.golang.org/grpc/metadata" diff --git a/runtime/lua/modules/datacore/datacore_test.go b/runtime/lua/modules/datacore/datacore_test.go index 5c4559833..6c74033aa 100644 --- a/runtime/lua/modules/datacore/datacore_test.go +++ b/runtime/lua/modules/datacore/datacore_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "git.spiralscout.com/estimation-engine/go-lua" + "github.com/ponyruntime/go-lua" "github.com/ponyruntime/pony/runtime/lua/engine" "github.com/stretchr/testify/assert" "go.uber.org/zap" diff --git a/runtime/lua/modules/datacore/loader.go b/runtime/lua/modules/datacore/loader.go index e84b7fbe4..199b9efa8 100644 --- a/runtime/lua/modules/datacore/loader.go +++ b/runtime/lua/modules/datacore/loader.go @@ -1,6 +1,6 @@ package datacore -import "git.spiralscout.com/estimation-engine/go-lua" +import "github.com/ponyruntime/go-lua" func (m *Module) Loader(l *lua.LState) int { t := l.NewTable() diff --git a/runtime/lua/modules/datacore/module.go b/runtime/lua/modules/datacore/module.go index 1db3e84e5..ec29343b3 100644 --- a/runtime/lua/modules/datacore/module.go +++ b/runtime/lua/modules/datacore/module.go @@ -3,8 +3,8 @@ package datacore import ( "fmt" - datacoreV1 "git.spiralscout.com/estimation-engine/api/gen/go/core/service/read/v1" - "git.spiralscout.com/estimation-engine/go-lua" + datacoreV1 "github.com/ponyruntime/api/gen/go/core/service/read/v1" + "github.com/ponyruntime/go-lua" "go.uber.org/zap" "google.golang.org/grpc" ) diff --git a/runtime/lua/modules/datacore/node.go b/runtime/lua/modules/datacore/node.go index f8da70559..110c198c7 100644 --- a/runtime/lua/modules/datacore/node.go +++ b/runtime/lua/modules/datacore/node.go @@ -4,9 +4,9 @@ import ( "context" "fmt" - nodeReq "git.spiralscout.com/estimation-engine/api/gen/go/core/request/node/v1" - nodeV1 "git.spiralscout.com/estimation-engine/api/gen/go/core/response/node/v1" - "git.spiralscout.com/estimation-engine/go-lua" + nodeReq "github.com/ponyruntime/api/gen/go/core/request/node/v1" + nodeV1 "github.com/ponyruntime/api/gen/go/core/response/node/v1" + "github.com/ponyruntime/go-lua" "github.com/ponyruntime/pony/runtime/lua/engine" "go.uber.org/zap" "google.golang.org/grpc/metadata" diff --git a/runtime/lua/modules/datacore/project.go b/runtime/lua/modules/datacore/project.go index fe0ba2481..1428e1729 100644 --- a/runtime/lua/modules/datacore/project.go +++ b/runtime/lua/modules/datacore/project.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - projectReq "git.spiralscout.com/estimation-engine/api/gen/go/core/request/project/v1" - "git.spiralscout.com/estimation-engine/go-lua" + projectReq "github.com/ponyruntime/api/gen/go/core/request/project/v1" + "github.com/ponyruntime/go-lua" "github.com/ponyruntime/pony/runtime/lua/engine" "go.uber.org/zap" "google.golang.org/grpc/metadata" diff --git a/runtime/lua/modules/env/env.go b/runtime/lua/modules/env/env.go index 76ca28625..b4c2032f0 100644 --- a/runtime/lua/modules/env/env.go +++ b/runtime/lua/modules/env/env.go @@ -3,9 +3,9 @@ package env import ( "context" - vaultReqV1 "git.spiralscout.com/estimation-engine/api/gen/go/vault/values/request/v1" - vaultServiceV1 "git.spiralscout.com/estimation-engine/api/gen/go/vault/values/service/v1" - "git.spiralscout.com/estimation-engine/go-lua" + vaultReqV1 "github.com/ponyruntime/api/gen/go/vault/values/request/v1" + vaultServiceV1 "github.com/ponyruntime/api/gen/go/vault/values/service/v1" + "github.com/ponyruntime/go-lua" "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/metadata" diff --git a/runtime/lua/modules/env/loader.go b/runtime/lua/modules/env/loader.go index efb64a52e..0cca7829e 100644 --- a/runtime/lua/modules/env/loader.go +++ b/runtime/lua/modules/env/loader.go @@ -1,7 +1,7 @@ package env import ( - "git.spiralscout.com/estimation-engine/go-lua" + "github.com/ponyruntime/go-lua" ) // Loader is the module loader function. diff --git a/runtime/lua/modules/http/http.go b/runtime/lua/modules/http/http.go index 196370cae..62f118319 100644 --- a/runtime/lua/modules/http/http.go +++ b/runtime/lua/modules/http/http.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "git.spiralscout.com/estimation-engine/go-lua" + "github.com/ponyruntime/go-lua" "go.uber.org/zap" ) diff --git a/runtime/lua/modules/http/response.go b/runtime/lua/modules/http/response.go index cc4d5fb72..4ad1004a9 100644 --- a/runtime/lua/modules/http/response.go +++ b/runtime/lua/modules/http/response.go @@ -3,7 +3,7 @@ package http import ( "net/http" - "git.spiralscout.com/estimation-engine/go-lua" + "github.com/ponyruntime/go-lua" ) const luaHTTPResponseTypeName = "http.response" diff --git a/runtime/lua/modules/json/json.go b/runtime/lua/modules/json/json.go index 392488a29..17ab58367 100644 --- a/runtime/lua/modules/json/json.go +++ b/runtime/lua/modules/json/json.go @@ -4,7 +4,7 @@ import ( "encoding/json" "errors" - "git.spiralscout.com/estimation-engine/go-lua" + "github.com/ponyruntime/go-lua" ) // Loader is the module loader function. diff --git a/runtime/lua/modules/sql/db.go b/runtime/lua/modules/sql/db.go index f8e74ffcf..6f0e8bd3f 100644 --- a/runtime/lua/modules/sql/db.go +++ b/runtime/lua/modules/sql/db.go @@ -5,7 +5,7 @@ import ( "go.uber.org/zap" - "git.spiralscout.com/estimation-engine/go-lua" + "github.com/ponyruntime/go-lua" // SQLite3 driver _ "github.com/mattn/go-sqlite3" ) diff --git a/runtime/lua/modules/sql/execute.go b/runtime/lua/modules/sql/execute.go index b9e8746ae..afef3ebde 100644 --- a/runtime/lua/modules/sql/execute.go +++ b/runtime/lua/modules/sql/execute.go @@ -5,7 +5,7 @@ import ( "database/sql" "time" - "git.spiralscout.com/estimation-engine/go-lua" + "github.com/ponyruntime/go-lua" "github.com/ponyruntime/pony/runtime/lua/engine" "go.uber.org/zap" ) diff --git a/runtime/lua/modules/sql/loader.go b/runtime/lua/modules/sql/loader.go index 279e2da2e..b89af25d9 100644 --- a/runtime/lua/modules/sql/loader.go +++ b/runtime/lua/modules/sql/loader.go @@ -1,6 +1,6 @@ package sql -import "git.spiralscout.com/estimation-engine/go-lua" +import "github.com/ponyruntime/go-lua" func (m *Module) Loader(l *lua.LState) int { // Create the SQL module table diff --git a/runtime/lua/modules/sql/module.go b/runtime/lua/modules/sql/module.go index bb39698b5..04fff618f 100644 --- a/runtime/lua/modules/sql/module.go +++ b/runtime/lua/modules/sql/module.go @@ -1,7 +1,7 @@ package sql import ( - "git.spiralscout.com/estimation-engine/go-lua" + "github.com/ponyruntime/go-lua" // PQ Driver _ "github.com/lib/pq" diff --git a/runtime/lua/modules/sql/prepare.go b/runtime/lua/modules/sql/prepare.go index 9d4b27213..a2718c52e 100644 --- a/runtime/lua/modules/sql/prepare.go +++ b/runtime/lua/modules/sql/prepare.go @@ -5,8 +5,8 @@ import ( "database/sql" "time" - "git.spiralscout.com/estimation-engine/go-lua" "github.com/google/uuid" + "github.com/ponyruntime/go-lua" "github.com/ponyruntime/pony/runtime/lua/engine" "go.uber.org/zap" ) diff --git a/runtime/lua/modules/sql/query.go b/runtime/lua/modules/sql/query.go index ce791c765..52d91574d 100644 --- a/runtime/lua/modules/sql/query.go +++ b/runtime/lua/modules/sql/query.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - "git.spiralscout.com/estimation-engine/go-lua" + "github.com/ponyruntime/go-lua" "github.com/ponyruntime/pony/runtime/lua/engine" "go.uber.org/zap" ) diff --git a/runtime/lua/modules/sql/sql_test.go b/runtime/lua/modules/sql/sql_test.go index a8a3b5501..ee617e415 100644 --- a/runtime/lua/modules/sql/sql_test.go +++ b/runtime/lua/modules/sql/sql_test.go @@ -7,7 +7,7 @@ import ( "os" "testing" - "git.spiralscout.com/estimation-engine/go-lua" + "github.com/ponyruntime/go-lua" lengine "github.com/ponyruntime/pony/runtime/lua/engine" "go.uber.org/zap" diff --git a/runtime/lua/modules/sql/transaction.go b/runtime/lua/modules/sql/transaction.go index 89978e792..5eae7629a 100644 --- a/runtime/lua/modules/sql/transaction.go +++ b/runtime/lua/modules/sql/transaction.go @@ -4,7 +4,7 @@ import ( "context" "database/sql" - "git.spiralscout.com/estimation-engine/go-lua" + "github.com/ponyruntime/go-lua" "go.uber.org/zap" ) diff --git a/runtime/lua/modules/treesitter/loader.go b/runtime/lua/modules/treesitter/loader.go index 0f1239026..22e69a96f 100644 --- a/runtime/lua/modules/treesitter/loader.go +++ b/runtime/lua/modules/treesitter/loader.go @@ -1,7 +1,7 @@ package treesitter import ( - "git.spiralscout.com/estimation-engine/go-lua" + "github.com/ponyruntime/go-lua" ) // Loader is the module loader function. diff --git a/runtime/lua/modules/treesitter/module.go b/runtime/lua/modules/treesitter/module.go index d501d7451..78cd35815 100644 --- a/runtime/lua/modules/treesitter/module.go +++ b/runtime/lua/modules/treesitter/module.go @@ -5,7 +5,7 @@ import ( "fmt" "unsafe" - "git.spiralscout.com/estimation-engine/go-lua" + "github.com/ponyruntime/go-lua" treesitter "github.com/tree-sitter/go-tree-sitter" treesittercsharp "github.com/tree-sitter/tree-sitter-c-sharp/bindings/go" treesittergo "github.com/tree-sitter/tree-sitter-go/bindings/go" diff --git a/runtime/runtime_hub.go b/runtime/runtime_hub.go index 206b9d8ee..4d346e0c8 100644 --- a/runtime/runtime_hub.go +++ b/runtime/runtime_hub.go @@ -7,7 +7,9 @@ import ( "encoding/base64" "encoding/json" "fmt" - "git.spiralscout.com/estimation-engine/go-lua" + "net/http" + + "github.com/ponyruntime/go-lua" "github.com/ponyruntime/pony/api" eventsbus2 "github.com/ponyruntime/pony/component/eventbus" "github.com/ponyruntime/pony/exec" @@ -15,7 +17,6 @@ import ( httpM "github.com/ponyruntime/pony/runtime/lua/modules/http" jsonM "github.com/ponyruntime/pony/runtime/lua/modules/json" "go.uber.org/zap" - "net/http" ) // app is an internal representation of the application diff --git a/server/http/server.go b/server/http/server.go index 4dda8e40c..7a86663ca 100644 --- a/server/http/server.go +++ b/server/http/server.go @@ -2,10 +2,11 @@ package http import ( "context" - "github.com/ponyruntime/pony/component" "log" "net/http" + "github.com/ponyruntime/pony/component" + "github.com/ponyruntime/pony/api" "github.com/ponyruntime/pony/exec" "go.uber.org/zap"