From 38ee710c808580512170651b9da95e9ca647ad07 Mon Sep 17 00:00:00 2001 From: jkoberg Date: Mon, 23 Dec 2024 15:31:28 +0100 Subject: [PATCH] fest(ocm): implement RefreshLock and GetLock Signed-off-by: jkoberg --- pkg/ocm/storage/received/ocm.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pkg/ocm/storage/received/ocm.go b/pkg/ocm/storage/received/ocm.go index 897c1cd916..0b069ccc34 100644 --- a/pkg/ocm/storage/received/ocm.go +++ b/pkg/ocm/storage/received/ocm.go @@ -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) + 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()) + return err } // Unlock removes a lock from a file