flo-python 0.1.0.dev4__py3-none-any.whl → 0.1.2__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.
flo/__init__.py CHANGED
@@ -34,6 +34,7 @@ Example:
34
34
  from .client import FloClient
35
35
  from .exceptions import (
36
36
  BadRequestError,
37
+ BlockTooLongError,
37
38
  ConflictError,
38
39
  ConnectionFailedError,
39
40
  FloError,
@@ -52,15 +53,19 @@ from .exceptions import (
52
53
  PayloadTooLargeError,
53
54
  ProtocolError,
54
55
  RateLimitedError,
56
+ RequestTimeoutError,
55
57
  ServerError,
58
+ TableMismatchError,
56
59
  UnauthorizedError,
60
+ UnavailableError,
57
61
  UnexpectedEofError,
58
- UnsupportedVersionError,
59
62
  ValidationError,
60
63
  ValueTooLargeError,
61
64
  is_connection_error,
62
65
  )
66
+ from .kv_txn import Transaction, TxnFinishedError, TxnUnsupportedOpError
63
67
  from .processing import ProcessingOperations
68
+ from .retry import DEFAULT_RETRY_POLICY, RetryPolicy
64
69
  from .types import (
65
70
  AckOptions,
66
71
  ActionDeleteOptions,
@@ -73,26 +78,35 @@ from .types import (
73
78
  ActionRunStatus,
74
79
  ActionStatusOptions,
75
80
  ActionType,
81
+ Condition,
76
82
  DeleteOptions,
77
83
  DequeueOptions,
78
84
  DequeueResult,
79
85
  DlqListOptions,
80
86
  DlqRequeueOptions,
81
87
  EnqueueOptions,
88
+ GetJsonResult,
82
89
  GetOptions,
90
+ GetResult,
83
91
  HistoryOptions,
84
- KVEntry,
92
+ IncrResult,
93
+ KVBeginResult,
94
+ KVCommitResult,
95
+ KVExistsOptions,
96
+ KVExpireOptions,
97
+ KVIncrOptions,
98
+ KVJsonOptions,
99
+ KVMGetOptions,
85
100
  Message,
101
+ MGetEntry,
86
102
  NackOptions,
87
103
  OpCode,
88
104
  OptionTag,
89
105
  PeekOptions,
106
+ PendingEntry,
90
107
  ProcessingCancelOptions,
91
108
  ProcessingListEntry,
92
109
  ProcessingListOptions,
93
- ProcessingRescaleOptions,
94
- ProcessingRestoreOptions,
95
- ProcessingSavepointOptions,
96
110
  ProcessingStatusOptions,
97
111
  ProcessingStatusResult,
98
112
  ProcessingStopOptions,
@@ -100,12 +114,17 @@ from .types import (
100
114
  ProcessingSyncOptions,
101
115
  ProcessingSyncResult,
102
116
  PutOptions,
117
+ PutResult,
118
+ Ran,
119
+ Reason,
120
+ RunStatus,
103
121
  ScanOptions,
104
122
  ScanResult,
105
123
  StatusCode,
106
124
  StorageTier,
107
125
  StreamAppendOptions,
108
126
  StreamAppendResult,
127
+ StreamClaimResult,
109
128
  StreamGroupAckOptions,
110
129
  StreamGroupJoinOptions,
111
130
  StreamGroupNackOptions,
@@ -117,9 +136,10 @@ from .types import (
117
136
  StreamReadResult,
118
137
  StreamRecord,
119
138
  StreamTrimOptions,
139
+ StreamTrimResult,
120
140
  TaskAssignment,
121
- TouchOptions,
122
141
  VersionEntry,
142
+ WaitFor,
123
143
  WorkerAwaitOptions,
124
144
  WorkerAwaitResult,
125
145
  WorkerCompleteOptions,
@@ -128,8 +148,9 @@ from .types import (
128
148
  WorkerListOptions,
129
149
  WorkerListResult,
130
150
  WorkerRegisterOptions,
131
- WorkerTask,
151
+ WorkerStatus,
132
152
  WorkerTouchOptions,
153
+ WorkerType,
133
154
  WorkflowCancelOptions,
134
155
  WorkflowCreateOptions,
135
156
  WorkflowDisableOptions,
@@ -156,11 +177,28 @@ from .worker import (
156
177
  )
157
178
  from .workflows import WorkflowOperations
158
179
 
159
- __version__ = "0.1.0"
180
+ __version__ = "0.1.2"
160
181
 
161
182
  __all__ = [
183
+ "Transaction",
184
+ "TxnFinishedError",
185
+ "TxnUnsupportedOpError",
186
+ "KVBeginResult",
187
+ "KVCommitResult",
188
+ "KVExistsOptions",
189
+ "KVIncrOptions",
190
+ "KVJsonOptions",
191
+ "KVMGetOptions",
192
+ "KVExpireOptions",
193
+ "GetResult",
194
+ "GetJsonResult",
195
+ "MGetEntry",
196
+ "PutResult",
197
+ "IncrResult",
162
198
  # Client
163
199
  "FloClient",
200
+ "RetryPolicy",
201
+ "DEFAULT_RETRY_POLICY",
164
202
  # High-level Worker API
165
203
  "ActionWorker",
166
204
  "ActionWorkerOptions",
@@ -179,9 +217,10 @@ __all__ = [
179
217
  "ConnectionFailedError",
180
218
  "InvalidEndpointError",
181
219
  "UnexpectedEofError",
220
+ "RequestTimeoutError",
182
221
  "ProtocolError",
183
222
  "InvalidMagicError",
184
- "UnsupportedVersionError",
223
+ "TableMismatchError",
185
224
  "InvalidChecksumError",
186
225
  "PayloadTooLargeError",
187
226
  "IncompleteResponseError",
@@ -189,28 +228,33 @@ __all__ = [
189
228
  "NamespaceTooLargeError",
190
229
  "KeyTooLargeError",
191
230
  "ValueTooLargeError",
231
+ "BlockTooLongError",
192
232
  "ServerError",
193
233
  "NotFoundError",
194
234
  "BadRequestError",
195
235
  "ConflictError",
196
236
  "UnauthorizedError",
197
237
  "OverloadedError",
238
+ "UnavailableError",
198
239
  "RateLimitedError",
199
240
  "InternalServerError",
200
241
  "GenericServerError",
201
242
  "is_connection_error",
202
243
  # Types
203
244
  "OpCode",
245
+ "Ran",
246
+ "Reason",
204
247
  "StatusCode",
205
248
  "OptionTag",
206
249
  # Result types
207
- "KVEntry",
208
250
  "ScanResult",
209
251
  "VersionEntry",
210
252
  "Message",
211
253
  "DequeueResult",
212
254
  # Options
255
+ "Condition",
213
256
  "GetOptions",
257
+ "WaitFor",
214
258
  "PutOptions",
215
259
  "DeleteOptions",
216
260
  "ScanOptions",
@@ -222,18 +266,20 @@ __all__ = [
222
266
  "DlqListOptions",
223
267
  "DlqRequeueOptions",
224
268
  "PeekOptions",
225
- "TouchOptions",
226
269
  # Stream types
227
270
  "StreamID",
228
271
  "StorageTier",
229
272
  "StreamRecord",
230
273
  "StreamAppendResult",
231
274
  "StreamReadResult",
275
+ "StreamClaimResult",
276
+ "PendingEntry",
232
277
  "StreamInfo",
233
278
  # Stream options
234
279
  "StreamAppendOptions",
235
280
  "StreamReadOptions",
236
281
  "StreamTrimOptions",
282
+ "StreamTrimResult",
237
283
  "StreamInfoOptions",
238
284
  "StreamGroupJoinOptions",
239
285
  "StreamGroupReadOptions",
@@ -241,6 +287,7 @@ __all__ = [
241
287
  "StreamGroupNackOptions",
242
288
  # Action types
243
289
  "ActionType",
290
+ "RunStatus",
244
291
  "ActionInfo",
245
292
  "ActionRunStatus",
246
293
  "ActionInvokeResult",
@@ -253,10 +300,11 @@ __all__ = [
253
300
  "ActionDeleteOptions",
254
301
  # Worker types
255
302
  "TaskAssignment",
256
- "WorkerTask",
257
303
  "WorkerAwaitResult",
258
304
  "WorkerInfo",
259
305
  "WorkerListResult",
306
+ "WorkerStatus",
307
+ "WorkerType",
260
308
  # Worker options
261
309
  "WorkerRegisterOptions",
262
310
  "WorkerAwaitOptions",
@@ -286,9 +334,6 @@ __all__ = [
286
334
  "ProcessingListOptions",
287
335
  "ProcessingStopOptions",
288
336
  "ProcessingCancelOptions",
289
- "ProcessingSavepointOptions",
290
- "ProcessingRestoreOptions",
291
- "ProcessingRescaleOptions",
292
337
  "ProcessingSyncOptions",
293
338
  "ProcessingStatusResult",
294
339
  "ProcessingListEntry",
flo/actions.py CHANGED
@@ -9,6 +9,12 @@ For a higher-level API, see `Worker` in worker.py.
9
9
 
10
10
  from typing import TYPE_CHECKING
11
11
 
12
+ from .kv_body import (
13
+ decode_action_invoke_answer,
14
+ decode_action_status_answer,
15
+ decode_worker_list_answer,
16
+ encode_worker_list_body,
17
+ )
12
18
  from .types import (
13
19
  ActionDeleteOptions,
14
20
  ActionInvokeOptions,
@@ -39,7 +45,6 @@ from .wire import (
39
45
  serialize_worker_await_value,
40
46
  serialize_worker_complete_value,
41
47
  serialize_worker_fail_value,
42
- serialize_worker_list_value,
43
48
  serialize_worker_register_value,
44
49
  serialize_worker_touch_value,
45
50
  )
@@ -78,7 +83,7 @@ class ActionOperations:
78
83
  action_type=action_type,
79
84
  timeout_ms=opts.timeout_ms,
80
85
  max_retries=opts.max_retries,
81
- description=opts.description,
86
+ owner=opts.owner,
82
87
  )
83
88
 
84
89
  await self._client._send_and_check(
@@ -109,8 +114,7 @@ class ActionOperations:
109
114
 
110
115
  value = serialize_action_invoke_value(
111
116
  input_data=input_data,
112
- priority=opts.priority,
113
- idempotency_key=opts.idempotency_key,
117
+ labels=opts.labels,
114
118
  )
115
119
 
116
120
  response = await self._client._send_and_check(
@@ -120,9 +124,7 @@ class ActionOperations:
120
124
  value,
121
125
  )
122
126
 
123
- # Response contains run_id as string
124
- run_id = response.data.decode("utf-8") if response.data else ""
125
- return ActionInvokeResult(run_id=run_id)
127
+ return ActionInvokeResult(run_id=decode_action_invoke_answer(response.data))
126
128
 
127
129
  async def status(
128
130
  self,
@@ -148,13 +150,7 @@ class ActionOperations:
148
150
  b"",
149
151
  )
150
152
 
151
- # Parse status response - format TBD based on server implementation
152
- # For now return basic status
153
- return ActionRunStatus(
154
- run_id=run_id,
155
- status="unknown",
156
- result=response.data if response.data else None,
157
- )
153
+ return decode_action_status_answer(run_id, response.data)
158
154
 
159
155
  async def list(
160
156
  self,
@@ -280,7 +276,7 @@ class WorkerOperations:
280
276
  Args:
281
277
  worker_id: Worker identifier.
282
278
  task_types: Task types to listen for.
283
- options: Optional await options (block_ms, timeout_ms).
279
+ options: Optional await options (block_ms).
284
280
 
285
281
  Returns:
286
282
  WorkerAwaitResult with task if available.
@@ -290,12 +286,9 @@ class WorkerOperations:
290
286
 
291
287
  value = serialize_worker_await_value(task_types)
292
288
 
293
- # Build options for block_ms and timeout_ms
294
289
  options_builder = OptionsBuilder()
295
290
  if opts.block_ms is not None:
296
291
  options_builder.add_u32(OptionTag.BLOCK_MS, opts.block_ms)
297
- if opts.timeout_ms is not None:
298
- options_builder.add_u32(OptionTag.TIMEOUT_MS, opts.timeout_ms)
299
292
 
300
293
  response = await self._client._send_and_check(
301
294
  OpCode.ACTION_AWAIT,
@@ -402,25 +395,25 @@ class WorkerOperations:
402
395
  self,
403
396
  options: WorkerListOptions | None = None,
404
397
  ) -> WorkerListResult:
405
- """List registered workers.
398
+ """List a page of the namespace's workers, in id order.
406
399
 
407
400
  Args:
408
- options: Optional list options.
401
+ options: The page's limit and cursor (the last page's ``cursor``;
402
+ None starts).
409
403
 
410
404
  Returns:
411
- WorkerListResult with list of workers.
405
+ WorkerListResult with the page's workers and the next page's
406
+ cursor, None on the last page.
412
407
  """
413
408
  opts = options or WorkerListOptions()
414
409
  namespace = self._client.get_namespace(opts.namespace)
415
410
 
416
- value = serialize_worker_list_value(opts.limit)
417
-
418
- await self._client._send_and_check(
411
+ response = await self._client._send_and_check(
419
412
  OpCode.WORKER_LIST,
420
413
  namespace,
421
414
  b"",
422
- value,
415
+ encode_worker_list_body(opts.limit, opts.cursor),
423
416
  )
424
417
 
425
- # Parse list response - format TBD based on server implementation
426
- return WorkerListResult(workers=[])
418
+ workers, cursor = decode_worker_list_answer(response.data)
419
+ return WorkerListResult(workers=workers, cursor=cursor)