예제 #1
0
 /**
  * Sets a list of vbuckets to stream keys from.
  *
  * @param vbs - A list of vbuckets.
  */
 public void setVbucketlist(int[] vbs) {
   byte[] vblist = new byte[(vbs.length + 1) * VBUCKET_LIST_FIELD_LENGTH];
   for (int i = 0; i < vbs.length + 1; i++) {
     if (i == 0) Util.valueToField(vblist, 0, VBUCKET_LIST_FIELD_LENGTH, (long) vbs.length);
     else if (vbs[i - 1] < TapStreamClient.NUM_VBUCKETS && vbs[i - 1] >= 0)
       Util.valueToField(
           vblist, (i * VBUCKET_LIST_FIELD_LENGTH), VBUCKET_LIST_FIELD_LENGTH, (long) vbs[i - 1]);
     else LOG.info("vBucket ignored " + vbs[i - 1] + "is not a valid vBucket number");
   }
   vbucketlist = vblist;
   encode();
 }
예제 #2
0
 /**
  * Sets the flags for the tap stream. These flags decide what kind of tap stream will be received.
  *
  * @param f The flags to use for this tap stream.
  */
 public void setFlags(Flag f) {
   if (flags.length != FLAGS_FIELD_LENGTH) flags = new byte[FLAGS_FIELD_LENGTH];
   if (!f.hasFlag(getFlags())) {
     Util.valueToField(flags, 0, FLAGS_FIELD_LENGTH, (long) f.flag);
     encode();
   }
 }
예제 #3
0
 /**
  * Stream all keys inserted into the server after a given date.
  *
  * @param date - The date to stream keys from. Null to stream all keys.
  */
 public void setBackfill(Date date) {
   backfilldate = new byte[BACKFILL_DATE_FIELD_LENGTH];
   if (date == null) {
     for (int i = 0; i < 8; i++) backfilldate[i] = -1;
   } else {
     Util.valueToField(backfilldate, 0, BACKFILL_DATE_FIELD_LENGTH, date.getTime());
   }
   encode();
 }
예제 #4
0
 /**
  * Returns the flags for this message.
  *
  * @return An int value of flags set for this tap message.
  */
 public int getFlags() {
   if (flags.length != FLAGS_FIELD_LENGTH) return 0;
   return (int) Util.fieldToValue(flags, 0, FLAGS_FIELD_LENGTH);
 }