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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ go 1.26

toolchain go1.26.5

require github.com/roadrunner-server/api-go/v6 v6.0.0-beta.13
require github.com/roadrunner-server/api-go/v6 v6.0.0-beta.14

require google.golang.org/protobuf v1.36.12 // indirect
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/roadrunner-server/api-go/v6 v6.0.0-beta.13 h1:BAV1aKkRp51C1OXDfEYZXgfrXqn4O7bpr6Z/m5otwd8=
github.com/roadrunner-server/api-go/v6 v6.0.0-beta.13/go.mod h1:Y4rsabWjr4Y10Jg6H8J5NDitQqlnXmGhCdgR+zyLYkI=
github.com/roadrunner-server/api-go/v6 v6.0.0-beta.14 h1:sTskv/3ImOZlUdtHuj9uT24gm1gQl/qU8rFNvn3MzhU=
github.com/roadrunner-server/api-go/v6 v6.0.0-beta.14/go.mod h1:Y4rsabWjr4Y10Jg6H8J5NDitQqlnXmGhCdgR+zyLYkI=
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
12 changes: 6 additions & 6 deletions rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func waitContext(parent context.Context, waitUs int64) (context.Context, context
return context.WithTimeout(parent, time.Microsecond*time.Duration(waitUs))
}

func (r *rpc) Lock(in *lockV1.LockRequest, out *lockV1.LockResponse) error {
func (r *rpc) Lock(in *lockV1.Request, out *lockV1.Response) error {
r.pl.log.Debug("lock request received", "ttl", int(in.GetTtl()), "wait_ttl", int(in.GetWait()), "resource", in.GetResource(), "id", in.GetId())

if in.GetId() == "" {
Expand All @@ -37,7 +37,7 @@ func (r *rpc) Lock(in *lockV1.LockRequest, out *lockV1.LockResponse) error {
return nil
}

func (r *rpc) LockRead(in *lockV1.LockRequest, out *lockV1.LockResponse) error {
func (r *rpc) LockRead(in *lockV1.Request, out *lockV1.Response) error {
r.pl.log.Debug("read lock request received", "ttl", int(in.GetTtl()), "wait_ttl", int(in.GetWait()), "resource", in.GetResource(), "id", in.GetId())

if in.GetId() == "" {
Expand All @@ -51,7 +51,7 @@ func (r *rpc) LockRead(in *lockV1.LockRequest, out *lockV1.LockResponse) error {
return nil
}

func (r *rpc) Release(in *lockV1.LockRequest, out *lockV1.LockResponse) error {
func (r *rpc) Release(in *lockV1.Request, out *lockV1.Response) error {
r.pl.log.Debug("release request received", "ttl", int(in.GetTtl()), "wait_ttl", int(in.GetWait()), "resource", in.GetResource(), "id", in.GetId())

if in.GetId() == "" {
Expand All @@ -65,7 +65,7 @@ func (r *rpc) Release(in *lockV1.LockRequest, out *lockV1.LockResponse) error {
return nil
}

func (r *rpc) ForceRelease(in *lockV1.LockRequest, out *lockV1.LockResponse) error {
func (r *rpc) ForceRelease(in *lockV1.Request, out *lockV1.Response) error {
r.pl.log.Debug("force release request received", "ttl", int(in.GetTtl()), "wait_ttl", int(in.GetWait()), "resource", in.GetResource(), "id", in.GetId())

cctx, cancel := waitContext(context.Background(), in.GetWait())
Expand All @@ -75,7 +75,7 @@ func (r *rpc) ForceRelease(in *lockV1.LockRequest, out *lockV1.LockResponse) err
return nil
}

func (r *rpc) Exists(in *lockV1.LockRequest, out *lockV1.LockResponse) error {
func (r *rpc) Exists(in *lockV1.Request, out *lockV1.Response) error {
r.pl.log.Debug("exists request received", "ttl", int(in.GetTtl()), "wait_ttl", int(in.GetWait()), "resource", in.GetResource(), "id", in.GetId())

if in.GetId() == "" {
Expand All @@ -89,7 +89,7 @@ func (r *rpc) Exists(in *lockV1.LockRequest, out *lockV1.LockResponse) error {
return nil
}

func (r *rpc) UpdateTTL(in *lockV1.LockRequest, out *lockV1.LockResponse) error {
func (r *rpc) UpdateTTL(in *lockV1.Request, out *lockV1.Response) error {
r.pl.log.Debug("updateTTL request received", "ttl", int(in.GetTtl()), "wait_ttl", int(in.GetWait()), "resource", in.GetResource(), "id", in.GetId())

if in.GetId() == "" {
Expand Down
2 changes: 1 addition & 1 deletion tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.26
toolchain go1.26.5

require (
github.com/roadrunner-server/api-go/v6 v6.0.0-beta.13
github.com/roadrunner-server/api-go/v6 v6.0.0-beta.14
github.com/roadrunner-server/config/v6 v6.0.0-beta.3
github.com/roadrunner-server/endure/v2 v2.6.2
github.com/roadrunner-server/goridge/v4 v4.0.0-beta.3
Expand Down
4 changes: 2 additions & 2 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ github.com/pelletier/go-toml/v2 v2.4.3 h1:GTRvJQutkOSftxIFD5xw9aepkYNuPWmVJpffdD
github.com/pelletier/go-toml/v2 v2.4.3/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/roadrunner-server/api-go/v6 v6.0.0-beta.13 h1:BAV1aKkRp51C1OXDfEYZXgfrXqn4O7bpr6Z/m5otwd8=
github.com/roadrunner-server/api-go/v6 v6.0.0-beta.13/go.mod h1:Y4rsabWjr4Y10Jg6H8J5NDitQqlnXmGhCdgR+zyLYkI=
github.com/roadrunner-server/api-go/v6 v6.0.0-beta.14 h1:sTskv/3ImOZlUdtHuj9uT24gm1gQl/qU8rFNvn3MzhU=
github.com/roadrunner-server/api-go/v6 v6.0.0-beta.14/go.mod h1:Y4rsabWjr4Y10Jg6H8J5NDitQqlnXmGhCdgR+zyLYkI=
github.com/roadrunner-server/config/v6 v6.0.0-beta.3 h1:G0EUzJ6Yw4UnleM6BhnOBbYPXKDHRmCJiGhC3nXDBwI=
github.com/roadrunner-server/config/v6 v6.0.0-beta.3/go.mod h1:eIB+c29njpcKokXrxe483FbQOBSTNGvU3hhC6W/qYSU=
github.com/roadrunner-server/endure/v2 v2.6.2 h1:sIB4kTyE7gtT3fDhuYWUYn6Vt/dcPtiA6FoNS1eS+84=
Expand Down
16 changes: 8 additions & 8 deletions tests/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ func newLockClient() (*rpc.Client, error) {
return rpc.NewClientWithCodec(goridgeRpc.NewClientCodec(conn)), nil
}

func call(method string, in *lockV1.LockRequest) (bool, error) {
func call(method string, in *lockV1.Request) (bool, error) {
cl, err := newLockClient()
if err != nil {
return false, err
}
defer func() { _ = cl.Close() }()

out := &lockV1.LockResponse{}
out := &lockV1.Response{}
if err := cl.Call(method, in, out); err != nil {
return false, err
}
return out.GetOk(), nil
}

func lock(resource, id string, ttl, wait int) (bool, error) {
return call("lock.Lock", &lockV1.LockRequest{
return call("lock.Lock", &lockV1.Request{
Resource: resource,
Id: id,
Ttl: new(int64(ttl)),
Expand All @@ -43,7 +43,7 @@ func lock(resource, id string, ttl, wait int) (bool, error) {
}

func lockRead(resource, id string, ttl, wait int) (bool, error) {
return call("lock.LockRead", &lockV1.LockRequest{
return call("lock.LockRead", &lockV1.Request{
Resource: resource,
Id: id,
Ttl: new(int64(ttl)),
Expand All @@ -52,28 +52,28 @@ func lockRead(resource, id string, ttl, wait int) (bool, error) {
}

func release(resource, id string) (bool, error) {
return call("lock.Release", &lockV1.LockRequest{
return call("lock.Release", &lockV1.Request{
Resource: resource,
Id: id,
})
}

func updateTTL(resource, id string, ttl int) (bool, error) {
return call("lock.UpdateTTL", &lockV1.LockRequest{
return call("lock.UpdateTTL", &lockV1.Request{
Resource: resource,
Id: id,
Ttl: new(int64(ttl)),
})
}

func forceRelease(resource string) (bool, error) {
return call("lock.ForceRelease", &lockV1.LockRequest{
return call("lock.ForceRelease", &lockV1.Request{
Resource: resource,
})
}

func exists(resource, id string) (bool, error) {
return call("lock.Exists", &lockV1.LockRequest{
return call("lock.Exists", &lockV1.Request{
Resource: resource,
Id: id,
})
Expand Down
Loading