Skip to content

Commit

Permalink
improved messages for file block reassembly #396
Browse files Browse the repository at this point in the history
  • Loading branch information
petersilva committed Oct 16, 2023
1 parent d94321f commit ff61117
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sarracenia/flowcb/reassemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def __init__(self, options) -> None:
#FIXME: missing metrics for now.
self.metric_scanned = 0
self.metric_hits = 0
sarracenia.known_report_codes['206'] = 'file block subset received and reassembled ok. Waiting for more.'

def after_work(self, worklist) -> None:

Expand Down Expand Up @@ -166,7 +167,7 @@ def after_work(self, worklist) -> None:

if blkno in old_blocks['waiting']:
del old_blocks['waiting'][blkno]
logger.info( f"deleted block {blkno} from waiting: {old_blocks['waiting']} ")
logger.info( f"deleted block {blkno} from waiting: {len(old_blocks['waiting'])} left. ")

# calculate where to seek to...
offset=0
Expand Down Expand Up @@ -203,7 +204,7 @@ def after_work(self, worklist) -> None:

with sarracenia.filemetadata.FileMetadata(root_file) as xrfab:
xrfab.set('mtime',m['mtime'])
logger.info( f" about to persist...waiting: {old_blocks['waiting']} ")
logger.info( f" about to persist...waiting: {len(old_blocks['waiting'])} ")
xrfab.set('blocks',old_blocks)

if len( old_blocks['waiting'] ) > 0 :
Expand All @@ -217,16 +218,17 @@ def after_work(self, worklist) -> None:
simultaneous streams.
(from https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)
"""
m.setReport( 206, "file block subset received and reassembled ok. Not forwarding." )
m.setReport( 206, f"file block subset {msg['blocks']['number']} received and reassembled ok. waiting for {(len(old_blocks['waiting']))} more blocks." )
worklist.rejected.append(m)
else:
# FIXME: for inflight. now rename the file to the real name.

m['relPath'] = rp[0:rp.find("§block_")]
m['new_file'] = m['new_file'][0:m['new_file'].find("§block_")]
m['blocks']['method'] = 'inplace'
del m['blocks']['number']
m['size'] = new_sz
logger.info( f"completed reassembly of {m['relPath']}" )
new_ok.append(m)

flck.unlock()
Expand Down

0 comments on commit ff61117

Please sign in to comment.