From 6e858307227f30fe0ee5faa95ecee397d3015517 Mon Sep 17 00:00:00 2001 From: wunder957 Date: Mon, 11 Sep 2023 22:43:48 +0800 Subject: [PATCH] Fix docs and more on base --- docs/source/analyzer/db.rst | 2 +- duetector/analyzer/base.py | 32 +++++++++++++++++++++++++++++++- duetector/analyzer/db.py | 4 ++-- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/docs/source/analyzer/db.rst b/docs/source/analyzer/db.rst index fec6378..8d2cffd 100644 --- a/docs/source/analyzer/db.rst +++ b/docs/source/analyzer/db.rst @@ -3,7 +3,7 @@ DBAnalyzer ``DBAnalyzer`` -.. autoclass:: duetector.analyzer.db.DBAnalyzer +.. automodule:: duetector.analyzer.db :members: :undoc-members: :private-members: diff --git a/duetector/analyzer/base.py b/duetector/analyzer/base.py index e039583..2e8416d 100644 --- a/duetector/analyzer/base.py +++ b/duetector/analyzer/base.py @@ -1,5 +1,7 @@ -from typing import List +from datetime import datetime +from typing import List, Optional +from duetector.analyzer.models import AnalyzerBrief, Tracking from duetector.config import Configuable @@ -37,3 +39,31 @@ def get_all_collector_ids(self) -> List[str]: List[str]: List of collector id. """ raise NotImplementedError + + def query( + self, + tracer: Optional[str] = None, + collector_id: Optional[str] = None, + start_datetime: Optional[datetime] = None, + end_datetime: Optional[datetime] = None, + start: int = 0, + limit: int = 20, + ) -> List[Tracking]: + """ + Query tracking data from storage. + """ + raise NotImplementedError + + def brief( + self, + start_datetime: Optional[datetime] = None, + end_datetime: Optional[datetime] = None, + ) -> AnalyzerBrief: + """ + Get brief of analyzer. + """ + raise NotImplementedError + + def analyze(self): + # TODO: Not design yet. + pass diff --git a/duetector/analyzer/db.py b/duetector/analyzer/db.py index 59bbaa5..d73bf9a 100644 --- a/duetector/analyzer/db.py +++ b/duetector/analyzer/db.py @@ -92,10 +92,10 @@ def query( collector_id (Optional[str], optional): Collector id. Defaults to None, all collector id will be queried. start_datetime (Optional[datetime], optional): Start time. Defaults to None. end_datetime (Optional[datetime], optional): End time. Defaults to None. - start (Optional[int], optional): Start index. Defaults to 0. + start (int, optional): Start index. Defaults to 0. limit (int, optional): Limit of records. Defaults to 20. ``0`` means no limit. Returns: - List[Tracking]: List of tracking records. + List[duetector.analyzer.models.Tracking]: List of tracking records. """