openfeature-provider-flagd 0.1.5__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openfeature/.gitignore +2 -0
- openfeature/contrib/provider/flagd/config.py +193 -23
- openfeature/contrib/provider/flagd/provider.py +62 -12
- openfeature/contrib/provider/flagd/resolvers/__init__.py +1 -47
- openfeature/contrib/provider/flagd/resolvers/grpc.py +226 -17
- openfeature/contrib/provider/flagd/resolvers/in_process.py +40 -31
- openfeature/contrib/provider/flagd/resolvers/process/connector/__init__.py +11 -0
- openfeature/contrib/provider/flagd/resolvers/process/connector/file_watcher.py +106 -0
- openfeature/contrib/provider/flagd/resolvers/process/connector/grpc_watcher.py +192 -0
- openfeature/contrib/provider/flagd/resolvers/process/custom_ops.py +58 -19
- openfeature/contrib/provider/flagd/resolvers/process/flags.py +50 -6
- openfeature/contrib/provider/flagd/resolvers/process/targeting.py +35 -0
- openfeature/contrib/provider/flagd/resolvers/protocol.py +47 -0
- openfeature/schemas/protobuf/flagd/evaluation/v1/evaluation_pb2.py +72 -0
- openfeature/schemas/protobuf/flagd/evaluation/v1/evaluation_pb2.pyi +450 -0
- openfeature/schemas/protobuf/flagd/evaluation/v1/evaluation_pb2_grpc.py +358 -0
- openfeature/schemas/protobuf/flagd/evaluation/v1/evaluation_pb2_grpc.pyi +155 -0
- openfeature/schemas/protobuf/flagd/sync/v1/sync_pb2.py +50 -0
- openfeature/schemas/protobuf/flagd/sync/v1/sync_pb2.pyi +148 -0
- openfeature/schemas/protobuf/flagd/sync/v1/sync_pb2_grpc.py +186 -0
- openfeature/schemas/protobuf/flagd/sync/v1/sync_pb2_grpc.pyi +86 -0
- openfeature/schemas/protobuf/schema/v1/schema_pb2.py +72 -0
- openfeature/schemas/protobuf/schema/v1/schema_pb2.pyi +451 -0
- openfeature/schemas/protobuf/schema/v1/schema_pb2_grpc.py +358 -0
- openfeature/schemas/protobuf/schema/v1/schema_pb2_grpc.pyi +156 -0
- openfeature/schemas/protobuf/sync/v1/sync_service_pb2.py +47 -0
- openfeature/schemas/protobuf/sync/v1/sync_service_pb2.pyi +174 -0
- openfeature/schemas/protobuf/sync/v1/sync_service_pb2_grpc.py +143 -0
- openfeature/schemas/protobuf/sync/v1/sync_service_pb2_grpc.pyi +70 -0
- {openfeature_provider_flagd-0.1.5.dist-info → openfeature_provider_flagd-0.2.0.dist-info}/METADATA +116 -15
- openfeature_provider_flagd-0.2.0.dist-info/RECORD +35 -0
- {openfeature_provider_flagd-0.1.5.dist-info → openfeature_provider_flagd-0.2.0.dist-info}/WHEEL +1 -1
- {openfeature_provider_flagd-0.1.5.dist-info → openfeature_provider_flagd-0.2.0.dist-info}/licenses/LICENSE +1 -1
- openfeature/contrib/provider/flagd/proto/flagd/evaluation/v1/evaluation_pb2.py +0 -62
- openfeature/contrib/provider/flagd/proto/flagd/evaluation/v1/evaluation_pb2_grpc.py +0 -267
- openfeature/contrib/provider/flagd/proto/flagd/sync/v1/sync_pb2.py +0 -40
- openfeature/contrib/provider/flagd/proto/flagd/sync/v1/sync_pb2_grpc.py +0 -135
- openfeature/contrib/provider/flagd/proto/schema/v1/schema_pb2.py +0 -62
- openfeature/contrib/provider/flagd/proto/schema/v1/schema_pb2_grpc.py +0 -267
- openfeature/contrib/provider/flagd/proto/sync/v1/sync_service_pb2.py +0 -37
- openfeature/contrib/provider/flagd/proto/sync/v1/sync_service_pb2_grpc.py +0 -102
- openfeature/contrib/provider/flagd/resolvers/process/file_watcher.py +0 -89
- openfeature_provider_flagd-0.1.5.dist-info/RECORD +0 -22
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
-
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
-
import grpc
|
|
4
|
-
|
|
5
|
-
from . import schema_pb2 as schema_dot_v1_dot_schema__pb2
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class ServiceStub(object):
|
|
9
|
-
"""Service defines the exposed rpcs of flagd
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
def __init__(self, channel):
|
|
13
|
-
"""Constructor.
|
|
14
|
-
|
|
15
|
-
Args:
|
|
16
|
-
channel: A grpc.Channel.
|
|
17
|
-
"""
|
|
18
|
-
self.ResolveAll = channel.unary_unary(
|
|
19
|
-
'/schema.v1.Service/ResolveAll',
|
|
20
|
-
request_serializer=schema_dot_v1_dot_schema__pb2.ResolveAllRequest.SerializeToString,
|
|
21
|
-
response_deserializer=schema_dot_v1_dot_schema__pb2.ResolveAllResponse.FromString,
|
|
22
|
-
)
|
|
23
|
-
self.ResolveBoolean = channel.unary_unary(
|
|
24
|
-
'/schema.v1.Service/ResolveBoolean',
|
|
25
|
-
request_serializer=schema_dot_v1_dot_schema__pb2.ResolveBooleanRequest.SerializeToString,
|
|
26
|
-
response_deserializer=schema_dot_v1_dot_schema__pb2.ResolveBooleanResponse.FromString,
|
|
27
|
-
)
|
|
28
|
-
self.ResolveString = channel.unary_unary(
|
|
29
|
-
'/schema.v1.Service/ResolveString',
|
|
30
|
-
request_serializer=schema_dot_v1_dot_schema__pb2.ResolveStringRequest.SerializeToString,
|
|
31
|
-
response_deserializer=schema_dot_v1_dot_schema__pb2.ResolveStringResponse.FromString,
|
|
32
|
-
)
|
|
33
|
-
self.ResolveFloat = channel.unary_unary(
|
|
34
|
-
'/schema.v1.Service/ResolveFloat',
|
|
35
|
-
request_serializer=schema_dot_v1_dot_schema__pb2.ResolveFloatRequest.SerializeToString,
|
|
36
|
-
response_deserializer=schema_dot_v1_dot_schema__pb2.ResolveFloatResponse.FromString,
|
|
37
|
-
)
|
|
38
|
-
self.ResolveInt = channel.unary_unary(
|
|
39
|
-
'/schema.v1.Service/ResolveInt',
|
|
40
|
-
request_serializer=schema_dot_v1_dot_schema__pb2.ResolveIntRequest.SerializeToString,
|
|
41
|
-
response_deserializer=schema_dot_v1_dot_schema__pb2.ResolveIntResponse.FromString,
|
|
42
|
-
)
|
|
43
|
-
self.ResolveObject = channel.unary_unary(
|
|
44
|
-
'/schema.v1.Service/ResolveObject',
|
|
45
|
-
request_serializer=schema_dot_v1_dot_schema__pb2.ResolveObjectRequest.SerializeToString,
|
|
46
|
-
response_deserializer=schema_dot_v1_dot_schema__pb2.ResolveObjectResponse.FromString,
|
|
47
|
-
)
|
|
48
|
-
self.EventStream = channel.unary_stream(
|
|
49
|
-
'/schema.v1.Service/EventStream',
|
|
50
|
-
request_serializer=schema_dot_v1_dot_schema__pb2.EventStreamRequest.SerializeToString,
|
|
51
|
-
response_deserializer=schema_dot_v1_dot_schema__pb2.EventStreamResponse.FromString,
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
class ServiceServicer(object):
|
|
56
|
-
"""Service defines the exposed rpcs of flagd
|
|
57
|
-
"""
|
|
58
|
-
|
|
59
|
-
def ResolveAll(self, request, context):
|
|
60
|
-
"""Missing associated documentation comment in .proto file."""
|
|
61
|
-
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
62
|
-
context.set_details('Method not implemented!')
|
|
63
|
-
raise NotImplementedError('Method not implemented!')
|
|
64
|
-
|
|
65
|
-
def ResolveBoolean(self, request, context):
|
|
66
|
-
"""Missing associated documentation comment in .proto file."""
|
|
67
|
-
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
68
|
-
context.set_details('Method not implemented!')
|
|
69
|
-
raise NotImplementedError('Method not implemented!')
|
|
70
|
-
|
|
71
|
-
def ResolveString(self, request, context):
|
|
72
|
-
"""Missing associated documentation comment in .proto file."""
|
|
73
|
-
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
74
|
-
context.set_details('Method not implemented!')
|
|
75
|
-
raise NotImplementedError('Method not implemented!')
|
|
76
|
-
|
|
77
|
-
def ResolveFloat(self, request, context):
|
|
78
|
-
"""Missing associated documentation comment in .proto file."""
|
|
79
|
-
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
80
|
-
context.set_details('Method not implemented!')
|
|
81
|
-
raise NotImplementedError('Method not implemented!')
|
|
82
|
-
|
|
83
|
-
def ResolveInt(self, request, context):
|
|
84
|
-
"""Missing associated documentation comment in .proto file."""
|
|
85
|
-
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
86
|
-
context.set_details('Method not implemented!')
|
|
87
|
-
raise NotImplementedError('Method not implemented!')
|
|
88
|
-
|
|
89
|
-
def ResolveObject(self, request, context):
|
|
90
|
-
"""Missing associated documentation comment in .proto file."""
|
|
91
|
-
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
92
|
-
context.set_details('Method not implemented!')
|
|
93
|
-
raise NotImplementedError('Method not implemented!')
|
|
94
|
-
|
|
95
|
-
def EventStream(self, request, context):
|
|
96
|
-
"""Missing associated documentation comment in .proto file."""
|
|
97
|
-
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
98
|
-
context.set_details('Method not implemented!')
|
|
99
|
-
raise NotImplementedError('Method not implemented!')
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
def add_ServiceServicer_to_server(servicer, server):
|
|
103
|
-
rpc_method_handlers = {
|
|
104
|
-
'ResolveAll': grpc.unary_unary_rpc_method_handler(
|
|
105
|
-
servicer.ResolveAll,
|
|
106
|
-
request_deserializer=schema_dot_v1_dot_schema__pb2.ResolveAllRequest.FromString,
|
|
107
|
-
response_serializer=schema_dot_v1_dot_schema__pb2.ResolveAllResponse.SerializeToString,
|
|
108
|
-
),
|
|
109
|
-
'ResolveBoolean': grpc.unary_unary_rpc_method_handler(
|
|
110
|
-
servicer.ResolveBoolean,
|
|
111
|
-
request_deserializer=schema_dot_v1_dot_schema__pb2.ResolveBooleanRequest.FromString,
|
|
112
|
-
response_serializer=schema_dot_v1_dot_schema__pb2.ResolveBooleanResponse.SerializeToString,
|
|
113
|
-
),
|
|
114
|
-
'ResolveString': grpc.unary_unary_rpc_method_handler(
|
|
115
|
-
servicer.ResolveString,
|
|
116
|
-
request_deserializer=schema_dot_v1_dot_schema__pb2.ResolveStringRequest.FromString,
|
|
117
|
-
response_serializer=schema_dot_v1_dot_schema__pb2.ResolveStringResponse.SerializeToString,
|
|
118
|
-
),
|
|
119
|
-
'ResolveFloat': grpc.unary_unary_rpc_method_handler(
|
|
120
|
-
servicer.ResolveFloat,
|
|
121
|
-
request_deserializer=schema_dot_v1_dot_schema__pb2.ResolveFloatRequest.FromString,
|
|
122
|
-
response_serializer=schema_dot_v1_dot_schema__pb2.ResolveFloatResponse.SerializeToString,
|
|
123
|
-
),
|
|
124
|
-
'ResolveInt': grpc.unary_unary_rpc_method_handler(
|
|
125
|
-
servicer.ResolveInt,
|
|
126
|
-
request_deserializer=schema_dot_v1_dot_schema__pb2.ResolveIntRequest.FromString,
|
|
127
|
-
response_serializer=schema_dot_v1_dot_schema__pb2.ResolveIntResponse.SerializeToString,
|
|
128
|
-
),
|
|
129
|
-
'ResolveObject': grpc.unary_unary_rpc_method_handler(
|
|
130
|
-
servicer.ResolveObject,
|
|
131
|
-
request_deserializer=schema_dot_v1_dot_schema__pb2.ResolveObjectRequest.FromString,
|
|
132
|
-
response_serializer=schema_dot_v1_dot_schema__pb2.ResolveObjectResponse.SerializeToString,
|
|
133
|
-
),
|
|
134
|
-
'EventStream': grpc.unary_stream_rpc_method_handler(
|
|
135
|
-
servicer.EventStream,
|
|
136
|
-
request_deserializer=schema_dot_v1_dot_schema__pb2.EventStreamRequest.FromString,
|
|
137
|
-
response_serializer=schema_dot_v1_dot_schema__pb2.EventStreamResponse.SerializeToString,
|
|
138
|
-
),
|
|
139
|
-
}
|
|
140
|
-
generic_handler = grpc.method_handlers_generic_handler(
|
|
141
|
-
'schema.v1.Service', rpc_method_handlers)
|
|
142
|
-
server.add_generic_rpc_handlers((generic_handler,))
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
# This class is part of an EXPERIMENTAL API.
|
|
146
|
-
class Service(object):
|
|
147
|
-
"""Service defines the exposed rpcs of flagd
|
|
148
|
-
"""
|
|
149
|
-
|
|
150
|
-
@staticmethod
|
|
151
|
-
def ResolveAll(request,
|
|
152
|
-
target,
|
|
153
|
-
options=(),
|
|
154
|
-
channel_credentials=None,
|
|
155
|
-
call_credentials=None,
|
|
156
|
-
insecure=False,
|
|
157
|
-
compression=None,
|
|
158
|
-
wait_for_ready=None,
|
|
159
|
-
timeout=None,
|
|
160
|
-
metadata=None):
|
|
161
|
-
return grpc.experimental.unary_unary(request, target, '/schema.v1.Service/ResolveAll',
|
|
162
|
-
schema_dot_v1_dot_schema__pb2.ResolveAllRequest.SerializeToString,
|
|
163
|
-
schema_dot_v1_dot_schema__pb2.ResolveAllResponse.FromString,
|
|
164
|
-
options, channel_credentials,
|
|
165
|
-
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
166
|
-
|
|
167
|
-
@staticmethod
|
|
168
|
-
def ResolveBoolean(request,
|
|
169
|
-
target,
|
|
170
|
-
options=(),
|
|
171
|
-
channel_credentials=None,
|
|
172
|
-
call_credentials=None,
|
|
173
|
-
insecure=False,
|
|
174
|
-
compression=None,
|
|
175
|
-
wait_for_ready=None,
|
|
176
|
-
timeout=None,
|
|
177
|
-
metadata=None):
|
|
178
|
-
return grpc.experimental.unary_unary(request, target, '/schema.v1.Service/ResolveBoolean',
|
|
179
|
-
schema_dot_v1_dot_schema__pb2.ResolveBooleanRequest.SerializeToString,
|
|
180
|
-
schema_dot_v1_dot_schema__pb2.ResolveBooleanResponse.FromString,
|
|
181
|
-
options, channel_credentials,
|
|
182
|
-
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
183
|
-
|
|
184
|
-
@staticmethod
|
|
185
|
-
def ResolveString(request,
|
|
186
|
-
target,
|
|
187
|
-
options=(),
|
|
188
|
-
channel_credentials=None,
|
|
189
|
-
call_credentials=None,
|
|
190
|
-
insecure=False,
|
|
191
|
-
compression=None,
|
|
192
|
-
wait_for_ready=None,
|
|
193
|
-
timeout=None,
|
|
194
|
-
metadata=None):
|
|
195
|
-
return grpc.experimental.unary_unary(request, target, '/schema.v1.Service/ResolveString',
|
|
196
|
-
schema_dot_v1_dot_schema__pb2.ResolveStringRequest.SerializeToString,
|
|
197
|
-
schema_dot_v1_dot_schema__pb2.ResolveStringResponse.FromString,
|
|
198
|
-
options, channel_credentials,
|
|
199
|
-
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
200
|
-
|
|
201
|
-
@staticmethod
|
|
202
|
-
def ResolveFloat(request,
|
|
203
|
-
target,
|
|
204
|
-
options=(),
|
|
205
|
-
channel_credentials=None,
|
|
206
|
-
call_credentials=None,
|
|
207
|
-
insecure=False,
|
|
208
|
-
compression=None,
|
|
209
|
-
wait_for_ready=None,
|
|
210
|
-
timeout=None,
|
|
211
|
-
metadata=None):
|
|
212
|
-
return grpc.experimental.unary_unary(request, target, '/schema.v1.Service/ResolveFloat',
|
|
213
|
-
schema_dot_v1_dot_schema__pb2.ResolveFloatRequest.SerializeToString,
|
|
214
|
-
schema_dot_v1_dot_schema__pb2.ResolveFloatResponse.FromString,
|
|
215
|
-
options, channel_credentials,
|
|
216
|
-
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
217
|
-
|
|
218
|
-
@staticmethod
|
|
219
|
-
def ResolveInt(request,
|
|
220
|
-
target,
|
|
221
|
-
options=(),
|
|
222
|
-
channel_credentials=None,
|
|
223
|
-
call_credentials=None,
|
|
224
|
-
insecure=False,
|
|
225
|
-
compression=None,
|
|
226
|
-
wait_for_ready=None,
|
|
227
|
-
timeout=None,
|
|
228
|
-
metadata=None):
|
|
229
|
-
return grpc.experimental.unary_unary(request, target, '/schema.v1.Service/ResolveInt',
|
|
230
|
-
schema_dot_v1_dot_schema__pb2.ResolveIntRequest.SerializeToString,
|
|
231
|
-
schema_dot_v1_dot_schema__pb2.ResolveIntResponse.FromString,
|
|
232
|
-
options, channel_credentials,
|
|
233
|
-
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
234
|
-
|
|
235
|
-
@staticmethod
|
|
236
|
-
def ResolveObject(request,
|
|
237
|
-
target,
|
|
238
|
-
options=(),
|
|
239
|
-
channel_credentials=None,
|
|
240
|
-
call_credentials=None,
|
|
241
|
-
insecure=False,
|
|
242
|
-
compression=None,
|
|
243
|
-
wait_for_ready=None,
|
|
244
|
-
timeout=None,
|
|
245
|
-
metadata=None):
|
|
246
|
-
return grpc.experimental.unary_unary(request, target, '/schema.v1.Service/ResolveObject',
|
|
247
|
-
schema_dot_v1_dot_schema__pb2.ResolveObjectRequest.SerializeToString,
|
|
248
|
-
schema_dot_v1_dot_schema__pb2.ResolveObjectResponse.FromString,
|
|
249
|
-
options, channel_credentials,
|
|
250
|
-
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
251
|
-
|
|
252
|
-
@staticmethod
|
|
253
|
-
def EventStream(request,
|
|
254
|
-
target,
|
|
255
|
-
options=(),
|
|
256
|
-
channel_credentials=None,
|
|
257
|
-
call_credentials=None,
|
|
258
|
-
insecure=False,
|
|
259
|
-
compression=None,
|
|
260
|
-
wait_for_ready=None,
|
|
261
|
-
timeout=None,
|
|
262
|
-
metadata=None):
|
|
263
|
-
return grpc.experimental.unary_stream(request, target, '/schema.v1.Service/EventStream',
|
|
264
|
-
schema_dot_v1_dot_schema__pb2.EventStreamRequest.SerializeToString,
|
|
265
|
-
schema_dot_v1_dot_schema__pb2.EventStreamResponse.FromString,
|
|
266
|
-
options, channel_credentials,
|
|
267
|
-
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
-
# source: sync/v1/sync_service.proto
|
|
4
|
-
"""Generated protocol buffer code."""
|
|
5
|
-
from google.protobuf import descriptor as _descriptor
|
|
6
|
-
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
7
|
-
from google.protobuf import symbol_database as _symbol_database
|
|
8
|
-
from google.protobuf.internal import builder as _builder
|
|
9
|
-
# @@protoc_insertion_point(imports)
|
|
10
|
-
|
|
11
|
-
_sym_db = _symbol_database.Default()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1async/v1/sync_service.proto\x12\x07sync.v1\"O\n\x10SyncFlagsRequest\x12\x1f\n\x0bprovider_id\x18\x01 \x01(\tR\nproviderId\x12\x1a\n\x08selector\x18\x02 \x01(\tR\x08selector\"l\n\x11SyncFlagsResponse\x12-\n\x12\x66lag_configuration\x18\x01 \x01(\tR\x11\x66lagConfiguration\x12(\n\x05state\x18\x02 \x01(\x0e\x32\x12.sync.v1.SyncStateR\x05state\"S\n\x14\x46\x65tchAllFlagsRequest\x12\x1f\n\x0bprovider_id\x18\x01 \x01(\tR\nproviderId\x12\x1a\n\x08selector\x18\x02 \x01(\tR\x08selector\"F\n\x15\x46\x65tchAllFlagsResponse\x12-\n\x12\x66lag_configuration\x18\x01 \x01(\tR\x11\x66lagConfiguration*\x92\x01\n\tSyncState\x12\x1a\n\x16SYNC_STATE_UNSPECIFIED\x10\x00\x12\x12\n\x0eSYNC_STATE_ALL\x10\x01\x12\x12\n\x0eSYNC_STATE_ADD\x10\x02\x12\x15\n\x11SYNC_STATE_UPDATE\x10\x03\x12\x15\n\x11SYNC_STATE_DELETE\x10\x04\x12\x13\n\x0fSYNC_STATE_PING\x10\x05\x32\xab\x01\n\x0f\x46lagSyncService\x12\x46\n\tSyncFlags\x12\x19.sync.v1.SyncFlagsRequest\x1a\x1a.sync.v1.SyncFlagsResponse\"\x00\x30\x01\x12P\n\rFetchAllFlags\x12\x1d.sync.v1.FetchAllFlagsRequest\x1a\x1e.sync.v1.FetchAllFlagsResponse\"\x00\x42l\n\x0b\x63om.sync.v1B\x10SyncServiceProtoP\x01Z\x0e\x66lagd/grpcsync\xa2\x02\x03SXX\xaa\x02\x07Sync.V1\xca\x02\x07Sync\\V1\xe2\x02\x13Sync\\V1\\GPBMetadata\xea\x02\x08Sync::V1b\x06proto3')
|
|
17
|
-
|
|
18
|
-
_globals = globals()
|
|
19
|
-
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
20
|
-
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'sync.v1.sync_service_pb2', _globals)
|
|
21
|
-
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
22
|
-
|
|
23
|
-
DESCRIPTOR._options = None
|
|
24
|
-
DESCRIPTOR._serialized_options = b'\n\013com.sync.v1B\020SyncServiceProtoP\001Z\016flagd/grpcsync\242\002\003SXX\252\002\007Sync.V1\312\002\007Sync\\V1\342\002\023Sync\\V1\\GPBMetadata\352\002\010Sync::V1'
|
|
25
|
-
_globals['_SYNCSTATE']._serialized_start=388
|
|
26
|
-
_globals['_SYNCSTATE']._serialized_end=534
|
|
27
|
-
_globals['_SYNCFLAGSREQUEST']._serialized_start=39
|
|
28
|
-
_globals['_SYNCFLAGSREQUEST']._serialized_end=118
|
|
29
|
-
_globals['_SYNCFLAGSRESPONSE']._serialized_start=120
|
|
30
|
-
_globals['_SYNCFLAGSRESPONSE']._serialized_end=228
|
|
31
|
-
_globals['_FETCHALLFLAGSREQUEST']._serialized_start=230
|
|
32
|
-
_globals['_FETCHALLFLAGSREQUEST']._serialized_end=313
|
|
33
|
-
_globals['_FETCHALLFLAGSRESPONSE']._serialized_start=315
|
|
34
|
-
_globals['_FETCHALLFLAGSRESPONSE']._serialized_end=385
|
|
35
|
-
_globals['_FLAGSYNCSERVICE']._serialized_start=537
|
|
36
|
-
_globals['_FLAGSYNCSERVICE']._serialized_end=708
|
|
37
|
-
# @@protoc_insertion_point(module_scope)
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
-
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
-
import grpc
|
|
4
|
-
|
|
5
|
-
from sync.v1 import sync_service_pb2 as sync_dot_v1_dot_sync__service__pb2
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class FlagSyncServiceStub(object):
|
|
9
|
-
"""FlagService implements a server streaming to provide realtime flag configurations
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
def __init__(self, channel):
|
|
13
|
-
"""Constructor.
|
|
14
|
-
|
|
15
|
-
Args:
|
|
16
|
-
channel: A grpc.Channel.
|
|
17
|
-
"""
|
|
18
|
-
self.SyncFlags = channel.unary_stream(
|
|
19
|
-
'/sync.v1.FlagSyncService/SyncFlags',
|
|
20
|
-
request_serializer=sync_dot_v1_dot_sync__service__pb2.SyncFlagsRequest.SerializeToString,
|
|
21
|
-
response_deserializer=sync_dot_v1_dot_sync__service__pb2.SyncFlagsResponse.FromString,
|
|
22
|
-
)
|
|
23
|
-
self.FetchAllFlags = channel.unary_unary(
|
|
24
|
-
'/sync.v1.FlagSyncService/FetchAllFlags',
|
|
25
|
-
request_serializer=sync_dot_v1_dot_sync__service__pb2.FetchAllFlagsRequest.SerializeToString,
|
|
26
|
-
response_deserializer=sync_dot_v1_dot_sync__service__pb2.FetchAllFlagsResponse.FromString,
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class FlagSyncServiceServicer(object):
|
|
31
|
-
"""FlagService implements a server streaming to provide realtime flag configurations
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
def SyncFlags(self, request, context):
|
|
35
|
-
"""Missing associated documentation comment in .proto file."""
|
|
36
|
-
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
37
|
-
context.set_details('Method not implemented!')
|
|
38
|
-
raise NotImplementedError('Method not implemented!')
|
|
39
|
-
|
|
40
|
-
def FetchAllFlags(self, request, context):
|
|
41
|
-
"""Missing associated documentation comment in .proto file."""
|
|
42
|
-
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
43
|
-
context.set_details('Method not implemented!')
|
|
44
|
-
raise NotImplementedError('Method not implemented!')
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def add_FlagSyncServiceServicer_to_server(servicer, server):
|
|
48
|
-
rpc_method_handlers = {
|
|
49
|
-
'SyncFlags': grpc.unary_stream_rpc_method_handler(
|
|
50
|
-
servicer.SyncFlags,
|
|
51
|
-
request_deserializer=sync_dot_v1_dot_sync__service__pb2.SyncFlagsRequest.FromString,
|
|
52
|
-
response_serializer=sync_dot_v1_dot_sync__service__pb2.SyncFlagsResponse.SerializeToString,
|
|
53
|
-
),
|
|
54
|
-
'FetchAllFlags': grpc.unary_unary_rpc_method_handler(
|
|
55
|
-
servicer.FetchAllFlags,
|
|
56
|
-
request_deserializer=sync_dot_v1_dot_sync__service__pb2.FetchAllFlagsRequest.FromString,
|
|
57
|
-
response_serializer=sync_dot_v1_dot_sync__service__pb2.FetchAllFlagsResponse.SerializeToString,
|
|
58
|
-
),
|
|
59
|
-
}
|
|
60
|
-
generic_handler = grpc.method_handlers_generic_handler(
|
|
61
|
-
'sync.v1.FlagSyncService', rpc_method_handlers)
|
|
62
|
-
server.add_generic_rpc_handlers((generic_handler,))
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
# This class is part of an EXPERIMENTAL API.
|
|
66
|
-
class FlagSyncService(object):
|
|
67
|
-
"""FlagService implements a server streaming to provide realtime flag configurations
|
|
68
|
-
"""
|
|
69
|
-
|
|
70
|
-
@staticmethod
|
|
71
|
-
def SyncFlags(request,
|
|
72
|
-
target,
|
|
73
|
-
options=(),
|
|
74
|
-
channel_credentials=None,
|
|
75
|
-
call_credentials=None,
|
|
76
|
-
insecure=False,
|
|
77
|
-
compression=None,
|
|
78
|
-
wait_for_ready=None,
|
|
79
|
-
timeout=None,
|
|
80
|
-
metadata=None):
|
|
81
|
-
return grpc.experimental.unary_stream(request, target, '/sync.v1.FlagSyncService/SyncFlags',
|
|
82
|
-
sync_dot_v1_dot_sync__service__pb2.SyncFlagsRequest.SerializeToString,
|
|
83
|
-
sync_dot_v1_dot_sync__service__pb2.SyncFlagsResponse.FromString,
|
|
84
|
-
options, channel_credentials,
|
|
85
|
-
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
86
|
-
|
|
87
|
-
@staticmethod
|
|
88
|
-
def FetchAllFlags(request,
|
|
89
|
-
target,
|
|
90
|
-
options=(),
|
|
91
|
-
channel_credentials=None,
|
|
92
|
-
call_credentials=None,
|
|
93
|
-
insecure=False,
|
|
94
|
-
compression=None,
|
|
95
|
-
wait_for_ready=None,
|
|
96
|
-
timeout=None,
|
|
97
|
-
metadata=None):
|
|
98
|
-
return grpc.experimental.unary_unary(request, target, '/sync.v1.FlagSyncService/FetchAllFlags',
|
|
99
|
-
sync_dot_v1_dot_sync__service__pb2.FetchAllFlagsRequest.SerializeToString,
|
|
100
|
-
sync_dot_v1_dot_sync__service__pb2.FetchAllFlagsResponse.FromString,
|
|
101
|
-
options, channel_credentials,
|
|
102
|
-
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
import logging
|
|
3
|
-
import os
|
|
4
|
-
import re
|
|
5
|
-
import threading
|
|
6
|
-
import time
|
|
7
|
-
import typing
|
|
8
|
-
|
|
9
|
-
import yaml
|
|
10
|
-
|
|
11
|
-
from openfeature.event import ProviderEventDetails
|
|
12
|
-
from openfeature.exception import ParseError
|
|
13
|
-
from openfeature.provider.provider import AbstractProvider
|
|
14
|
-
|
|
15
|
-
from .flags import Flag
|
|
16
|
-
|
|
17
|
-
logger = logging.getLogger("openfeature.contrib")
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class FileWatcherFlagStore:
|
|
21
|
-
def __init__(
|
|
22
|
-
self,
|
|
23
|
-
file_path: str,
|
|
24
|
-
provider: AbstractProvider,
|
|
25
|
-
poll_interval_seconds: float = 1.0,
|
|
26
|
-
):
|
|
27
|
-
self.file_path = file_path
|
|
28
|
-
self.provider = provider
|
|
29
|
-
self.poll_interval_seconds = poll_interval_seconds
|
|
30
|
-
|
|
31
|
-
self.last_modified = 0.0
|
|
32
|
-
self.flag_data: typing.Mapping[str, Flag] = {}
|
|
33
|
-
self.load_data()
|
|
34
|
-
self.thread = threading.Thread(target=self.refresh_file, daemon=True)
|
|
35
|
-
self.thread.start()
|
|
36
|
-
|
|
37
|
-
def shutdown(self) -> None:
|
|
38
|
-
pass
|
|
39
|
-
|
|
40
|
-
def get_flag(self, key: str) -> typing.Optional[Flag]:
|
|
41
|
-
return self.flag_data.get(key)
|
|
42
|
-
|
|
43
|
-
def refresh_file(self) -> None:
|
|
44
|
-
while True:
|
|
45
|
-
time.sleep(self.poll_interval_seconds)
|
|
46
|
-
logger.debug("checking for new flag store contents from file")
|
|
47
|
-
last_modified = os.path.getmtime(self.file_path)
|
|
48
|
-
if last_modified > self.last_modified:
|
|
49
|
-
self.load_data(last_modified)
|
|
50
|
-
|
|
51
|
-
def load_data(self, modified_time: typing.Optional[float] = None) -> None:
|
|
52
|
-
try:
|
|
53
|
-
with open(self.file_path) as file:
|
|
54
|
-
if self.file_path.endswith(".yaml"):
|
|
55
|
-
data = yaml.safe_load(file)
|
|
56
|
-
else:
|
|
57
|
-
data = json.load(file)
|
|
58
|
-
|
|
59
|
-
self.flag_data = self.parse_flags(data)
|
|
60
|
-
logger.debug(f"{self.flag_data=}")
|
|
61
|
-
self.provider.emit_provider_configuration_changed(
|
|
62
|
-
ProviderEventDetails(flags_changed=list(self.flag_data.keys()))
|
|
63
|
-
)
|
|
64
|
-
self.last_modified = modified_time or os.path.getmtime(self.file_path)
|
|
65
|
-
except FileNotFoundError:
|
|
66
|
-
logger.exception("Provided file path not valid")
|
|
67
|
-
except json.JSONDecodeError:
|
|
68
|
-
logger.exception("Could not parse JSON flag data from file")
|
|
69
|
-
except yaml.error.YAMLError:
|
|
70
|
-
logger.exception("Could not parse YAML flag data from file")
|
|
71
|
-
except ParseError:
|
|
72
|
-
logger.exception("Could not parse flag data using flagd syntax")
|
|
73
|
-
except Exception:
|
|
74
|
-
logger.exception("Could not read flags from file")
|
|
75
|
-
|
|
76
|
-
def parse_flags(self, flags_data: dict) -> dict:
|
|
77
|
-
flags = flags_data.get("flags", {})
|
|
78
|
-
evaluators: typing.Optional[dict] = flags_data.get("$evaluators")
|
|
79
|
-
if evaluators:
|
|
80
|
-
transposed = json.dumps(flags)
|
|
81
|
-
for name, rule in evaluators.items():
|
|
82
|
-
transposed = re.sub(
|
|
83
|
-
rf"{{\s*\"\$ref\":\s*\"{name}\"\s*}}", json.dumps(rule), transposed
|
|
84
|
-
)
|
|
85
|
-
flags = json.loads(transposed)
|
|
86
|
-
|
|
87
|
-
if not isinstance(flags, dict):
|
|
88
|
-
raise ParseError("`flags` key of configuration must be a dictionary")
|
|
89
|
-
return {key: Flag.from_dict(key, data) for key, data in flags.items()}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
openfeature/contrib/provider/flagd/__init__.py,sha256=WlrcPaCH31dEG1IvrvpeuhAaQ8Ni8LEzDpNM_x-qKOA,65
|
|
2
|
-
openfeature/contrib/provider/flagd/config.py,sha256=DF_pAm1jYWIUTS7564YHI1mLBb1v3z7MstRgMwUHsmA,1921
|
|
3
|
-
openfeature/contrib/provider/flagd/flag_type.py,sha256=rZYfmqQEmtqVVTb8e-d8Wt8ZCnHtf7xPSmYxyU8w0R0,158
|
|
4
|
-
openfeature/contrib/provider/flagd/provider.py,sha256=i5_hJmy-EdbltQaPfcbCk6j9k1YkUnKxgubzKIQK3dQ,4614
|
|
5
|
-
openfeature/contrib/provider/flagd/proto/flagd/evaluation/v1/evaluation_pb2.py,sha256=W0Vgg8z7nEg_HTlAJkO6pu5nBcR8Ls3yoIykboavLRI,7704
|
|
6
|
-
openfeature/contrib/provider/flagd/proto/flagd/evaluation/v1/evaluation_pb2_grpc.py,sha256=GTKQXbUfRrquUG5o11N7ymhFnOuzh9_hcToZ9-cjOtA,13339
|
|
7
|
-
openfeature/contrib/provider/flagd/proto/flagd/sync/v1/sync_pb2.py,sha256=zUu_-V6DhHH5ZekWVsxKjGkUwkJrRrhqyXj8oX-Jo_g,3205
|
|
8
|
-
openfeature/contrib/provider/flagd/proto/flagd/sync/v1/sync_pb2_grpc.py,sha256=JNBei4U6aYtxeWU7h9s57yA4DL9ECnOyEbR9iGLoXmE,6155
|
|
9
|
-
openfeature/contrib/provider/flagd/proto/schema/v1/schema_pb2.py,sha256=onIastnVdAUCc8ez1zwniq6yJj-zeLEdllet_kX1qn8,7337
|
|
10
|
-
openfeature/contrib/provider/flagd/proto/schema/v1/schema_pb2_grpc.py,sha256=nllthJYfwhDBZHH_eGfSHesNbO6rJEZ0vXKyTFFy4AA,12393
|
|
11
|
-
openfeature/contrib/provider/flagd/proto/sync/v1/sync_service_pb2.py,sha256=uKBjB_lpfHN3r8wsjmqnQEBLtN9gw8zPmvWfWKsOYAE,2954
|
|
12
|
-
openfeature/contrib/provider/flagd/proto/sync/v1/sync_service_pb2_grpc.py,sha256=v5MSyyIOpE68EYWjsbdAq677gnD4jdNeLhMAB7EveNQ,4424
|
|
13
|
-
openfeature/contrib/provider/flagd/resolvers/__init__.py,sha256=kM5bt6cJCQgCsvJd1Tb2YD050X06wk8rK249JmNjoUc,1468
|
|
14
|
-
openfeature/contrib/provider/flagd/resolvers/grpc.py,sha256=9F-jX08Ynar5d2cgTV90lDQxgxIlxKg9KEIwueCU3u8,5460
|
|
15
|
-
openfeature/contrib/provider/flagd/resolvers/in_process.py,sha256=-RGKP9xC4Ic65-gBLvjMJJ-7EKDKsKnEu_0GdqGHaKk,4383
|
|
16
|
-
openfeature/contrib/provider/flagd/resolvers/process/custom_ops.py,sha256=8vscgX-SA_lnjb8Tg4S_qrVspqeVwtyXc8F846tcdc8,3644
|
|
17
|
-
openfeature/contrib/provider/flagd/resolvers/process/file_watcher.py,sha256=0GMA-gs6PchT4tW_daV1LwFmCw21mVa_WawusW72xWA,3191
|
|
18
|
-
openfeature/contrib/provider/flagd/resolvers/process/flags.py,sha256=aE-i-ghpjoGejOwP3K4DotcdHYw_o393oxrMaBmpgko,1718
|
|
19
|
-
openfeature_provider_flagd-0.1.5.dist-info/METADATA,sha256=rWFt0M5Qb54eiiLaEPhhHVCzwY5PlxLYZwEToiMaCTA,15005
|
|
20
|
-
openfeature_provider_flagd-0.1.5.dist-info/WHEEL,sha256=as-1oFTWSeWBgyzh0O_qF439xqBe6AbBgt4MfYe5zwY,87
|
|
21
|
-
openfeature_provider_flagd-0.1.5.dist-info/licenses/LICENSE,sha256=h8jwqxShIeVkc8vOo9ynxGYW16f4fVPxLhZKZs0H5U8,11350
|
|
22
|
-
openfeature_provider_flagd-0.1.5.dist-info/RECORD,,
|