MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / predictSerializedSize

Method predictSerializedSize

src/PutRequest.java:492–501  ·  view source on GitHub ↗

Predicts a lower bound on the serialized size of this RPC. This is to avoid using a dynamic buffer, to avoid re-sizing the buffer. Since we use a static buffer, if the prediction is wrong and turns out to be less than what we need, there will be an exception which will prevent the RPC from being ser

()

Source from the content-addressed store, hash-verified

490 * prevent the RPC from being serialized. That'd be a severe bug.
491 */
492 private int predictSerializedSize() {
493 int size = 0;
494 size += 4; // int: Number of parameters.
495 size += 1; // byte: Type of the 1st parameter.
496 size += 3; // vint: region name length (3 bytes => max length = 32768).
497 size += region.name().length; // The region name.
498
499 size += predictPutSize();
500 return size;
501 }
502
503 /** The raw size of the underlying `Put'. */
504 int predictPutSize() {

Callers 1

serializeOldMethod · 0.95

Calls 2

predictPutSizeMethod · 0.95
nameMethod · 0.45

Tested by

no test coverage detected