greenplumn s3common_reader 源码
greenplumn s3common_reader 代码
文件路径:/gpcontrib/gpcloud/src/s3common_reader.cpp
#include "s3common_reader.h"
void S3CommonReader::open(const S3Params ¶ms) {
this->keyReader.setS3InterfaceService(s3InterfaceService);
S3CompressionType compressionType = s3InterfaceService->checkCompressionType(params.getS3Url());
switch (compressionType) {
case S3_COMPRESSION_DEFLATE:
case S3_COMPRESSION_GZIP:
this->upstreamReader = &this->decompressReader;
this->decompressReader.setReader(&this->keyReader);
break;
case S3_COMPRESSION_PLAIN:
this->upstreamReader = &this->keyReader;
break;
default:
S3_CHECK_OR_DIE(false, S3RuntimeError, "unknown file type");
};
this->upstreamReader->open(params);
}
// read() attempts to read up to count bytes into the buffer.
// Return 0 if EOF. Throw exception if encounters errors.
uint64_t S3CommonReader::read(char *buf, uint64_t count) {
return this->upstreamReader->read(buf, count);
}
// This should be reentrant, has no side effects when called multiple times.
void S3CommonReader::close() {
if (this->upstreamReader != NULL) {
this->upstreamReader->close();
this->upstreamReader = NULL;
}
}
相关信息
相关文章
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