refactor: 独立ratelimiter包

This commit is contained in:
RockChinQ
2024-01-25 22:35:15 +08:00
parent f4ead5ec5c
commit b43882aad0
9 changed files with 147 additions and 102 deletions
+24
View File
@@ -0,0 +1,24 @@
from __future__ import annotations
import abc
from ...boot import app
class ReteLimitAlgo(metaclass=abc.ABCMeta):
ap: app.Application
def __init__(self, ap: app.Application):
self.ap = ap
async def initialize(self):
pass
@abc.abstractmethod
async def require_access(self, launcher_type: str, launcher_id: int) -> bool:
raise NotImplementedError
@abc.abstractmethod
async def release_access(self, launcher_type: str, launcher_id: int):
raise NotImplementedError