diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..c9974ea50f440951bd224c0959081dfc0f18f11b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,12 @@ +## 为process1做贡献 + + ***感谢你对本项目的关注, 同时欢迎为本项目建言献策,提交代码,维护支持!*** + + + +关于如何贡献本项目, 参考: + +- [openEuler贡献攻略](https://openeuler.org/zh/community/contribution/)。 +- [行为准则](https://openeuler.org/zh/community/conduct/) + +我们会以issue的方式发布任务, 欢迎感兴趣的同学认领. \ No newline at end of file diff --git a/README.md b/README.md index a30d77cb6d259b550f55edf35a7459bbebc49635..e7af85e7dc4afa723f5658d46ef16f2aeef16435 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,56 @@ systemd是为了解决启动时间长,启动脚本复杂问题而诞生的。 - **使用方便**:更灵活简洁的架构,易于理解、便于运维 - **极致安全**:保持对进程的跟踪,提供最小的运行环境 -## 架构设想 与 社区合作的 思路 +## 设计思路 -**TODO** +### 简洁但不简单,打造轻量级底座(功能裁剪/自研替代) + +**趋势** + +- 各大OS发行商均发布轻量级OS +- 1号进程越来越厚重,打造"用户态kernel" +- 传统OS越来越不适应云边端 + +**思路** + +•提供process1底座, **框架+组件**的形式,将纷繁的关系简化,封装在模块内部, 方便选配、管理、升级 + +•为init进程减负,只提供框架,做最少的事,减轻故障时影响 + +•**集成或自研**必要的库和工具,保证OS足够轻量,只提供必要的基础的功能、工具,其他容器化、虚拟机化 + +•**提供统一、轻量的底座,**kernel+process1, **即最小OS** + +### 组件化定制/版本控制,适应云、边、端等场景 + +**思路** + +•提供统一的框架,力争**屏蔽底层差异** + +•**组件化**,可根据硬件**自由选配** + +•组件**版本控制**,轻松应对安装/部署/升级 + +### 更加可靠,保活+自恢复 + +**现状** + +•1号进程承担的功能太多,触发问题概率高 + +•代码质量不高,安全性差 + +**思路** + +•解放1号进程,只做必要的事情,启动+进程回收+关键模块保活,**永远在线** + +•1号进程故障自恢复,组件保活 + +•使用RUST,安全、并发、高效、实用 + +•故障监测/上报 + +## 分层视图 + +## 架构图 + +## 代码目录结构说明 \ No newline at end of file diff --git a/libs/event/Cargo.toml b/libs/event/Cargo.toml index 591a69e3db73f0150acbc7af19ee8ff00c6a9f5d..7fc3bf75a82fbb55af0d54734f38780ab10f1be1 100644 --- a/libs/event/Cargo.toml +++ b/libs/event/Cargo.toml @@ -7,3 +7,4 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +utils = { path = "../utils" } diff --git a/libs/event/src/lib.rs b/libs/event/src/lib.rs index 31e1bb209f98ec5fc6b7cbea4c4766a555c87247..a77740f634502661cb420b3849245fdc6e524d13 100644 --- a/libs/event/src/lib.rs +++ b/libs/event/src/lib.rs @@ -5,3 +5,145 @@ mod tests { assert_eq!(2 + 2, 4); } } + +#[warn(dead_code)] +#[derive(Debug)] +#[warn(unused_variables)] +struct Todo { + unimplemented: i32, +} + +type Type = Todo; +type RetType = Todo; + + +#[derive(Debug)] +enum EVENT_TYPE { + EVENT_OFF = 0, + EVENT_ON = 1, + EVENT_ONESHOT = -1, +} + +#[derive(Debug)] +enum EVENT_STATE { + EVENT_INITIAL, + EVENT_ARMED, + EVENT_PENDING, + EVENT_RUNNING, + EVENT_EXITING, + EVENT_FINISHED, + EVENT_PREPARING, +} + +#[derive(Debug)] +enum EVENT_PRIORITY { + EVENT_PRIORITY_IMPORTANT = -100, + EVENT_PRIORITY_NORMAL = 0, + EVENT_PRIORITY_IDLE = 100, +} + +struct Event { + n_ref: u32, + epoll_fd: i32, + wd_fd: i32, + +} + +impl Event { + fn new(arg: Type) -> Self { + unimplemented!(); + } + + fn default(arg: Type) -> RetType { + unimplemented!(); + } + + fn for_loop(arg: Type) -> RetType { + unimplemented!(); + } + + fn dispatch(arg: Type) -> RetType { + unimplemented!(); + } + + fn run(arg: Type) -> RetType { + unimplemented!(); + } + + fn wait(arg: Type) -> RetType { + unimplemented!(); + } + + fn exit(arg: Type) -> RetType { + unimplemented!(); + } + + fn refer(arg: Type) -> RetType { + unimplemented!(); + } + + fn unrefer(arg: Type) -> RetType { + unimplemented!(); + } + + fn now(arg: Type) -> RetType { + unimplemented!(); + } + + ///set get functions + fn get_fd(arg: Type) -> RetType { + unimplemented!(); + } + + fn get_state(arg: Type) -> RetType { + unimplemented!(); + } + + fn exit_code(arg: Type) -> RetType { + unimplemented!(); + } + + fn set_watchdog(arg: Type) -> RetType { + unimplemented!(); + } + + fn get_watchdog(arg: Type) -> RetType { + unimplemented!(); + } + + fn get_iteration(arg: Type) -> RetType { + unimplemented!(); + } + + fn add_io(arg: Type) -> RetType { + unimplemented!(); + } + + fn add_time(arg: Type) -> RetType { + unimplemented!(); + } + + fn add_signal(arg: Type) -> RetType { + unimplemented!(); + } + + fn add_inotify(arg: Type) -> RetType { + unimplemented!(); + } + + fn add_child(arg: Type) -> RetType { + unimplemented!(); + } + + fn add_defer(arg: Type) -> RetType { + unimplemented!(); + } + + fn add_post(arg: Type) -> RetType { + unimplemented!(); + } + + fn add_exit(arg: Type) -> RetType { + unimplemented!(); + } +} \ No newline at end of file