Attempt to implement streaming optimization in DiskS3.

This commit is contained in:
Vladimir Chebotarev 2020-07-12 16:53:08 +03:00
parent 718523b0ee
commit 67f9d8124b

View File

@ -25,10 +25,29 @@ public:
}
off_t seek(off_t off, int whence) override
{
off_t position = getPosition();
if (whence == SEEK_CUR)
{
off += position;
whence = SEEK_SET;
}
if (whence == SEEK_SET && off >= position && off < position + 1024*1024)
{
swap(*nested);
off_t position = nested->seek(off, whence);
nested->ignore(off - position);
swap(*nested);
position = off;
}
else
{
swap(*nested);
position = nested->seek(off, whence);
swap(*nested);
}
return position;
}