Example #1
0
    response_lrpop (LeftOrRight lr)
    {
      if (lr == IS_LEFT) {
	    setPCode (TAIR_RESP_LPOP_PACKET);
      } else {
	    setPCode (TAIR_RESP_RPOP_PACKET);
      }

      config_version = 0;
      values.clear ();
    }
Example #2
0
    request_lrpop (LeftOrRight lr)
    {
      if (lr == IS_LEFT)
	    setPCode (TAIR_REQ_LPOP_PACKET);
      else
	    setPCode (TAIR_REQ_RPOP_PACKET);

      server_flag = 0;
      area = 0;
      version = 0;
      expire = 0;
      count = 1;
    }
 request_sadd_multi() {
     setPCode(TAIR_REQ_SADDMULTI_PACKET);
     area = 0;
     expire = 0;
     keys_values_map.clear();
     sfree = 1;
 }
    request_sadd_multi(request_sadd_multi & packet)
    {
      setPCode(packet.getPCode());
      server_flag = packet.server_flag;
      area = packet.area;

      expire = packet.expire;

      sfree = packet.sfree;

      keys_values_map.clear();
      map<data_entry*, vector<data_entry *>*>::iterator iter;
      for(iter = packet.keys_values_map.begin();
              iter != keys_values_map.end(); iter++) {
          data_entry* key = iter->first;
          vector<data_entry*>* values = iter->second;

          data_entry* ckey = new data_entry();
          ckey->clone(*key);

          vector<data_entry*>* cvalues = new vector<data_entry*>();
          if (values != NULL) {
              int size = values->size();
              for(int i = 0; i < size; i++) {
                  data_entry* tmp = new data_entry();
                  tmp->clone(*tmp);
                  cvalues->push_back(tmp);
              }
          }

          keys_values_map.insert(make_pair(ckey, cvalues));
      }
    }
Example #5
0
 response_hmset ()
 {
   config_version = 0;
   setPCode (TAIR_RESP_HMSET_PACKET);
   code = 0;
   retvalue = 0;
 }
Example #6
0
 response_hget ()
 {
   config_version = 0;
   setPCode (TAIR_RESP_HGET_PACKET);
   code = 0;
   version = 0;
 }
Example #7
0
 flow_control_set() : type(tair::stat::IN),
                      lower_mb(-1),
                      upper_mb(-1),
                      ns(-1),
                      success(false) {
     setPCode(TAIR_FLOW_CONTROL_SET);
 }
Example #8
0
 request_hvals (request_hvals & packet)
 {
   setPCode (packet.getPCode ());
   server_flag = packet.server_flag;
   area = packet.area;
   key.clone (packet.key);
 }
Example #9
0
    request_prefix_incdec(const request_prefix_incdec &rhs) {
        setPCode(TAIR_REQ_PREFIX_INCDEC_PACKET);
        server_flag = rhs.server_flag;
        area = rhs.area;
        key_count = rhs.key_count;
        packet_id = rhs.packet_id;
        if (rhs.pkey != NULL) {
            pkey = new data_entry(*rhs.pkey);
        } else {
            pkey = NULL;
        }

        if (rhs.key_counter_map != NULL) {
            key_counter_map = new key_counter_map_t;
            key_counter_map_t::const_iterator it = rhs.key_counter_map->begin();
            while (it != rhs.key_counter_map->end()) {
                data_entry *key = new data_entry(*it->first);
                counter_wrapper *wrapper = new counter_wrapper(*it->second);
                key_counter_map->insert(make_pair(key, wrapper));
                ++it;
            }
        } else {
            key_counter_map = NULL;
        }
    }
    void clone(request_mput &packet, bool need_alloc)
    {
      if (this == &packet) {
        return ;
      }
      clear();
      setPCode(TAIR_REQ_MPUT_PACKET);
      server_flag = packet.server_flag;
      area = packet.area;
      count = packet.count;
      len = packet.len;
      compressed = packet.compressed;
      packet_data_len = packet.packet_data_len;

      if (need_alloc) {
        if (compressed) {
          packet_data = new char[packet_data_len];
          memcpy(packet_data, packet.packet_data, packet_data_len);
        }

        alloc = true;
        record_vec = new mput_record_vec();
        mput_record_vec::iterator it;
        for (it = packet.record_vec->begin(); it != packet.record_vec->end(); ++it) {
          mput_record* rec = new mput_record(**it);
          record_vec->push_back(rec);
        }
      } else {
        alloc = packet.alloc;
        record_vec = packet.record_vec;
        packet_data = packet.packet_data;
      }

      packet_id = packet.packet_id;
    }
