Convert some of the data store to async. (#7976)

This commit is contained in:
Patrick Cloke 2020-07-30 07:20:41 -04:00 committed by GitHub
parent 3950ae51ef
commit b3a97d6dac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 190 additions and 207 deletions

View file

@ -14,7 +14,7 @@
# limitations under the License.
import logging
from typing import Dict, Iterable, List, Optional, Set, Tuple, TypeVar
from typing import Awaitable, Dict, Iterable, List, Optional, Set, Tuple, TypeVar
import attr
@ -419,7 +419,7 @@ class StateGroupStorage(object):
def _get_state_groups_from_groups(
self, groups: List[int], state_filter: StateFilter
):
) -> Awaitable[Dict[int, StateMap[str]]]:
"""Returns the state groups for a given set of groups, filtering on
types of state events.
@ -429,7 +429,7 @@ class StateGroupStorage(object):
from the database.
Returns:
Deferred[Dict[int, StateMap[str]]]: Dict of state group to state map.
Dict of state group to state map.
"""
return self.stores.state._get_state_groups_from_groups(groups, state_filter)
@ -532,7 +532,7 @@ class StateGroupStorage(object):
def _get_state_for_groups(
self, groups: Iterable[int], state_filter: StateFilter = StateFilter.all()
):
) -> Awaitable[Dict[int, StateMap[str]]]:
"""Gets the state at each of a list of state groups, optionally
filtering by type/state_key
@ -540,8 +540,9 @@ class StateGroupStorage(object):
groups: list of state groups for which we want to get the state.
state_filter: The state filter used to fetch state.
from the database.
Returns:
Deferred[dict[int, StateMap[str]]]: Dict of state group to state map.
Dict of state group to state map.
"""
return self.stores.state._get_state_for_groups(groups, state_filter)