0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Hypertable::FsBroker::MaprBroker Class Reference

#include <MaprBroker.h>

Inheritance diagram for Hypertable::FsBroker::MaprBroker:
Inheritance graph
[legend]
Collaboration diagram for Hypertable::FsBroker::MaprBroker:
Collaboration graph
[legend]

Public Member Functions

 MaprBroker (PropertiesPtr &props)
 
virtual ~MaprBroker ()
 
virtual void open (Response::Callback::Open *cb, const char *fname, uint32_t flags, uint32_t bufsz)
 Open a file and pass the fd to the callback on success. More...
 
virtual void create (Response::Callback::Open *cb, const char *fname, uint32_t flags, int32_t bufsz, int16_t replication, int64_t blksz)
 Open a file, and create it if it doesn't exist, optionally overwriting the contents. More...
 
virtual void close (ResponseCallback *cb, uint32_t fd)
 Close open file. More...
 
virtual void read (Response::Callback::Read *cb, uint32_t fd, uint32_t amount)
 Read data from an open file. More...
 
virtual void append (Response::Callback::Append *cb, uint32_t fd, uint32_t amount, const void *data, Filesystem::Flags flags)
 Append data to open file. More...
 
virtual void seek (ResponseCallback *cb, uint32_t fd, uint64_t offset)
 Seek open file. More...
 
virtual void remove (ResponseCallback *cb, const char *fname)
 Remove a file or directory. More...
 
virtual void length (Response::Callback::Length *cb, const char *fname, bool accurate=true)
 Get length of file. More...
 
virtual void pread (Response::Callback::Read *cb, uint32_t fd, uint64_t offset, uint32_t amount, bool verify_checksum)
 Read from file at position. More...
 
virtual void mkdirs (ResponseCallback *cb, const char *dname)
 Make a directory hierarcy, If the parent dirs are not, present, they are also created. More...
 
virtual void rmdir (ResponseCallback *cb, const char *dname)
 Remove a directory. More...
 
virtual void readdir (Response::Callback::Readdir *cb, const char *dname)
 Read a directory's contents. More...
 
virtual void flush (ResponseCallback *cb, uint32_t fd)
 Flush data that has been written. More...
 
virtual void sync (ResponseCallback *cb, uint32_t fd)
 Sync out data that has been written. More...
 
virtual void status (Response::Callback::Status *cb)
 Check status of FSBroker. More...
 
virtual void shutdown (ResponseCallback *cb)
 Gracefully shutdown broker, closeing open files. More...
 
virtual void exists (Response::Callback::Exists *cb, const char *fname)
 Check for the existence of a file. More...
 
virtual void rename (ResponseCallback *cb, const char *src, const char *dst)
 Rename a file from src to dst. More...
 
virtual void debug (ResponseCallback *, int32_t command, StaticBuffer &serialized_parameters)
 Debug command. More...
 
- Public Member Functions inherited from Hypertable::FsBroker::Lib::Broker
virtual ~Broker ()
 
OpenFileMapget_open_file_map ()
 

Private Member Functions

virtual void report_error (ResponseCallback *cb)
 

Private Attributes

MetricsHandlerPtr m_metrics_handler
 Metrics collection handler. More...
 
Hypertable::Status m_status
 Server status information. More...
 
bool m_verbose
 
hdfsFS m_filesystem
 
bool m_aggregate_writes
 
bool m_readbuffering
 
String m_namenode_host
 
uint16_t m_namenode_port
 

Static Private Attributes

static atomic< int > ms_next_fd
 

Additional Inherited Members

- Protected Attributes inherited from Hypertable::FsBroker::Lib::Broker
OpenFileMap m_open_file_map
 A map of open files. More...
 

Detailed Description

Definition at line 71 of file MaprBroker.h.

Constructor & Destructor Documentation

MaprBroker::MaprBroker ( PropertiesPtr props)

Definition at line 64 of file MaprBroker.cc.

MaprBroker::~MaprBroker ( )
virtual

Definition at line 80 of file MaprBroker.cc.

Member Function Documentation

void MaprBroker::append ( Response::Callback::Append cb,
uint32_t  fd,
uint32_t  amount,
const void *  data,
Filesystem::Flags  flags 
)
virtual

Append data to open file.

Parameters
cbResponse callback
fdAn open file descriptor.
amountNumber of bytes to write.
dataThe data to write.
flagsFlags (FLUSH or SYNC)

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 229 of file MaprBroker.cc.

void MaprBroker::close ( ResponseCallback cb,
uint32_t  fd 
)
virtual

Close open file.

Parameters
fdAn open file descriptor of the file to close.
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 167 of file MaprBroker.cc.

void MaprBroker::create ( Response::Callback::Open cb,
const char *  fname,
uint32_t  flags,
int32_t  bufsz,
int16_t  replication,
int64_t  blksz 
)
virtual

Open a file, and create it if it doesn't exist, optionally overwriting the contents.

Fd is passed to the callback upon success.

Parameters
fnameThe file to be opened and/or created.
flagsAn enum Hypertable::Filesystem::OpenFlags. If OPEN_FLAG_OVERWRITE is set, then overwrite the file.
bufszBuffer size.
replicationAmount of replication of file.
blkszBlock size of file.
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 123 of file MaprBroker.cc.

void MaprBroker::debug ( ResponseCallback cb,
int32_t  command,
StaticBuffer serialized_parameters 
)
virtual

