1 //-< REPSOCK.H >-----------------------------------------------------*--------* 2 // FastDB Version 1.0 (c) 1999 GARRET * ? * 3 // (Main Memory Database Management System) * /\| * 4 // * / \ * 5 // Created: 6-May-2003 K.A. Knizhnik * / [] \ * 6 // Last update: 6-Apr-2003 K.A. Knizhnik * GARRET * 7 //-------------------------------------------------------------------*--------* 8 // Replication socket 9 //-------------------------------------------------------------------*--------* 10 11 #ifndef __REPSOCK_H__ 12 #define __REPSOCK_H__ 13 14 #include "sockio.h" 15 16 BEGIN_FASTDB_NAMESPACE 17 18 19 // 20 // Socket use for CLI level replication 21 // 22 class FASTDB_DLL_ENTRY replication_socket_t : public socket_t { 23 public: 24 virtual int read(void* buf, size_t min_size, size_t max_size, time_t timeout); 25 virtual bool write(void const* buf, size_t size, time_t timeout); 26 27 virtual bool is_ok(); 28 virtual void get_error_text(char* buf, size_t buf_size); 29 30 virtual bool shutdown(); 31 32 virtual bool close(); 33 34 virtual void handleError(int socket, const char* operation, const char* error); 35 36 static replication_socket_t* connect(char const* addresses[], 37 int n_addresses, 38 int max_attempts = DEFAULT_CONNECT_MAX_ATTEMPTS, 39 time_t timeout = DEFAULT_RECONNECT_TIMEOUT); 40 41 // 42 // Not implemented for replication socket 43 // 44 virtual socket_t* accept(); 45 virtual bool cancel_accept(); 46 virtual char* get_peer_name(); 47 virtual socket_handle_t get_handle(); 48 49 enum { 50 MaxSockets = 8 51 }; 52 53 54 ~replication_socket_t(); 55 56 protected: 57 replication_socket_t(char const* addresses[], int n_adresses, int max_attempts, time_t timeout); 58 59 socket_t** sockets; 60 int n_sockets; 61 bool succeed; 62 }; 63 64 END_FASTDB_NAMESPACE 65 66 #endif 67 68 69 70