define gupax thread model (src/README.md)

This commit is contained in:
hinto-janaiyo 2022-11-29 17:33:24 -05:00
parent 212baf93ec
commit db60bc2c09
No known key found for this signature in database
GPG key ID: B1C5A64B80691E45
5 changed files with 12 additions and 5 deletions

BIN
images/thread_model.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

View file

@ -1,6 +1,7 @@
# Gupax source files
* [Structure](#Structure)
* [Bootstrap](#Bootstrap)
* [Thread Model](#Thread-Model)
* [Disk](#Disk)
* [Scale](#Scale)
* [Naming Scheme](#naming-scheme)
@ -9,12 +10,12 @@
| File/Folder | Purpose |
|--------------|---------|
| constants.rs | General constants needed in Gupax
| command.rs | Code for executing/handling P2Pool/XMRig
| disk.rs | Code for writing to disk: `state.toml/node.toml/pool.toml`; This holds the structs for the [State]
| ferris.rs | Cute crab bytes
| gupax.rs | `Gupax` tab
| main.rs | `App/Tab/State` + misc data/functions
| node.rs | Community node ping code for the `P2Pool` simple tab
| process.rs | Code for executing/handling P2Pool/XMRig
| p2pool.rs | `P2Pool` tab
| status.rs | `Status` tab
| update.rs | Update code for the `Gupax` tab
@ -43,6 +44,9 @@ This is how Gupax works internally when starting up:
- If `ask_before_quit` == `true`, ask before quitting
- Kill processes, kill connections, exit
## Thread Model
![thread_model.png](https://github.com/hinto-janaiyo/gupax/blob/main/images/thread_model.png)
## Disk
Long-term state is saved onto the disk in the "OS data folder", using the [TOML](https://github.com/toml-lang/toml) format. If not found, default files will be created. Given a slightly corrupted state file, Gupax will attempt to merge it with a new default one. This will most likely happen if the internal data structure of `state.toml` is changed in the future (e.g removing an outdated setting). Merging silently in the background is a good non-interactive way to handle this. The node/pool database cannot be merged, and if given a corrupted file, Gupax will show an un-recoverable error screen. If Gupax can't read/write to disk at all, or if there are any other big issues, it will show an un-recoverable error screen.

View file

@ -60,7 +60,7 @@ mod gupax;
mod p2pool;
mod xmrig;
mod update;
mod command;
mod process;
use {ferris::*,constants::*,node::*,disk::*,status::*,update::*,gupax::*};
//---------------------------------------------------------------------------------------------------- Struct + Impl

View file

@ -20,7 +20,7 @@ use crate::{
constants::*,
disk::*,
node::*,
command::*,
process::*,
};
use egui::{
TextEdit,SelectableLabel,ComboBox,Label,Button,
@ -45,7 +45,7 @@ egui::Frame::none()
.show(ui, |ui| {
let text_style = egui::TextStyle::Monospace;
let row_height = ui.text_style_height(&text_style);
let total_rows = 10_000;
let total_rows = 700_000;
let width = width-(SPACE*2.0);
egui::ScrollArea::vertical().max_width(width).max_height(height*3.5).auto_shrink([false; 2]).show_rows(ui, row_height, total_rows, |ui, row_range| {
let mut text = "".to_string();

View file

@ -62,7 +62,10 @@ impl Process {
args,
path,
signal: ProcessSignal::None,
output: String::new(),
// P2Pool log level 1 produces a bit less than 100,000 lines a day.
// Assuming each line averages 80 UTF-8 scalars (80 bytes), then this
// initial buffer should last around a week (56MB) before resetting.
output: String::with_capacity(56_000_000),
input: vec![String::new()],
}
}