0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Protected Attributes | List of all members
Hypertable::FsBroker::Lib::Broker Class Referenceabstract

Abstract class to be implemented by brokers. More...

#include <Broker.h>

Inheritance diagram for Hypertable::FsBroker::Lib::Broker:
Inheritance graph
[legend]
Collaboration diagram for Hypertable::FsBroker::Lib::Broker:
Collaboration graph
[legend]

Public Member Functions

virtual ~Broker ()
 
virtual void open (Response::Callback::Open *cb, const char *fname, uint32_t flags, uint32_t bufsz)=0
 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)=0
 Open a file, and create it if it doesn't exist, optionally overwriting the contents. More...
 
virtual void close (ResponseCallback *cb, uint32_t fd)=0
 Close open file. More...
 
virtual void read (Response::Callback::Read *cb, uint32_t fd, uint32_t amount)=0
 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)=0
 Append data to open file. More...
 
virtual void seek (ResponseCallback *cb, uint32_t fd, uint64_t offset)=0
 Seek open file. More...
 
virtual void remove (ResponseCallback *cb, const char *fname)=0
 Remove a file or directory. More...
 
virtual void length (Response::Callback::Length *cb, const char *fname, bool accurate=true)=0
 Get length of file. More...
 
virtual void pread (Response::Callback::Read *cb, uint32_t fd, uint64_t offset, uint32_t amount, bool verify_checksum)=0
 Read from file at position. More...
 
virtual void mkdirs (ResponseCallback *cb, const char *dname)=0
 Make a directory hierarcy, If the parent dirs are not, present, they are also created. More...
 
virtual void rmdir (ResponseCallback *cb, const char *dname)=0
 Remove a directory. More...
 
virtual void readdir (Response::Callback::Readdir *cb, const char *dname)=0
 Read a directory's contents. More...
 
virtual void flush (ResponseCallback *cb, uint32_t fd)=0
 Flush data that has been written. More...
 
virtual void sync (ResponseCallback *cb, uint32_t fd)=0
 Sync out data that has been written. More...
 
virtual void status (Response::Callback::Status *cb)=0
 Check status of FSBroker. More...
 
virtual void shutdown (ResponseCallback *cb)=0
 Gracefully shutdown broker, closeing open files. More...
 
virtual void exists (Response::Callback::Exists *cb, const char *fname)=0
 Check for the existence of a file. More...
 
virtual void rename (ResponseCallback *cb, const char *src, const char *dst)=0
 Rename a file from src to dst. More...
 
virtual void debug (ResponseCallback *cb, int32_t command, StaticBuffer &serialized_parameters)=0
 Debug command. More...
 
OpenFileMapget_open_file_map ()
 

Protected Attributes

OpenFileMap m_open_file_map
 A map of open files. More...
 

Detailed Description

Abstract class to be implemented by brokers.

Definition at line 51 of file Broker.h.

Constructor & Destructor Documentation

virtual Hypertable::FsBroker::Lib::Broker::~Broker ( )
inlinevirtual

Definition at line 53 of file Broker.h.

Member Function Documentation

virtual void Hypertable::FsBroker::Lib::Broker::append ( Response::Callback::Append cb,
uint32_t  fd,
uint32_t  amount,
const void *  data,
Filesystem::Flags  flags 
)
pure 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)

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::close ( ResponseCallback cb,
uint32_t  fd 
)
pure virtual

Close open file.

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

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::create ( Response::Callback::Open cb,
const char *  fname,
uint32_t  flags,
int32_t  bufsz,
int16_t  replication,
int64_t  blksz 
)
pure 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

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::debug ( ResponseCallback cb,
int32_t  command,
StaticBuffer serialized_parameters 
)
pure virtual

Debug command.

Parameters
command
serialized_parameters
cb

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::exists ( Response::Callback::Exists cb,
const char *  fname 
)
pure virtual

Check for the existence of a file.

Parameters
cbResponse callback
fnameThe file to be checked.

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::flush ( ResponseCallback cb,
uint32_t  fd 
)
pure virtual

Flush data that has been written.

Parameters
fdAn open file.
cb

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

OpenFileMap& Hypertable::FsBroker::Lib::Broker::get_open_file_map ( )
inline
Return values
Returnsa refrence to the open file map.

Definition at line 229 of file Broker.h.

virtual void Hypertable::FsBroker::Lib::Broker::length ( Response::Callback::Length cb,
const char *  fname,
bool  accurate = true 
)
pure virtual

Get length of file.

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

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::mkdirs ( ResponseCallback cb,
const char *  dname 
)
pure virtual

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

Parameters
dnameThe pathname
cb

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::open ( Response::Callback::Open cb,
const char *  fname,
uint32_t  flags,
uint32_t  bufsz 
)
pure 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

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::pread ( Response::Callback::Read cb,
uint32_t  fd,
uint64_t  offset,
uint32_t  amount,
bool  verify_checksum 
)
pure 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

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::read ( Response::Callback::Read cb,
uint32_t  fd,
uint32_t  amount 
)
pure virtual

Read data from an open file.

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

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::readdir ( Response::Callback::Readdir cb,
const char *  dname 
)
pure virtual

Read a directory's contents.

Parameters
dnameThe directory to list.
cb

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::remove ( ResponseCallback cb,
const char *  fname 
)
pure virtual

Remove a file or directory.

Parameters
fnameFile to remove.
cb

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::rename ( ResponseCallback cb,
const char *  src,
const char *  dst 
)
pure virtual

Rename a file from src to dst.

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

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::rmdir ( ResponseCallback cb,
const char *  dname 
)
pure virtual

Remove a directory.

Parameters
dnameThe directory to be removed.
cb

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::seek ( ResponseCallback cb,
uint32_t  fd,
uint64_t  offset 
)
pure virtual

Seek open file.

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

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::shutdown ( ResponseCallback cb)
pure virtual

Gracefully shutdown broker, closeing open files.

Parameters
cbCallbock to be called upon finishing task.

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::status ( Response::Callback::Status cb)
pure virtual

Check status of FSBroker.

Parameters
cbcall cb->response_ok()

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

virtual void Hypertable::FsBroker::Lib::Broker::sync ( ResponseCallback cb,
uint32_t  fd 
)
pure virtual

Sync out data that has been written.

Parameters
fdAn open file.
cb

Implemented in Hypertable::FsBroker::MaprBroker, Hypertable::FsBroker::QfsBroker, Hypertable::FsBroker::LocalBroker, and Hypertable::FsBroker::CephBroker.

Member Data Documentation

OpenFileMap Hypertable::FsBroker::Lib::Broker::m_open_file_map
protected

A map of open files.

This map keeps track of files opened by each client, and optionally their filename and other important information.

Definition at line 237 of file Broker.h.


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