MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / getSaltBytes

Method getSaltBytes

src/core/RowKey.java:115–123  ·  view source on GitHub ↗

Returns the byte array for the given salt id WARNING: Don't use this one unless you know what you're doing. It's here for unit testing. @param bucket The ID of the bucket to get the salt for @return The salt as a byte array based on the width in bytes @since 2.2

(final int bucket)

Source from the content-addressed store, hash-verified

113 * @since 2.2
114 */
115 public static byte[] getSaltBytes(final int bucket) {
116 final byte[] bytes = new byte[Const.SALT_WIDTH()];
117 int shift = 0;
118 for (int i = 1;i <= Const.SALT_WIDTH(); i++) {
119 bytes[Const.SALT_WIDTH() - i] = (byte) (bucket >>> shift);
120 shift += 8;
121 }
122 return bytes;
123 }
124
125 /**
126 * Calculates and writes an array of one or more salt bytes at the front of

Callers 9

getSaltMethod · 0.95
getSaltNegativeWidthMethod · 0.95
getDataTableScannersMethod · 0.95
prepareRequestsMethod · 0.95
prefixKeyWithSaltMethod · 0.95
getScannerMethod · 0.95
getMetricScannerMethod · 0.95

Calls 1

SALT_WIDTHMethod · 0.95

Tested by 4

getSaltMethod · 0.76
getSaltNegativeWidthMethod · 0.76