fork of https://github.com/oxigraph/rocksdb and https://github.com/facebook/rocksdb for nextgraph and oxigraph
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.2 KiB
52 lines
1.2 KiB
// Copyright (c) 2009- Facebook
|
|
// Distributed under the Thrift Software License
|
|
//
|
|
// See accompanying file LICENSE or visit the Thrift site at:
|
|
// http://developers.facebook.com/thrift/
|
|
|
|
#ifndef _THRIFT_TRANSPORT_THDFSFILETRANSPORT_H_
|
|
#define _THRIFT_TRANSPORT_THDFSFILETRANSPORT_H_
|
|
|
|
#include "thrift/lib/cpp/transport/TTransport.h"
|
|
#include "thrift/lib/cpp/transport/TVirtualTransport.h"
|
|
#include "HDFS.h"
|
|
#include <string>
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
namespace apache { namespace thrift { namespace transport {
|
|
/**
|
|
* Dead-simple wrapper around libhdfs.
|
|
* THDFSFileTransport only takes care of read/write,
|
|
* and leaves allocation/release to HDFS and HDFSFile.
|
|
* @author Li Zhang <lzhang@facebook.com>
|
|
*/
|
|
class THDFSFileTransport : public TVirtualTransport<THDFSFileTransport> {
|
|
public:
|
|
|
|
THDFSFileTransport(boost::shared_ptr<HDFSFile> hdfsFile) : hdfsFile_(hdfsFile) {
|
|
}
|
|
|
|
~THDFSFileTransport() {
|
|
}
|
|
|
|
bool isOpen() {
|
|
return hdfsFile_->isOpen();
|
|
}
|
|
|
|
void open();
|
|
|
|
void close();
|
|
|
|
uint32_t read(uint8_t* buf, uint32_t len);
|
|
|
|
void write(const uint8_t* buf, uint32_t len);
|
|
|
|
protected:
|
|
boost::shared_ptr<HDFSFile> hdfsFile_;
|
|
};
|
|
|
|
}}} // apache::thrift::transport
|
|
|
|
#endif // _THRIFT_TRANSPORT_THDFSFILETRANSPORT_H_
|
|
|