algorithms.base
Base classes for analysis algorithms.
- class AnalysisContext[source]
Bases:
objectDescribe the current capture and supply inputs to an algorithm.
secrets can hold known values from ground truth. extra carries algorithm-specific options.
- class Match[source]
Bases:
objectReport one match with a byte offset, length, and confidence.
The algorithm can supply a label, matched bytes, and metadata when it has them. Interpret the offset in the input coordinates.
- class AlgorithmResult[source]
Bases:
objectReport the algorithm name, overall confidence, and matches.
The metadata can contain algorithm-specific diagnostics.
- class BaseAlgorithm[source]
Bases:
ABCBase class for all analysis algorithms.
- abstractmethod run(dump_data, context)[source]
Run the algorithm on dump data.
- Parameters:
dump_data (bytes)
context (AnalysisContext)
- Return type:
- estimate_working_set(size, context=None, sample=None)[source]
Estimate the peak additional memory that
run()needs, in bytes.Exclude the input buffer because the caller budgets it separately. Use context for analysis options and sample for examples of the input bytes when the memory cost depends on content. Give a conservative estimate. The default is zero for algorithms with no size-dependent working set.
- Parameters:
size (int)
context (AnalysisContext | None)
- Return type:
Auto-discovery registry for algorithm plugins.
- ALGORITHM_ENTRY_POINT_GROUP = 'memdiver.algorithms'
Entry-point group under which out-of-tree packages advertise algorithms.
- class AlgorithmRegistry[source]
Bases:
objectDiscover and manage algorithm plugins.
- discover()[source]
Load built-in algorithms and installed algorithm plugins.
Search the known-key, unknown-key, key-finder, and pattern packages. Discover external plugins in the
memdiver.algorithmsentry-point group. A built-in import failure is logged and does not stop the rest of the scan.- Return type:
None