lfs----------

#include "LfsClient.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <assert.h>
#include  "Log.h"
#include "LfsNetClient.h"
namespace lfs{
LfsClient::LfsClient ():m_imp(new  LfsNetClient)
{
} 
LfsClient::~LfsClient ()
{
	delete m_imp;
} 
int LfsClient::Initialize(const char* nsAddr)
{
	LOG_INFO("Initialized");
	// Global Namespace Init --> Maybe read from Config file
	assert(m_imp != NULL);
	return m_imp->Initialize(nsAddr);
}
int LfsClient::Close(const int fd)
{
	assert(m_imp != NULL);
	return m_imp->Close(fd);
}
int LfsClient::Open(const char* fileName, const int flags)
{
	assert(m_imp != NULL);
	return m_imp->Open(fileName, flags);
}
int LfsClient::Write(const int fd, const void* data, int64_t count)
{
	assert(m_imp != NULL);
	return m_imp->Write(fd, data, count);
}
int LfsClient::Read(const int fd, void* buf, const int64_t count)
{
	assert(m_imp != NULL);
	return m_imp->Read(fd, buf, count);
}
int LfsClient::Unlink(const char* fileName)
{
	assert(m_imp != NULL);
	return m_imp->Unlink(fileName);
}
int LfsClient::Fstat(const int fd, common::FileInfo& buf)
{
	assert(m_imp != NULL);
	return m_imp->Fstat(fd, buf);
}
int64_t LfsClient::SaveFile(char* fileName, const char* localFile, const int32_t flag, const char* nsAddr)
{
	assert(m_imp != NULL);
	return m_imp->SaveFile(fileName, localFile, flag, nsAddr);
}
int LfsClient::FetchFile(const char* localFile, const char* fileName, const char* nsAddr)
{
	assert(m_imp != NULL);
	return m_imp->FetchFile(localFile, fileName, nsAddr);
}
}/* end namespace lfs */
/**
 * Autogenerated by Thrift Compiler (0.8.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
#include "Lfs_constants.h"
namespace lfs { namespace rpc {
const LfsConstants g_Lfs_constants;
LfsConstants::LfsConstants() {
}
}} // namespace
#include "LfsLocalfsImp.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include  "Log.h"
namespace lfs{
int LfsLocalfsImp::Initialize(const char* nsAddr)
{
	LOG_INFO("Initialized");
	// Global Namespace Init --> Maybe read from Config file
	return 0;
}
int LfsLocalfsImp::Close(const int fd)
{
	if(fd < 0)
	{
		LOG_ERROR("fd error!");
		return -1;
	}
	return ::close(fd);
}
int LfsLocalfsImp::Open(const char* fileName, const int flags)
{
	if(fileName == NULL)
	{
		LOG_ERROR("file Name NULL");
		return -1;
	}
	return ::open(fileName, flags);
}
int LfsLocalfsImp::Write(const int fd, const void* data, int64_t count)
{
	if(fd < 0 || data == NULL || count < 0)
	{
		LOG_ERROR("fd error or data NULL or count < 0!");
		return -1;
	}
	return ::write(fd, data, count);
}
int LfsLocalfsImp::Read(const int fd, void* buf, const int64_t count)
{
	if(fd < 0 || buf == NULL || count < 0)
	{
		LOG_ERROR("fd error or data NULL or count < 0!");
		return -1;
	}
	return ::read(fd, buf, count);
}
int LfsLocalfsImp::Unlink(const char* fileName)
{
	if(fileName == NULL)
	{
		LOG_ERROR("fileName NULL");
		return -1;
	}
	return unlink(fileName);
}
int LfsLocalfsImp::Fstat(const int fd, common::FileInfo& buf)
{
	struct stat fst;
	int ret = ::fstat(fd, &fst);
	if(ret != 0 )
	{
		LOG_ERROR("get the file info error from OS!");	
		return -1;
	}
	buf.ID = fst.st_ino;
	buf.Size = fst.st_size;
    buf.UsedSize = fst.st_blksize * fst.st_blocks;
    buf.ModifyTime = fst.st_mtime;
    buf.CreateTime = fst.st_ctime;
	return 0;
}
int64_t LfsLocalfsImp::SaveFile(char* fileName, const char* localFile, const int32_t flag, const char* nsAddr)
{
	LOG_INFO("Not Support, save file....");
	return 0;
}
int LfsLocalfsImp::FetchFile(const char* localFile, const char* fileName, const char* nsAddr)
{
	LOG_INFO("Not Support, fetch file....");
	return 0;
}
}/* end namespace lfs */
#include "LfsNetClient.h"
#include <transport/TSocket.h>
#include <transport/TTransportUtils.h>
#include <protocol/TBinaryProtocol.h>
#include  "Log.h"
namespace lfs{
using namespace apache::thrift::transport ;
using namespace apache::thrift ;
using namespace apache::thrift::protocol ;
LfsNetClient::LfsNetClient()
{
}
LfsNetClient::~LfsNetClient()
{
}
int LfsNetClient::Initialize(const char* nsAddr)
{
	LOG_INFO("Initialized");
	// Global Namespace Init --> Maybe read from Config file
	this->CreateTransport(nsAddr);
	return 0;
}
int LfsNetClient::Close(const int fd)
{
	if(fd < 0)
	{
		LOG_ERROR("fd error!");
		return -1;
	}
	if(m_client == NULL)
	{
		LOG_ERROR("client is NULL, network disconnected!");
		return -1;
	}
	int ret = m_client->Close(fd);
	if(ret != 0)
	{
		LOG_ERROR("call remote Close error!");
		return -1;
	}
	m_transport->close();
	LOG_INFO("disconnected with remote server!");
	return 0;
}
int LfsNetClient::Open(const char* fileName, const int flags)
{
	if(fileName == NULL)
	{
		LOG_ERROR("file Name NULL");
		return -1;
	}
	if(m_transport == NULL)
	{
		LOG_ERROR("transport is NULL, network not connected!, pls initialize first");
		return -1;
	}
	m_transport->open();
	LOG_INFO("connected to remote server!");
	if(m_client == NULL)
	{
		LOG_ERROR("client connect to server failed!");
		return -1;
	}
	
	return m_client->Open(std::string(fileName), flags);
}
int LfsNetClient::Write(const int fd, const void* data, int64_t count)
{
	if(fd < 0 || data == NULL || count < 0)
	{
		LOG_ERROR("fd error or data NULL or count < 0!");
		return -1;
	}
	if(m_client == NULL)
	{
		LOG_ERROR("transport is NULL, network not connected!");
		return -1;
	}
	std::string strData;
	strData.assign((const char *) data, ((const char *)data) + count);
	return m_client->Write(fd, strData, count);
}
int LfsNetClient::Read(const int fd, void* buf, const int64_t count)
{
	if(fd < 0 || buf == NULL || count < 0)
	{
		LOG_ERROR("fd error or data NULL or count < 0!");
		return -1;
	}
	if(m_client == NULL)
	{
		LOG_ERROR("transport is NULL, network not connected!");
		return -1;
	}
	lfs::rpc::ReadBuf readData;
	m_client->Read(readData, fd, count);
	if(count < readData.count)
	{
		LOG_ERROR("read too much data from server, maybe got a error!");
		return -1;
	}
	memcpy(buf, readData.data.c_str(), readData.count);
	return int(readData.count);
}
int LfsNetClient::Unlink(const char* fileName)
{
	if(fileName == NULL)
	{
		LOG_ERROR("fileName NULL");
		return -1;
	}
	return m_client->Unlink(std::string(fileName));
}
int LfsNetClient::Fstat(const int fd, common::FileInfo& buf)
{
	lfs::rpc::FileInfo ret;
	m_client->Fstat(ret, fd);
	buf.ID = ret.ID;
	buf.Size = ret.Size;
    buf.UsedSize = ret.UsedSize;
    buf.ModifyTime = ret.ModifyTime;
    buf.CreateTime = ret.CreateTime;
	return 0;
}
int64_t LfsNetClient::SaveFile(char* fileName, const char* localFile, const int32_t flag, const char* nsAddr)
{
	LOG_INFO("Not Support, save file....");
	return 0;
}
int LfsNetClient::FetchFile(const char* localFile, const char* fileName, const char* nsAddr)
{
	LOG_INFO("Not Support, fetch file....");
	return 0;
}
int LfsNetClient::CreateTransport(const char * nsAddr)
{
	// get 
	std::string ip = "127.0.0.1";
	int port = 9090;
	m_ip = ip;
	m_port = port;
	try
	{
		boost::shared_ptr<TSocket> clientSocket( new TSocket(m_ip, m_port));
		m_transport.reset((new TBufferedTransport(clientSocket)));
		boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(m_transport));
		m_client.reset(new lfs::rpc::LfsServiceClient(protocol)) ;	
	}
	catch(...)
	{
		LOG_ERROR("create lfs client (thrift) error!");
		return -1;
	}
	return 0;
}
}/* end namespace lfs */
/**
 * Autogenerated by Thrift Compiler (0.8.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
#include "LfsService.h"
namespace lfs { namespace rpc {
uint32_t LfsService_Initialize_args::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->ns_addr);
          this->__isset.ns_addr = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Initialize_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Initialize_args");
  xfer += oprot->writeFieldBegin("ns_addr", ::apache::thrift::protocol::T_STRING, 1);
  xfer += oprot->writeString(this->ns_addr);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Initialize_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Initialize_pargs");
  xfer += oprot->writeFieldBegin("ns_addr", ::apache::thrift::protocol::T_STRING, 1);
  xfer += oprot->writeString((*(this->ns_addr)));
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Initialize_result::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->success);
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Initialize_result::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Initialize_result");
  if (this->__isset.success) {
    xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_I32, 0);
    xfer += oprot->writeI32(this->success);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Initialize_presult::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32((*(this->success)));
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Close_args::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->fd);
          this->__isset.fd = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Close_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Close_args");
  xfer += oprot->writeFieldBegin("fd", ::apache::thrift::protocol::T_I32, 1);
  xfer += oprot->writeI32(this->fd);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Close_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Close_pargs");
  xfer += oprot->writeFieldBegin("fd", ::apache::thrift::protocol::T_I32, 1);
  xfer += oprot->writeI32((*(this->fd)));
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Close_result::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->success);
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Close_result::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Close_result");
  if (this->__isset.success) {
    xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_I32, 0);
    xfer += oprot->writeI32(this->success);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Close_presult::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32((*(this->success)));
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Open_args::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->fileName);
          this->__isset.fileName = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->flags);
          this->__isset.flags = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Open_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Open_args");
  xfer += oprot->writeFieldBegin("fileName", ::apache::thrift::protocol::T_STRING, 1);
  xfer += oprot->writeString(this->fileName);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldBegin("flags", ::apache::thrift::protocol::T_I32, 2);
  xfer += oprot->writeI32(this->flags);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Open_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Open_pargs");
  xfer += oprot->writeFieldBegin("fileName", ::apache::thrift::protocol::T_STRING, 1);
  xfer += oprot->writeString((*(this->fileName)));
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldBegin("flags", ::apache::thrift::protocol::T_I32, 2);
  xfer += oprot->writeI32((*(this->flags)));
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Open_result::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->success);
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Open_result::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Open_result");
  if (this->__isset.success) {
    xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_I32, 0);
    xfer += oprot->writeI32(this->success);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Open_presult::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32((*(this->success)));
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Write_args::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->fd);
          this->__isset.fd = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->data);
          this->__isset.data = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->count);
          this->__isset.count = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Write_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Write_args");
  xfer += oprot->writeFieldBegin("fd", ::apache::thrift::protocol::T_I32, 1);
  xfer += oprot->writeI32(this->fd);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldBegin("data", ::apache::thrift::protocol::T_STRING, 2);
  xfer += oprot->writeString(this->data);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldBegin("count", ::apache::thrift::protocol::T_I64, 3);
  xfer += oprot->writeI64(this->count);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Write_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Write_pargs");
  xfer += oprot->writeFieldBegin("fd", ::apache::thrift::protocol::T_I32, 1);
  xfer += oprot->writeI32((*(this->fd)));
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldBegin("data", ::apache::thrift::protocol::T_STRING, 2);
  xfer += oprot->writeString((*(this->data)));
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldBegin("count", ::apache::thrift::protocol::T_I64, 3);
  xfer += oprot->writeI64((*(this->count)));
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Write_result::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->success);
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Write_result::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Write_result");
  if (this->__isset.success) {
    xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_I32, 0);
    xfer += oprot->writeI32(this->success);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Write_presult::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32((*(this->success)));
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Read_args::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->fd);
          this->__isset.fd = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->cap);
          this->__isset.cap = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Read_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Read_args");
  xfer += oprot->writeFieldBegin("fd", ::apache::thrift::protocol::T_I32, 1);
  xfer += oprot->writeI32(this->fd);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldBegin("cap", ::apache::thrift::protocol::T_I64, 2);
  xfer += oprot->writeI64(this->cap);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Read_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Read_pargs");
  xfer += oprot->writeFieldBegin("fd", ::apache::thrift::protocol::T_I32, 1);
  xfer += oprot->writeI32((*(this->fd)));
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldBegin("cap", ::apache::thrift::protocol::T_I64, 2);
  xfer += oprot->writeI64((*(this->cap)));
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Read_result::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->success.read(iprot);
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Read_result::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Read_result");
  if (this->__isset.success) {
    xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0);
    xfer += this->success.write(oprot);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Read_presult::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += (*(this->success)).read(iprot);
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Unlink_args::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->fileName);
          this->__isset.fileName = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Unlink_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Unlink_args");
  xfer += oprot->writeFieldBegin("fileName", ::apache::thrift::protocol::T_STRING, 1);
  xfer += oprot->writeString(this->fileName);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Unlink_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Unlink_pargs");
  xfer += oprot->writeFieldBegin("fileName", ::apache::thrift::protocol::T_STRING, 1);
  xfer += oprot->writeString((*(this->fileName)));
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Unlink_result::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->success);
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Unlink_result::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Unlink_result");
  if (this->__isset.success) {
    xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_I32, 0);
    xfer += oprot->writeI32(this->success);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Unlink_presult::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32((*(this->success)));
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Fstat_args::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->fd);
          this->__isset.fd = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Fstat_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Fstat_args");
  xfer += oprot->writeFieldBegin("fd", ::apache::thrift::protocol::T_I32, 1);
  xfer += oprot->writeI32(this->fd);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Fstat_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Fstat_pargs");
  xfer += oprot->writeFieldBegin("fd", ::apache::thrift::protocol::T_I32, 1);
  xfer += oprot->writeI32((*(this->fd)));
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Fstat_result::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += this->success.read(iprot);
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t LfsService_Fstat_result::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("LfsService_Fstat_result");
  if (this->__isset.success) {
    xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0);
    xfer += this->success.write(oprot);
    xfer += oprot->writeFieldEnd();
  }
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
uint32_t LfsService_Fstat_presult::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 0:
        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
          xfer += (*(this->success)).read(iprot);
          this->__isset.success = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
int32_t LfsServiceClient::Initialize(const std::string& ns_addr)
{
  send_Initialize(ns_addr);
  return recv_Initialize();
}
void LfsServiceClient::send_Initialize(const std::string& ns_addr)
{
  int32_t cseqid = 0;
  oprot_->writeMessageBegin("Initialize", ::apache::thrift::protocol::T_CALL, cseqid);
  LfsService_Initialize_pargs args;
  args.ns_addr = &ns_addr;
  args.write(oprot_);
  oprot_->writeMessageEnd();
  oprot_->getTransport()->writeEnd();
  oprot_->getTransport()->flush();
}
int32_t LfsServiceClient::recv_Initialize()
{
  int32_t rseqid = 0;
  std::string fname;
  ::apache::thrift::protocol::TMessageType mtype;
  iprot_->readMessageBegin(fname, mtype, rseqid);
  if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
    ::apache::thrift::TApplicationException x;
    x.read(iprot_);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
    throw x;
  }
  if (mtype != ::apache::thrift::protocol::T_REPLY) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  if (fname.compare("Initialize") != 0) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  int32_t _return;
  LfsService_Initialize_presult result;
  result.success = &_return;
  result.read(iprot_);
  iprot_->readMessageEnd();
  iprot_->getTransport()->readEnd();
  if (result.__isset.success) {
    return _return;
  }
  throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "Initialize failed: unknown result");
}
int32_t LfsServiceClient::Close(const int32_t fd)
{
  send_Close(fd);
  return recv_Close();
}
void LfsServiceClient::send_Close(const int32_t fd)
{
  int32_t cseqid = 0;
  oprot_->writeMessageBegin("Close", ::apache::thrift::protocol::T_CALL, cseqid);
  LfsService_Close_pargs args;
  args.fd = &fd;
  args.write(oprot_);
  oprot_->writeMessageEnd();
  oprot_->getTransport()->writeEnd();
  oprot_->getTransport()->flush();
}
int32_t LfsServiceClient::recv_Close()
{
  int32_t rseqid = 0;
  std::string fname;
  ::apache::thrift::protocol::TMessageType mtype;
  iprot_->readMessageBegin(fname, mtype, rseqid);
  if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
    ::apache::thrift::TApplicationException x;
    x.read(iprot_);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
    throw x;
  }
  if (mtype != ::apache::thrift::protocol::T_REPLY) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  if (fname.compare("Close") != 0) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  int32_t _return;
  LfsService_Close_presult result;
  result.success = &_return;
  result.read(iprot_);
  iprot_->readMessageEnd();
  iprot_->getTransport()->readEnd();
  if (result.__isset.success) {
    return _return;
  }
  throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "Close failed: unknown result");
}
int32_t LfsServiceClient::Open(const std::string& fileName, const int32_t flags)
{
  send_Open(fileName, flags);
  return recv_Open();
}
void LfsServiceClient::send_Open(const std::string& fileName, const int32_t flags)
{
  int32_t cseqid = 0;
  oprot_->writeMessageBegin("Open", ::apache::thrift::protocol::T_CALL, cseqid);
  LfsService_Open_pargs args;
  args.fileName = &fileName;
  args.flags = &flags;
  args.write(oprot_);
  oprot_->writeMessageEnd();
  oprot_->getTransport()->writeEnd();
  oprot_->getTransport()->flush();
}
int32_t LfsServiceClient::recv_Open()
{
  int32_t rseqid = 0;
  std::string fname;
  ::apache::thrift::protocol::TMessageType mtype;
  iprot_->readMessageBegin(fname, mtype, rseqid);
  if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
    ::apache::thrift::TApplicationException x;
    x.read(iprot_);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
    throw x;
  }
  if (mtype != ::apache::thrift::protocol::T_REPLY) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  if (fname.compare("Open") != 0) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  int32_t _return;
  LfsService_Open_presult result;
  result.success = &_return;
  result.read(iprot_);
  iprot_->readMessageEnd();
  iprot_->getTransport()->readEnd();
  if (result.__isset.success) {
    return _return;
  }
  throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "Open failed: unknown result");
}
int32_t LfsServiceClient::Write(const int32_t fd, const std::string& data, const int64_t count)
{
  send_Write(fd, data, count);
  return recv_Write();
}
void LfsServiceClient::send_Write(const int32_t fd, const std::string& data, const int64_t count)
{
  int32_t cseqid = 0;
  oprot_->writeMessageBegin("Write", ::apache::thrift::protocol::T_CALL, cseqid);
  LfsService_Write_pargs args;
  args.fd = &fd;
  args.data = &data;
  args.count = &count;
  args.write(oprot_);
  oprot_->writeMessageEnd();
  oprot_->getTransport()->writeEnd();
  oprot_->getTransport()->flush();
}
int32_t LfsServiceClient::recv_Write()
{
  int32_t rseqid = 0;
  std::string fname;
  ::apache::thrift::protocol::TMessageType mtype;
  iprot_->readMessageBegin(fname, mtype, rseqid);
  if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
    ::apache::thrift::TApplicationException x;
    x.read(iprot_);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
    throw x;
  }
  if (mtype != ::apache::thrift::protocol::T_REPLY) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  if (fname.compare("Write") != 0) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  int32_t _return;
  LfsService_Write_presult result;
  result.success = &_return;
  result.read(iprot_);
  iprot_->readMessageEnd();
  iprot_->getTransport()->readEnd();
  if (result.__isset.success) {
    return _return;
  }
  throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "Write failed: unknown result");
}
void LfsServiceClient::Read(ReadBuf& _return, const int32_t fd, const int64_t cap)
{
  send_Read(fd, cap);
  recv_Read(_return);
}
void LfsServiceClient::send_Read(const int32_t fd, const int64_t cap)
{
  int32_t cseqid = 0;
  oprot_->writeMessageBegin("Read", ::apache::thrift::protocol::T_CALL, cseqid);
  LfsService_Read_pargs args;
  args.fd = &fd;
  args.cap = &cap;
  args.write(oprot_);
  oprot_->writeMessageEnd();
  oprot_->getTransport()->writeEnd();
  oprot_->getTransport()->flush();
}
void LfsServiceClient::recv_Read(ReadBuf& _return)
{
  int32_t rseqid = 0;
  std::string fname;
  ::apache::thrift::protocol::TMessageType mtype;
  iprot_->readMessageBegin(fname, mtype, rseqid);
  if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
    ::apache::thrift::TApplicationException x;
    x.read(iprot_);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
    throw x;
  }
  if (mtype != ::apache::thrift::protocol::T_REPLY) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  if (fname.compare("Read") != 0) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  LfsService_Read_presult result;
  result.success = &_return;
  result.read(iprot_);
  iprot_->readMessageEnd();
  iprot_->getTransport()->readEnd();
  if (result.__isset.success) {
    // _return pointer has now been filled
    return;
  }
  throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "Read failed: unknown result");
}
int32_t LfsServiceClient::Unlink(const std::string& fileName)
{
  send_Unlink(fileName);
  return recv_Unlink();
}
void LfsServiceClient::send_Unlink(const std::string& fileName)
{
  int32_t cseqid = 0;
  oprot_->writeMessageBegin("Unlink", ::apache::thrift::protocol::T_CALL, cseqid);
  LfsService_Unlink_pargs args;
  args.fileName = &fileName;
  args.write(oprot_);
  oprot_->writeMessageEnd();
  oprot_->getTransport()->writeEnd();
  oprot_->getTransport()->flush();
}
int32_t LfsServiceClient::recv_Unlink()
{
  int32_t rseqid = 0;
  std::string fname;
  ::apache::thrift::protocol::TMessageType mtype;
  iprot_->readMessageBegin(fname, mtype, rseqid);
  if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
    ::apache::thrift::TApplicationException x;
    x.read(iprot_);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
    throw x;
  }
  if (mtype != ::apache::thrift::protocol::T_REPLY) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  if (fname.compare("Unlink") != 0) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  int32_t _return;
  LfsService_Unlink_presult result;
  result.success = &_return;
  result.read(iprot_);
  iprot_->readMessageEnd();
  iprot_->getTransport()->readEnd();
  if (result.__isset.success) {
    return _return;
  }
  throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "Unlink failed: unknown result");
}
void LfsServiceClient::Fstat(FileInfo& _return, const int32_t fd)
{
  send_Fstat(fd);
  recv_Fstat(_return);
}
void LfsServiceClient::send_Fstat(const int32_t fd)
{
  int32_t cseqid = 0;
  oprot_->writeMessageBegin("Fstat", ::apache::thrift::protocol::T_CALL, cseqid);
  LfsService_Fstat_pargs args;
  args.fd = &fd;
  args.write(oprot_);
  oprot_->writeMessageEnd();
  oprot_->getTransport()->writeEnd();
  oprot_->getTransport()->flush();
}
void LfsServiceClient::recv_Fstat(FileInfo& _return)
{
  int32_t rseqid = 0;
  std::string fname;
  ::apache::thrift::protocol::TMessageType mtype;
  iprot_->readMessageBegin(fname, mtype, rseqid);
  if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
    ::apache::thrift::TApplicationException x;
    x.read(iprot_);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
    throw x;
  }
  if (mtype != ::apache::thrift::protocol::T_REPLY) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  if (fname.compare("Fstat") != 0) {
    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
    iprot_->readMessageEnd();
    iprot_->getTransport()->readEnd();
  }
  LfsService_Fstat_presult result;
  result.success = &_return;
  result.read(iprot_);
  iprot_->readMessageEnd();
  iprot_->getTransport()->readEnd();
  if (result.__isset.success) {
    // _return pointer has now been filled
    return;
  }
  throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "Fstat failed: unknown result");
}
bool LfsServiceProcessor::process(boost::shared_ptr<apache::thrift::protocol::TProtocol> piprot, boost::shared_ptr<apache::thrift::protocol::TProtocol> poprot, void* callContext) {
  ::apache::thrift::protocol::TProtocol* iprot = piprot.get();
  ::apache::thrift::protocol::TProtocol* oprot = poprot.get();
  std::string fname;
  ::apache::thrift::protocol::TMessageType mtype;
  int32_t seqid;
  iprot->readMessageBegin(fname, mtype, seqid);
  if (mtype != ::apache::thrift::protocol::T_CALL && mtype != ::apache::thrift::protocol::T_ONEWAY) {
    iprot->skip(::apache::thrift::protocol::T_STRUCT);
    iprot->readMessageEnd();
    iprot->getTransport()->readEnd();
    ::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::INVALID_MESSAGE_TYPE);
    oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid);
    x.write(oprot);
    oprot->writeMessageEnd();
    oprot->getTransport()->writeEnd();
    oprot->getTransport()->flush();
    return true;
  }
  return process_fn(iprot, oprot, fname, seqid, callContext);
}
bool LfsServiceProcessor::process_fn(apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot, std::string& fname, int32_t seqid, void* callContext) {
  std::map<std::string, void (LfsServiceProcessor::*)(int32_t, apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, void*)>::iterator pfn;
  pfn = processMap_.find(fname);
  if (pfn == processMap_.end()) {
    iprot->skip(apache::thrift::protocol::T_STRUCT);
    iprot->readMessageEnd();
    iprot->getTransport()->readEnd();
    ::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::UNKNOWN_METHOD, "Invalid method name: '"+fname+"'");
    oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid);
    x.write(oprot);
    oprot->writeMessageEnd();
    oprot->getTransport()->writeEnd();
    oprot->getTransport()->flush();
    return true;
  }
  (this->*(pfn->second))(seqid, iprot, oprot, callContext);
  return true;
}
void LfsServiceProcessor::process_Initialize(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
  void* ctx = NULL;
  if (this->eventHandler_.get() != NULL) {
    ctx = this->eventHandler_->getContext("LfsService.Initialize", callContext);
  }
  apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "LfsService.Initialize");
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preRead(ctx, "LfsService.Initialize");
  }
  LfsService_Initialize_args args;
  args.read(iprot);
  iprot->readMessageEnd();
  uint32_t bytes = iprot->getTransport()->readEnd();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postRead(ctx, "LfsService.Initialize", bytes);
  }
  LfsService_Initialize_result result;
  try {
    result.success = iface_->Initialize(args.ns_addr);
    result.__isset.success = true;
  } catch (const std::exception& e) {
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->handlerError(ctx, "LfsService.Initialize");
    }
    apache::thrift::TApplicationException x(e.what());
    oprot->writeMessageBegin("Initialize", apache::thrift::protocol::T_EXCEPTION, seqid);
    x.write(oprot);
    oprot->writeMessageEnd();
    oprot->getTransport()->writeEnd();
    oprot->getTransport()->flush();
    return;
  }
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preWrite(ctx, "LfsService.Initialize");
  }
  oprot->writeMessageBegin("Initialize", apache::thrift::protocol::T_REPLY, seqid);
  result.write(oprot);
  oprot->writeMessageEnd();
  bytes = oprot->getTransport()->writeEnd();
  oprot->getTransport()->flush();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postWrite(ctx, "LfsService.Initialize", bytes);
  }
}
void LfsServiceProcessor::process_Close(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
  void* ctx = NULL;
  if (this->eventHandler_.get() != NULL) {
    ctx = this->eventHandler_->getContext("LfsService.Close", callContext);
  }
  apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "LfsService.Close");
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preRead(ctx, "LfsService.Close");
  }
  LfsService_Close_args args;
  args.read(iprot);
  iprot->readMessageEnd();
  uint32_t bytes = iprot->getTransport()->readEnd();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postRead(ctx, "LfsService.Close", bytes);
  }
  LfsService_Close_result result;
  try {
    result.success = iface_->Close(args.fd);
    result.__isset.success = true;
  } catch (const std::exception& e) {
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->handlerError(ctx, "LfsService.Close");
    }
    apache::thrift::TApplicationException x(e.what());
    oprot->writeMessageBegin("Close", apache::thrift::protocol::T_EXCEPTION, seqid);
    x.write(oprot);
    oprot->writeMessageEnd();
    oprot->getTransport()->writeEnd();
    oprot->getTransport()->flush();
    return;
  }
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preWrite(ctx, "LfsService.Close");
  }
  oprot->writeMessageBegin("Close", apache::thrift::protocol::T_REPLY, seqid);
  result.write(oprot);
  oprot->writeMessageEnd();
  bytes = oprot->getTransport()->writeEnd();
  oprot->getTransport()->flush();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postWrite(ctx, "LfsService.Close", bytes);
  }
}
void LfsServiceProcessor::process_Open(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
  void* ctx = NULL;
  if (this->eventHandler_.get() != NULL) {
    ctx = this->eventHandler_->getContext("LfsService.Open", callContext);
  }
  apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "LfsService.Open");
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preRead(ctx, "LfsService.Open");
  }
  LfsService_Open_args args;
  args.read(iprot);
  iprot->readMessageEnd();
  uint32_t bytes = iprot->getTransport()->readEnd();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postRead(ctx, "LfsService.Open", bytes);
  }
  LfsService_Open_result result;
  try {
    result.success = iface_->Open(args.fileName, args.flags);
    result.__isset.success = true;
  } catch (const std::exception& e) {
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->handlerError(ctx, "LfsService.Open");
    }
    apache::thrift::TApplicationException x(e.what());
    oprot->writeMessageBegin("Open", apache::thrift::protocol::T_EXCEPTION, seqid);
    x.write(oprot);
    oprot->writeMessageEnd();
    oprot->getTransport()->writeEnd();
    oprot->getTransport()->flush();
    return;
  }
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preWrite(ctx, "LfsService.Open");
  }
  oprot->writeMessageBegin("Open", apache::thrift::protocol::T_REPLY, seqid);
  result.write(oprot);
  oprot->writeMessageEnd();
  bytes = oprot->getTransport()->writeEnd();
  oprot->getTransport()->flush();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postWrite(ctx, "LfsService.Open", bytes);
  }
}
void LfsServiceProcessor::process_Write(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
  void* ctx = NULL;
  if (this->eventHandler_.get() != NULL) {
    ctx = this->eventHandler_->getContext("LfsService.Write", callContext);
  }
  apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "LfsService.Write");
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preRead(ctx, "LfsService.Write");
  }
  LfsService_Write_args args;
  args.read(iprot);
  iprot->readMessageEnd();
  uint32_t bytes = iprot->getTransport()->readEnd();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postRead(ctx, "LfsService.Write", bytes);
  }
  LfsService_Write_result result;
  try {
    result.success = iface_->Write(args.fd, args.data, args.count);
    result.__isset.success = true;
  } catch (const std::exception& e) {
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->handlerError(ctx, "LfsService.Write");
    }
    apache::thrift::TApplicationException x(e.what());
    oprot->writeMessageBegin("Write", apache::thrift::protocol::T_EXCEPTION, seqid);
    x.write(oprot);
    oprot->writeMessageEnd();
    oprot->getTransport()->writeEnd();
    oprot->getTransport()->flush();
    return;
  }
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preWrite(ctx, "LfsService.Write");
  }
  oprot->writeMessageBegin("Write", apache::thrift::protocol::T_REPLY, seqid);
  result.write(oprot);
  oprot->writeMessageEnd();
  bytes = oprot->getTransport()->writeEnd();
  oprot->getTransport()->flush();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postWrite(ctx, "LfsService.Write", bytes);
  }
}
void LfsServiceProcessor::process_Read(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
  void* ctx = NULL;
  if (this->eventHandler_.get() != NULL) {
    ctx = this->eventHandler_->getContext("LfsService.Read", callContext);
  }
  apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "LfsService.Read");
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preRead(ctx, "LfsService.Read");
  }
  LfsService_Read_args args;
  args.read(iprot);
  iprot->readMessageEnd();
  uint32_t bytes = iprot->getTransport()->readEnd();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postRead(ctx, "LfsService.Read", bytes);
  }
  LfsService_Read_result result;
  try {
    iface_->Read(result.success, args.fd, args.cap);
    result.__isset.success = true;
  } catch (const std::exception& e) {
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->handlerError(ctx, "LfsService.Read");
    }
    apache::thrift::TApplicationException x(e.what());
    oprot->writeMessageBegin("Read", apache::thrift::protocol::T_EXCEPTION, seqid);
    x.write(oprot);
    oprot->writeMessageEnd();
    oprot->getTransport()->writeEnd();
    oprot->getTransport()->flush();
    return;
  }
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preWrite(ctx, "LfsService.Read");
  }
  oprot->writeMessageBegin("Read", apache::thrift::protocol::T_REPLY, seqid);
  result.write(oprot);
  oprot->writeMessageEnd();
  bytes = oprot->getTransport()->writeEnd();
  oprot->getTransport()->flush();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postWrite(ctx, "LfsService.Read", bytes);
  }
}
void LfsServiceProcessor::process_Unlink(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
  void* ctx = NULL;
  if (this->eventHandler_.get() != NULL) {
    ctx = this->eventHandler_->getContext("LfsService.Unlink", callContext);
  }
  apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "LfsService.Unlink");
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preRead(ctx, "LfsService.Unlink");
  }
  LfsService_Unlink_args args;
  args.read(iprot);
  iprot->readMessageEnd();
  uint32_t bytes = iprot->getTransport()->readEnd();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postRead(ctx, "LfsService.Unlink", bytes);
  }
  LfsService_Unlink_result result;
  try {
    result.success = iface_->Unlink(args.fileName);
    result.__isset.success = true;
  } catch (const std::exception& e) {
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->handlerError(ctx, "LfsService.Unlink");
    }
    apache::thrift::TApplicationException x(e.what());
    oprot->writeMessageBegin("Unlink", apache::thrift::protocol::T_EXCEPTION, seqid);
    x.write(oprot);
    oprot->writeMessageEnd();
    oprot->getTransport()->writeEnd();
    oprot->getTransport()->flush();
    return;
  }
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preWrite(ctx, "LfsService.Unlink");
  }
  oprot->writeMessageBegin("Unlink", apache::thrift::protocol::T_REPLY, seqid);
  result.write(oprot);
  oprot->writeMessageEnd();
  bytes = oprot->getTransport()->writeEnd();
  oprot->getTransport()->flush();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postWrite(ctx, "LfsService.Unlink", bytes);
  }
}
void LfsServiceProcessor::process_Fstat(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
{
  void* ctx = NULL;
  if (this->eventHandler_.get() != NULL) {
    ctx = this->eventHandler_->getContext("LfsService.Fstat", callContext);
  }
  apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "LfsService.Fstat");
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preRead(ctx, "LfsService.Fstat");
  }
  LfsService_Fstat_args args;
  args.read(iprot);
  iprot->readMessageEnd();
  uint32_t bytes = iprot->getTransport()->readEnd();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postRead(ctx, "LfsService.Fstat", bytes);
  }
  LfsService_Fstat_result result;
  try {
    iface_->Fstat(result.success, args.fd);
    result.__isset.success = true;
  } catch (const std::exception& e) {
    if (this->eventHandler_.get() != NULL) {
      this->eventHandler_->handlerError(ctx, "LfsService.Fstat");
    }
    apache::thrift::TApplicationException x(e.what());
    oprot->writeMessageBegin("Fstat", apache::thrift::protocol::T_EXCEPTION, seqid);
    x.write(oprot);
    oprot->writeMessageEnd();
    oprot->getTransport()->writeEnd();
    oprot->getTransport()->flush();
    return;
  }
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->preWrite(ctx, "LfsService.Fstat");
  }
  oprot->writeMessageBegin("Fstat", apache::thrift::protocol::T_REPLY, seqid);
  result.write(oprot);
  oprot->writeMessageEnd();
  bytes = oprot->getTransport()->writeEnd();
  oprot->getTransport()->flush();
  if (this->eventHandler_.get() != NULL) {
    this->eventHandler_->postWrite(ctx, "LfsService.Fstat", bytes);
  }
}
::boost::shared_ptr< ::apache::thrift::TProcessor > LfsServiceProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) {
  ::apache::thrift::ReleaseHandler< LfsServiceIfFactory > cleanup(handlerFactory_);
  ::boost::shared_ptr< LfsServiceIf > handler(handlerFactory_->getHandler(connInfo), cleanup);
  ::boost::shared_ptr< ::apache::thrift::TProcessor > processor(new LfsServiceProcessor(handler));
  return processor;
}
}} // namespace
// This autogenerated skeleton file illustrates how to build a server.
// You should copy it to another filename to avoid overwriting it.
#include "LfsService.h"
#include "CommonDefine.h"
#include <protocol/TBinaryProtocol.h>
#include <server/TSimpleServer.h>
#include <transport/TServerSocket.h>
#include <transport/TBufferTransports.h>
#include <boost/shared_array.hpp>
#include "CommonDefine.h"
#include "LfsLocalfsImp.h"
#include "Log.h"
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using boost::shared_ptr;
using namespace  ::lfs::rpc;
class LfsServiceHandler : virtual public LfsServiceIf {
 public:
  LfsServiceHandler() 
   : m_localFsImp(new lfs::LfsLocalfsImp)
  {
    // Your initialization goes here
  }
  int32_t Initialize(const std::string& nsAddr) {
    // Your implementation goes here
	printf("Initialize\n");
	if(nsAddr.size() > 0)
	{
		return m_localFsImp->Initialize(nsAddr.c_str());
	}
	return -1;
  }
  int32_t Close(const int32_t fd) {
    // Your implementation goes here
    printf("Close\n");
	return m_localFsImp->Close(fd);
  }
  int32_t Open(const std::string& fileName, const int32_t flags) {
    // Your implementation goes here
    printf("Open\n");
	if(fileName.size() > 0)
	{
		return m_localFsImp->Open(fileName.c_str(), flags);
	}
	else
	{
		return -1;
	}
  }
  int32_t Write(const int32_t fd, const std::string& data, const int64_t count) {
    // Your implementation goes here
    printf("Write\n");
	return m_localFsImp->Write(fd, data.c_str(), count);
  }
  void Read(ReadBuf& _return, const int32_t fd, const int64_t cap) {
    // Your implementation goes here
    printf("Read\n");
	if(cap <= 0)
	{
		LOG_ERROR("read memory capacity not good!");
		return ;
	}
	int len = 128;
	boost::shared_array<char> data(new char [len]);
	int ret = m_localFsImp->Read(fd, data.get(), len);
	if(ret >= 0)
	{
		_return.data.assign(data.get(), data.get()+ret);
		_return.count = ret;
	}
	else
	{
		LOG_ERROR("read failed!");
	}
  }
  int32_t Unlink(const std::string& fileName) {
    // Your implementation goes here
    printf("Unlink\n");
	if(fileName.size() <=0)
	{
		LOG_ERROR("file name is NULL");
		return -1;
	}
	return m_localFsImp->Unlink(fileName.c_str());
  }
  void Fstat(FileInfo& _return, const int32_t fd) {
    // Your implementation goes here
	  printf("Fstat\n");
	  lfs::common::FileInfo fi;
	  int ret =  m_localFsImp->Fstat(fd, fi);
	  if(ret == 0)
	  {
		  _return.ID = fi.ID;	
		  _return.UsedSize = fi.UsedSize;
		  _return.ModifyTime = fi.ModifyTime;
		  _return.CreateTime = fi.CreateTime;
	  }
	  else
	  {
		  LOG_ERROR("get fstat error!");
		  _return.ID = -1;
	  }
  }
private:
	boost::shared_ptr<lfs::LfsLocalfsImp> m_localFsImp;
};
int main(int argc, char **argv) {
  int port = 9071
  shared_ptr<LfsServiceHandler> handler(new LfsServiceHandler());
  shared_ptr<TProcessor> processor(new LfsServiceProcessor(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;
}
/**
 * Autogenerated by Thrift Compiler (0.8.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
#include "Lfs_types.h"
namespace lfs { namespace rpc {
const char* FileInfo::ascii_fingerprint = "806821246DB1136FDC1DF7FFEF5B1637";
const uint8_t FileInfo::binary_fingerprint[16] = {0x80,0x68,0x21,0x24,0x6D,0xB1,0x13,0x6F,0xDC,0x1D,0xF7,0xFF,0xEF,0x5B,0x16,0x37};
uint32_t FileInfo::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->ID);
          this->__isset.ID = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->Size);
          this->__isset.Size = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 3:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->UsedSize);
          this->__isset.UsedSize = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 4:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->ModifyTime);
          this->__isset.ModifyTime = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 5:
        if (ftype == ::apache::thrift::protocol::T_I32) {
          xfer += iprot->readI32(this->CreateTime);
          this->__isset.CreateTime = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t FileInfo::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("FileInfo");
  xfer += oprot->writeFieldBegin("ID", ::apache::thrift::protocol::T_I64, 1);
  xfer += oprot->writeI64(this->ID);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldBegin("Size", ::apache::thrift::protocol::T_I32, 2);
  xfer += oprot->writeI32(this->Size);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldBegin("UsedSize", ::apache::thrift::protocol::T_I32, 3);
  xfer += oprot->writeI32(this->UsedSize);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldBegin("ModifyTime", ::apache::thrift::protocol::T_I32, 4);
  xfer += oprot->writeI32(this->ModifyTime);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldBegin("CreateTime", ::apache::thrift::protocol::T_I32, 5);
  xfer += oprot->writeI32(this->CreateTime);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
const char* ReadBuf::ascii_fingerprint = "1CCCF6FC31CFD1D61BBBB1BAF3590620";
const uint8_t ReadBuf::binary_fingerprint[16] = {0x1C,0xCC,0xF6,0xFC,0x31,0xCF,0xD1,0xD6,0x1B,0xBB,0xB1,0xBA,0xF3,0x59,0x06,0x20};
uint32_t ReadBuf::read(::apache::thrift::protocol::TProtocol* iprot) {
  uint32_t xfer = 0;
  std::string fname;
  ::apache::thrift::protocol::TType ftype;
  int16_t fid;
  xfer += iprot->readStructBegin(fname);
  using ::apache::thrift::protocol::TProtocolException;
  while (true)
  {
    xfer += iprot->readFieldBegin(fname, ftype, fid);
    if (ftype == ::apache::thrift::protocol::T_STOP) {
      break;
    }
    switch (fid)
    {
      case 1:
        if (ftype == ::apache::thrift::protocol::T_STRING) {
          xfer += iprot->readString(this->data);
          this->__isset.data = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      case 2:
        if (ftype == ::apache::thrift::protocol::T_I64) {
          xfer += iprot->readI64(this->count);
          this->__isset.count = true;
        } else {
          xfer += iprot->skip(ftype);
        }
        break;
      default:
        xfer += iprot->skip(ftype);
        break;
    }
    xfer += iprot->readFieldEnd();
  }
  xfer += iprot->readStructEnd();
  return xfer;
}
uint32_t ReadBuf::write(::apache::thrift::protocol::TProtocol* oprot) const {
  uint32_t xfer = 0;
  xfer += oprot->writeStructBegin("ReadBuf");
  xfer += oprot->writeFieldBegin("data", ::apache::thrift::protocol::T_STRING, 1);
  xfer += oprot->writeString(this->data);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldBegin("count", ::apache::thrift::protocol::T_I64, 2);
  xfer += oprot->writeI64(this->count);
  xfer += oprot->writeFieldEnd();
  xfer += oprot->writeFieldStop();
  xfer += oprot->writeStructEnd();
  return xfer;
}
}} // namespace
#include "Log.h"
#include <stdarg.h>
#include <stdio.h>
#include <errno.h>
#include <time.h>
namespace lfs{
namespace common{
void Log::Out(const int moduleIndex, const int lvl, const char * fileName, const char * funcName, int line, const char * fmt, ...)
{
	static const char * moduleName[]={
		"LFS",
	};
	static const char * levelName[] = {
		"FATAL",
		"ERROR",
		"WARNING",
		"Debug",
		"INFO"
	};
	time_t now;                                                      
	char dbgtime[26] ;                                                  
	time(&now);                                                         
	ctime_r(&now, dbgtime);                                             
	dbgtime[24] = '\0';       
	// with time
	// printf("[%s] [%s][%s][%s:%d]", moduleName[moduleIndex], levelName[lvl], dbgtime, fileName, line);
	// no time - no funcName
	// printf("[%s] [%s][%s:%d]", moduleName[moduleIndex], levelName[lvl], fileName, line);
	// no time with funcName 
	printf("[%s] [%s][%s:%s:%d]", moduleName[moduleIndex], levelName[lvl], fileName, funcName, line);
	va_list pArg;
	va_start(pArg, fmt);
	vprintf(fmt, pArg);
	va_end(pArg);
	printf("\n");
}
}/*  Namespace common */
}/*  Namespace lfs */
#include <stdio.h>
#include "LfsClient.h"
#include "Log.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
int tmain()
{
	lfs::LfsClient lfs;
	int ret = lfs.Initialize();
	if(ret != 0)
	{
		LOG_ERROR("Initialize error!");
		return -1;
	}
	int fd = lfs.Open("hello", O_CREAT|O_WRONLY);
	if(fd < 0)
	{
		LOG_ERROR("Open failed");
		return -1;
	}
	const char * msg = "hello world";
	int64_t len = ::strlen(msg);
	ret = lfs.Write(fd, msg, len);
	if(ret < 0)
	{
		LOG_ERROR("write Failed [%d]", ret);
		return -1;
	}
	lfs.Close(fd);
	return 0;
}
#include <gtest/gtest.h>
int add(int a, int b)
{
	return a + b;
}
TEST(FooTest, HandleNoneZeroInput)
{
	EXPECT_EQ(14, add(4, 10));
	EXPECT_EQ(12, add(30, 18));
}
int tmain(int argc, char* argv[])
{
	testing::InitGoogleTest(&argc, argv);
	return RUN_ALL_TESTS();
}
#ifndef  COMMON_DEFINE_H
#define  COMMON_DEFINE_H
#include <stddef.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/socket.h>
#include <arpa/inet.h>
typedef unsigned long long uint64_t;
typedef unsigned int uint32_t;
//typedef unsigned short uint16_t;
//typedef unsigned char uint8_t;
typedef long long int64_t;
typedef int int32_t;
//typedef short int16_t;
//typedef char int8_t;
namespace lfs {
namespace common{
enum OpenFlag
{
	L_READ,
	L_WRITE,
	L_STAT,
	L_UNLINK
};
struct FileInfo
{
	uint64_t ID; // file id
    int32_t Size; // file size
    int32_t UsedSize; // hold space
    int32_t ModifyTime; // modify time
    int32_t CreateTime; // create time
    //int32_t Flag; // deleta flag
    //uint32_t Crc; // crc value
};
}/* namespace common */
}/* namespace lfs */
#endif
#ifndef  LFS_CLIENT_H
#define  LFS_CLIENT_H
#include "CommonDefine.h"
namespace lfs {
class LfsNetClient;
class LfsClient
{
public:
	LfsClient();
	~LfsClient();
	/**
	 * Initialize
	 * This function is to Initialzie the LfsClient, such as prepare connectionInfo(IP+Port)
	 *
	 * @param		nsAddr -- name server's address( 127.0.0.1:9071)
	 * @return     	int  0 -- success,  -1 -- failed
	 *
	 */
	int Initialize(const char* nsAddr = NULL);
	/**
	 * Close
	 * This function is  to close the LfsClient resource
	 *
	 * @param		fd -- file description of remte server file
	 * @return     	int  0 -- success, -1 -- failed
	 */
	int Close(const int fd);
	/**
	 * Open
	 * This function is  to open the remote server file
	 *
	 * @param		fileName -- file name of remote server file
	 * @param		flags -- open flags : now is same as the linux open call
	 * @return     	int -- return the fd of the remote file
	 */
	int Open(const char* fileName, const int flags);
	/**
	 * Write
	 * This function is  to write some data into remote server 
	 *
	 * @param		fd -- file description of remte server file
	 * @param		data -- data will be wroten into remote server file
	 * @param		count -- data size of bytes
	 * @return     	int -- real wroten bytes to remote server file
	 */
	int Write(const int fd, const void* data, int64_t count);
	/**
	 * Read
	 * This function is read bytes from the remtome server
	 *
	 * @param		fd -- file description of remte server file
	 * @param		buf -- buf size to be fill in
	 * @param		count -- count of the buf size
	 * @return     	int  -- read bytes from remote server file
	 */
	int Read(const int fd, void* buf, const int64_t count);
	/**
	 * Unlink
	 * This function is to delete the remote server file
	 *
	 * @param		fileName  -- file name in remote server
	 * @return     	int  0 -- success,  -1 -- failed
	 */
	int Unlink(const char* fileName);
	/**
	 * Fstat
	 * This function is  to get the information of remote server file
	 *
	 * @param		fd -- file description of remte server file
	 * @param		fi -- file info of the remote server file
	 * @return     	int  0 -- success,  -1 -- failed
	 */
	int Fstat(const int fd, common::FileInfo& fi);
	/**
	 * SaveFile
	 * This function is  to upload local file to remote server
	 *
	 * @param		fileName  -- file name in remote server
	 * @param		localFile -- file in local machine
	 * @param		flag -- the flag of save file: ????
	 * @param		nsAddr    -- name server address
	 * @return     	int  0 -- success,  -1 -- failed
	 */
	int64_t SaveFile(char* fileName, const char* localFile, const int32_t flag, const char* nsAddr = NULL);
	/**
	 * FetchFile
	 * This function is to download remote server file into local machine
	 *
	 * @param		localFile -- file in local machine
	 * @param		fileName  -- file name in remote server
	 * @param		nsAddr    -- name server address
	 * @return     	int  0 -- success,  -1 -- failed
	 */
	int FetchFile(const char* localFile, const char* fileName, const char* nsAddr = NULL);
private:
	LfsNetClient * m_imp;
};
} // Namespace lfs
#endif
/**
 * Autogenerated by Thrift Compiler (0.8.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
#ifndef Lfs_CONSTANTS_H
#define Lfs_CONSTANTS_H
#include "Lfs_types.h"
namespace lfs { namespace rpc {
class LfsConstants {
 public:
  LfsConstants();
};
extern const LfsConstants g_Lfs_constants;
}} // namespace
#endif
#ifndef  LFS_LOCAL_FS_IMP_H
#define  LFS_LOCAL_FS_IMP_H
#include "CommonDefine.h"
namespace lfs {
class LfsLocalfsImp
{
public:
	int Initialize(const char* nsAddr = NULL);
	int Close(const int fd);
	int Open(const char* fileName, const int flags);
	int Write(const int fd, const void* data, int64_t count);
	int Read(const int fd, void* buf, const int64_t count);
	int Unlink(const char* fileName);
	int Fstat(const int fd, common::FileInfo& buf);
	int64_t SaveFile(char* fileName, const char* localFile, const int32_t flag, const char* nsAddr = NULL);
	int FetchFile(const char* localFile, const char* fileName, const char* nsAddr = NULL);
};
} // Namespace lfs
#endif
#ifndef  LFS_NET_CLIENT_H
#define  LFS_NET_CLIENT_H
#include "CommonDefine.h"
#include <string>
#include <boost/shared_ptr.hpp>
#include <transport/TTransport.h>
#include "LfsService.h"
namespace lfs {
class LfsNetClient
{
public:
	LfsNetClient();
	~LfsNetClient();
	int Initialize(const char* nsAddr = "127.0.0.1:9090");
	int Close(const int fd);
	int Open(const char* fileName, const int flags);
	int Write(const int fd, const void* data, int64_t count);
	int Read(const int fd, void* buf, const int64_t count);
	int Unlink(const char* fileName);
	int Fstat(const int fd, common::FileInfo& buf);
	// save tiny file
	int64_t SaveFile(char* fileName, const char* localFile, const int32_t flag, const char* nsAddr = NULL);
	// fetch tiny file
	int FetchFile(const char* localFile, const char* fileName, const char* nsAddr = NULL);
private:
	int CreateTransport(const char * nsAddr);
private:
	std::string m_ip;
	int m_port;
	boost::shared_ptr<apache::thrift::transport::TTransport> m_transport;
	boost::shared_ptr<lfs::rpc::LfsServiceClient> m_client;
};
} // Namespace lfs
#endif
/**
 * Autogenerated by Thrift Compiler (0.8.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
#ifndef LfsService_H
#define LfsService_H
#include <TProcessor.h>
#include "Lfs_types.h"
namespace lfs { namespace rpc {
class LfsServiceIf {
 public:
  virtual ~LfsServiceIf() {}
  virtual int32_t Initialize(const std::string& ns_addr) = 0;
  virtual int32_t Close(const int32_t fd) = 0;
  virtual int32_t Open(const std::string& fileName, const int32_t flags) = 0;
  virtual int32_t Write(const int32_t fd, const std::string& data, const int64_t count) = 0;
  virtual void Read(ReadBuf& _return, const int32_t fd, const int64_t cap) = 0;
  virtual int32_t Unlink(const std::string& fileName) = 0;
  virtual void Fstat(FileInfo& _return, const int32_t fd) = 0;
};
class LfsServiceIfFactory {
 public:
  typedef LfsServiceIf Handler;
  virtual ~LfsServiceIfFactory() {}
  virtual LfsServiceIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0;
  virtual void releaseHandler(LfsServiceIf* /* handler */) = 0;
};
class LfsServiceIfSingletonFactory : virtual public LfsServiceIfFactory {
 public:
  LfsServiceIfSingletonFactory(const boost::shared_ptr<LfsServiceIf>& iface) : iface_(iface) {}
  virtual ~LfsServiceIfSingletonFactory() {}
  virtual LfsServiceIf* getHandler(const ::apache::thrift::TConnectionInfo&) {
    return iface_.get();
  }
  virtual void releaseHandler(LfsServiceIf* /* handler */) {}
 protected:
  boost::shared_ptr<LfsServiceIf> iface_;
};
class LfsServiceNull : virtual public LfsServiceIf {
 public:
  virtual ~LfsServiceNull() {}
  int32_t Initialize(const std::string& /* ns_addr */) {
    int32_t _return = 0;
    return _return;
  }
  int32_t Close(const int32_t /* fd */) {
    int32_t _return = 0;
    return _return;
  }
  int32_t Open(const std::string& /* fileName */, const int32_t /* flags */) {
    int32_t _return = 0;
    return _return;
  }
  int32_t Write(const int32_t /* fd */, const std::string& /* data */, const int64_t /* count */) {
    int32_t _return = 0;
    return _return;
  }
  void Read(ReadBuf& /* _return */, const int32_t /* fd */, const int64_t /* cap */) {
    return;
  }
  int32_t Unlink(const std::string& /* fileName */) {
    int32_t _return = 0;
    return _return;
  }
  void Fstat(FileInfo& /* _return */, const int32_t /* fd */) {
    return;
  }
};
typedef struct _LfsService_Initialize_args__isset {
  _LfsService_Initialize_args__isset() : ns_addr(false) {}
  bool ns_addr;
} _LfsService_Initialize_args__isset;
class LfsService_Initialize_args {
 public:
  LfsService_Initialize_args() : ns_addr("") {
  }
  virtual ~LfsService_Initialize_args() throw() {}
  std::string ns_addr;
  _LfsService_Initialize_args__isset __isset;
  void __set_ns_addr(const std::string& val) {
    ns_addr = val;
  }
  bool operator == (const LfsService_Initialize_args & rhs) const
  {
    if (!(ns_addr == rhs.ns_addr))
      return false;
    return true;
  }
  bool operator != (const LfsService_Initialize_args &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const LfsService_Initialize_args & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class LfsService_Initialize_pargs {
 public:
  virtual ~LfsService_Initialize_pargs() throw() {}
  const std::string* ns_addr;
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _LfsService_Initialize_result__isset {
  _LfsService_Initialize_result__isset() : success(false) {}
  bool success;
} _LfsService_Initialize_result__isset;
class LfsService_Initialize_result {
 public:
  LfsService_Initialize_result() : success(0) {
  }
  virtual ~LfsService_Initialize_result() throw() {}
  int32_t success;
  _LfsService_Initialize_result__isset __isset;
  void __set_success(const int32_t val) {
    success = val;
  }
  bool operator == (const LfsService_Initialize_result & rhs) const
  {
    if (!(success == rhs.success))
      return false;
    return true;
  }
  bool operator != (const LfsService_Initialize_result &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const LfsService_Initialize_result & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _LfsService_Initialize_presult__isset {
  _LfsService_Initialize_presult__isset() : success(false) {}
  bool success;
} _LfsService_Initialize_presult__isset;
class LfsService_Initialize_presult {
 public:
  virtual ~LfsService_Initialize_presult() throw() {}
  int32_t* success;
  _LfsService_Initialize_presult__isset __isset;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
};
typedef struct _LfsService_Close_args__isset {
  _LfsService_Close_args__isset() : fd(false) {}
  bool fd;
} _LfsService_Close_args__isset;
class LfsService_Close_args {
 public:
  LfsService_Close_args() : fd(0) {
  }
  virtual ~LfsService_Close_args() throw() {}
  int32_t fd;
  _LfsService_Close_args__isset __isset;
  void __set_fd(const int32_t val) {
    fd = val;
  }
  bool operator == (const LfsService_Close_args & rhs) const
  {
    if (!(fd == rhs.fd))
      return false;
    return true;
  }
  bool operator != (const LfsService_Close_args &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const LfsService_Close_args & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class LfsService_Close_pargs {
 public:
  virtual ~LfsService_Close_pargs() throw() {}
  const int32_t* fd;
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _LfsService_Close_result__isset {
  _LfsService_Close_result__isset() : success(false) {}
  bool success;
} _LfsService_Close_result__isset;
class LfsService_Close_result {
 public:
  LfsService_Close_result() : success(0) {
  }
  virtual ~LfsService_Close_result() throw() {}
  int32_t success;
  _LfsService_Close_result__isset __isset;
  void __set_success(const int32_t val) {
    success = val;
  }
  bool operator == (const LfsService_Close_result & rhs) const
  {
    if (!(success == rhs.success))
      return false;
    return true;
  }
  bool operator != (const LfsService_Close_result &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const LfsService_Close_result & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _LfsService_Close_presult__isset {
  _LfsService_Close_presult__isset() : success(false) {}
  bool success;
} _LfsService_Close_presult__isset;
class LfsService_Close_presult {
 public:
  virtual ~LfsService_Close_presult() throw() {}
  int32_t* success;
  _LfsService_Close_presult__isset __isset;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
};
typedef struct _LfsService_Open_args__isset {
  _LfsService_Open_args__isset() : fileName(false), flags(false) {}
  bool fileName;
  bool flags;
} _LfsService_Open_args__isset;
class LfsService_Open_args {
 public:
  LfsService_Open_args() : fileName(""), flags(0) {
  }
  virtual ~LfsService_Open_args() throw() {}
  std::string fileName;
  int32_t flags;
  _LfsService_Open_args__isset __isset;
  void __set_fileName(const std::string& val) {
    fileName = val;
  }
  void __set_flags(const int32_t val) {
    flags = val;
  }
  bool operator == (const LfsService_Open_args & rhs) const
  {
    if (!(fileName == rhs.fileName))
      return false;
    if (!(flags == rhs.flags))
      return false;
    return true;
  }
  bool operator != (const LfsService_Open_args &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const LfsService_Open_args & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class LfsService_Open_pargs {
 public:
  virtual ~LfsService_Open_pargs() throw() {}
  const std::string* fileName;
  const int32_t* flags;
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _LfsService_Open_result__isset {
  _LfsService_Open_result__isset() : success(false) {}
  bool success;
} _LfsService_Open_result__isset;
class LfsService_Open_result {
 public:
  LfsService_Open_result() : success(0) {
  }
  virtual ~LfsService_Open_result() throw() {}
  int32_t success;
  _LfsService_Open_result__isset __isset;
  void __set_success(const int32_t val) {
    success = val;
  }
  bool operator == (const LfsService_Open_result & rhs) const
  {
    if (!(success == rhs.success))
      return false;
    return true;
  }
  bool operator != (const LfsService_Open_result &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const LfsService_Open_result & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _LfsService_Open_presult__isset {
  _LfsService_Open_presult__isset() : success(false) {}
  bool success;
} _LfsService_Open_presult__isset;
class LfsService_Open_presult {
 public:
  virtual ~LfsService_Open_presult() throw() {}
  int32_t* success;
  _LfsService_Open_presult__isset __isset;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
};
typedef struct _LfsService_Write_args__isset {
  _LfsService_Write_args__isset() : fd(false), data(false), count(false) {}
  bool fd;
  bool data;
  bool count;
} _LfsService_Write_args__isset;
class LfsService_Write_args {
 public:
  LfsService_Write_args() : fd(0), data(""), count(0) {
  }
  virtual ~LfsService_Write_args() throw() {}
  int32_t fd;
  std::string data;
  int64_t count;
  _LfsService_Write_args__isset __isset;
  void __set_fd(const int32_t val) {
    fd = val;
  }
  void __set_data(const std::string& val) {
    data = val;
  }
  void __set_count(const int64_t val) {
    count = val;
  }
  bool operator == (const LfsService_Write_args & rhs) const
  {
    if (!(fd == rhs.fd))
      return false;
    if (!(data == rhs.data))
      return false;
    if (!(count == rhs.count))
      return false;
    return true;
  }
  bool operator != (const LfsService_Write_args &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const LfsService_Write_args & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class LfsService_Write_pargs {
 public:
  virtual ~LfsService_Write_pargs() throw() {}
  const int32_t* fd;
  const std::string* data;
  const int64_t* count;
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _LfsService_Write_result__isset {
  _LfsService_Write_result__isset() : success(false) {}
  bool success;
} _LfsService_Write_result__isset;
class LfsService_Write_result {
 public:
  LfsService_Write_result() : success(0) {
  }
  virtual ~LfsService_Write_result() throw() {}
  int32_t success;
  _LfsService_Write_result__isset __isset;
  void __set_success(const int32_t val) {
    success = val;
  }
  bool operator == (const LfsService_Write_result & rhs) const
  {
    if (!(success == rhs.success))
      return false;
    return true;
  }
  bool operator != (const LfsService_Write_result &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const LfsService_Write_result & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _LfsService_Write_presult__isset {
  _LfsService_Write_presult__isset() : success(false) {}
  bool success;
} _LfsService_Write_presult__isset;
class LfsService_Write_presult {
 public:
  virtual ~LfsService_Write_presult() throw() {}
  int32_t* success;
  _LfsService_Write_presult__isset __isset;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
};
typedef struct _LfsService_Read_args__isset {
  _LfsService_Read_args__isset() : fd(false), cap(false) {}
  bool fd;
  bool cap;
} _LfsService_Read_args__isset;
class LfsService_Read_args {
 public:
  LfsService_Read_args() : fd(0), cap(0) {
  }
  virtual ~LfsService_Read_args() throw() {}
  int32_t fd;
  int64_t cap;
  _LfsService_Read_args__isset __isset;
  void __set_fd(const int32_t val) {
    fd = val;
  }
  void __set_cap(const int64_t val) {
    cap = val;
  }
  bool operator == (const LfsService_Read_args & rhs) const
  {
    if (!(fd == rhs.fd))
      return false;
    if (!(cap == rhs.cap))
      return false;
    return true;
  }
  bool operator != (const LfsService_Read_args &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const LfsService_Read_args & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class LfsService_Read_pargs {
 public:
  virtual ~LfsService_Read_pargs() throw() {}
  const int32_t* fd;
  const int64_t* cap;
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _LfsService_Read_result__isset {
  _LfsService_Read_result__isset() : success(false) {}
  bool success;
} _LfsService_Read_result__isset;
class LfsService_Read_result {
 public:
  LfsService_Read_result() {
  }
  virtual ~LfsService_Read_result() throw() {}
  ReadBuf success;
  _LfsService_Read_result__isset __isset;
  void __set_success(const ReadBuf& val) {
    success = val;
  }
  bool operator == (const LfsService_Read_result & rhs) const
  {
    if (!(success == rhs.success))
      return false;
    return true;
  }
  bool operator != (const LfsService_Read_result &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const LfsService_Read_result & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _LfsService_Read_presult__isset {
  _LfsService_Read_presult__isset() : success(false) {}
  bool success;
} _LfsService_Read_presult__isset;
class LfsService_Read_presult {
 public:
  virtual ~LfsService_Read_presult() throw() {}
  ReadBuf* success;
  _LfsService_Read_presult__isset __isset;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
};
typedef struct _LfsService_Unlink_args__isset {
  _LfsService_Unlink_args__isset() : fileName(false) {}
  bool fileName;
} _LfsService_Unlink_args__isset;
class LfsService_Unlink_args {
 public:
  LfsService_Unlink_args() : fileName("") {
  }
  virtual ~LfsService_Unlink_args() throw() {}
  std::string fileName;
  _LfsService_Unlink_args__isset __isset;
  void __set_fileName(const std::string& val) {
    fileName = val;
  }
  bool operator == (const LfsService_Unlink_args & rhs) const
  {
    if (!(fileName == rhs.fileName))
      return false;
    return true;
  }
  bool operator != (const LfsService_Unlink_args &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const LfsService_Unlink_args & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class LfsService_Unlink_pargs {
 public:
  virtual ~LfsService_Unlink_pargs() throw() {}
  const std::string* fileName;
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _LfsService_Unlink_result__isset {
  _LfsService_Unlink_result__isset() : success(false) {}
  bool success;
} _LfsService_Unlink_result__isset;
class LfsService_Unlink_result {
 public:
  LfsService_Unlink_result() : success(0) {
  }
  virtual ~LfsService_Unlink_result() throw() {}
  int32_t success;
  _LfsService_Unlink_result__isset __isset;
  void __set_success(const int32_t val) {
    success = val;
  }
  bool operator == (const LfsService_Unlink_result & rhs) const
  {
    if (!(success == rhs.success))
      return false;
    return true;
  }
  bool operator != (const LfsService_Unlink_result &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const LfsService_Unlink_result & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _LfsService_Unlink_presult__isset {
  _LfsService_Unlink_presult__isset() : success(false) {}
  bool success;
} _LfsService_Unlink_presult__isset;
class LfsService_Unlink_presult {
 public:
  virtual ~LfsService_Unlink_presult() throw() {}
  int32_t* success;
  _LfsService_Unlink_presult__isset __isset;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
};
typedef struct _LfsService_Fstat_args__isset {
  _LfsService_Fstat_args__isset() : fd(false) {}
  bool fd;
} _LfsService_Fstat_args__isset;
class LfsService_Fstat_args {
 public:
  LfsService_Fstat_args() : fd(0) {
  }
  virtual ~LfsService_Fstat_args() throw() {}
  int32_t fd;
  _LfsService_Fstat_args__isset __isset;
  void __set_fd(const int32_t val) {
    fd = val;
  }
  bool operator == (const LfsService_Fstat_args & rhs) const
  {
    if (!(fd == rhs.fd))
      return false;
    return true;
  }
  bool operator != (const LfsService_Fstat_args &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const LfsService_Fstat_args & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
class LfsService_Fstat_pargs {
 public:
  virtual ~LfsService_Fstat_pargs() throw() {}
  const int32_t* fd;
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _LfsService_Fstat_result__isset {
  _LfsService_Fstat_result__isset() : success(false) {}
  bool success;
} _LfsService_Fstat_result__isset;
class LfsService_Fstat_result {
 public:
  LfsService_Fstat_result() {
  }
  virtual ~LfsService_Fstat_result() throw() {}
  FileInfo success;
  _LfsService_Fstat_result__isset __isset;
  void __set_success(const FileInfo& val) {
    success = val;
  }
  bool operator == (const LfsService_Fstat_result & rhs) const
  {
    if (!(success == rhs.success))
      return false;
    return true;
  }
  bool operator != (const LfsService_Fstat_result &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const LfsService_Fstat_result & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _LfsService_Fstat_presult__isset {
  _LfsService_Fstat_presult__isset() : success(false) {}
  bool success;
} _LfsService_Fstat_presult__isset;
class LfsService_Fstat_presult {
 public:
  virtual ~LfsService_Fstat_presult() throw() {}
  FileInfo* success;
  _LfsService_Fstat_presult__isset __isset;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
};
class LfsServiceClient : virtual public LfsServiceIf {
 public:
  LfsServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) :
    piprot_(prot),
    poprot_(prot) {
    iprot_ = prot.get();
    oprot_ = prot.get();
  }
  LfsServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) :
    piprot_(iprot),
    poprot_(oprot) {
    iprot_ = iprot.get();
    oprot_ = oprot.get();
  }
  boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {
    return piprot_;
  }
  boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {
    return poprot_;
  }
  int32_t Initialize(const std::string& ns_addr);
  void send_Initialize(const std::string& ns_addr);
  int32_t recv_Initialize();
  int32_t Close(const int32_t fd);
  void send_Close(const int32_t fd);
  int32_t recv_Close();
  int32_t Open(const std::string& fileName, const int32_t flags);
  void send_Open(const std::string& fileName, const int32_t flags);
  int32_t recv_Open();
  int32_t Write(const int32_t fd, const std::string& data, const int64_t count);
  void send_Write(const int32_t fd, const std::string& data, const int64_t count);
  int32_t recv_Write();
  void Read(ReadBuf& _return, const int32_t fd, const int64_t cap);
  void send_Read(const int32_t fd, const int64_t cap);
  void recv_Read(ReadBuf& _return);
  int32_t Unlink(const std::string& fileName);
  void send_Unlink(const std::string& fileName);
  int32_t recv_Unlink();
  void Fstat(FileInfo& _return, const int32_t fd);
  void send_Fstat(const int32_t fd);
  void recv_Fstat(FileInfo& _return);
 protected:
  boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
  boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;
  ::apache::thrift::protocol::TProtocol* iprot_;
  ::apache::thrift::protocol::TProtocol* oprot_;
};
class LfsServiceProcessor : public ::apache::thrift::TProcessor {
 protected:
  boost::shared_ptr<LfsServiceIf> iface_;
  virtual bool process_fn(apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot, std::string& fname, int32_t seqid, void* callContext);
 private:
  std::map<std::string, void (LfsServiceProcessor::*)(int32_t, apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, void*)> processMap_;
  void process_Initialize(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot, void* callContext);
  void process_Close(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot, void* callContext);
  void process_Open(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot, void* callContext);
  void process_Write(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot, void* callContext);
  void process_Read(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot, void* callContext);
  void process_Unlink(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot, void* callContext);
  void process_Fstat(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot, void* callContext);
 public:
  LfsServiceProcessor(boost::shared_ptr<LfsServiceIf> iface) :
    iface_(iface) {
    processMap_["Initialize"] = &LfsServiceProcessor::process_Initialize;
    processMap_["Close"] = &LfsServiceProcessor::process_Close;
    processMap_["Open"] = &LfsServiceProcessor::process_Open;
    processMap_["Write"] = &LfsServiceProcessor::process_Write;
    processMap_["Read"] = &LfsServiceProcessor::process_Read;
    processMap_["Unlink"] = &LfsServiceProcessor::process_Unlink;
    processMap_["Fstat"] = &LfsServiceProcessor::process_Fstat;
  }
  virtual bool process(boost::shared_ptr<apache::thrift::protocol::TProtocol> piprot, boost::shared_ptr<apache::thrift::protocol::TProtocol> poprot, void* callContext);
  virtual ~LfsServiceProcessor() {}
};
class LfsServiceProcessorFactory : public ::apache::thrift::TProcessorFactory {
 public:
  LfsServiceProcessorFactory(const ::boost::shared_ptr< LfsServiceIfFactory >& handlerFactory) :
      handlerFactory_(handlerFactory) {}
  ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo);
 protected:
  ::boost::shared_ptr< LfsServiceIfFactory > handlerFactory_;
};
class LfsServiceMultiface : virtual public LfsServiceIf {
 public:
  LfsServiceMultiface(std::vector<boost::shared_ptr<LfsServiceIf> >& ifaces) : ifaces_(ifaces) {
  }
  virtual ~LfsServiceMultiface() {}
 protected:
  std::vector<boost::shared_ptr<LfsServiceIf> > ifaces_;
  LfsServiceMultiface() {}
  void add(boost::shared_ptr<LfsServiceIf> iface) {
    ifaces_.push_back(iface);
  }
 public:
  int32_t Initialize(const std::string& ns_addr) {
    size_t sz = ifaces_.size();
    for (size_t i = 0; i < sz; ++i) {
      if (i == sz - 1) {
        return ifaces_[i]->Initialize(ns_addr);
      } else {
        ifaces_[i]->Initialize(ns_addr);
      }
    }
  }
  int32_t Close(const int32_t fd) {
    size_t sz = ifaces_.size();
    for (size_t i = 0; i < sz; ++i) {
      if (i == sz - 1) {
        return ifaces_[i]->Close(fd);
      } else {
        ifaces_[i]->Close(fd);
      }
    }
  }
  int32_t Open(const std::string& fileName, const int32_t flags) {
    size_t sz = ifaces_.size();
    for (size_t i = 0; i < sz; ++i) {
      if (i == sz - 1) {
        return ifaces_[i]->Open(fileName, flags);
      } else {
        ifaces_[i]->Open(fileName, flags);
      }
    }
  }
  int32_t Write(const int32_t fd, const std::string& data, const int64_t count) {
    size_t sz = ifaces_.size();
    for (size_t i = 0; i < sz; ++i) {
      if (i == sz - 1) {
        return ifaces_[i]->Write(fd, data, count);
      } else {
        ifaces_[i]->Write(fd, data, count);
      }
    }
  }
  void Read(ReadBuf& _return, const int32_t fd, const int64_t cap) {
    size_t sz = ifaces_.size();
    for (size_t i = 0; i < sz; ++i) {
      if (i == sz - 1) {
        ifaces_[i]->Read(_return, fd, cap);
        return;
      } else {
        ifaces_[i]->Read(_return, fd, cap);
      }
    }
  }
  int32_t Unlink(const std::string& fileName) {
    size_t sz = ifaces_.size();
    for (size_t i = 0; i < sz; ++i) {
      if (i == sz - 1) {
        return ifaces_[i]->Unlink(fileName);
      } else {
        ifaces_[i]->Unlink(fileName);
      }
    }
  }
  void Fstat(FileInfo& _return, const int32_t fd) {
    size_t sz = ifaces_.size();
    for (size_t i = 0; i < sz; ++i) {
      if (i == sz - 1) {
        ifaces_[i]->Fstat(_return, fd);
        return;
      } else {
        ifaces_[i]->Fstat(_return, fd);
      }
    }
  }
};
}} // namespace
#endif
/**
 * Autogenerated by Thrift Compiler (0.8.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
#ifndef Lfs_TYPES_H
#define Lfs_TYPES_H
#include <Thrift.h>
#include <TApplicationException.h>
#include <protocol/TProtocol.h>
#include <transport/TTransport.h>
namespace lfs { namespace rpc {
typedef struct _FileInfo__isset {
  _FileInfo__isset() : ID(false), Size(false), UsedSize(false), ModifyTime(false), CreateTime(false) {}
  bool ID;
  bool Size;
  bool UsedSize;
  bool ModifyTime;
  bool CreateTime;
} _FileInfo__isset;
class FileInfo {
 public:
  static const char* ascii_fingerprint; // = "806821246DB1136FDC1DF7FFEF5B1637";
  static const uint8_t binary_fingerprint[16]; // = {0x80,0x68,0x21,0x24,0x6D,0xB1,0x13,0x6F,0xDC,0x1D,0xF7,0xFF,0xEF,0x5B,0x16,0x37};
  FileInfo() : ID(0), Size(0), UsedSize(0), ModifyTime(0), CreateTime(0) {
  }
  virtual ~FileInfo() throw() {}
  int64_t ID;
  int32_t Size;
  int32_t UsedSize;
  int32_t ModifyTime;
  int32_t CreateTime;
  _FileInfo__isset __isset;
  void __set_ID(const int64_t val) {
    ID = val;
  }
  void __set_Size(const int32_t val) {
    Size = val;
  }
  void __set_UsedSize(const int32_t val) {
    UsedSize = val;
  }
  void __set_ModifyTime(const int32_t val) {
    ModifyTime = val;
  }
  void __set_CreateTime(const int32_t val) {
    CreateTime = val;
  }
  bool operator == (const FileInfo & rhs) const
  {
    if (!(ID == rhs.ID))
      return false;
    if (!(Size == rhs.Size))
      return false;
    if (!(UsedSize == rhs.UsedSize))
      return false;
    if (!(ModifyTime == rhs.ModifyTime))
      return false;
    if (!(CreateTime == rhs.CreateTime))
      return false;
    return true;
  }
  bool operator != (const FileInfo &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const FileInfo & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
typedef struct _ReadBuf__isset {
  _ReadBuf__isset() : data(false), count(false) {}
  bool data;
  bool count;
} _ReadBuf__isset;
class ReadBuf {
 public:
  static const char* ascii_fingerprint; // = "1CCCF6FC31CFD1D61BBBB1BAF3590620";
  static const uint8_t binary_fingerprint[16]; // = {0x1C,0xCC,0xF6,0xFC,0x31,0xCF,0xD1,0xD6,0x1B,0xBB,0xB1,0xBA,0xF3,0x59,0x06,0x20};
  ReadBuf() : data(""), count(0) {
  }
  virtual ~ReadBuf() throw() {}
  std::string data;
  int64_t count;
  _ReadBuf__isset __isset;
  void __set_data(const std::string& val) {
    data = val;
  }
  void __set_count(const int64_t val) {
    count = val;
  }
  bool operator == (const ReadBuf & rhs) const
  {
    if (!(data == rhs.data))
      return false;
    if (!(count == rhs.count))
      return false;
    return true;
  }
  bool operator != (const ReadBuf &rhs) const {
    return !(*this == rhs);
  }
  bool operator < (const ReadBuf & ) const;
  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
};
}} // namespace
#endif
#ifndef  LOG_H_
#define  LOG_H_
#define MODULE	   0
#define	LOG_FATAL(fmt,...) 		lfs::common::Log::Out(MODULE, 0, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
#define	LOG_ERROR(fmt,...) 		lfs::common::Log::Out(MODULE, 1, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
#define	LOG_WARNING(fmt,...)	lfs::common::Log::Out(MODULE, 2, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
#define	LOG_DEBUG(fmt,...) 		lfs::common::Log::Out(MODULE, 3, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
#define	LOG_INFO(fmt,...) 		lfs::common::Log::Out(MODULE, 4, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
namespace lfs{
namespace common{
class Log
{
public:
	static void Out(const int moduleIndex, const int lvl, const char * fileName, const char * funcName, int line, const char * fmt, ...);
protected:
private:
}; 
}/*  Namespace common */
}/*  Namespace lfs */
#endif /* LOG_H */

                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值