Double the table's size and re-hash everything.
Double the table's size and re-hash everything.
Insert raw bytes with given hash code into the map if not present.
Insert raw bytes with given hash code into the map if not present. The key bytes for comparison is assumed to be at the start having "numKeyBytes" size, while the total size including value is "numBytes". Normally one would have serialized form of key bytes followed by self-contained serialized form of value bytes (i.e. including its size).
This method will handle writing only the 8 byte key header while any additional fixed-width bytes to be tracked in read/write should be taken care of in handleExisting and handleNew. These bytes are not part of key equality check itself.
the base object for the bytes as required by Unsafe API
the base offset for the bytes as required by Unsafe API
number of bytes used by the key which should be at the start of "baseObject" with value after that
the total number of bytes used by key and value together (excluding the four bytes of "numKeyBytes" itself)
the hash code of key bytes
A HashMap implementation using a serialized ByteBuffer for key data and another one for value data. Key data is required to hold fixed-width values while the value data will be written back-to-back as new data is inserted into the map. Key data is stored in the following format:
If key has variable length data, then it should be appended to the value data. The offset+hash code is read as a single long where LSB is used for hash code while MSB is used for offset, so the two can be reverse in actual memory layout on big-endian machines. Since there is no disk storage of this map so no attempt is made to have consistent endianness or memory layout of the data.
Rehash of the map (when loadFactor exceeds) moves around the above key fields to create a new array as per the new hash locations. The value fields are left untouched with the headers of keys having the offsets into value array as before the rehash.