Debug command.

Parameters
command
serialized_parameters
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 591 of file MaprBroker.cc.

void MaprBroker::exists ( Response::Callback::Exists cb,
const char *  fname 
)
virtual

Check for the existence of a file.

Parameters
cbResponse callback
fnameThe file to be checked.

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 564 of file MaprBroker.cc.

void MaprBroker::flush ( ResponseCallback cb,
uint32_t  fd 
)
virtual

Flush data that has been written.

Parameters
fdAn open file.
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 521 of file MaprBroker.cc.

void MaprBroker::length ( Response::Callback::Length cb,
const char *  fname,
bool  accurate = true 
)
virtual

Get length of file.

Parameters
fnameFile to get length of.
accurateShould the length be accurate or an estimation.
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 327 of file MaprBroker.cc.

void MaprBroker::mkdirs ( ResponseCallback cb,
const char *  dname 
)
virtual

Make a directory hierarcy, If the parent dirs are not, present, they are also created.

Parameters
dnameThe pathname
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 397 of file MaprBroker.cc.

void MaprBroker::open ( Response::Callback::Open cb,
const char *  fname,
uint32_t  flags,
uint32_t  bufsz 
)
virtual

Open a file and pass the fd to the callback on success.

Parameters
fnameThe filename to be opened.
flagsAn enum Hypertable::Filesystem::OpenFlags
bufszBuffer size
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 87 of file MaprBroker.cc.

void MaprBroker::pread ( Response::Callback::Read cb,
uint32_t  fd,
uint64_t  offset,
uint32_t  amount,
bool  verify_checksum 
)
virtual

Read from file at position.

Parameters
fdOpen fd to read from.
offsetPostion to read from.
amountNubmer of bytes to read.
verify_checksumVerify checksum of data read
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 352 of file MaprBroker.cc.

void MaprBroker::read ( Response::Callback::Read cb,
uint32_t  fd,
uint32_t  amount 
)
virtual

Read data from an open file.

Parameters
fdAn open file descriptor.
amountNumber of bytes to read.
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 176 of file MaprBroker.cc.

void MaprBroker::readdir ( Response::Callback::Readdir cb,
const char *  dname 
)
virtual

Read a directory's contents.

Parameters
dnameThe directory to list.
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 486 of file MaprBroker.cc.

void MaprBroker::remove ( ResponseCallback cb,
const char *  fname 
)
virtual

Remove a file or directory.

Parameters
fnameFile to remove.
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 309 of file MaprBroker.cc.

void MaprBroker::rename ( ResponseCallback cb,
const char *  src,
const char *  dst 
)
virtual

Rename a file from src to dst.

Parameters
srcThe file to be renamed.
dstThe path the file should be renamed to.
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 579 of file MaprBroker.cc.

void MaprBroker::report_error ( ResponseCallback cb)
privatevirtual

Definition at line 600 of file MaprBroker.cc.

void MaprBroker::rmdir ( ResponseCallback cb,
const char *  dname 
)
virtual

Remove a directory.

Parameters
dnameThe directory to be removed.
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 461 of file MaprBroker.cc.

void MaprBroker::seek ( ResponseCallback cb,
uint32_t  fd,
uint64_t  offset 
)
virtual

Seek open file.

Parameters
fdAn open file descriptor.
offsetPosition to seek to.
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 281 of file MaprBroker.cc.

void MaprBroker::shutdown ( ResponseCallback cb)
virtual

Gracefully shutdown broker, closeing open files.

Parameters
cbCallbock to be called upon finishing task.

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 557 of file MaprBroker.cc.

void MaprBroker::status ( Response::Callback::Status cb)
virtual

Check status of FSBroker.

Parameters
cbcall cb->response_ok()

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 552 of file MaprBroker.cc.

void MaprBroker::sync ( ResponseCallback cb,
uint32_t  fd 
)
virtual

Sync out data that has been written.

Parameters
fdAn open file.
cb

Implements Hypertable::FsBroker::Lib::Broker.

Definition at line 525 of file MaprBroker.cc.

Member Data Documentation

bool Hypertable::FsBroker::MaprBroker::m_aggregate_writes
private

Definition at line 117 of file MaprBroker.h.

hdfsFS Hypertable::FsBroker::MaprBroker::m_filesystem
private

Definition at line 116 of file MaprBroker.h.

MetricsHandlerPtr Hypertable::FsBroker::MaprBroker::m_metrics_handler
private

Metrics collection handler.

Definition at line 110 of file MaprBroker.h.

String Hypertable::FsBroker::MaprBroker::m_namenode_host
private

Definition at line 119 of file MaprBroker.h.

uint16_t Hypertable::FsBroker::MaprBroker::m_namenode_port
private

Definition at line 120 of file MaprBroker.h.

bool Hypertable::FsBroker::MaprBroker::m_readbuffering
private

Definition at line 118 of file MaprBroker.h.

Hypertable::Status Hypertable::FsBroker::MaprBroker::m_status
private

Server status information.

Definition at line 113 of file MaprBroker.h.

bool Hypertable::FsBroker::MaprBroker::m_verbose
private

Definition at line 115 of file MaprBroker.h.

atomic< int > MaprBroker::ms_next_fd
staticprivate

Definition at line 105 of file MaprBroker.h.


The documentation for this class was generated from the following files: