short SeqGenEntry::fetchNewRange(SequenceGeneratorAttributes &inSGA) { Lng32 cliRC = 0; // fetch new range from Seq Generator database SequenceGeneratorAttributes sga; sga = inSGA; if (sga.getSGCache() == 0) sga.setSGCache(1); sga.setSGRetryNum(getRetryNum()); cliRC = SQL_EXEC_SeqGenCliInterface(&cliInterfaceArr_, &sga); if (cliRC < 0) return (short)cliRC; cachedStartValue_ = sga.getSGNextValue(); cachedCurrValue_ = cachedStartValue_; cachedEndValue_ = sga.getSGEndValue(); if (cachedStartValue_ > sga.getSGMaxValue()) { return -1579; // max reached } fetchNewRange_ = FALSE; return 0; }
char * Reliapack::getAckPacket(char *packet) { char * buf = new char[HEADER_LENGTH]; //copy the sequence number and retry number into new packet. for(int i=0; i<4; i++) { //buf[i+4] = packet[i]; buf[i] = 0; } for(int i=8; i<HEADER_LENGTH; i++) buf[i] = packet[i]; setResponseSeqNum(buf, getSeqNum(packet)); setResponseRetryNum(buf, getRetryNum(packet)); return buf; }
SeqGenEntry * SequenceValueGenerator::getEntry(SequenceGeneratorAttributes &sga) { Int64 hashVal = sga.getSGObjectUID().get_value(); sgQueue()->position((char*)&hashVal, sizeof(hashVal)); SeqGenEntry * sge = NULL; while ((sge = (SeqGenEntry *)sgQueue()->getNext()) != NULL) { if (sge->getSGObjectUID() == hashVal) break; } if (! sge) { sge = new(getHeap()) SeqGenEntry(hashVal, getHeap()); sgQueue()->insert((char*)&hashVal, sizeof(hashVal), sge); } sge->setRetryNum(getRetryNum()); return sge; }