Skip to content

Commit

Permalink
Storage/XRootD: Support sending file via FUSE
Browse files Browse the repository at this point in the history
Like this the webserver can deal with the file instead of sending
possibly large amounts of data though Indico itself.
  • Loading branch information
ThiefMaster committed May 5, 2017
1 parent 2e308fa commit ba6bd10
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions storage_xrootd/indico_storage_xrootd.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from __future__ import unicode_literals

import ast
import os
import shutil
import sys
Expand Down Expand Up @@ -46,10 +47,13 @@ def _get_storage_backends(self, sender, **kwargs):

class XRootDStorage(Storage):
name = 'xrootd'
simple_data = True
simple_data = False

def __init__(self, data):
self.xrootd_host, self.path = data.split(':', 1)
data = self._parse_data(data)
self.xrootd_host = data['host']
self.path = data['root']
self.fuse = bool(ast.literal_eval(data.get('fuse', 'False').title()))

@return_ascii
def __repr__(self):
Expand Down Expand Up @@ -105,4 +109,5 @@ def getsize(self, file_id):
raise StorageError('Could not get size of "{}": {}'.format(file_id, e)), None, sys.exc_info()[2]

def send_file(self, file_id, content_type, filename, inline=True):
return send_file(filename, self.open(file_id), content_type, inline=inline)
file_data = self._resolve_path(file_id) if self.fuse else self.open(file_id)
return send_file(filename, file_data, content_type, inline=inline)

0 comments on commit ba6bd10

Please sign in to comment.