-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy path__init__.py
More file actions
49 lines (36 loc) · 1.15 KB
/
__init__.py
File metadata and controls
49 lines (36 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""
This package contains the generic interfaces used for the data system (v1 and
v2), as well as types for v1 and v2 specific protocols.
"""
from abc import abstractmethod
from typing import Protocol
from ldclient.impl.util import Result
class Synchronizer(Protocol):
"""
Represents a component capable of obtaining a Basis and subsequent delta
updates asynchronously.
"""
@abstractmethod
def name(self) -> str:
"""Returns the name of the initializer."""
raise NotImplementedError
# TODO(fdv2): Need sync method
def close(self):
"""
Close the synchronizer, releasing any resources it holds.
"""
class Initializer(Protocol):
"""
Represents a component capable of obtaining a Basis via a synchronous call.
"""
@abstractmethod
def name(self) -> str:
"""Returns the name of the initializer."""
raise NotImplementedError
@abstractmethod
def fetch(self) -> Result:
"""
Fetch returns a Basis, or an error if the Basis could not be retrieved.
"""
raise NotImplementedError
__all__: list[str] = ["Synchronizer", "Initializer"]