aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/iohash.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-03-14 16:50:18 +0100
committerGitHub Enterprise <[email protected]>2024-03-14 16:50:18 +0100
commit0a935231009cb21680d364ef125f0296a5a5bed6 (patch)
tree7e55a67ae60883b0eab71a0d636aeec23f307d14 /src/zencore/iohash.cpp
parentclean up test linking (#4) (diff)
downloadzen-0a935231009cb21680d364ef125f0296a5a5bed6.tar.xz
zen-0a935231009cb21680d364ef125f0296a5a5bed6.zip
special treatment large oplog attachments v2 (#5)
- Bugfix: Install Ctrl+C handler earlier when doing `zen oplog-export` and `zen oplog-export` to properly cancel jobs - Improvement: Add ability to block a set of CAS entries from GC in project store - Improvement: Large attachments and loose files are now split into smaller chunks and stored in blocks during oplog export
Diffstat (limited to 'src/zencore/iohash.cpp')
-rw-r--r--src/zencore/iohash.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/zencore/iohash.cpp b/src/zencore/iohash.cpp
index cedee913a..a6bf25f6c 100644
--- a/src/zencore/iohash.cpp
+++ b/src/zencore/iohash.cpp
@@ -31,14 +31,15 @@ IoHash::HashBuffer(const CompositeBuffer& Buffer)
for (const SharedBuffer& Segment : Buffer.GetSegments())
{
- size_t SegmentSize = Segment.GetSize();
- if (SegmentSize >= (65536 + 32768) && Segment.IsFileReference())
+ size_t SegmentSize = Segment.GetSize();
+ static const size_t BufferingSize = 512 * 1024;
+ if (SegmentSize >= (BufferingSize + BufferingSize / 2) && Segment.IsFileReference())
{
const IoBuffer SegmentBuffer = Segment.AsIoBuffer();
size_t Offset = 0;
while (Offset < SegmentSize)
{
- size_t ChunkSize = Min<size_t>(SegmentSize - Offset, 65536u);
+ size_t ChunkSize = Min<size_t>(SegmentSize - Offset, BufferingSize);
IoBuffer SubRange(SegmentBuffer, Offset, ChunkSize);
Hasher.Append(SubRange.GetData(), ChunkSize);
Offset += ChunkSize;