Skip to content

Create Collector and Category Struct #9

@ngreese

Description

@ngreese

Make structs, enums, and implementations to enable flag usage to specify what data to get.

Category/Metrics Enum

enum Category {
    cpu,
    net,
    du,
    ...
}

Collector struct/impl

struct Collector {
    categories: Vec<Category>,
}

impl Collector {
    pub fn collect() -> serde_json::Value {}
    fn all_categories() -> &Self {} // Category::*
    fn set_categories(selected: Vec<Category>) -> &Self {} // Vec<Category> [cpu,net]
}

CLI example

./tinyd // calls all_categories()
./tinyd --all //calls all_categories()
./tinyd --collect "a,b,c" // (or --categories, --types?) calls set_categories([a,b,c])

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions