pub struct GroupAccess { /* private fields */ }Expand description
Access to one deployment-owned IPC directory and its named SHM objects.
All group writers are trusted peers, not isolated principals. The owner prepares lock inodes; other users only attach. The parent directory must be provisioned by the operator and protected from untrusted replacement. No credentials, umask, existing permissions or unrelated resources change.
Implementations§
Source§impl GroupAccess
impl GroupAccess
pub fn new(owner: u32, gid: u32, directory: impl AsRef<Path>) -> Result<Self>
pub fn owner_uid(&self) -> u32
pub fn gid(&self) -> u32
pub fn directory(&self) -> &Path
pub fn is_owner(&self) -> bool
Sourcepub fn segment_name(&self, fleet: &str, kind: u8) -> String
pub fn segment_name(&self, fleet: &str, kind: u8) -> String
Scope the SHM name to the same owner/group/directory as its kernel locks. This prevents two IPC directories from supplying different death locks for the same mapped inbox. The name also fits Darwin’s 31-byte limit.
Sourcepub fn prepare(&self) -> Result<()>
pub fn prepare(&self) -> Result<()>
Prepare once as owner; attaching peers never create directories.
Sourcepub fn prepare_locks(&self, segment: &str, lanes: usize) -> Result<()>
pub fn prepare_locks(&self, segment: &str, lanes: usize) -> Result<()>
Prepare bounded lane/watcher lock files before publishing the inbox.
pub fn open_region( &self, name: &str, size: usize, ) -> Result<(ShmRegion, ShmRegionLock)>
Sourcepub fn unlink_region(&self, region: &ShmRegion) -> Result<()>
pub fn unlink_region(&self, region: &ShmRegion) -> Result<()>
Remove only a group-shared name. Persistent lock inodes are not removed on restart and private per-UID companion directories are never visited. All participants must already be stopped, as with ordinary SHM unlink.
pub fn try_hold_lane( &self, segment: &str, lane: usize, ) -> Result<Option<LaneHold>>
pub fn try_hold_watcher( &self, segment: &str, slot: usize, ) -> Result<Option<WatcherHold>>
Sourcepub fn bell_path(&self, segment: &str, suffix: &str) -> PathBuf
pub fn bell_path(&self, segment: &str, suffix: &str) -> PathBuf
The group-writable bell directory is separate from immutable lock names. A caller must own the corresponding lane before binding/removing a bell.