Skip to content

Commit

Permalink
chore: RR 2024.2 support
Browse files Browse the repository at this point in the history
Signed-off-by: Valery Piashchynski <[email protected]>
  • Loading branch information
rustatian committed Jul 4, 2024
1 parent 42cae48 commit 1a6778b
Show file tree
Hide file tree
Showing 16 changed files with 140 additions and 43 deletions.
10 changes: 10 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

set -e -o pipefail

if ! command -v golangci-lint &> /dev/null; then
echo "golangci-lint is not installed"
exit 1
fi

exec golangci-lint --build-tags=race run "$@"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
vendor/
**/vendor/
.idea
.DS_Store
.DS_Store
**/composer.lock
14 changes: 3 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,11 @@

run:
timeout: 1m
skip-dirs:
- .github
- .git
allow-parallel-runners: true

output:
format: colored-line-number # colored-line-number|line-number|json|tab|checkstyle|code-climate

linters-settings:
wsl:
allow-assign-and-anything: true
govet:
check-shadowing: true
golint:
min-confidence: 0.1
gocyclo:
min-complexity: 15
godot:
Expand All @@ -36,7 +26,6 @@ linters-settings:
range-loops: true
for-loops: true
nolintlint:
allow-leading-space: false
require-specific: true

linters: # All available linters list: <https://golangci-lint.run/usage/linters/>
Expand Down Expand Up @@ -79,6 +68,9 @@ linters: # All available linters list: <https://golangci-lint.run/usage/linters/
- whitespace # Tool for detection of leading and trailing whitespace

issues:
exclude-dirs:
- .github
- .git
exclude-rules:
- path: _test\.go
linters:
Expand Down
7 changes: 7 additions & 0 deletions githooks-installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

set -e

cp ./.githooks/pre-commit .git/hooks/pre-commit

echo "DONE"
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/roadrunner-server/informer/v4
module github.com/roadrunner-server/informer/v5

go 1.22.4
go 1.22.5

require (
github.com/roadrunner-server/api/v4 v4.15.0
github.com/roadrunner-server/endure/v2 v2.4.5
github.com/roadrunner-server/errors v1.4.0
github.com/roadrunner-server/sdk/v4 v4.8.0
github.com/roadrunner-server/pool v1.0.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ github.com/roadrunner-server/errors v1.4.0 h1:Odjg3VZrj1q5Y8ILwoN+JgERyv0pkhrWPN
github.com/roadrunner-server/errors v1.4.0/go.mod h1:78PvraAFj+Sxy5nDmo0S+h6rEMLFIDszWZxA3B0sPAs=
github.com/roadrunner-server/goridge/v3 v3.8.2 h1:4TpIJAMylMIVTva/L/STB4ZvYNVoQ77+Syr6abxj95c=
github.com/roadrunner-server/goridge/v3 v3.8.2/go.mod h1:7IIDW50j1saxnOxktFeUPpkSIfyvM/dYopTrbGWXboA=
github.com/roadrunner-server/sdk/v4 v4.8.0 h1:MpvRRlqJCjjqeCYah5K1ce64Z9zFqnuTYa1SgdhKJ5Y=
github.com/roadrunner-server/sdk/v4 v4.8.0/go.mod h1:CD9AE/wsGfhI7nbx+Bl727oQiGjh62ExrRJ/DhBg91s=
github.com/roadrunner-server/pool v1.0.0 h1:9iA67WLrJGRuigbN8qR6Rrs4OMy/TfkG7gSOS8sl0oU=
github.com/roadrunner-server/pool v1.0.0/go.mod h1:fLWNBj17Bu/YAN61QoInLr3ieRifpg1qN/4LGJqPsKo=
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
Expand Down
2 changes: 1 addition & 1 deletion go.work
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.22.4
go 1.22.5

use (
.
Expand Down
81 changes: 81 additions & 0 deletions go.work.sum

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import (
"context"
"time"

"github.com/roadrunner-server/api/v4/plugins/v3/jobs"
"github.com/roadrunner-server/api/v4/plugins/v4/jobs"
"github.com/roadrunner-server/endure/v2/dep"
"github.com/roadrunner-server/errors"
"github.com/roadrunner-server/sdk/v4/state/process"
"github.com/roadrunner-server/pool/state/process"
)

const PluginName = "informer"

type Named interface {
// Name returns user-friendly name of the plugin
// Name returns the user-friendly name of the plugin
Name() string
}

Expand All @@ -34,7 +34,7 @@ type Informer interface {
// JobsStat interface provides statistic for the job plugin
type JobsStat interface {
Named
// JobsState returns slice with the attached drivers information
// JobsState returns a slice with the attached drivers information
JobsState(ctx context.Context) ([]*jobs.State, error)
}

Expand Down
6 changes: 3 additions & 3 deletions rpc.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package informer

import (
"github.com/roadrunner-server/api/v4/plugins/v3/jobs"
"github.com/roadrunner-server/sdk/v4/state/process"
"github.com/roadrunner-server/api/v4/plugins/v4/jobs"
"github.com/roadrunner-server/pool/state/process"
)

type rpc struct {
Expand All @@ -11,7 +11,7 @@ type rpc struct {

// WorkerList contains a list of workers.
type WorkerList struct {
// Workers are list of workers.
// Workers are a list of workers.
Workers []*process.State `json:"workers"`
}

Expand Down
10 changes: 6 additions & 4 deletions tests/go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
module tests

go 1.22.4
go 1.22.5

require (
github.com/roadrunner-server/config/v4 v4.9.2
github.com/roadrunner-server/endure/v2 v2.4.5
github.com/roadrunner-server/goridge/v3 v3.8.2
github.com/roadrunner-server/http/v4 v4.7.6
github.com/roadrunner-server/informer/v4 v4.3.16
github.com/roadrunner-server/informer/v5 v5.0.0-00010101000000-000000000000
github.com/roadrunner-server/logger/v4 v4.4.4
github.com/roadrunner-server/pool v1.0.0
github.com/roadrunner-server/resetter/v4 v4.3.4
github.com/roadrunner-server/rpc/v4 v4.4.4
github.com/roadrunner-server/sdk/v4 v4.7.3
Expand All @@ -18,7 +19,7 @@ require (
go.uber.org/zap v1.27.0
)

replace github.com/roadrunner-server/informer/v4 => ../
replace github.com/roadrunner-server/informer/v5 => ../

require (
github.com/beorn7/perks v1.0.1 // indirect
Expand Down Expand Up @@ -56,8 +57,9 @@ require (
github.com/prometheus/procfs v0.15.1 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/quic-go v0.45.0 // indirect
github.com/roadrunner-server/api/v4 v4.12.0 // indirect
github.com/roadrunner-server/api/v4 v4.15.0 // indirect
github.com/roadrunner-server/errors v1.4.0 // indirect
github.com/roadrunner-server/events v1.0.0 // indirect
github.com/roadrunner-server/tcplisten v1.4.0 // indirect
github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
Expand Down
8 changes: 6 additions & 2 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,24 @@ github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
github.com/quic-go/quic-go v0.45.0 h1:OHmkQGM37luZITyTSu6ff03HP/2IrwDX1ZFiNEhSFUE=
github.com/quic-go/quic-go v0.45.0/go.mod h1:1dLehS7TIR64+vxGR70GDcatWTOtMX2PUtnKsjbTurI=
github.com/roadrunner-server/api/v4 v4.12.0 h1:N8AC+b7uzrDpTPnFTBVWNIs9ZMV42hwKDCo29X84iS8=
github.com/roadrunner-server/api/v4 v4.12.0/go.mod h1:nLV2f4O7tDh5DaMDff4oX1bNJ9erz7eyq+4TajgKGck=
github.com/roadrunner-server/api/v4 v4.15.0 h1:/CUbaHb9AT2PSWQFhjUxnuSC5p0ypkACrFgiIvNHsoo=
github.com/roadrunner-server/api/v4 v4.15.0/go.mod h1:fAiaKHRVkt49S302Jhj60jd+nUNfs8iyjKE5rIoQ+kE=
github.com/roadrunner-server/config/v4 v4.9.2 h1:AvZj6b9Jz8dR1FB3Suugcn+8Cok2WnIla4iznbuwmKo=
github.com/roadrunner-server/config/v4 v4.9.2/go.mod h1:yYYIkw1u2Hq8521v/qoqDuOHwOKH9X8Mx+t+TWX7UME=
github.com/roadrunner-server/endure/v2 v2.4.5 h1:GoZm/1HjKCKm8TpaP/Pm2KbN0X9gLyN840cA3Fn/TCE=
github.com/roadrunner-server/endure/v2 v2.4.5/go.mod h1:83UvLdt+RNxELTSna+SZMWQiu+Thj6wOz6hmlp65XFI=
github.com/roadrunner-server/errors v1.4.0 h1:Odjg3VZrj1q5Y8ILwoN+JgERyv0pkhrWPNOM4h68iQ8=
github.com/roadrunner-server/errors v1.4.0/go.mod h1:78PvraAFj+Sxy5nDmo0S+h6rEMLFIDszWZxA3B0sPAs=
github.com/roadrunner-server/events v1.0.0 h1:r+DM2mVJbcJSxj7AoESvolgUQQYNcEjzKPdgTXz3lPI=
github.com/roadrunner-server/events v1.0.0/go.mod h1:KMcez/tib0yky9TR/0Ag8SZcgAn3kjzXWciZL/n2Hu8=
github.com/roadrunner-server/goridge/v3 v3.8.2 h1:4TpIJAMylMIVTva/L/STB4ZvYNVoQ77+Syr6abxj95c=
github.com/roadrunner-server/goridge/v3 v3.8.2/go.mod h1:7IIDW50j1saxnOxktFeUPpkSIfyvM/dYopTrbGWXboA=
github.com/roadrunner-server/http/v4 v4.7.6 h1:A8Dnwl54C6r3biOiDXmH9IhCKVsqUG+R05NkiFbZc6c=
github.com/roadrunner-server/http/v4 v4.7.6/go.mod h1:LmsUpsoGhYhh7vKwkz3zx1Cgsybmo5PIdpXZ6ngyQMA=
github.com/roadrunner-server/logger/v4 v4.4.4 h1:GM+eMhrBIaNR0TP94krK3H0rLOiVEP3woYhQTKDTUxA=
github.com/roadrunner-server/logger/v4 v4.4.4/go.mod h1:gV0HHkfuLW/2DH1jtRUCFCkYd7FWOg8cP26TnPXUavY=
github.com/roadrunner-server/pool v1.0.0 h1:9iA67WLrJGRuigbN8qR6Rrs4OMy/TfkG7gSOS8sl0oU=
github.com/roadrunner-server/pool v1.0.0/go.mod h1:fLWNBj17Bu/YAN61QoInLr3ieRifpg1qN/4LGJqPsKo=
github.com/roadrunner-server/resetter/v4 v4.3.4 h1:vbEnrka/i+PmnDcr+meijE+DW+c34o7POj3oLdpDQww=
github.com/roadrunner-server/resetter/v4 v4.3.4/go.mod h1:YWE7nD1t8Lcyu3HmlniBWmBkJeszAUfjjuQOqrU/7kk=
github.com/roadrunner-server/rpc/v4 v4.4.4 h1:6uAG2Q/QDvOO/+fhGwnEjlCu1C57wtIRoOPxkHWDZMA=
Expand Down
2 changes: 1 addition & 1 deletion tests/informer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/roadrunner-server/endure/v2"
goridgeRpc "github.com/roadrunner-server/goridge/v3/pkg/rpc"
"github.com/roadrunner-server/http/v4"
"github.com/roadrunner-server/informer/v4"
"github.com/roadrunner-server/informer/v5"
"github.com/roadrunner-server/logger/v4"
"github.com/roadrunner-server/resetter/v4"
rpcPlugin "github.com/roadrunner-server/rpc/v4"
Expand Down
2 changes: 1 addition & 1 deletion tests/pkgs.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github.com/roadrunner-server/amqp/v4,github.com/roadrunner-server/app-logger/v4,github.com/roadrunner-server/beanstalk/v4,github.com/roadrunner-server/boltdb/v4,github.com/roadrunner-server/centrifuge/v4,github.com/roadrunner-server/config/v4,github.com/roadrunner-server/fileserver/v4,github.com/roadrunner-server/grpc/v4,github.com/roadrunner-server/gzip/v4,github.com/roadrunner-server/headers/v4,github.com/roadrunner-server/http/v4,github.com/roadrunner-server/informer/v4,github.com/roadrunner-server/jobs/v4,github.com/roadrunner-server/kafka/v4,github.com/roadrunner-server/kv/v4,github.com/roadrunner-server/logger/v4,github.com/roadrunner-server/lock/v4,github.com/roadrunner-server/memcached/v4,github.com/roadrunner-server/memory/v4,github.com/roadrunner-server/metrics/v4,github.com/roadrunner-server/nats/v4,github.com/roadrunner-server/otel/v4,github.com/roadrunner-server/prometheus/v4,github.com/roadrunner-server/proxy_ip_parser/v4,github.com/roadrunner-server/redis/v4,github.com/roadrunner-server/resetter/v4,github.com/roadrunner-server/rpc/v4,github.com/roadrunner-server/send/v4,github.com/roadrunner-server/server/v4,github.com/roadrunner-server/service/v4,github.com/roadrunner-server/sqs/v4,github.com/roadrunner-server/static/v4,github.com/roadrunner-server/status/v4,github.com/roadrunner-server/tcp/v4
github.com/roadrunner-server/amqp/v5,github.com/roadrunner-server/app-logger/v5,github.com/roadrunner-server/beanstalk/v5,github.com/roadrunner-server/boltdb/v5,github.com/roadrunner-server/centrifuge/v5,github.com/roadrunner-server/config/v5,github.com/roadrunner-server/fileserver/v5,github.com/roadrunner-server/grpc/v5,github.com/roadrunner-server/gzip/v5,github.com/roadrunner-server/headers/v5,github.com/roadrunner-server/http/v5,github.com/roadrunner-server/informer/v5,github.com/roadrunner-server/jobs/v5,github.com/roadrunner-server/kafka/v5,github.com/roadrunner-server/kv/v5,github.com/roadrunner-server/logger/v5,github.com/roadrunner-server/lock/v5,github.com/roadrunner-server/memcached/v5,github.com/roadrunner-server/memory/v5,github.com/roadrunner-server/metrics/v5,github.com/roadrunner-server/nats/v5,github.com/roadrunner-server/otel/v5,github.com/roadrunner-server/prometheus/v5,github.com/roadrunner-server/proxy_ip_parser/v5,github.com/roadrunner-server/redis/v5,github.com/roadrunner-server/resetter/v5,github.com/roadrunner-server/rpc/v5,github.com/roadrunner-server/send/v5,github.com/roadrunner-server/server/v5,github.com/roadrunner-server/service/v5,github.com/roadrunner-server/sqs/v5,github.com/roadrunner-server/static/v5,github.com/roadrunner-server/status/v5,github.com/roadrunner-server/tcp/v5
18 changes: 9 additions & 9 deletions tests/test_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"os/exec"
"time"

"github.com/roadrunner-server/sdk/v4/payload"
"github.com/roadrunner-server/sdk/v4/pool"
staticPool "github.com/roadrunner-server/sdk/v4/pool/static_pool"
"github.com/roadrunner-server/sdk/v4/state/process"
"github.com/roadrunner-server/sdk/v4/worker"
"github.com/roadrunner-server/pool/payload"
"github.com/roadrunner-server/pool/pool"
staticPool "github.com/roadrunner-server/pool/pool/static_pool"
"github.com/roadrunner-server/pool/state/process"
"github.com/roadrunner-server/pool/worker"
"go.uber.org/zap"
)

Expand All @@ -31,7 +31,7 @@ var testPoolConfig = &pool.Config{ //nolint:gochecknoglobals
type Configurer interface {
// UnmarshalKey takes a single key and unmarshal it into a Struct.
UnmarshalKey(name string, out any) error
// Has checks if config section exists.
// Has checks if a config section exists.
Has(name string) bool
}

Expand All @@ -43,13 +43,13 @@ type Server interface {
}

type Pool interface {
// Workers returns worker list associated with the pool.
// Workers return a worker list associated with the pool.
Workers() (workers []*worker.Process)
// Exec payload
Exec(ctx context.Context, p *payload.Payload, stopCh chan struct{}) (chan *staticPool.PExec, error)
// Reset kill all workers inside the watcher and replaces with new
// Reset kills all workers inside the watcher and replaces with new
Reset(ctx context.Context) error
// Destroy all underlying stack (but let them complete the task).
// Destroy all underlying stacks (but let them complete the task).
Destroy(ctx context.Context)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugin_2.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"sync"
"time"

"github.com/roadrunner-server/sdk/v4/state/process"
"github.com/roadrunner-server/pool/state/process"
)

// Gauge //////////////
Expand Down

0 comments on commit 1a6778b

Please sign in to comment.