Skip to content

Commit 3950f25

Browse files
committed
introduce buffering parameter in open()
whitespace
1 parent 2d968fe commit 3950f25

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: irods/manager/data_object_manager.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ def open(self, path, mode,
424424
returned_values = None, # Used to update session reference, for forging more conns to same host, in irods.parallel.io_main
425425
allow_redirect = True, # This may be set to False to disallow the client redirect-to-resource.
426426
**options):
427+
_buffering = options.pop('_buffering', -1)
427428
_raw_fd_holder = options.get('_raw_fd_holder',[])
428429
# If no keywords are used that would influence the server as to the choice of a storage resource,
429430
# then use the default resource in the client configuration.
@@ -526,12 +527,19 @@ def make_FileOpenRequest(**extra_opts):
526527
# Use case: auto_close has defaulted to the irods.configuration getter.
527528
# access entry in irods.configuration
528529
auto_close = auto_close()
530+
531+
bufopt = {}
532+
if _buffering >= 0: # originally '>' - DWM
533+
bufopt['buffer_size'] = _buffering
534+
529535
if auto_close:
530-
ret_value = ManagedBufferedRandom(raw, _session = self.sess)
536+
ret_value = ManagedBufferedRandom(raw, _session = self.sess, **bufopt)
531537
else:
532-
ret_value = io.BufferedRandom(raw)
538+
ret_value = io.BufferedRandom(raw, **bufopt)
539+
533540
if 'a' in mode:
534541
ret_value.seek(0,io.SEEK_END)
542+
535543
return ret_value
536544

537545
def replica_truncate(self, path, desired_size, **options):

0 commit comments

Comments
 (0)