Skip to content

Commit

Permalink
fest(ocm): implement RefreshLock and GetLock
Browse files Browse the repository at this point in the history
Signed-off-by: jkoberg <[email protected]>
  • Loading branch information
kobergj committed Dec 23, 2024
1 parent 15f3cf9 commit 38ee710
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions pkg/ocm/storage/received/ocm.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,27 @@ func (d *driver) SetLock(ctx context.Context, ref *provider.Reference, lock *pro
}

func (d *driver) GetLock(ctx context.Context, ref *provider.Reference) (*provider.Lock, error) {
return nil, errtypes.NotSupported("operation not supported")
client, _, rel, err := d.webdavClient(ctx, nil, ref)
if err != nil {
return nil, err
}

token, err := client.GetLock(rel)

Check failure on line 493 in pkg/ocm/storage/received/ocm.go

View workflow job for this annotation

GitHub Actions / lint

client.GetLock undefined (type *gowebdav.Client has no field or method GetLock)

Check failure on line 493 in pkg/ocm/storage/received/ocm.go

View workflow job for this annotation

GitHub Actions / lint

client.GetLock undefined (type *gowebdav.Client has no field or method GetLock)
if err != nil {
return nil, err
}

return &provider.Lock{LockId: token, Type: provider.LockType_LOCK_TYPE_EXCL}, nil
}

func (d *driver) RefreshLock(ctx context.Context, ref *provider.Reference, lock *provider.Lock, existingLockID string) error {
return errtypes.NotSupported("operation not supported")
client, _, rel, err := d.webdavClient(ctx, nil, ref)
if err != nil {
return err
}

err = client.RefreshLock(rel, lock.GetLockId())

Check failure on line 507 in pkg/ocm/storage/received/ocm.go

View workflow job for this annotation

GitHub Actions / lint

client.RefreshLock undefined (type *gowebdav.Client has no field or method RefreshLock) (typecheck)

Check failure on line 507 in pkg/ocm/storage/received/ocm.go

View workflow job for this annotation

GitHub Actions / lint

client.RefreshLock undefined (type *gowebdav.Client has no field or method RefreshLock)) (typecheck)
return err
}

// Unlock removes a lock from a file
Expand Down

0 comments on commit 38ee710

Please sign in to comment.