File tree Expand file tree Collapse file tree 3 files changed +50
-2
lines changed
driver/src/main/java/oracle/nosql/driver Expand file tree Collapse file tree 3 files changed +50
-2
lines changed Original file line number Diff line number Diff line change 2525import static oracle .nosql .driver .util .HttpConstants .REQUEST_NAMESPACE_HEADER ;
2626import static oracle .nosql .driver .util .HttpConstants .NOSQL_DATA_PATH ;
2727import static oracle .nosql .driver .util .HttpConstants .REQUEST_ID_HEADER ;
28+ import static oracle .nosql .driver .util .HttpConstants .SERVER_SERIAL_VERSION ;
2829import static oracle .nosql .driver .util .HttpConstants .USER_AGENT ;
2930import static oracle .nosql .driver .util .HttpConstants .X_RATELIMIT_DELAY ;
3031import static oracle .nosql .driver .util .LogUtil .isLoggable ;
@@ -1230,10 +1231,20 @@ final Result processResponse(HttpResponseStatus status,
12301231
12311232 setSessionCookie (headers );
12321233
1234+ Result res = null ;
12331235 try (ByteInputStream bis = new NettyByteInputStream (content )) {
1234- return processOKResponse (bis , kvRequest , serialVersionUsed ,
1235- queryVersionUsed );
1236+ res = processOKResponse (bis , kvRequest , serialVersionUsed ,
1237+ queryVersionUsed );
12361238 }
1239+ String sv = headers .get (SERVER_SERIAL_VERSION );
1240+ if (sv != null ) {
1241+ try {
1242+ res .setServerSerialVersion (Integer .parseInt (sv ));
1243+ } catch (Exception e ) {
1244+ /* ignore */
1245+ }
1246+ }
1247+ return res ;
12371248 }
12381249
12391250 /**
Original file line number Diff line number Diff line change @@ -22,6 +22,13 @@ public class Result {
2222 private int readUnits ;
2323 private int writeKB ;
2424
25+ /*
26+ * if available, the serial version of the proxy, otherwise 0. This
27+ * allows the SDK to conditionalize code and tests based on new features
28+ * and semantics
29+ */
30+ private int serialVersion ;
31+
2532 /*
2633 * Cloud Only
2734 * If rate limiting is in place, this value will represent the number of
@@ -163,4 +170,23 @@ public TopologyInfo getTopology() {
163170 public void setTopology (TopologyInfo ti ) {
164171 topology = ti ;
165172 }
173+
174+ /**
175+ * @hidden
176+ * Returns the server protocol serial version or 0 if not available.
177+ * This is a new feature not supported in older servers.
178+ *
179+ * @return the serial version of the server
180+ */
181+ public int getServerSerialVersion () {
182+ return serialVersion ;
183+ }
184+
185+ /**
186+ * @hidden
187+ * @param version the server's serial version
188+ */
189+ public void setServerSerialVersion (int version ) {
190+ serialVersion = version ;
191+ }
166192}
Original file line number Diff line number Diff line change @@ -52,6 +52,17 @@ public class HttpConstants {
5252 */
5353 public static final String REQUEST_NAMESPACE_HEADER = "x-nosql-default-ns" ;
5454
55+ /**
56+ * A header that indicates the serial version of the protocol used by the
57+ * server (proxy).
58+ */
59+ public static final String SERVER_SERIAL_VERSION = "x-nosql-serial-version" ;
60+
61+ /**
62+ * A header that indicates the version of the proxy and kv used.
63+ */
64+ public static final String SERVER_VERSION = "x-nosql-version" ;
65+
5566 /**
5667 * Headers possibly set by the load balancer service to indicate original
5768 * IP address
You can’t perform that action at this time.
0 commit comments