greenplumn decompress_reader 源码

  • 2022-08-18
  • 浏览 (499)

greenplumn decompress_reader 代码

文件路径:/gpcontrib/gpcloud/include/decompress_reader.h

#ifndef INCLUDE_DECOMPRESS_READER_H_
#define INCLUDE_DECOMPRESS_READER_H_

#include "reader.h"
#include "s3common_headers.h"
#include "s3exception.h"
#include "s3macros.h"
#include "s3params.h"

// 2MB by default
extern uint64_t S3_ZIP_DECOMPRESS_CHUNKSIZE;

class DecompressReader : public Reader {
   public:
    DecompressReader();
    virtual ~DecompressReader();

    virtual void open(const S3Params &params);

    // read() attempts to read up to count bytes into the buffer.
    // Return 0 if EOF. Throw exception if encounters errors.
    virtual uint64_t read(char *buf, uint64_t count);

    // This should be reentrant, has no side effects when called multiple times.
    virtual void close();

    void setReader(Reader *reader);

    void resizeDecompressReaderBuffer(uint64_t size);

   private:
    void decompress();

    uint64_t getDecompressedBytesNum() {
        return S3_ZIP_DECOMPRESS_CHUNKSIZE - this->zstream.avail_out;
    }

    Reader *reader;

    // zlib related variables.
    z_stream zstream;
    char *in;            // Input buffer for decompression.
    char *out;           // Output buffer for decompression.
    uint64_t outOffset;  // Next position to read in out buffer.

    bool isClosed;
};

#endif /* INCLUDE_DECOMPRESS_READER_H_ */

相关信息

greenplumn 源码目录

相关文章

greenplumn compress_writer 源码

greenplumn gpcheckcloud 源码

greenplumn gpcommon 源码

greenplumn gpreader 源码

greenplumn gpwriter 源码

greenplumn reader 源码

greenplumn restful_service 源码

greenplumn s3bucket_reader 源码

greenplumn s3common_headers 源码

greenplumn s3common_reader 源码

0  赞