2018-10-24 18:15:29 +02:00
|
|
|
from typing import Any, Dict, Set
|
|
|
|
|
|
|
|
class SubscriberHandler:
|
|
|
|
def __init__(self) -> None:
|
2018-11-17 16:44:58 +01:00
|
|
|
self.stream_info = dict() # type: Dict[int, Set[int]]
|
2018-10-24 18:15:29 +02:00
|
|
|
|
|
|
|
def set_info(self,
|
|
|
|
stream_id: int,
|
2018-11-17 16:44:58 +01:00
|
|
|
users: Set[int]) -> None:
|
|
|
|
self.stream_info[stream_id] = users
|
2018-10-24 18:15:29 +02:00
|
|
|
|
|
|
|
def get_users(self,
|
|
|
|
stream_id: int) -> Set[int]:
|
2018-11-17 16:44:58 +01:00
|
|
|
users = self.stream_info[stream_id]
|
2018-10-24 18:15:29 +02:00
|
|
|
return users
|