27 #ifndef FsBroker_Lib_Client_h
28 #define FsBroker_Lib_Client_h
43 #include <unordered_map>
72 const sockaddr_in &addr, uint32_t timeout_ms);
93 Client(
Comm *comm,
const sockaddr_in &addr, uint32_t timeout_ms);
101 Client(
const String &host,
int port, uint32_t timeout_ms);
116 int open(
const String &name, uint32_t flags)
override;
118 uint32_t outstanding, uint64_t start_offset=0,
119 uint64_t end_offset=0)
override;
123 int32_t bufsz, int32_t replication,
125 int create(
const String &name, uint32_t flags, int32_t bufsz,
126 int32_t replication, int64_t blksz)
override;
130 void close(int32_t fd)
override;
133 size_t read(int32_t fd,
void *dst,
size_t amount)
override;
135 uint64_t *offset, uint32_t *
length)
override;
142 uint32_t *
length)
override;
145 void seek(int32_t fd, uint64_t offset)
override;
148 void remove(
const String &name,
bool force =
true)
override;
152 int64_t
length(
const String &name,
bool accurate =
true)
override;
155 void pread(int32_t fd,
size_t len, uint64_t offset,
157 size_t pread(int32_t fd,
void *dst,
size_t len, uint64_t offset,
158 bool verify_checksum)
override;
160 uint64_t *offset, uint32_t *
length)
override;
166 void flush(int32_t fd)
override;
168 void sync(int32_t fd)
override;
171 void rmdir(
const String &name,
bool force =
true)
override;
174 void readdir(
const String &name, std::vector<Dirent> &listing)
override;
176 std::vector<Dirent> &listing)
override;
240 #endif // FsBroker_Lib_Client_h
void decode_response_open(EventPtr &event, int32_t *fd) override
Decodes the response from an open request.
A memory buffer of static size.
void sync(int32_t fd) override
int64_t decode_response_length(EventPtr &event) override
Decodes the response from a length request.
Holds Nagios-style program status information.
int open_buffered(const String &name, uint32_t flags, uint32_t buf_size, uint32_t outstanding, uint64_t start_offset=0, uint64_t end_offset=0) override
Opens a file in buffered (readahead) mode.
Abstract base class for a filesystem.
std::string String
A String is simply a typedef to std::string.
std::unordered_map< uint32_t, ClientBufferedReaderHandler * > m_buffered_reader_map
void mkdirs(const String &name, DispatchHandler *handler) override
Creates a directory asynchronously.
Abstract base class for application dispatch handlers registered with AsyncComm.
bool decode_response_exists(EventPtr &event) override
Decodes the response from an exists request.
Flags
Enumeration type for append flags.
Program options handling.
std::shared_ptr< Event > EventPtr
Smart pointer to Event.
void flush(int32_t fd, DispatchHandler *handler) override
void append(int32_t fd, StaticBuffer &buffer, Flags flags, DispatchHandler *handler) override
void decode_response_pread(EventPtr &event, const void **buffer, uint64_t *offset, uint32_t *length) override
Decodes the response from a pread request.
ConnectionManagerPtr m_conn_mgr
void status(Status &status, Timer *timer=0) override
Check status of filesystem.
void send_message(CommBufPtr &cbuf, DispatchHandler *handler, Timer *timer=0)
Sends a message to the FS broker.
void length(const String &name, bool accurate, DispatchHandler *handler) override
Gets the length of a file asynchronously.
void decode_response_status(EventPtr &event, Status &status) override
Decodes the response from an status request.
uint32_t get_timeout()
Gets the configured request timeout value.
void create(const String &name, uint32_t flags, int32_t bufsz, int32_t replication, int64_t blksz, DispatchHandler *handler) override
Creates a file asynchronously.
void readdir(const String &name, DispatchHandler *handler) override
Obtains a listing of all files in a directory asynchronously.
void close(int32_t fd, DispatchHandler *handler) override
Encapsulate an internet address.
void decode_response_create(EventPtr &event, int32_t *fd) override
Decodes the response from a create request.
std::shared_ptr< CommBuf > CommBufPtr
Smart pointer to CommBuf.
std::shared_ptr< Client > ClientPtr
Smart pointer to Client.
void pread(int32_t fd, size_t len, uint64_t offset, bool verify_checksum, DispatchHandler *handler) override
std::shared_ptr< Properties > PropertiesPtr
void decode_response_readdir(EventPtr &event, std::vector< Dirent > &listing) override
Decodes the response from a readdir request.
bool wait_for_connection(uint32_t max_wait_ms)
Waits up to max_wait_secs for a connection to be established with the FS broker.
void debug(int32_t command, StaticBuffer &serialized_parameters) override
Invokes debug request asynchronously.
void read(int32_t fd, size_t amount, DispatchHandler *handler) override
Perform immediate shutdown.
void rename(const String &src, const String &dst, DispatchHandler *handler) override
Rename a path asynchronously.
void shutdown(uint16_t flags, DispatchHandler *handler)
Shuts down the FS broker.
Entry point to AsyncComm service.
Client(ConnectionManagerPtr &conn_manager_ptr, const sockaddr_in &addr, uint32_t timeout_ms)
Constructor with explicit values.
Declarations for ConnectionManager.
void open(const String &name, uint32_t flags, DispatchHandler *handler) override
Opens a file asynchronously.
Internet address wrapper classes and utility functions.
void rmdir(const String &name, DispatchHandler *handler) override
Recursively removes a directory asynchronously.
A timer class to keep timeout states across AsyncComm related calls.
Proxy class for FS broker.
void seek(int32_t fd, uint64_t offset, DispatchHandler *handler) override
std::shared_ptr< ConnectionManager > ConnectionManagerPtr
Smart pointer to ConnectionManager.
void decode_response_append(EventPtr &event, uint64_t *offset, uint32_t *length) override
Decodes the response from an append request.
void decode_response_read(EventPtr &event, const void **buffer, uint64_t *offset, uint32_t *length) override
Decodes the response from a read request.
void exists(const String &name, DispatchHandler *handler) override
Determines if a file exists asynchronously.
Declarations for DispatchHandlerSynchronizer.
Abstract base class for a filesystem.