blob: cf58d066ff175801688459dd595809f6cd6759c7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.fs4;
import java.nio.ByteBuffer;
/**
* A ping packet for FS4. This packet has no data. It maps to
* PCODE_MONITORQUERY the C++ implementation of the protocol.
*
* @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
*/
public class PingPacket extends BasicPacket {
private int flags = 0;
public int getCode() { return (flags == 0) ? 206 : 220; }
public void encodeBody(ByteBuffer buffer) {
if (flags != 0) {
buffer.putInt(MQF_QFLAGS);
buffer.putInt(flags);
}
}
/** feature bits, taken from searchlib/common/transport.h */
static final int MQF_QFLAGS = 0x00000002;
/** flag bits, taken from searchlib/common/transport.h */
static final int MQFLAG_REPORT_ACTIVEDOCS = 0x00000020;
/** ask the backend to report active (searchable) documents */
public void enableActivedocsReporting() {
flags |= MQFLAG_REPORT_ACTIVEDOCS;
}
}
|