Page MenuHomeSoftware Heritage

Improve code in BufferingProxyStorage
Closed, MigratedEdits Locked

Description

swh/storage/buffer.py could use some improvements:

  1. Renaming s to stats would be clearer to me. It'd be nice to do the renaming throughout, at some point. You could also add a comment saying that if not stats: means that object_add didn't flush the buffers, and we should check for the volume of contents.
  2. queue, content instead of q, c
  3. we should store and update the sum of content lengths in an attribute on the fly to avoid a gratuitous quatratic behavior.
  4. At some point we should rename min_batch_size to buffer_thresholds or something clearer.