ThriftHadoopFileSystem_server.skeleton.cpp
上传用户:quxuerui
上传日期:2018-01-08
资源大小:41811k
文件大小:4k
源码类别:
网格计算
开发平台:
Java
- // This autogenerated skeleton file illustrates how to build a server.
- // You should copy it to another filename to avoid overwriting it.
- #include "ThriftHadoopFileSystem.h"
- #include <protocol/TBinaryProtocol.h>
- #include <server/TSimpleServer.h>
- #include <transport/TServerSocket.h>
- #include <transport/TBufferTransports.h>
- using namespace facebook::thrift;
- using namespace facebook::thrift::protocol;
- using namespace facebook::thrift::transport;
- using namespace facebook::thrift::server;
- using boost::shared_ptr;
- class ThriftHadoopFileSystemHandler : virtual public ThriftHadoopFileSystemIf {
- public:
- ThriftHadoopFileSystemHandler() {
- // Your initialization goes here
- }
- void setInactivityTimeoutPeriod(const int64_t periodInSeconds) {
- // Your implementation goes here
- printf("setInactivityTimeoutPeriodn");
- }
- void shutdown(const int32_t status) {
- // Your implementation goes here
- printf("shutdownn");
- }
- void create(ThriftHandle& _return, const Pathname& path) {
- // Your implementation goes here
- printf("createn");
- }
- void createFile(ThriftHandle& _return, const Pathname& path, const int16_t mode, const bool overwrite, const int32_t bufferSize, const int16_t block_replication, const int64_t blocksize) {
- // Your implementation goes here
- printf("createFilen");
- }
- void open(ThriftHandle& _return, const Pathname& path) {
- // Your implementation goes here
- printf("openn");
- }
- void append(ThriftHandle& _return, const Pathname& path) {
- // Your implementation goes here
- printf("appendn");
- }
- bool write(const ThriftHandle& handle, const std::string& data) {
- // Your implementation goes here
- printf("writen");
- }
- void read(std::string& _return, const ThriftHandle& handle, const int64_t offset, const int32_t size) {
- // Your implementation goes here
- printf("readn");
- }
- bool close(const ThriftHandle& out) {
- // Your implementation goes here
- printf("closen");
- }
- bool rm(const Pathname& path, const bool recursive) {
- // Your implementation goes here
- printf("rmn");
- }
- bool rename(const Pathname& path, const Pathname& dest) {
- // Your implementation goes here
- printf("renamen");
- }
- bool mkdirs(const Pathname& path) {
- // Your implementation goes here
- printf("mkdirsn");
- }
- bool exists(const Pathname& path) {
- // Your implementation goes here
- printf("existsn");
- }
- void stat(FileStatus& _return, const Pathname& path) {
- // Your implementation goes here
- printf("statn");
- }
- void listStatus(std::vector<FileStatus> & _return, const Pathname& path) {
- // Your implementation goes here
- printf("listStatusn");
- }
- void chmod(const Pathname& path, const int16_t mode) {
- // Your implementation goes here
- printf("chmodn");
- }
- void chown(const Pathname& path, const std::string& owner, const std::string& group) {
- // Your implementation goes here
- printf("chownn");
- }
- void setReplication(const Pathname& path, const int16_t replication) {
- // Your implementation goes here
- printf("setReplicationn");
- }
- void getFileBlockLocations(std::vector<BlockLocation> & _return, const Pathname& path, const int64_t start, const int64_t length) {
- // Your implementation goes here
- printf("getFileBlockLocationsn");
- }
- };
- int main(int argc, char **argv) {
- int port = 9090;
- shared_ptr<ThriftHadoopFileSystemHandler> handler(new ThriftHadoopFileSystemHandler());
- shared_ptr<TProcessor> processor(new ThriftHadoopFileSystemProcessor(handler));
- shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
- shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
- shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
- TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);
- server.serve();
- return 0;
- }