Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ linters: # All available linters list: <https://golangci-lint.run/usage/linters/
- copyloopvar # checks for pointers to enclosing loop variables
- gochecknoglobals # Checks that no globals are present in Go code
- gochecknoinits # Checks that no init functions are present in Go code
- gocognit # Computes and checks the cognitive complexity of functions
- goconst # Finds repeated strings that could be replaced by a constant
- gocritic # The most opinionated Go source code linter
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
Expand Down
1 change: 1 addition & 0 deletions api/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"context"

"github.com/ponyruntime/pony/api/payload"
)

Expand Down
2 changes: 1 addition & 1 deletion api/module.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package api

import "git.spiralscout.com/estimation-engine/go-lua"
import "github.com/ponyruntime/go-lua"

type Module interface {
Loader(*lua.LState) int
Expand Down
11 changes: 6 additions & 5 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ package main
import (
"context"
"fmt"
pctx "github.com/ponyruntime/pony/api/context"
"github.com/ponyruntime/pony/component"
"github.com/ponyruntime/pony/config/json"
"github.com/ponyruntime/pony/server/http"
"go.uber.org/zap/zapcore"
"log"
"os"
"os/signal"
"path/filepath"
"syscall"
"time"

pctx "github.com/ponyruntime/pony/api/context"
"github.com/ponyruntime/pony/component"
"github.com/ponyruntime/pony/config/json"
"github.com/ponyruntime/pony/server/http"
"go.uber.org/zap/zapcore"

"github.com/ponyruntime/pony/exec"
"github.com/urfave/cli/v2"
"go.uber.org/zap"
Expand Down
1 change: 1 addition & 0 deletions component/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package component

import (
"context"

"github.com/ponyruntime/pony/api"
"github.com/ponyruntime/pony/exec"
)
Expand Down
3 changes: 2 additions & 1 deletion component/eventbus/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package eventsbus

import (
"context"
"github.com/ponyruntime/pony/api/payload"
"testing"

"github.com/ponyruntime/pony/api/payload"

"github.com/ponyruntime/pony/api"
"github.com/stretchr/testify/require"
)
Expand Down
3 changes: 2 additions & 1 deletion component/eventbus/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package eventsbus

import (
"context"
"github.com/ponyruntime/pony/api"
"log"
"time"

"github.com/ponyruntime/pony/api"
)

type Subscriber struct {
Expand Down
1 change: 1 addition & 0 deletions component/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package component

import (
"context"

"github.com/ponyruntime/pony/api"
"github.com/ponyruntime/pony/api/payload"
ebs "github.com/ponyruntime/pony/component/eventbus"
Expand Down
3 changes: 2 additions & 1 deletion component/hub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package component
import (
"context"
"fmt"
"testing"

"github.com/ponyruntime/pony/api"
"github.com/ponyruntime/pony/api/payload"
ebs "github.com/ponyruntime/pony/component/eventbus"
Expand All @@ -11,7 +13,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"go.uber.org/zap"
"testing"
)

// mockComponent is a mock implementation of component.Component
Expand Down
3 changes: 2 additions & 1 deletion component/maps.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package component

import (
"context"
"sync"

"github.com/ponyruntime/pony/api"
"github.com/ponyruntime/pony/exec"
"sync"
)

type cmap map[api.Component]Component
Expand Down
3 changes: 2 additions & 1 deletion config/json/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package json

import (
"encoding/json"
"os"

"github.com/ponyruntime/pony/api"
"github.com/ponyruntime/pony/api/payload"
"os"
)

type Event struct {
Expand Down
32 changes: 16 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ module github.com/ponyruntime/pony
go 1.23.2

require (
git.spiralscout.com/estimation-engine/api v1.9.2
git.spiralscout.com/estimation-engine/go-lua v1.2.0
github.com/google/uuid v1.6.0
github.com/lib/pq v1.10.9
github.com/mattn/go-sqlite3 v1.14.24
github.com/stretchr/testify v1.9.0
github.com/ponyruntime/api v1.9.1
github.com/ponyruntime/go-lua v1.2.0
github.com/stretchr/testify v1.10.0
github.com/tree-sitter/go-tree-sitter v0.24.0
github.com/tree-sitter/tree-sitter-c-sharp v0.23.1-0.20240901191145-fd7f7402db6e
github.com/tree-sitter/tree-sitter-go v0.23.1
github.com/tree-sitter/tree-sitter-html v0.23.0
github.com/tree-sitter/tree-sitter-javascript v0.23.0
github.com/tree-sitter/tree-sitter-php v0.23.5
github.com/tree-sitter/tree-sitter-python v0.23.2
github.com/tree-sitter/tree-sitter-typescript v0.23.0
github.com/tree-sitter/tree-sitter-c-sharp v0.23.1
github.com/tree-sitter/tree-sitter-go v0.23.4
github.com/tree-sitter/tree-sitter-html v0.23.2
github.com/tree-sitter/tree-sitter-javascript v0.23.1
github.com/tree-sitter/tree-sitter-php v0.23.11
github.com/tree-sitter/tree-sitter-python v0.23.5
github.com/tree-sitter/tree-sitter-typescript v0.23.2
github.com/urfave/cli/v2 v2.27.5
go.uber.org/zap v1.27.0
google.golang.org/grpc v1.67.1
google.golang.org/grpc v1.68.1
)

require (
Expand All @@ -31,10 +31,10 @@ require (
github.com/stretchr/objx v0.5.2 // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/text v0.19.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
google.golang.org/protobuf v1.35.1 // indirect
golang.org/x/net v0.32.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241206012308-a4fef0638583 // indirect
google.golang.org/protobuf v1.35.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
42 changes: 34 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
git.spiralscout.com/estimation-engine/api v1.9.2 h1:ppXZMezdkaK1F8xvbKPLFGU+20YGATfakTzRfN6ub+0=
git.spiralscout.com/estimation-engine/api v1.9.2/go.mod h1:0PSn5Dl/UczDlpiHUOktg6lRDAxtv02Ypw0GqjvTqQs=
git.spiralscout.com/estimation-engine/go-lua v1.2.0 h1:bcVA1y7F2HcgQ90bs+ZpThBVO8Q0jwIcZofF9UYO76I=
git.spiralscout.com/estimation-engine/go-lua v1.2.0/go.mod h1:UoL42ZCN1N2QB11kkcanFYP4O0a3n5xB3gQBbYSvLCw=
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand All @@ -18,44 +14,62 @@ github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBW
github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
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/ponyruntime/api v1.9.1 h1:2eIi0VTHlmeguXiURUnToPmDRGbgpxg20PlFntF3f1Y=
github.com/ponyruntime/api v1.9.1/go.mod h1:JsV7aK1VWMLOwWgEpLsAQ0iY+OATyFw61OkTfx9p+cc=
github.com/ponyruntime/go-lua v1.2.0 h1:MYf5Ds5MGhqDfyYnHPTSRF2B7MK8TPFmQFtyxnRvHHk=
github.com/ponyruntime/go-lua v1.2.0/go.mod h1:MACtdm8bgMnTf8fdsbl5r+z2FJ3mA0A1mFQaVnQZ0xQ=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/smacker/go-tree-sitter v0.0.0-20230720070738-0d0a9f78d8f8 h1:DxgjlvWYsb80WEN2Zv3WqJFAg2DKjUQJO6URGdf1x6Y=
github.com/smacker/go-tree-sitter v0.0.0-20230720070738-0d0a9f78d8f8/go.mod h1:q99oHDsbP0xRwmn7Vmob8gbSMNyvJ83OauXPSuHQuKE=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tree-sitter/go-tree-sitter v0.24.0 h1:kRZb6aBNfcI/u0Qh8XEt3zjNVnmxTisDBN+kXK0xRYQ=
github.com/tree-sitter/go-tree-sitter v0.24.0/go.mod h1:x681iFVoLMEwOSIHA1chaLkXlroXEN7WY+VHGFaoDbk=
github.com/tree-sitter/tree-sitter-c v0.21.5-0.20240818205408-927da1f210eb h1:A8425heRM8mylnv4H58FPUiH+aYivyitre0PzxrfmWs=
github.com/tree-sitter/tree-sitter-c v0.21.5-0.20240818205408-927da1f210eb/go.mod h1:dOF6gtQiF9UwNh995T5OphYmtIypkjsp3ap7r9AN/iA=
github.com/tree-sitter/tree-sitter-c-sharp v0.23.1-0.20240901191145-fd7f7402db6e h1:81nd9JyWcTma3nH14GLEXTfaaMbR9svOFpzFWjWblUw=
github.com/tree-sitter/tree-sitter-c-sharp v0.23.1-0.20240901191145-fd7f7402db6e/go.mod h1:ykYdYQ6HbKODfXUJx/v4WGgO01IrBh+7Qxqdk0Qd9H4=
github.com/tree-sitter/tree-sitter-c-sharp v0.23.1 h1:ddG6osP34sMieVNN6lu5ZG/3N8Wn+67+43BmipqidyM=
github.com/tree-sitter/tree-sitter-c-sharp v0.23.1/go.mod h1:H7/aFm5vR1A8Yn5VIOfLWPdlKuJsMgZ5eDmaJdv8bY0=
github.com/tree-sitter/tree-sitter-cpp v0.22.4-0.20240818224355-b1a4e2b25148 h1:AfFPZwtwGN01BW1jDdqBVqscTwetvMpydqYZz57RSlc=
github.com/tree-sitter/tree-sitter-cpp v0.22.4-0.20240818224355-b1a4e2b25148/go.mod h1:Bh6U3viD57rFXRYIQ+kmiYtr+1Bx0AceypDLJJSyi9s=
github.com/tree-sitter/tree-sitter-embedded-template v0.21.1-0.20240819044651-ffbf64942c33 h1:TwqSV3qLp3tKSqirGLRHnjFk9Tc2oy57LIl+FQ4GjI4=
github.com/tree-sitter/tree-sitter-embedded-template v0.21.1-0.20240819044651-ffbf64942c33/go.mod h1:CvCKCt3v04Ufos1zZnNCelBDeCGRpPucaN8QczoUsN4=
github.com/tree-sitter/tree-sitter-go v0.23.1 h1:EcHIrtBYmGHfWuswond3kVtDHWdNKs+L6TTtH7Umx7Q=
github.com/tree-sitter/tree-sitter-go v0.23.1/go.mod h1:kD9x9jckk/ER4F9tnlsJq7ftCPLI71BJAdDI6q9zeHM=
github.com/tree-sitter/tree-sitter-go v0.23.4 h1:yt5KMGnTHS+86pJmLIAZMWxukr8W7Ae1STPvQUuNROA=
github.com/tree-sitter/tree-sitter-go v0.23.4/go.mod h1:Jrx8QqYN0v7npv1fJRH1AznddllYiCMUChtVjxPK040=
github.com/tree-sitter/tree-sitter-html v0.23.0 h1:RmoByXiOn0+SB9oGGBEesSkRrIwUNyctNfWk3iTxSLE=
github.com/tree-sitter/tree-sitter-html v0.23.0/go.mod h1:mbvs/uUb9Oa4Q+enZU5zIZHqwmIk87CpcIMTOjFTebw=
github.com/tree-sitter/tree-sitter-html v0.23.2 h1:1UYDV+Yd05GGRhVnTcbP58GkKLSHHZwVaN+lBZV11Lc=
github.com/tree-sitter/tree-sitter-html v0.23.2/go.mod h1:gpUv/dG3Xl/eebqgeYeFMt+JLOY9cgFinb/Nw08a9og=
github.com/tree-sitter/tree-sitter-java v0.21.1-0.20240824015150-576d8097e495 h1:jrt4qbJVEFs4H93/ITxygHc6u0TGqAkkate7TQ4wFSA=
github.com/tree-sitter/tree-sitter-java v0.21.1-0.20240824015150-576d8097e495/go.mod h1:oyaR7fLnRV0hT9z6qwE9GkaeTom/hTDwK3H2idcOJFc=
github.com/tree-sitter/tree-sitter-javascript v0.23.0 h1:ZaCwxWjMg0byrhDjWboLosVbXqCaeTpQmZVotOvB0k8=
github.com/tree-sitter/tree-sitter-javascript v0.23.0/go.mod h1:SFJmRal3tB4GcacLVBNC2G3nWviiYz6VYMWnVpk3qRo=
github.com/tree-sitter/tree-sitter-javascript v0.23.1 h1:1fWupaRC0ArlHJ/QJzsfQ3Ibyopw7ZfQK4xXc40Zveo=
github.com/tree-sitter/tree-sitter-javascript v0.23.1/go.mod h1:lmGD1EJdCA+v0S1u2fFgepMg/opzSg/4pgFym2FPGAs=
github.com/tree-sitter/tree-sitter-json v0.21.1-0.20240818005659-bdd69eb8c8a5 h1:pfV3G3k7NCKqKk8THBmyuh2zA33lgYHS3GVrzRR8ry4=
github.com/tree-sitter/tree-sitter-json v0.21.1-0.20240818005659-bdd69eb8c8a5/go.mod h1:GbMKRjLfk0H+PI7nLi1Sx5lHf5wCpLz9al8tQYSxpEk=
github.com/tree-sitter/tree-sitter-php v0.23.5 h1:iQc0hwaSSEx0wgCPRJ4TabKjfIpMZ2/bEpPyZgvd8bE=
github.com/tree-sitter/tree-sitter-php v0.23.5/go.mod h1:HRaAoQwd169tXTZJJEwABdAHNMBnbE0APdNtGvd10Xg=
github.com/tree-sitter/tree-sitter-php v0.23.11 h1:iHewsLNDmznh8kgGyfWfujsZxIz1YGbSd2ZTEM0ZiP8=
github.com/tree-sitter/tree-sitter-php v0.23.11/go.mod h1:T/kbfi+UcCywQfUNAJnGTN/fMSUjnwPXA8k4yoIks74=
github.com/tree-sitter/tree-sitter-python v0.23.2 h1:M1gNdtgs/vMc8IcY8M8utk9mfUdHK3Q97AHIwzN1Wow=
github.com/tree-sitter/tree-sitter-python v0.23.2/go.mod h1:rORvb5DhB1Uho2YYTmkWJ8atPugfjXRR1TiPyIPibpM=
github.com/tree-sitter/tree-sitter-python v0.23.5 h1:1PyX73mysVFmNZZDIGIsIJhpLSuxKfkaYvW+qh/zm7I=
github.com/tree-sitter/tree-sitter-python v0.23.5/go.mod h1:cpdthSy/Yoa28aJFBscFHlGiU+cnSiSh1kuDVtI8YeM=
github.com/tree-sitter/tree-sitter-ruby v0.21.1-0.20240818211811-7dbc1e2d0e2d h1:fcYCvoXdcP1uRQYXqJHRy6Hec+uKScQdKVtMwK9JeCI=
github.com/tree-sitter/tree-sitter-ruby v0.21.1-0.20240818211811-7dbc1e2d0e2d/go.mod h1:T1nShQ4v5AJtozZ8YyAS4uzUtDAJj/iv4YfwXSbUHzg=
github.com/tree-sitter/tree-sitter-rust v0.21.3-0.20240818005432-2b43eafe6447 h1:o9alBu1J/WjrcTKEthYtXmdkDc5OVXD+PqlvnEZ0Lzc=
github.com/tree-sitter/tree-sitter-rust v0.21.3-0.20240818005432-2b43eafe6447/go.mod h1:1Oh95COkkTn6Ezp0vcMbvfhRP5gLeqqljR0BYnBzWvc=
github.com/tree-sitter/tree-sitter-typescript v0.23.0 h1:fWfrHk9kVXcoNDfUZbcIRDZ72O2xRPKVmTSJPUA8P0o=
github.com/tree-sitter/tree-sitter-typescript v0.23.0/go.mod h1:azxbCBrW6EYH6MNoTybDvOcTmw0+iSPIV+QVZXwYsQY=
github.com/tree-sitter/tree-sitter-typescript v0.23.2 h1:/Odvphn18PniVixb9e97X0DbNVsU6Qocv9mfkyzdXwU=
github.com/tree-sitter/tree-sitter-typescript v0.23.2/go.mod h1:zjzMXT/Ulffel2xfOcAkQQkiAkmgnbtPGlFQw/5X4xA=
github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w=
github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
Expand All @@ -68,16 +82,28 @@ go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI=
golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241206012308-a4fef0638583 h1:IfdSdTcLFy4lqUQrQJLkLt1PB+AsqVz6lwkWPzWEz10=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241206012308-a4fef0638583/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0=
google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw=
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
5 changes: 4 additions & 1 deletion runtime/lua/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ import (
"fmt"
"strings"

"git.spiralscout.com/estimation-engine/go-lua"
"github.com/ponyruntime/go-lua"
"go.uber.org/zap"
)

// Engine encapsulates the Lua state and config
type Engine struct {
log *zap.Logger
L *lua.LState
printBuf *strings.Builder
}

// NewLuaEngine creates and initializes a new LuaEngine
func NewLuaEngine(ctx context.Context, log *zap.Logger) *Engine {
log.Debug("initializing engine")
L := lua.NewState()
L.SetContext(ctx)

Expand All @@ -36,6 +38,7 @@ func NewLuaEngine(ctx context.Context, log *zap.Logger) *Engine {
}))

return &Engine{
log: log,
printBuf: sb,
L: L,
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/lua/engine/helpers.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package engine

import (
"git.spiralscout.com/estimation-engine/go-lua"
"github.com/ponyruntime/go-lua"
"go.uber.org/zap"
)

Expand Down
16 changes: 8 additions & 8 deletions runtime/lua/luapool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"go.uber.org/zap"
)

type PoolCfg struct {
type Config struct {
// Number of Virtual Machines (Lua) to be created
numVMs int
// lua script code (actual lua code, tool)
Expand All @@ -22,8 +22,8 @@ type PoolCfg struct {
mainFnName string
}

func NewPoolCfg(numVMs int, script, mainFnName string) *PoolCfg {
return &PoolCfg{
func NewPoolCfg(numVMs int, script, mainFnName string) *Config {
return &Config{
numVMs: numVMs,
script: script,
mainFnName: mainFnName,
Expand All @@ -49,12 +49,12 @@ type Pool struct {
logger *zap.Logger
timeout time.Duration
modules []api.Module
vms map[string]chan *vm.Vm
vms map[string]chan *vm.VM
}

// scripts - scriptID -> 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
Expand All @@ -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...)
Expand Down Expand Up @@ -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
Expand Down
Loading