-
Notifications
You must be signed in to change notification settings - Fork 0
aurora protocol
Relevant source files
The following files were used as context for generating this wiki page:
The aurora-protocol crate serves as the single source of truth for all communication between the aurora-daemon and aurora-player protocol/Cargo.toml:1-15. It defines the shared data structures, request/response enums, and serialization logic required for IPC (Inter-Process Communication) over Unix domain sockets.
By centralizing these definitions, Aurora ensures that both the background service and the GUI frontend remain synchronized regarding the structure of audio metadata, playback states, and control commands.
The protocol crate is a dependency for both the daemon and the player protocol/Cargo.lock:5-11. It uses serde for serialization, allowing complex Rust enums and structs to be transmitted as JSON payloads across the wire.
The following diagram illustrates how aurora-protocol entities bridge the gap between the two main binaries.
Diagram: Protocol Entity Mapping
graph LR
subgraph "aurora-player (Client)"
UI["Slint UI"]
INT["interface.rs"]
end
subgraph "aurora-protocol (Shared)"
REQ["enum Request"]
RES["enum Response"]
ST["struct Status"]
end
subgraph "aurora-daemon (Server)"
DIS["Command Dispatch"]
ENG["Playback Engine"]
end
UI -- "Triggers" --> INT
INT -- "Sends" --> REQ
REQ -- "Handled by" --> DIS
DIS -- "Updates" --> ENG
ENG -- "Generates" --> ST
ST -- "Wrapped in" --> RES
RES -- "Updates UI" --> INT
Sources: protocol/src/interface.rs:5-50, protocol/src/lib.rs:12-20
The core of the protocol consists of two primary enums defined in protocol/src/interface.rs. These enums represent the entire command set and data feedback loop of the system.
The Request enum contains variants for every action a user can take in the GUI, from simple playback toggles to complex playlist management protocol/src/interface.rs:5-35.
-
Playback Control:
Play,Pause,Next,Prev,Seek. -
Queue Management:
Enqueue,ReplaceQueue,RemoveSong,MoveQueue. -
Library & Playlists:
PlaylistCreate,PlaylistAddSongs,Search,GetArtistList. -
Preferences:
SetVolume,SetShuffle,SetRepeat.
For a full reference of variants and their parameters, see Request & Response Enums.
The Response enum is sent by the daemon to update the client state or provide results for a specific query protocol/src/interface.rs:37-50.
-
State Updates:
Status(heartbeat),Theme(visual updates),Volume. -
Data Payloads:
SearchResults,PlaylistList,Queue,ArtistList. -
Error Handling:
Error(containingerr_idanderr_msg).
For details on response semantics, see Request & Response Enums.
Beyond the communication enums, the crate defines the fundamental objects that represent music and system state.
| Structure | Role | Key Fields |
|---|---|---|
Status |
The "Heartbeat" of the app. |
current_song, is_paused, position, volume protocol/src/lib.rs:13-20
|
Theme |
Color palette for the UI. |
bgd0 through bgd4, acct, srch protocol/src/lib.rs:29-40
|
SearchType |
Defines search scope. |
ByTitle, ByArtist protocol/src/lib.rs:23-26
|
Song |
Audio metadata and ID. | Defined in songs.rs protocol/src/lib.rs:3
|
Playlist |
Collection of songs. | Defined in playlists.rs protocol/src/lib.rs:2
|
This diagram shows how the protocol structs relate to the internal state of the aurora-daemon.
Diagram: Data Structure Association
classDiagram
class Status {
+Option~Song~ current_song
+bool is_paused
+Duration position
+f32 volume
}
class Theme {
+String bgd0
+String acct
+String srch
}
class Request {
<<enumeration>>
Play(Uuid)
Seek(Duration)
SetVolume(f32)
}
class Response {
<<enumeration>>
Status(Status)
Theme(Theme)
Error(u8, String)
}
Status --* Response : "encapsulated in"
Theme --* Response : "encapsulated in"
Sources: protocol/src/lib.rs:12-40, protocol/src/interface.rs:5-50
For detailed documentation on song metadata and playlist schemas, see Shared Data Types: Song, Playlist & Theme.
The protocol uses serde to handle the conversion between Rust types and the wire format.
-
Serialization: The
aurora-playerserializes aRequestto JSON. - Framing: The JSON is prefixed with its length (handled by the transport layer in the daemon/player crates) and sent over the Unix socket.
-
Deserialization: The
aurora-daemonreceives the bytes and reconstructs theRequestenum to dispatch it to the appropriate handler.
Sources: protocol/Cargo.toml:14-15, protocol/src/interface.rs:1-2
Child Pages:
- Request & Response Enums — Full reference for every Request and Response variant.
- Shared Data Types: Song, Playlist & Theme — Detailed struct definitions for the core domain objects.
Overview
aurora-daemon
- Background Service
- Startup & State Init
- Request Handlers & Dispatch
- Playback Engine & Audio
- Library Indexing & Watching
- Playlists, Liked & History
- Background Threads
aurora-protocol
aurora-player
Reference