Skip to content

Commit 9c6919d

Browse files
committed
ipfixprobe - refactor StoragePlugin
1 parent d29572b commit 9c6919d

File tree

3 files changed

+38
-37
lines changed

3 files changed

+38
-37
lines changed
Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,19 @@
11
/**
2-
* \file storage.hpp
3-
* \brief Generic interface of storage plugin
4-
* \author Vaclav Bartos <[email protected]>
5-
* \author Jiri Havranek <[email protected]>
6-
* \date 2021
7-
*/
8-
/*
9-
* Copyright (C) 2021 CESNET
10-
*
11-
* LICENSE TERMS
12-
*
13-
* Redistribution and use in source and binary forms, with or without
14-
* modification, are permitted provided that the following conditions
15-
* are met:
16-
* 1. Redistributions of source code must retain the above copyright
17-
* notice, this list of conditions and the following disclaimer.
18-
* 2. Redistributions in binary form must reproduce the above copyright
19-
* notice, this list of conditions and the following disclaimer in
20-
* the documentation and/or other materials provided with the
21-
* distribution.
22-
* 3. Neither the name of the Company nor the names of its contributors
23-
* may be used to endorse or promote products derived from this
24-
* software without specific prior written permission.
25-
*
2+
* @file
3+
* @brief Generic interface of storage plugin
4+
* @author Pavel Siska <[email protected]>
5+
* @author Vaclav Bartos <[email protected]>
6+
* @author Jiri Havranek <[email protected]>
7+
* @date 2025
268
*
9+
* Copyright (c) 2025 CESNET
2710
*
11+
* SPDX-License-Identifier: BSD-3-Clause
2812
*/
2913

30-
#ifndef IPXP_STORAGE_HPP
31-
#define IPXP_STORAGE_HPP
14+
#pragma once
3215

16+
#include "api.hpp"
3317
#include "flowifc.hpp"
3418
#include "packet.hpp"
3519
#include "plugin.hpp"
@@ -46,14 +30,7 @@ namespace ipxp {
4630
/**
4731
* \brief Base class for flow caches.
4832
*/
49-
class StoragePlugin : public Plugin {
50-
protected:
51-
ipx_ring_t* m_export_queue;
52-
53-
private:
54-
ProcessPlugin** m_plugins; /**< Array of plugins. */
55-
uint32_t m_plugin_cnt;
56-
33+
class IPXP_API StoragePlugin : public Plugin {
5734
public:
5835
StoragePlugin()
5936
: m_export_queue(nullptr)
@@ -186,7 +163,31 @@ class StoragePlugin : public Plugin {
186163
m_plugins[i]->pre_export(rec);
187164
}
188165
}
166+
167+
ipx_ring_t* m_export_queue;
168+
169+
private:
170+
ProcessPlugin** m_plugins; /**< Array of plugins. */
171+
uint32_t m_plugin_cnt;
189172
};
190173

174+
/**
175+
* @brief Factory template for creating plugins.
176+
*
177+
* This template allows dynamic creation of plugin instances based on the specified
178+
* base class and constructor argument types.
179+
*
180+
* @tparam Base The base class for the plugin.
181+
* @tparam Args The argument types required for the plugin constructor.
182+
*/
183+
template<typename Base, typename... Args>
184+
class IPXP_API PluginFactory;
185+
186+
/**
187+
* @brief Type alias for the StoragePlugin factory.
188+
*
189+
* Provides a factory for creating StoragePlugin instances using a string-based constructor.
190+
*/
191+
using StoragePluginFactory = PluginFactory<StoragePlugin, const std::string&>;
192+
191193
} // namespace ipxp
192-
#endif /* IPXP_STORAGE_HPP */

src/core/ipfixprobe.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
#include <ipfixprobe/plugin.hpp>
4848
#include <ipfixprobe/process.hpp>
4949
#include <ipfixprobe/ring.h>
50-
#include <ipfixprobe/storage.hpp>
50+
#include <ipfixprobe/storagePlugin.hpp>
5151
#include <ipfixprobe/utils.hpp>
5252
#include <telemetry.hpp>
5353

src/core/workers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include <ipfixprobe/packet.hpp>
4040
#include <ipfixprobe/process.hpp>
4141
#include <ipfixprobe/ring.h>
42-
#include <ipfixprobe/storage.hpp>
42+
#include <ipfixprobe/storagePlugin.hpp>
4343

4444
namespace ipxp {
4545

0 commit comments

Comments
 (0)