Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Make the clafrica more modular #96

Closed
pythonbrad opened this issue Oct 7, 2023 · 3 comments
Closed

refactor: Make the clafrica more modular #96

pythonbrad opened this issue Oct 7, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@pythonbrad
Copy link
Member

pythonbrad commented Oct 7, 2023

Proposal

The service component will be responsible to handle the communication between the front-end, the OS, and the engine (processor, translator, ...). The communication will be through messages.

Structure

/
├── cli (the frontend is responsible of the binary application)
|       └── main.rs
|       └── lib.rs
├── keyboard (through enigo-rs and rdev)
├── service
|      └── src
|      |   ├── message.rs (responsible for the communication with the front-end and the keyboard)
|      |   └── lib.rs
|      └── Cargo.toml
├── config
|      └── src
|      |   └── lib.rs
|      └── Cargo.toml
└── engine
        ├── processor
        |      ├── src
        |      |   ├── message.rs (responsible for the communication with the service)
        |      |   └── lib.rs
        |      └── Cargo.toml
        └── translator
                ├── src
                |   ├── message.rs (responsible for the communication with the service)
                |   └── lib.rs
                └── Cargo.toml

Explanation:

  • translator.transate , processor.process and processor.commit will return a set of instructions that the service should execute. Think about channel commiunication in the same thread.
  • Except the OS and the frontend, i think that remaining are WASM compatible.

Change

  • The service will be responsible for the interaction between the engine and the front-end / keyboard.
  • Engine and Service are in the same thread.
  • Service, Front-end and keyboard are in different thread.

Advantage

  • The engine and the front-end can communicate through the service via sending / receiving of messages.
  • The engine and the front-end will be independent.
  • The front-end can be implemented through inter-process communication.

Further goal

@pythonbrad pythonbrad changed the title refactor: Add the service component refactor: Add the service component (lib.rs) Oct 9, 2023
@pythonbrad pythonbrad changed the title refactor: Add the service component (lib.rs) refactor: Make the clafrica more modular Oct 9, 2023
@pythonbrad pythonbrad self-assigned this Oct 9, 2023
@pythonbrad
Copy link
Member Author

I forgot he clafrica-lib.
It will be still as a crate.

What will be the new name? 🤔

  • buffer
  • memory

@pythonbrad
Copy link
Member Author

Suggestion

The cli will replace the clafrica crate.
The service will be replace the clafrica-lib.
Each crate will have his own changelog and readme.

@pythonbrad
Copy link
Member Author

For more compatibility with non rust code, refer to it https://rustwasm.github.io/docs/book/reference/add-wasm-support-to-crate.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant