Skip to content

Commit

Permalink
Add used assumptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
BenediktBurger committed Oct 27, 2023
1 parent 8624282 commit 0130432
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
74 changes: 74 additions & 0 deletions LECO_ASSUMPTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Assumptions of LECO

LECO is not yet fully defined, but some features are required for the code to work.
Here are internal definitions used for PyLECO, which are not yet in LECO, so they might change.

The assumptions link to issues/pull requests, where these points are discussed.

## Control Protocol

### Control Protocol Message

The header frame consists of three parts:
1. UUIDv7 as conversation_id
2. 3 bytes as message_id, the content (whether a timestamp or a count) is not yet defined.
3. 1 byte as message_type which contains the serialization scheme:
- 0 means not defined,
- 1 means JSON, our default

### Message content

Messages use JSONRPC messages.
Also the control messages (sign_in etc.) are done via JSONRPC.
Error codes are also defined.
All this is in [PR #56](https://github.com/pymeasure/leco-protocol/pull/56) defined.


### Coordinator Workings

#### Directory update at sign-in/sign-out

At each sign-in/sign-out of a Component, the Coordinator sends the full directory (components/Coordinators) to all known Coordinators.

If a not signed in Coordinator tries to sign out, the Coordinator ignores that message.

If a Coordinator tries to sign out, but the message arrives via a different identity, the sign-out is rejected.


## Data Protocol

### Message Format

A Data Protocol Message consists in three or more frames ([#62](https://github.com/pymeasure/leco-protocol/issues/62)):
1. Topic (see below)
2. Header (see below)
3. One or more data frames

#### Topic

The topic is the full name of the sending Component. ([#60](https://github.com/pymeasure/leco-protocol/issues/60))

#### Header

Similar to the control protocol ([#61](https://github.com/pymeasure/leco-protocol/issues/61)):
1. UUIDv7
2. 1 byte Message_type (0 not defined, 1 JSON, >127 user defined)

#### Content

For log messages, the content is a list of:
- record.asctime: Timestamp formatted as '%Y-%m-%d %H:%M:%S'
- record.levelname: Logger level name
- record.name: Logger name
- record text (including traceback)


## General

As default ports for the different applications:

- COORDINATOR_PORT = 12300 # the Coordinator receives and sends at that port.
- PROXY_RECEIVING_PORT = 11100 # the proxy server receives at that port
- PROXY_SENDING_PORT = 11099 # the proxy server sends at that port
- LOG_RECEIVING_PORT = 11098 # the log server receives at that port
- LOG_SENDING_PORT = 11097 # the log server sends at that port
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ The [stable-development branch](https://github.com/pymeasure/pyleco/tree/stable-
Follow that branch to have always working code (as far as possible), but following the ongoing development.

Note: LECO is still under development, such that the code and API might change.
[LECO_ASSUMPTIONS](LECO_ASSUMPTIONS.md) contains the assumptions used in this project, which are not yet defined by LECO.
These things might change, if LECO defines them differently

![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/bmoneke/7a8a7b874b62ed803eb56ca04830bede/raw/pyleco-coverage.json)

Expand Down

0 comments on commit 0130432

Please sign in to comment.