pub struct AccessControlManager { /* private fields */ }Expand description
Unified access control manager
Implementations§
Source§impl AccessControlManager
impl AccessControlManager
Sourcepub fn with_managers(
file_locks: Arc<FileLockManager>,
resource_locks: Arc<ResourceLockManager>,
project_root: PathBuf,
) -> Self
pub fn with_managers( file_locks: Arc<FileLockManager>, resource_locks: Arc<ResourceLockManager>, project_root: PathBuf, ) -> Self
Create with custom managers (for testing or sharing)
Sourcepub fn with_strategy(self, strategy: ContentionStrategy) -> Self
pub fn with_strategy(self, strategy: ContentionStrategy) -> Self
Set the contention strategy
Sourcepub fn with_lock_persistence(self, lock_store: Arc<dyn LockPersistence>) -> Self
pub fn with_lock_persistence(self, lock_store: Arc<dyn LockPersistence>) -> Self
Enable inter-process locking with a persistent lock store
Sourcepub fn lock_store(&self) -> Option<&Arc<dyn LockPersistence>>
pub fn lock_store(&self) -> Option<&Arc<dyn LockPersistence>>
Get the lock store (if configured)
Sourcepub fn file_locks(&self) -> &Arc<FileLockManager>
pub fn file_locks(&self) -> &Arc<FileLockManager>
Get a reference to the file lock manager
Sourcepub fn resource_locks(&self) -> &Arc<ResourceLockManager>
pub fn resource_locks(&self) -> &Arc<ResourceLockManager>
Get a reference to the resource lock manager
Sourcepub async fn track_file_read(&self, agent_id: &str, path: &Path)
pub async fn track_file_read(&self, agent_id: &str, path: &Path)
Track that an agent has read a file
Sourcepub async fn has_read_file(&self, agent_id: &str, path: &Path) -> bool
pub async fn has_read_file(&self, agent_id: &str, path: &Path) -> bool
Check if an agent has read a file
Sourcepub async fn validate_write(&self, agent_id: &str, path: &Path) -> Result<()>
pub async fn validate_write(&self, agent_id: &str, path: &Path) -> Result<()>
Validate that a write operation is allowed (file must have been read first)
Sourcepub async fn clear_tracking_for_agent(&self, agent_id: &str)
pub async fn clear_tracking_for_agent(&self, agent_id: &str)
Clear read tracking for an agent (call on agent shutdown)
Sourcepub fn get_file_lock_requirement(
tool_name: &str,
input: &Value,
) -> Option<(PathBuf, LockType)>
pub fn get_file_lock_requirement( tool_name: &str, input: &Value, ) -> Option<(PathBuf, LockType)>
Get the lock requirement for a file operation
Sourcepub fn detect_build_command(command: &str) -> bool
pub fn detect_build_command(command: &str) -> bool
Detect if a bash command is a build command
Sourcepub fn detect_test_command(command: &str) -> bool
pub fn detect_test_command(command: &str) -> bool
Detect if a bash command is a test command
Sourcepub fn get_resource_requirement(
&self,
command: &str,
) -> Option<(ResourceType, ResourceScope)>
pub fn get_resource_requirement( &self, command: &str, ) -> Option<(ResourceType, ResourceScope)>
Get resource lock requirement for a bash command
Sourcepub async fn acquire_for_tool(
self: &Arc<Self>,
agent_id: &str,
tool_name: &str,
input: &Value,
) -> Result<LockBundle>
pub async fn acquire_for_tool( self: &Arc<Self>, agent_id: &str, tool_name: &str, input: &Value, ) -> Result<LockBundle>
Acquire all necessary locks for a tool operation
Sourcepub async fn cleanup_agent(&self, agent_id: &str) -> (usize, usize, usize)
pub async fn cleanup_agent(&self, agent_id: &str) -> (usize, usize, usize)
Release all locks and tracking for an agent (call on agent shutdown)
Sourcepub async fn cleanup_stale_locks(&self) -> Result<usize>
pub async fn cleanup_stale_locks(&self) -> Result<usize>
Cleanup stale persistent locks (call on startup)