Skip to content

Commit

Permalink
Clients: add NoRename version of webdav
Browse files Browse the repository at this point in the history
Motivation:

The Default WebDAV protocol impl supports renaming.  This allows
rsemanager to upload a file to a temporary and then rename the recently
uploaded file to the target.  Doing this is A Good Thing.

However, this approach doesn't work for object stores (at least, S3)
because they don't support server-side renaming.

Modification:

Following the approach adopted for gfal, this patch adds a NoRename
variant of webdav for use with presigned urls.

Result:

Rucio is now able to upload a file to an S3 endpoint using the webdav
protocol impl and the final problem described in rucio#7342 is resolved.

Signed-off-by: Paul Millar <paul.millar@desy.de>
  • Loading branch information
paulmillar authored and bari12 committed Feb 25, 2025
1 parent 63bd7b8 commit 5dcf2f9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/rucio/rse/protocols/webdav.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import logging
import os
import sys
from dataclasses import dataclass
Expand Down Expand Up @@ -564,3 +565,30 @@ def get_space_usage(self):
return totalsize, unusedsize
except Exception as error:
raise exception.ServiceUnavailable(error)


class NoRename(Default):
""" Implementing access to RSEs using the WebDAV protocol but without
renaming files on upload/download. Necessary for some storage endpoints.
"""

def __init__(self, protocol_attr, rse_settings, logger=logging.log):
""" Initializes the object with information about the referred RSE.
:param protocol_attr: Properties of the requested protocol.
:param rse_settings: The RSE settings.
:param logger: Optional decorated logger that can be passed from the calling daemons or servers.
"""
super(NoRename, self).__init__(protocol_attr, rse_settings, logger=logger)
self.renaming = False
self.attributes.pop('determinism_type', None)

def rename(self, pfn, new_pfn):
""" Allows to rename a file stored inside the connected RSE.
:param pfn: Current physical file name
:param new_pfn New physical file name
:raises DestinationNotAccessible, ServiceUnavailable, SourceNotFound
"""
raise NotImplementedError

0 comments on commit 5dcf2f9

Please sign in to comment.