mirror of https://github.com/dapr/go-sdk.git
change ownerID to lockOwner (#301)
Signed-off-by: yaron2 <schneider.yaron@live.com>
This commit is contained in:
parent
0b65cca826
commit
e086ac59a0
|
@ -225,7 +225,7 @@ ctx := context.Background()
|
||||||
store := "my-store" // defined in the component YAML
|
store := "my-store" // defined in the component YAML
|
||||||
|
|
||||||
r, err := testClient.TryLockAlpha1(ctx, testLockStore, &LockRequest{
|
r, err := testClient.TryLockAlpha1(ctx, testLockStore, &LockRequest{
|
||||||
OwnerID: "owner1",
|
LockOwner: "owner1",
|
||||||
ResourceID: "resource1",
|
ResourceID: "resource1",
|
||||||
ExpiryInSeconds: 5,
|
ExpiryInSeconds: 5,
|
||||||
})
|
})
|
||||||
|
@ -235,7 +235,7 @@ Unlock a lock:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
r, err := testClient.UnlockAlpha1(ctx, testLockStore, &UnlockRequest{
|
r, err := testClient.UnlockAlpha1(ctx, testLockStore, &UnlockRequest{
|
||||||
OwnerID: "owner1",
|
LockOwner: "owner1",
|
||||||
ResourceID: "resource1",
|
ResourceID: "resource1",
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
|
@ -24,14 +24,14 @@ import (
|
||||||
// LockRequest is the lock request object.
|
// LockRequest is the lock request object.
|
||||||
type LockRequest struct {
|
type LockRequest struct {
|
||||||
ResourceID string
|
ResourceID string
|
||||||
OwnerID string
|
LockOwner string
|
||||||
ExpiryInSeconds int32
|
ExpiryInSeconds int32
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnlockRequest is the unlock request object.
|
// UnlockRequest is the unlock request object.
|
||||||
type UnlockRequest struct {
|
type UnlockRequest struct {
|
||||||
ResourceID string
|
ResourceID string
|
||||||
OwnerID string
|
LockOwner string
|
||||||
}
|
}
|
||||||
|
|
||||||
// LockResponse is the lock operation response object.
|
// LockResponse is the lock operation response object.
|
||||||
|
@ -57,7 +57,7 @@ func (c *GRPCClient) TryLockAlpha1(ctx context.Context, storeName string, reques
|
||||||
|
|
||||||
req := pb.TryLockRequest{
|
req := pb.TryLockRequest{
|
||||||
ResourceId: request.ResourceID,
|
ResourceId: request.ResourceID,
|
||||||
LockOwner: request.OwnerID,
|
LockOwner: request.LockOwner,
|
||||||
ExpiryInSeconds: request.ExpiryInSeconds,
|
ExpiryInSeconds: request.ExpiryInSeconds,
|
||||||
StoreName: storeName,
|
StoreName: storeName,
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ func (c *GRPCClient) UnlockAlpha1(ctx context.Context, storeName string, request
|
||||||
|
|
||||||
req := pb.UnlockRequest{
|
req := pb.UnlockRequest{
|
||||||
ResourceId: request.ResourceID,
|
ResourceId: request.ResourceID,
|
||||||
LockOwner: request.OwnerID,
|
LockOwner: request.LockOwner,
|
||||||
StoreName: storeName,
|
StoreName: storeName,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ func TestLock(t *testing.T) {
|
||||||
|
|
||||||
t.Run("try lock", func(t *testing.T) {
|
t.Run("try lock", func(t *testing.T) {
|
||||||
r, err := testClient.TryLockAlpha1(ctx, testLockStore, &LockRequest{
|
r, err := testClient.TryLockAlpha1(ctx, testLockStore, &LockRequest{
|
||||||
OwnerID: "owner1",
|
LockOwner: "owner1",
|
||||||
ResourceID: "resource1",
|
ResourceID: "resource1",
|
||||||
ExpiryInSeconds: 5,
|
ExpiryInSeconds: 5,
|
||||||
})
|
})
|
||||||
|
@ -54,7 +54,7 @@ func TestLock(t *testing.T) {
|
||||||
|
|
||||||
t.Run("unlock invalid store name", func(t *testing.T) {
|
t.Run("unlock invalid store name", func(t *testing.T) {
|
||||||
r, err := testClient.UnlockAlpha1(ctx, "", &UnlockRequest{
|
r, err := testClient.UnlockAlpha1(ctx, "", &UnlockRequest{
|
||||||
OwnerID: "owner1",
|
LockOwner: "owner1",
|
||||||
ResourceID: "resource1",
|
ResourceID: "resource1",
|
||||||
})
|
})
|
||||||
assert.Nil(t, r)
|
assert.Nil(t, r)
|
||||||
|
@ -69,7 +69,7 @@ func TestLock(t *testing.T) {
|
||||||
|
|
||||||
t.Run("unlock", func(t *testing.T) {
|
t.Run("unlock", func(t *testing.T) {
|
||||||
r, err := testClient.UnlockAlpha1(ctx, testLockStore, &UnlockRequest{
|
r, err := testClient.UnlockAlpha1(ctx, testLockStore, &UnlockRequest{
|
||||||
OwnerID: "owner1",
|
LockOwner: "owner1",
|
||||||
ResourceID: "resource1",
|
ResourceID: "resource1",
|
||||||
})
|
})
|
||||||
assert.NotNil(t, r)
|
assert.NotNil(t, r)
|
||||||
|
|
Loading…
Reference in New Issue