Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #ifndef SCHEDULE_CONFIG_H
12 : #define SCHEDULE_CONFIG_H
13 :
14 : #include <unordered_map>
15 : #include <unordered_set>
16 : #include "dgw_client.h"
17 :
18 : namespace dgw {
19 :
20 : class ScheduleConfig {
21 : public:
22 1 : explicit ScheduleConfig() = default;
23 1 : virtual ~ScheduleConfig() = default;
24 : static ScheduleConfig &GetInstance();
25 :
26 : void RecordConfig(const uint32_t key, const bqs::DynamicSchedQueueAttr &requestQ,
27 : const bqs::DynamicSchedQueueAttr &responseQ);
28 :
29 : const std::unordered_set<uint32_t> &GetSchedKeys() const;
30 :
31 : void StopSched(const uint32_t key);
32 :
33 : void RestartSched(const uint32_t key);
34 :
35 : const bool IsStopped(const uint32_t key) const;
36 :
37 : private:
38 : std::unordered_set<uint32_t> schedKeys_;
39 : std::unordered_set<uint32_t> stoppedSchedKeys_;
40 : std::unordered_map<uint32_t, std::pair<bqs::DynamicSchedQueueAttr, bqs::DynamicSchedQueueAttr>> configMap_;
41 : };
42 : }
43 :
44 : #endif
|