Example #11
0
 request_get_items(request_get_items& packet) : request_get(packet)
 {
    setPCode(TAIR_REQ_GETITEMS_PACKET);
    count = packet.count;
    offset = packet.offset;
    type = packet.type;
 }
Example #12
0
 request_exists(const uint16_t iarea, const data_entry &ikey)
 {
   setPCode(TAIR_REQ_EXISTS_PACKET);
   server_flag = 0;
   area = iarea;
   key = ikey;
 }
Example #13
0
    response_lrange ()
    {
      setPCode (TAIR_RESP_LRANGE_PACKET);

      config_version = 0;
      values.clear ();
    }
Example #14
0
 request_lrange (int pcode)
 {
   setPCode (pcode);
   server_flag = 0;
   area = 0;
   start = 0;
   end = 0;
 }
 request_put()
 {
    setPCode(TAIR_REQ_PUT_PACKET);
    server_flag = 0;
    area = 0;
    version = 0;
    expired = 0;
 }
Example #16
0
 request_mupdate()
 {
    setPCode(TAIR_REQ_MUPDATE_PACKET);
    server_flag = 0;
    count = 0;
    len = 8;
    key_and_values = NULL;
 }
Example #17
0
    request_zrevrank (request_zrevrank & packet)
    {
      setPCode (packet.getPCode ());
      server_flag = packet.server_flag;
      area = packet.area;

      key.clone (packet.key);
    }
Example #18
0
 request_prefix_puts() {
   setPCode(TAIR_REQ_PREFIX_PUTS_PACKET);
   area = 0;
   key_count = 0;
   packet_id = 0;
   pkey = NULL;
   kvmap = NULL;
 }
 request_sadd()
 {
   setPCode(TAIR_REQ_SADD_PACKET);
   server_flag = 0;
   area = 0;
   version = 0;
   expire = 0;
 }
Example #20
0
 request_expire (request_expire & packet)
 {
   setPCode (packet.getPCode ());
   server_flag = packet.server_flag;
   area = packet.area;
   expiretime = packet.expiretime;
   key.clone (packet.key);
 }
Example #21
0
    request_persist (request_persist & packet)
    {
      setPCode (packet.getPCode ());
      server_flag = packet.server_flag;
      area = packet.area;

      key.clone (packet.key);
    }
Example #22
0
 request_hexists(const uint16_t iarea, const data_entry &ikey, const data_entry &ifield)
 {
   setPCode(TAIR_REQ_HEXISTS_PACKET);
   server_flag = 0;
   area = iarea;
   key = ikey;
   field = ifield;
 }
Example #23
0
    request_hexists(request_hexists & packet)
    {
      setPCode(packet.getPCode());
      server_flag = packet.server_flag;
      area = packet.area;

      key.clone(packet.key);
      field.clone(packet.field);
    }
Example #24
0
 request_prefix_incdec() {
     setPCode(TAIR_REQ_PREFIX_INCDEC_PACKET);
     server_flag = 0;
     area = 0;
     pkey = NULL;
     key_count = 0;
     packet_id = 0;
     key_counter_map = NULL;
 }
Example #25
0
    request_lrange ()
    {
      setPCode (TAIR_REQ_LRANGE_PACKET);

      server_flag = 0;
      area = 0;
      start = 0;
      end = 0;
    }
    request_zrem ()
    {
      setPCode (TAIR_REQ_ZREM_PACKET);

      server_flag = 0;
      area = 0;
      version = 0;
      expire = 0;
    }
Example #27
0
 response_inval_stat() : base_packet() {
     config_version = 0;
     key = NULL;
     stat_value = NULL;
     setPCode(TAIR_RESP_INVAL_STAT_PACKET);
     uncompressed_data_size = 0;
     group_count = 0;
     code = 0;
 }
    response_zrange()
    {
      setPCode(TAIR_RESP_ZRANGE_PACKET);

      needfree       = true;
      config_version = 0;

      values.clear();
    }
    response_zrangewithscore()
    {
      setPCode(TAIR_RESP_ZRANGEWITHSCORE_PACKET);

      config_version = 0;
      needfree       = true;
      values.clear();
      scores.clear();
    }
Example #30
0
 request_lrange (request_lrange & packet)
 {
   setPCode (packet.getPCode ());
   server_flag = packet.server_flag;
   area = packet.area;
   start = packet.start;
   end = packet.end;
   key.clone (packet.key);
 }