Astdiskd

Astdiskd is responsible for:

  • Detecting newly mounted disk drives

  • Detecting the removal of drives

  • Communicating a list of currently mounted drives to other components.

Drive Detection

Astdiskd communicates with UDisks 2 over DBus to receive information about the mounted volumes on the system.

On startup, it reads disk information from the UDisks managed objects at /org/freedesktop/UDisks2/block_devices/.

It listens for job signals in the path /org/freedesktop/UDisks2/jobs/, dispatching a task if the job is filesystem-mount or cleanup.

This relies on another program automatically mounting drives that are inserted, and ensuring that DBus notices them. UDiskie 2 is recommended.

DFeet is useful for observing and debugging the DBus interactions. Python-dbus-next is the pure-python library that is used to communicate with DBus.

Astdiskd Data Structures and Classes

class astoria.astdiskd.DiskManager(verbose, config_file)[source]

Astoria Disk Manager.

async main()[source]

Main routine for astdiskd.

Return type:

None

name = 'astdiskd'
property offline_status: DiskManagerMessage

Status to publish when the manager goes offline.

This status should ensure that any other components relying on this data go into a safe state.

async update_state()[source]

Update the status of astdiskd when disks are changed.

Return type:

None

class astoria.common.disks.structs.DiskUUID

alias of str

class astoria.common.disks.DiskInfo(**data)[source]

Information about a mounted disk.

disk_type: DiskType
mount_path: Path
uuid: NewType()(DiskUUID, str)
class astoria.common.ipc.DiskManagerMessage(**data)[source]

Status message for Disk Manager.

Published to /astoria/astdiskd

calculate_disk_info(default_usercode_entrypoint)[source]

Calculate the disk info of the disks in the message.

As astdiskd only gives us information about the path of each disk, we need to calculate the type of each disk in the message.

Parameters:

default_usercode_entrypoint (str) – default entrypoint from astoria config

Return type:

Dict[NewType()(DiskUUID, str), DiskInfo]

Returns:

A dictionary of disk UUIDs and disk information.

disks: Dict[NewType()(DiskUUID, str), Path]