Skip to content

Latest commit

 

History

History
89 lines (69 loc) · 2.9 KB

README.md

File metadata and controls

89 lines (69 loc) · 2.9 KB

Virtual Sensor

An agent run on each node in HPC system, which is responsible for monitoring & health checking node, push gathered informations to specified Kafka topic via configurations.

Prerequisite

Dependencies:

Install:

sudo apt install librdkafka-dev libspdlog-dev sysstat libpcap-dev libboost-all-dev nlohmann-json3-dev
git clone [email protected]:machinezone/IXWebSocket.git
cd IXWebSocket
cmake -DBUILD_SHARED_LIBS=ON
make -j
make install

Some commands

Build to binary:

make

Test memory leak:

make test_memory_leak

Project structure

📦include                           // All header files go here
 ┣ 📜common.h                               // Common typedef, reusable functions and classes
 ┣ 📜exceptions.h                           // Contain all exception types
 ┣ 📜kafka_producer.h                       // Kafka producer
 ┣ 📜main.h                                 // All libaries (standard & 3rd-party) was included here
 ┣ 📜process.h                              // Process info
 ┗ 📜sensor.h                               // Sensor
📦src                               // Implementaion files
 ┣ 📜main.cpp                               // Program entry
 ┗ 📜process.cpp                            
📦.github
 ┗ 📂workflows                      // CI/CD scripts
📦test                              // Tests
📜.gitignore                        // Git ignore file
📜CMakeLists.txt                    // Project build configurations
📜Makefile                          // Contains some helpful scripts
📜README.md

Coding rules, conventions and considerations

Rules:

  • NO unused variables
  • NO hard codes
  • Use header guard when declare a header file and its implementation file
  • Follow RAII rules
  • Follow Rule of three
  • Unused method must throw Unimplemented exception

Conventions:

  • Private method should have name with prefix _
  • Class name must be in CamelCase with first letter capitalized
  • Method name must be in camelCase with first letter in lowercase
  • Header guard name must be __CAPITALIZED_SNAKE_CASE__ with prefix & postfix are __. Example: __COMMON_H__
  • Filename must be in snake case snake_case

Consider to:

  • Use inline function when task has a seperate logic from other bodies of code
  • Use const for not modified variables and parameters
  • Use typedef to set variable's type a meaningful name
  • Pass by reference for object values
  • Minimalize dependencies as much as possible