Update class instantiation/usage graph

This commit is contained in:
Stein Magnus Jodal 2010-08-20 03:08:59 +02:00
parent ce878ca797
commit a67aaef8c7

View File

@ -12,40 +12,93 @@ In addition to what you'll find here, don't forget the :doc:`/api/index`.
Class instantiation and usage Class instantiation and usage
============================= =============================
The following diagram shows how Mopidy with the despotify backend and ALSA The following diagram shows how Mopidy is wired together with the MPD client,
mixer is wired together. The gray nodes are part of external dependencies, and the Spotify service, and the speakers.
not Mopidy. The red nodes lives in the ``main`` process (running an
:mod:`asyncore` loop), while the blue nodes lives in a secondary process named **Legend**
``core`` (running a service loop in :class:`mopidy.core.CoreProcess`).
- Filled red boxes are the key external systems.
- Gray boxes are external dependencies.
- Blue circles lives in the ``main`` process, also known as ``CoreProcess``.
It processing messages on the core queue.
- Purple circles lives in a process named ``MpdProcess``, running an
:mod:`asyncore` loop.
- Green circles lives in a process named ``GStreamerProcess``.
- Brown circle is a thread living in the ``CoreProcess``.
.. digraph:: class_instantiation_and_usage .. digraph:: class_instantiation_and_usage
"spytify" [ color="gray" ] "main" [ color="blue" ]
"despotify" [ color="gray" ]
"alsaaudio" [ color="gray" ]
"__main__" [ color="red" ]
"CoreProcess" [ color="blue" ] "CoreProcess" [ color="blue" ]
"DespotifyBackend" [ color="blue" ]
"AlsaMixer" [ color="blue" ] # Frontend
"MPD client" [ color="red", style="filled", shape="box" ]
"MpdFrontend" [ color="blue" ] "MpdFrontend" [ color="blue" ]
"MpdServer" [ color="red" ] "MpdProcess" [ color="purple" ]
"MpdSession" [ color="red" ] "MpdServer" [ color="purple" ]
"__main__" -> "CoreProcess" [ label="create" ] "MpdSession" [ color="purple" ]
"__main__" -> "MpdServer" [ label="create" ] "MpdDispatcher" [ color="blue" ]
"CoreProcess" -> "DespotifyBackend" [ label="create" ]
# Backend
"Libspotify\nBackend" [ color="blue" ]
"Libspotify\nSessionManager" [ color="brown" ]
"pyspotify" [ color="gray", shape="box" ]
"libspotify" [ color="gray", shape="box" ]
"Spotify" [ color="red", style="filled", shape="box" ]
# Output/mixer
"GStreamer\nOutput" [ color="blue" ]
"GStreamer\nSoftwareMixer" [ color="blue" ]
"GStreamer\nProcess" [ color="green" ]
"GStreamer" [ color="gray", shape="box" ]
"Speakers" [ color="red", style="filled", shape="box" ]
"main" -> "CoreProcess" [ label="create" ]
# Frontend
"CoreProcess" -> "MpdFrontend" [ label="create" ] "CoreProcess" -> "MpdFrontend" [ label="create" ]
"MpdServer" -> "MpdSession" [ label="create one per client" ] "MpdFrontend" -> "MpdProcess" [ label="create" ]
"MpdSession" -> "MpdFrontend" [ label="pass MPD requests to" ] "MpdProcess" -> "MpdServer" [ label="create" ]
"MpdFrontend" -> "DespotifyBackend" [ label="use backend API" ] "MpdServer" -> "MpdSession" [ label="create one\nper client" ]
"DespotifyBackend" -> "AlsaMixer" [ label="create and use mixer API" ] "MpdSession" -> "MpdDispatcher" [
"DespotifyBackend" -> "spytify" [ label="use Python wrapper" ] label="pass requests\nvia core_queue" ]
"spytify" -> "despotify" [ label="use C library" ] "MpdDispatcher" -> "MpdSession" [
"AlsaMixer" -> "alsaaudio" [ label="use Python library" ] label="pass response\nvia reply_to pipe" ]
"MpdDispatcher" -> "Libspotify\nBackend" [ label="use backend API" ]
"MPD client" -> "MpdServer" [ label="connect" ]
"MPD client" -> "MpdSession" [ label="request" ]
"MpdSession" -> "MPD client" [ label="response" ]
# Backend
"CoreProcess" -> "Libspotify\nBackend" [ label="create" ]
"Libspotify\nBackend" -> "Libspotify\nSessionManager" [
label="creates and uses" ]
"Libspotify\nSessionManager" -> "Libspotify\nBackend" [
label="pass commands\nvia core_queue" ]
"Libspotify\nSessionManager" -> "pyspotify" [ label="use Python\nwrapper" ]
"pyspotify" -> "Libspotify\nSessionManager" [ label="use callbacks" ]
"pyspotify" -> "libspotify" [ label="use C library" ]
"libspotify" -> "Spotify" [ label="use service" ]
"Libspotify\nSessionManager" -> "GStreamer\nProcess" [
label="pass commands\nand audio data\nvia output_queue" ]
# Output/mixer
"Libspotify\nBackend" -> "GStreamer\nSoftwareMixer" [
label="create and\nuse mixer API" ]
"GStreamer\nSoftwareMixer" -> "GStreamer\nProcess" [
label="pass commands\nvia output_queue" ]
"CoreProcess" -> "GStreamer\nOutput" [ label="create" ]
"GStreamer\nOutput" -> "GStreamer\nProcess" [ label="create" ]
"GStreamer\nProcess" -> "GStreamer" [ label="use library" ]
"GStreamer" -> "Speakers" [ label="play audio" ]
Thread/process communication Thread/process communication
============================ ============================
.. warning::
This section is currently outdated.
- Everything starts with ``Main``. - Everything starts with ``Main``.
- ``Main`` creates a ``Core`` process which runs the frontend, backend, and - ``Main`` creates a ``Core`` process which runs the frontend, backend, and
mixer. mixer.