Files

61 lines
1.6 KiB
C
Raw Permalink Normal View History

2013-08-02 13:12:24 -07:00
// Gigablast, Inc., copyright Jul 2007
// like Msg1.h but buffers up the add requests to avoid packet storms
2016-03-08 22:14:30 +01:00
#ifndef GB_MSG4_H
#define GB_MSG4_H
2013-08-02 13:12:24 -07:00
bool saveAddsInProgress ( const char *filenamePrefix );
bool loadAddsInProgress ( const char *filenamePrefix );
2013-08-02 13:12:24 -07:00
// used by Repair.cpp to make sure we are not adding any more data ("writing")
bool hasAddsInQueue ( ) ;
bool isInMsg4LinkedList ( class Msg4 *msg4 ) ;
2014-02-09 12:38:40 -07:00
#include "SafeBuf.h"
2013-08-02 13:12:24 -07:00
class Msg4 {
public:
static bool registerHandler();
2013-08-02 13:12:24 -07:00
// meta list format =
// (rdbId | 0x08) then rdb record [if nosplit]
// (rdbId | 0x00) then rdb record [if split ]
bool addMetaList( class SafeBuf *sb, collnum_t collnum, void *state,
void (* callback)(void *state), int32_t niceness, char rdbId = -1, int32_t shardOverride = -1 );
2014-01-10 14:12:58 -08:00
2013-08-02 13:12:24 -07:00
// this one is faster...
// returns false if blocked
bool addMetaList( const char *metaList, int32_t metaListSize, collnum_t collnum, void *state,
void (* callback)(void *state), int32_t niceness, char rdbId = -1, int32_t shardOverride = -1 );
bool addMetaList2();
2013-08-02 13:12:24 -07:00
2016-05-19 18:37:26 +02:00
Msg4() { m_inUse = false; }
// why wasn't this saved in addsinprogress.dat file?
2016-05-19 18:37:26 +02:00
~Msg4() { if ( m_inUse ) log("BAD: MSG4 in use!!!!!!"); }
2013-08-02 13:12:24 -07:00
// private:
void (*m_callback ) ( void *state );
void *m_state;
2014-02-09 12:38:40 -07:00
SafeBuf m_tmpBuf;
2013-08-02 13:12:24 -07:00
char m_rdbId;
char m_inUse;
collnum_t m_collnum;
2014-11-10 14:45:11 -08:00
int32_t m_niceness;
2014-11-10 14:45:11 -08:00
int32_t m_shardOverride;
2013-08-02 13:12:24 -07:00
2016-02-15 15:57:54 +01:00
const char *m_metaList ;
2014-11-10 14:45:11 -08:00
int32_t m_metaListSize ;
2016-02-15 15:57:54 +01:00
const char *m_currentPtr ; // into m_metaList
2013-08-02 13:12:24 -07:00
// the linked list for waiting in line
class Msg4 *m_next;
};
2016-03-08 22:14:30 +01:00
#endif // GB_MSG4_H