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

Method predictSerializedSize

src/AppendRequest.java:504–518  ·  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

502 * prevent the RPC from being serialized. That'd be a severe bug.
503 */
504 private int predictSerializedSize() {
505 int size = 0;
506 size += 4; // int: Number of parameters.
507 size += 1; // byte: Type of the 1st parameter.
508 size += 3; // vint: region name length (3 bytes => max length = 32768).
509 size += region.name().length; // The region name.
510
511 size += predictAppendSize();
512 size += 4; // int: Number of attributes
513 size += 4; // int: length of the attribute name
514 size += 4; // char[]: attribute name
515 size += 1; // vint: attribute length
516 size += 1; // vint: attribute value
517 return size;
518 }
519
520 /** The raw size of the underlying `Append'. */
521 int predictAppendSize() {

Callers 1

serializeOldMethod · 0.95

Calls 2

predictAppendSizeMethod · 0.95
nameMethod · 0.45

Tested by

no test coverage detected