Skip to content

Commit 6cd0749

Browse files
committed
Create HelperProcessorRegistry
1 parent 7e45864 commit 6cd0749

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

pythonbpf/helper/helper_utils.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class HelperHandlerRegistry:
2+
"""Registry for BPF helpers"""
3+
_handlers = {}
4+
5+
@classmethod
6+
def register(cls, helper_name):
7+
"""Decorator to register a handler function for a helper"""
8+
def decorator(func):
9+
cls._handlers[helper_name] = func
10+
return func
11+
return decorator
12+
13+
@classmethod
14+
def get_handler(cls, helper_name):
15+
"""Get the handler function for a helper"""
16+
return cls._handlers.get(helper_name)

0 commit comments

Comments
 (0)