MCPcopy Create free account
hub / github.com/apache/cloudberry / getNextOffset

Method getNextOffset

gpcontrib/gpcloud/src/s3key_reader.cpp:5–21  ·  view source on GitHub ↗

Return (offset, length) of next chunk to download, or (fileSize, 0) if reach end of file.

Source from the content-addressed store, hash-verified

3// Return (offset, length) of next chunk to download,
4// or (fileSize, 0) if reach end of file.
5Range OffsetMgr::getNextOffset() {
6 Range ret;
7
8 pthread_mutex_lock(&this->offsetLock);
9 ret.offset = std::min(this->curPos, this->keySize);
10
11 if (this->curPos + this->chunkSize > this->keySize) {
12 ret.length = this->keySize - this->curPos;
13 this->curPos = this->keySize;
14 } else {
15 ret.length = this->chunkSize;
16 this->curPos += this->chunkSize;
17 }
18 pthread_mutex_unlock(&this->offsetLock);
19
20 return ret;
21}
22
23ChunkBuffer::ChunkBuffer(const S3Url& s3Url, S3KeyReader& reader, const S3MemoryContext& context)
24 : s3Url(s3Url), chunkData(context), offsetMgr(reader.getOffsetMgr()), sharedKeyReader(reader) {

Callers 3

TESTFunction · 0.80
ChunkBufferMethod · 0.80
readMethod · 0.80

Calls 2

pthread_mutex_lockFunction · 0.85
pthread_mutex_unlockFunction · 0.85

Tested by 1

TESTFunction · 0.64