#include <rom_sandbox_manager.h>
Classes | |
struct | SandboxMetadata |
Public Member Functions | |
void | SetRootDirectory (const std::filesystem::path &root) |
const std::filesystem::path & | RootDirectory () const |
absl::StatusOr< SandboxMetadata > | CreateSandbox (Rom &rom, absl::string_view description) |
absl::StatusOr< SandboxMetadata > | ActiveSandbox () const |
absl::StatusOr< std::filesystem::path > | ActiveSandboxRomPath () const |
std::vector< SandboxMetadata > | ListSandboxes () const |
absl::Status | RemoveSandbox (const std::string &id) |
absl::StatusOr< int > | CleanupOlderThan (absl::Duration max_age) |
Static Public Member Functions | |
static RomSandboxManager & | Instance () |
Private Member Functions | |
RomSandboxManager () | |
absl::Status | EnsureRootExistsLocked () |
std::string | GenerateSandboxIdLocked () |
int sequence_ | ABSL_GUARDED_BY (mutex_)=0 |
Private Attributes | |
std::filesystem::path | root_directory_ |
std::mutex | mutex_ |
std::unordered_map< std::string, SandboxMetadata > | sandboxes_ |
std::optional< std::string > | active_sandbox_id_ |
Definition at line 27 of file rom_sandbox_manager.h.
|
private |
Definition at line 45 of file rom_sandbox_manager.cc.
Referenced by Instance().
|
static |
Definition at line 40 of file rom_sandbox_manager.cc.
References RomSandboxManager().
Referenced by yaze::editor::ProposalDrawer::AcceptProposal(), yaze::cli::agent::CreateProposalFromAgentResponse(), yaze::cli::agent::HandleAcceptCommand(), and yaze::cli::agent::HandleDiffCommand().
void yaze::cli::RomSandboxManager::SetRootDirectory | ( | const std::filesystem::path & | root | ) |
Definition at line 48 of file rom_sandbox_manager.cc.
References EnsureRootExistsLocked(), mutex_, and root_directory_.
const std::filesystem::path & yaze::cli::RomSandboxManager::RootDirectory | ( | ) | const |
Definition at line 54 of file rom_sandbox_manager.cc.
References root_directory_.
absl::StatusOr< RomSandboxManager::SandboxMetadata > yaze::cli::RomSandboxManager::CreateSandbox | ( | Rom & | rom, |
absl::string_view | description | ||
) |
Definition at line 79 of file rom_sandbox_manager.cc.
References active_sandbox_id_, yaze::Rom::SaveSettings::backup, EnsureRootExistsLocked(), yaze::Rom::SaveSettings::filename, yaze::Rom::filename(), GenerateSandboxIdLocked(), yaze::cli::RomSandboxManager::SandboxMetadata::id, yaze::Rom::is_loaded(), mutex_, RETURN_IF_ERROR, root_directory_, sandboxes_, yaze::Rom::SaveSettings::save_new, yaze::Rom::SaveToFile(), and yaze::Rom::SaveSettings::z3_save.
Referenced by yaze::cli::agent::CreateProposalFromAgentResponse().
absl::StatusOr< RomSandboxManager::SandboxMetadata > yaze::cli::RomSandboxManager::ActiveSandbox | ( | ) | const |
Definition at line 136 of file rom_sandbox_manager.cc.
References active_sandbox_id_, mutex_, and sandboxes_.
Referenced by ActiveSandboxRomPath(), and yaze::cli::agent::HandleDiffCommand().
absl::StatusOr< std::filesystem::path > yaze::cli::RomSandboxManager::ActiveSandboxRomPath | ( | ) | const |
Definition at line 149 of file rom_sandbox_manager.cc.
References ActiveSandbox(), and ASSIGN_OR_RETURN.
std::vector< RomSandboxManager::SandboxMetadata > yaze::cli::RomSandboxManager::ListSandboxes | ( | ) | const |
Definition at line 155 of file rom_sandbox_manager.cc.
References mutex_, and sandboxes_.
absl::Status yaze::cli::RomSandboxManager::RemoveSandbox | ( | const std::string & | id | ) |
Definition at line 169 of file rom_sandbox_manager.cc.
References active_sandbox_id_, mutex_, and sandboxes_.
Referenced by CleanupOlderThan(), and yaze::cli::agent::HandleAcceptCommand().
absl::StatusOr< int > yaze::cli::RomSandboxManager::CleanupOlderThan | ( | absl::Duration | max_age | ) |
Definition at line 188 of file rom_sandbox_manager.cc.
References mutex_, RemoveSandbox(), and sandboxes_.
|
private |
Definition at line 58 of file rom_sandbox_manager.cc.
References root_directory_.
Referenced by CreateSandbox(), and SetRootDirectory().
|
private |
Definition at line 70 of file rom_sandbox_manager.cc.
Referenced by CreateSandbox().
|
privatepure virtual |
|
private |
Definition at line 82 of file rom_sandbox_manager.h.
Referenced by CreateSandbox(), EnsureRootExistsLocked(), RootDirectory(), and SetRootDirectory().
|
mutableprivate |
Definition at line 83 of file rom_sandbox_manager.h.
Referenced by ActiveSandbox(), CleanupOlderThan(), CreateSandbox(), ListSandboxes(), RemoveSandbox(), and SetRootDirectory().
|
private |
Definition at line 84 of file rom_sandbox_manager.h.
Referenced by ActiveSandbox(), CleanupOlderThan(), CreateSandbox(), ListSandboxes(), and RemoveSandbox().
|
private |
Definition at line 85 of file rom_sandbox_manager.h.
Referenced by ActiveSandbox(), CreateSandbox(), and RemoveSandbox().