![]() |
JaffarPlus
High-performance best-first search optimizer for tool-assisted speedruns
|
Builds the configured InputHistory strategy from the "Store Input History" config object. More...
#include "inputHistory.hpp"#include "inputHistoryNone.hpp"#include "inputHistoryRaw.hpp"#include "inputHistoryTrie.hpp"#include <jaffarCommon/exceptions.hpp>#include <jaffarCommon/json.hpp>Go to the source code of this file.
Functions | |
| std::string | jaffarPlus::inputHistory::getType (const nlohmann::json &config) |
| The configured strategy name ("None" | "Raw" | "Trie"). | |
| std::shared_ptr< void > | jaffarPlus::inputHistory::createSharedBacking (const nlohmann::json &config, const uint32_t numShards) |
| Creates the shared backing for the configured strategy (the trie for "Trie"; nullptr otherwise). | |
| size_t | jaffarPlus::inputHistory::getSharedBackingMaxMemoryBytes (const std::shared_ptr< void > &backing) |
| Hard upper bound (bytes) on the shared backing's memory: the trie's node-storage ceiling for the "Trie" strategy, 0 for None/Raw (their per-state history lives in the StateDb slot, already budgeted). | |
| size_t | jaffarPlus::inputHistory::getSharedBackingApproxMemoryBytes (const std::shared_ptr< void > &backing) |
| Current (approximate) live memory of the shared backing: the trie's node-storage footprint for the "Trie" strategy, 0 for None/Raw. | |
| bool | jaffarPlus::inputHistory::isSharedBackingExhausted (const std::shared_ptr< void > &backing) |
| True if the shared backing (the trie) has hit its hard node-storage ceiling. | |
| std::unique_ptr< InputHistory > | jaffarPlus::inputHistory::create (const nlohmann::json &config, const uint32_t maxInputIndex, const uint32_t numShards, const uint32_t shardId, const std::shared_ptr< void > &backing) |
Creates one runner's input-history instance bound to backing. | |
Builds the configured InputHistory strategy from the "Store Input History" config object.
The shared backing (the trie, for the "Trie" strategy) is created once per search via createSharedBacking() and then bound into each runner's instance via create(). None/Raw have no shared backing. Default type when unspecified: "Trie".
Definition in file inputHistoryFactory.hpp.
| std::unique_ptr< InputHistory > jaffarPlus::inputHistory::create | ( | const nlohmann::json & | config, |
| const uint32_t | maxInputIndex, | ||
| const uint32_t | numShards, | ||
| const uint32_t | shardId, | ||
| const std::shared_ptr< void > & | backing | ||
| ) |
Creates one runner's input-history instance bound to backing.
| config | The "Store Input History" configuration object ("Type" plus any per-strategy keys). |
| maxInputIndex | One past the highest input index (per-step bit width for raw/snapshot encoding). |
| numShards | Shard count the backing was created with (the last shard is the manager shard). |
| shardId | This runner's free-list shard (its worker thread id; 0 for standalone runners). |
| backing | The shared handle from createSharedBacking() (ignored by None/Raw). |
Definition at line 75 of file inputHistoryFactory.hpp.
| std::shared_ptr< void > jaffarPlus::inputHistory::createSharedBacking | ( | const nlohmann::json & | config, |
| const uint32_t | numShards | ||
| ) |
Creates the shared backing for the configured strategy (the trie for "Trie"; nullptr otherwise).
| config | The "Store Input History" configuration object (its "Type" selects the strategy). |
| numShards | Number of contention-free free-list shards (one per worker thread + one for the StateDb/driver manager operations). |
Definition at line 35 of file inputHistoryFactory.hpp.
| size_t jaffarPlus::inputHistory::getSharedBackingApproxMemoryBytes | ( | const std::shared_ptr< void > & | backing | ) |
Current (approximate) live memory of the shared backing: the trie's node-storage footprint for the "Trie" strategy, 0 for None/Raw.
The driver polls this against the ceiling to stop gracefully before the trie's hard cap is hit.
Definition at line 53 of file inputHistoryFactory.hpp.
| size_t jaffarPlus::inputHistory::getSharedBackingMaxMemoryBytes | ( | const std::shared_ptr< void > & | backing | ) |
Hard upper bound (bytes) on the shared backing's memory: the trie's node-storage ceiling for the "Trie" strategy, 0 for None/Raw (their per-state history lives in the StateDb slot, already budgeted).
Used by the engine's RAM guard to account for this otherwise-uncounted, unbounded-growth structure.
Definition at line 44 of file inputHistoryFactory.hpp.
| std::string jaffarPlus::inputHistory::getType | ( | const nlohmann::json & | config | ) |
The configured strategy name ("None" | "Raw" | "Trie").
Required – JaffarPlus configs must set every option explicitly, so an absent "Type" is an error (thrown by the strict accessor).
Definition at line 26 of file inputHistoryFactory.hpp.
| bool jaffarPlus::inputHistory::isSharedBackingExhausted | ( | const std::shared_ptr< void > & | backing | ) |
True if the shared backing (the trie) has hit its hard node-storage ceiling.
False for None/Raw (which have no such ceiling – their history lives in the StateDb slot, already budgeted).
Definition at line 61 of file inputHistoryFactory.hpp.