File: code_structure.rst

package info (click to toggle)
masakari 20.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,816 kB
  • sloc: python: 22,459; sh: 329; makefile: 68
file content (92 lines) | stat: -rw-r--r-- 2,654 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
..
      Copyright 2020 Leafcloud B.V.

      Licensed under the Apache License, Version 2.0 (the "License"); you may
      not use this file except in compliance with the License. You may obtain
      a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
      WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
      License for the specific language governing permissions and limitations
      under the License.

=======================
Masakari Code Structure
=======================

Getting started with any codebase requires some getting used to the layout of the project,
this guide is meant to make your journey navigating the code easier.
All paths are relative to the repository root.

Code layout
===========

The Python source code for the project can be found in
``masakari``:

- ``masakari/api`` contains the api service,
- ``masakari/engine`` contains the engine service.

The data model
==============

The oslo objects
----------------

The base datamodel can be found in ``masakari/objects``.
It uses ``oslo_versionedobjects``.

These objects are used throughout the code, including RPC, REST API and database persistence.

The oslo notifications
----------------------

The datamodel for oslo notifications (not to be confused with Masakari notifications
which are one type of Masakari data objects) can be found in
``masakari/notifications``.

The REST API
------------

Mappings of the models for the API are in ``masakari/api/openstack/ha/schemas``.

The controllers are in ``masakari/api/openstack/ha``.

The implementations of the actions are in ``masakari/ha/api.py``.

The database (persistence)
--------------------------

Some objects can be persisted (saved) to the database,
currently only ``sqlalchemy`` is supported as the backend.

The general interface is in ``masakari/db/api.py``.

The sqlalchemy implementation is in ``masakari/db/sqlalchemy/api.py``.

Database mappings are in ``masakari/db/sqlalchemy/models.py``.

The entry points
================

The Masakari project has a variety of entry points.

The entry points can be found in the ``entry_points`` section of ``setup.cfg``.

The main entry points
---------------------

The main entry points are for the engine and the api:

- ``masakari.cmd.api:main``,
- ``masakari.cmd.engine:main``.

Another interesting one is the entry point for the management CLI, ``masakari.cmd.manage:main``.

The tests
=========

The tests are located in: ``masakari/tests``.