Class RowKeyElastic
java.lang.Object
ghidra.features.bsim.query.description.RowKey
ghidra.features.bsim.query.elastic.RowKeyElastic
- All Implemented Interfaces:
Comparable<RowKey>
A "document id" that uniquely indexes documents, within the ElasticSearch database,
that describe executables
ExecutableRecord
and functions FunctionDescription
This plays the same role as the row id for executable and function rows in an SQL
database.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionKey initialized to zeroRowKeyElastic
(int a, int b, int c) Create 96-bit, given 3 32-bit integersRowKeyElastic
(long val) Initialize a key from a 64-bit long valueRowKeyElastic
(String md5) Construct key from String representation of an md5 hash. -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
Emit the key as a base64 string of 16-characters.void
generateFunctionId
(StringBuilder buffer, FunctionDescription func) Generate an id string for a FunctionDescription.void
generateLibraryFunctionId
(StringBuilder buffer, String funcName) Generate an encoded document id from 64 bits of this key + additional bits derived from a name string.long
getLong()
int
hashCode()
static RowKeyElastic
Parse an encoded document id of an executable back into a keystatic RowKeyElastic
parseFunctionId
(String val) Parse an encoded document id of a function back into a key This handles both the normal function form: 64-bits encoded as decimal and the library function form: 80-bits encoded in base64
-
Field Details
-
valueA
protected int valueA -
valueB
protected int valueB -
valueC
protected int valueC
-
-
Constructor Details
-
RowKeyElastic
public RowKeyElastic(long val) Initialize a key from a 64-bit long value- Parameters:
val
- is (least significant) 64-bits of the key
-
RowKeyElastic
public RowKeyElastic(int a, int b, int c) Create 96-bit, given 3 32-bit integers- Parameters:
a
- is most significant 32-bitsb
- is middle 32-bitsc
- is least significant 32-bits
-
RowKeyElastic
Construct key from String representation of an md5 hash. The key is initialized from the last 96-bits of the hash- Parameters:
md5
- is the hash
-
RowKeyElastic
public RowKeyElastic()Key initialized to zero
-
-
Method Details
-
getLong
public long getLong() -
equals
-
hashCode
public int hashCode() -
compareTo
-
generateExeIdString
Emit the key as a base64 string of 16-characters. Used to encode executable document ids- Returns:
- the String encoding
-
generateLibraryFunctionId
Generate an encoded document id from 64 bits of this key + additional bits derived from a name string. This encodes the document id of a library function given just the function Name and the RowKey (this) of the containing library executable. The final String encodes 80-bits of id in 14 characters.- Parameters:
buffer
- is the StringBuilder to encode the id tofuncName
- is a function name that is hashed into the final encoded id
-
generateFunctionId
Generate an id string for a FunctionDescription. If the function is not from a library, just use the counter id already set for the function and emit it as a decimal string. If it is from a library, emit an id, 4 bytes of which is from the md5 placeholder hash of the library, the rest of the id is a base64 encoding of a hash generated from: the remainder of the md5 placeholder hash of the library the name of the function- Parameters:
buffer
- holds the emitted id stringfunc
- is the function being labeled
-
parseExeIdString
Parse an encoded document id of an executable back into a key- Parameters:
id
- is the encoded String- Returns:
- the decoded RowKey
-
parseFunctionId
Parse an encoded document id of a function back into a key This handles both the normal function form: 64-bits encoded as decimal and the library function form: 80-bits encoded in base64- Parameters:
val
- is the encoded String- Returns:
- the decoded RowKey
-