cocoindex 0.1.34__tar.gz → 0.1.36__tar.gz

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.
Files changed (232) hide show
  1. {cocoindex-0.1.34 → cocoindex-0.1.36}/Cargo.lock +1 -1
  2. {cocoindex-0.1.34 → cocoindex-0.1.36}/Cargo.toml +1 -1
  3. {cocoindex-0.1.34 → cocoindex-0.1.36}/PKG-INFO +1 -1
  4. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/core/basics.md +1 -1
  5. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/core/flow_methods.mdx +47 -18
  6. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/code_embedding/pyproject.toml +1 -1
  7. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/docs_to_knowledge_graph/pyproject.toml +1 -1
  8. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/fastapi_server_docker/requirements.txt +1 -1
  9. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/gdrive_text_embedding/main.py +3 -3
  10. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/gdrive_text_embedding/pyproject.toml +1 -1
  11. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/requirements.txt +1 -1
  12. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/manuals_llm_extraction/pyproject.toml +1 -1
  13. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/pdf_embedding/pyproject.toml +1 -1
  14. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/pyproject.toml +1 -1
  15. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/text_embedding/pyproject.toml +1 -1
  16. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/text_embedding_qdrant/pyproject.toml +1 -1
  17. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/__init__.py +1 -1
  18. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/cli.py +7 -10
  19. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/flow.py +63 -36
  20. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/execution/db_tracking.rs +25 -0
  21. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/execution/dumper.rs +8 -5
  22. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/execution/evaluator.rs +14 -10
  23. cocoindex-0.1.36/src/execution/indexing_status.rs +59 -0
  24. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/execution/mod.rs +1 -0
  25. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/execution/row_indexer.rs +68 -61
  26. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/execution/source_indexer.rs +21 -7
  27. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/interface.rs +24 -6
  28. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/sources/google_drive.rs +32 -13
  29. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/sources/local_file.rs +29 -16
  30. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/server.rs +4 -0
  31. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/service/error.rs +4 -4
  32. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/service/flows.rs +79 -39
  33. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/setup/auth_registry.rs +7 -1
  34. {cocoindex-0.1.34 → cocoindex-0.1.36}/.cargo/config.toml +0 -0
  35. {cocoindex-0.1.34 → cocoindex-0.1.36}/.env.lib_debug +0 -0
  36. {cocoindex-0.1.34 → cocoindex-0.1.36}/.github/ISSUE_TEMPLATE//360/237/220/233-bug-report.md" +0 -0
  37. {cocoindex-0.1.34 → cocoindex-0.1.36}/.github/ISSUE_TEMPLATE//360/237/222/241-feature-request.md" +0 -0
  38. {cocoindex-0.1.34 → cocoindex-0.1.36}/.github/scripts/update_version.sh +0 -0
  39. {cocoindex-0.1.34 → cocoindex-0.1.36}/.github/workflows/CI.yml +0 -0
  40. {cocoindex-0.1.34 → cocoindex-0.1.36}/.github/workflows/_test.yml +0 -0
  41. {cocoindex-0.1.34 → cocoindex-0.1.36}/.github/workflows/docs.yml +0 -0
  42. {cocoindex-0.1.34 → cocoindex-0.1.36}/.github/workflows/release.yml +0 -0
  43. {cocoindex-0.1.34 → cocoindex-0.1.36}/.gitignore +0 -0
  44. {cocoindex-0.1.34 → cocoindex-0.1.36}/.vscode/settings.json +0 -0
  45. {cocoindex-0.1.34 → cocoindex-0.1.36}/CODE_OF_CONDUCT.md +0 -0
  46. {cocoindex-0.1.34 → cocoindex-0.1.36}/CONTRIBUTING.md +0 -0
  47. {cocoindex-0.1.34 → cocoindex-0.1.36}/LICENSE +0 -0
  48. {cocoindex-0.1.34 → cocoindex-0.1.36}/README.md +0 -0
  49. {cocoindex-0.1.34 → cocoindex-0.1.36}/dev/neo4j.yaml +0 -0
  50. {cocoindex-0.1.34 → cocoindex-0.1.36}/dev/postgres.yaml +0 -0
  51. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/.gitignore +0 -0
  52. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/README.md +0 -0
  53. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/about/community.md +0 -0
  54. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/about/contributing.md +0 -0
  55. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/ai/llm.mdx +0 -0
  56. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/core/cli.mdx +0 -0
  57. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/core/custom_function.mdx +0 -0
  58. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/core/data_example.svg +0 -0
  59. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/core/data_types.mdx +0 -0
  60. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/core/flow_def.mdx +0 -0
  61. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/core/flow_example.svg +0 -0
  62. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/core/initialization.mdx +0 -0
  63. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/getting_started/installation.md +0 -0
  64. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/getting_started/markdown_files.zip +0 -0
  65. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/getting_started/overview.md +0 -0
  66. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/getting_started/quickstart.md +0 -0
  67. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/ops/functions.md +0 -0
  68. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/ops/sources.md +0 -0
  69. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docs/ops/storages.md +0 -0
  70. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/docusaurus.config.ts +0 -0
  71. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/package.json +0 -0
  72. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/sidebars.ts +0 -0
  73. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/src/components/HomepageFeatures/index.tsx +0 -0
  74. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/src/components/HomepageFeatures/styles.module.css +0 -0
  75. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/src/css/custom.css +0 -0
  76. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/src/theme/Root.js +0 -0
  77. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/static/.nojekyll +0 -0
  78. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/static/img/docusaurus.png +0 -0
  79. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/static/img/favicon.ico +0 -0
  80. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/static/img/icon.svg +0 -0
  81. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/static/robots.txt +0 -0
  82. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/tsconfig.json +0 -0
  83. {cocoindex-0.1.34 → cocoindex-0.1.36}/docs/yarn.lock +0 -0
  84. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/code_embedding/.env +0 -0
  85. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/code_embedding/README.md +0 -0
  86. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/code_embedding/main.py +0 -0
  87. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/docs_to_knowledge_graph/.env +0 -0
  88. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/docs_to_knowledge_graph/README.md +0 -0
  89. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/docs_to_knowledge_graph/main.py +0 -0
  90. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/docs_to_knowledge_graph/markdown_files/1706.03762v7.md +0 -0
  91. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/docs_to_knowledge_graph/markdown_files/1810.04805v2.md +0 -0
  92. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/docs_to_knowledge_graph/markdown_files/rfc8259.md +0 -0
  93. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/fastapi_server_docker/.dockerignore +0 -0
  94. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/fastapi_server_docker/.env +0 -0
  95. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/fastapi_server_docker/README.md +0 -0
  96. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/fastapi_server_docker/compose.yaml +0 -0
  97. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/fastapi_server_docker/dockerfile +0 -0
  98. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/fastapi_server_docker/main.py +0 -0
  99. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/fastapi_server_docker/sample_code/main.py +0 -0
  100. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/fastapi_server_docker/src/cocoindex_funs.py +0 -0
  101. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/gdrive_text_embedding/.env.example +0 -0
  102. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/gdrive_text_embedding/.gitignore +0 -0
  103. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/gdrive_text_embedding/README.md +0 -0
  104. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/gdrive_text_embedding/data/1706.03762v7.docx +0 -0
  105. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/gdrive_text_embedding/data/1810.04805v2.docx +0 -0
  106. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/.env +0 -0
  107. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/README.md +0 -0
  108. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/frontend/.gitignore +0 -0
  109. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/frontend/index.html +0 -0
  110. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/frontend/package-lock.json +0 -0
  111. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/frontend/package.json +0 -0
  112. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/frontend/src/App.jsx +0 -0
  113. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/frontend/src/main.jsx +0 -0
  114. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/frontend/src/style.css +0 -0
  115. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/frontend/vite.config.js +0 -0
  116. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/img/cat1.jpeg +0 -0
  117. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/img/dog1.jpeg +0 -0
  118. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/img/elephant1.jpg +0 -0
  119. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/img/giraffe.jpg +0 -0
  120. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/image_search_example/main.py +0 -0
  121. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/manuals_llm_extraction/.env +0 -0
  122. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/manuals_llm_extraction/README.md +0 -0
  123. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/manuals_llm_extraction/main.py +0 -0
  124. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/manuals_llm_extraction/manuals/array.pdf +0 -0
  125. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/manuals_llm_extraction/manuals/base64.pdf +0 -0
  126. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/manuals_llm_extraction/manuals/copy.pdf +0 -0
  127. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/manuals_llm_extraction/manuals/glob.pdf +0 -0
  128. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/pdf_embedding/.env +0 -0
  129. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/pdf_embedding/README.md +0 -0
  130. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/pdf_embedding/main.py +0 -0
  131. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/pdf_embedding/pdf_files/1706.03762v7.pdf +0 -0
  132. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/pdf_embedding/pdf_files/1810.04805v2.pdf +0 -0
  133. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/pdf_embedding/pdf_files/rfc8259.pdf +0 -0
  134. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/.env +0 -0
  135. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/README.md +0 -0
  136. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/img/cocoinsight.png +0 -0
  137. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/img/neo4j.png +0 -0
  138. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/main.py +0 -0
  139. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/products/p1.json +0 -0
  140. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/products/p2.json +0 -0
  141. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/products/p3.json +0 -0
  142. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/products/p4.json +0 -0
  143. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/products/p5.json +0 -0
  144. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/products/p6.json +0 -0
  145. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/products/p7.json +0 -0
  146. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/products/p8.json +0 -0
  147. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/product_taxonomy_knowledge_graph/products/p9.json +0 -0
  148. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/text_embedding/.env +0 -0
  149. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/text_embedding/README.md +0 -0
  150. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/text_embedding/Text_Embedding.ipynb +0 -0
  151. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/text_embedding/main.py +0 -0
  152. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/text_embedding/markdown_files/1706.03762v7.md +0 -0
  153. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/text_embedding/markdown_files/1810.04805v2.md +0 -0
  154. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/text_embedding/markdown_files/rfc8259.md +0 -0
  155. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/text_embedding_qdrant/.env +0 -0
  156. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/text_embedding_qdrant/README.md +0 -0
  157. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/text_embedding_qdrant/main.py +0 -0
  158. {cocoindex-0.1.34 → cocoindex-0.1.36}/examples/text_embedding_qdrant/markdown_files/rfc8259.md +0 -0
  159. {cocoindex-0.1.34 → cocoindex-0.1.36}/pyproject.toml +0 -0
  160. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/auth_registry.py +0 -0
  161. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/convert.py +0 -0
  162. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/functions.py +0 -0
  163. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/index.py +0 -0
  164. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/lib.py +0 -0
  165. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/llm.py +0 -0
  166. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/op.py +0 -0
  167. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/py.typed +0 -0
  168. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/query.py +0 -0
  169. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/runtime.py +0 -0
  170. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/setting.py +0 -0
  171. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/setup.py +0 -0
  172. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/sources.py +0 -0
  173. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/storages.py +0 -0
  174. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/tests/__init__.py +0 -0
  175. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/tests/test_convert.py +0 -0
  176. {cocoindex-0.1.34 → cocoindex-0.1.36}/python/cocoindex/typing.py +0 -0
  177. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/base/field_attrs.rs +0 -0
  178. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/base/json_schema.rs +0 -0
  179. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/base/mod.rs +0 -0
  180. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/base/schema.rs +0 -0
  181. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/base/spec.rs +0 -0
  182. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/base/value.rs +0 -0
  183. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/builder/analyzed_flow.rs +0 -0
  184. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/builder/analyzer.rs +0 -0
  185. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/builder/flow_builder.rs +0 -0
  186. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/builder/mod.rs +0 -0
  187. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/builder/plan.rs +0 -0
  188. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/execution/db_tracking_setup.rs +0 -0
  189. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/execution/live_updater.rs +0 -0
  190. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/execution/memoization.rs +0 -0
  191. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/execution/query.rs +0 -0
  192. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/execution/stats.rs +0 -0
  193. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/lib.rs +0 -0
  194. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/lib_context.rs +0 -0
  195. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/llm/anthropic.rs +0 -0
  196. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/llm/gemini.rs +0 -0
  197. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/llm/mod.rs +0 -0
  198. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/llm/ollama.rs +0 -0
  199. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/llm/openai.rs +0 -0
  200. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/factory_bases.rs +0 -0
  201. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/functions/extract_by_llm.rs +0 -0
  202. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/functions/mod.rs +0 -0
  203. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/functions/parse_json.rs +0 -0
  204. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/functions/split_recursively.rs +0 -0
  205. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/mod.rs +0 -0
  206. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/py_factory.rs +0 -0
  207. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/registration.rs +0 -0
  208. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/registry.rs +0 -0
  209. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/sdk.rs +0 -0
  210. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/sources/mod.rs +0 -0
  211. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/storages/mod.rs +0 -0
  212. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/storages/neo4j.rs +0 -0
  213. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/storages/postgres.rs +0 -0
  214. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/storages/qdrant.rs +0 -0
  215. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/ops/storages/spec.rs +0 -0
  216. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/prelude.rs +0 -0
  217. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/py/convert.rs +0 -0
  218. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/py/mod.rs +0 -0
  219. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/service/mod.rs +0 -0
  220. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/service/search.rs +0 -0
  221. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/settings.rs +0 -0
  222. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/setup/components.rs +0 -0
  223. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/setup/db_metadata.rs +0 -0
  224. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/setup/driver.rs +0 -0
  225. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/setup/mod.rs +0 -0
  226. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/setup/states.rs +0 -0
  227. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/utils/db.rs +0 -0
  228. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/utils/fingerprint.rs +0 -0
  229. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/utils/immutable.rs +0 -0
  230. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/utils/mod.rs +0 -0
  231. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/utils/retriable.rs +0 -0
  232. {cocoindex-0.1.34 → cocoindex-0.1.36}/src/utils/yaml_ser.rs +0 -0
@@ -533,7 +533,7 @@ dependencies = [
533
533
 
534
534
  [[package]]
535
535
  name = "cocoindex"
536
- version = "0.1.34"
536
+ version = "0.1.36"
537
537
  dependencies = [
538
538
  "anyhow",
539
539
  "async-openai",
@@ -2,7 +2,7 @@
2
2
  name = "cocoindex"
3
3
  # Version used for local development is always higher than others to take precedence.
4
4
  # Will be overridden for specific release versions.
5
- version = "0.1.34"
5
+ version = "0.1.36"
6
6
  edition = "2021"
7
7
 
8
8
  [profile.release]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cocoindex
3
- Version: 0.1.34
3
+ Version: 0.1.36
4
4
  Requires-Dist: sentence-transformers>=3.3.1
5
5
  Requires-Dist: click>=8.1.8
6
6
  Requires-Dist: rich>=14.0.0
@@ -11,7 +11,7 @@ CocoIndex is an ETL framework for building indexes from specified data sources,
11
11
 
12
12
  ## Indexing flow
13
13
 
14
- An indexing flow extracts data from speicfied data sources, upon specified transformations, and puts the transformed data into specified storage for later retrieval.
14
+ An indexing flow extracts data from specified data sources, upon specified transformations, and puts the transformed data into specified storage for later retrieval.
15
15
 
16
16
  An indexing flow has two aspects: data and operations on data.
17
17
 
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  title: Flow Running
3
+ toc_max_heading_level: 4
3
4
  description: Run a CocoIndex Flow, including build / update data in the target storage and evaluate the flow without changing the target storage.
4
5
  ---
5
6
 
@@ -70,8 +71,7 @@ This is to achieve best efficiency.
70
71
 
71
72
  ### One time update
72
73
 
73
- <Tabs queryString="code_lang">
74
- <TabItem value="shell" label="Shell" default>
74
+ #### CLI
75
75
 
76
76
  The `cocoindex update` subcommand creates/updates data in the target storage.
77
77
 
@@ -81,7 +81,9 @@ Once it's done, the target data is fresh up to the moment when the function is c
81
81
  python main.py cocoindex update
82
82
  ```
83
83
 
84
- </TabItem>
84
+ #### Library API
85
+
86
+ <Tabs>
85
87
  <TabItem value="python" label="Python">
86
88
 
87
89
  The `update()` async method creates/updates data in the target storage.
@@ -108,8 +110,7 @@ A data source may enable one or multiple *change capture mechanisms*:
108
110
 
109
111
  Change capture mechanisms enable CocoIndex to continuously capture changes from the source data and update the target data accordingly, under live update mode.
110
112
 
111
- <Tabs queryString="code_lang">
112
- <TabItem value="shell" label="Shell" default>
113
+ #### CLI
113
114
 
114
115
  To perform live update, run the `cocoindex update` subcommand with `-L` option:
115
116
 
@@ -120,7 +121,9 @@ python main.py cocoindex update -L
120
121
  If there's at least one data source with change capture mechanism enabled, it will keep running until the aborted (e.g. by `Ctrl-C`).
121
122
  Otherwise, it falls back to the same behavior as one time update, and will finish after a one-time update is done.
122
123
 
123
- </TabItem>
124
+ #### Library API
125
+
126
+ <Tabs>
124
127
  <TabItem value="python" label="Python">
125
128
 
126
129
  To perform live update, you need to create a `cocoindex.FlowLiveUpdater` object using the `cocoindex.Flow` object.
@@ -145,8 +148,10 @@ my_updater = cocoindex.FlowLiveUpdater(
145
148
 
146
149
  A `FlowLiveUpdater` object supports the following methods:
147
150
 
151
+ * `start()`: Start the updater.
152
+ CocoIndex will continuously capture changes from the source data and update the target data accordingly in background threads managed by the engine.
148
153
  * `abort()`: Abort the updater.
149
- * `wait()` (async): Wait for the updater to finish. It only unblocks in one of the following cases:
154
+ * `wait()`: Wait for the updater to finish. It only unblocks in one of the following cases:
150
155
  * The updater was aborted.
151
156
  * A one time update is done, and live update is not enabled:
152
157
  either `live_mode` is `False`, or all data sources have no change capture mechanisms enabled.
@@ -154,6 +159,8 @@ A `FlowLiveUpdater` object supports the following methods:
154
159
 
155
160
  ```python
156
161
  my_updater = cocoindex.FlowLiveUpdater(demo_flow)
162
+ # Start the updater.
163
+ my_updater.start()
157
164
 
158
165
  # Perform your own logic (e.g. a query loop).
159
166
  ...
@@ -163,26 +170,47 @@ print(my_updater.update_stats())
163
170
  # Abort the updater.
164
171
  my_updater.abort()
165
172
  # Wait for the updater to finish.
166
- await my_updater.wait()
173
+ my_updater.wait()
167
174
  ```
168
175
 
169
176
  Python SDK also allows you to use the updater as a context manager.
170
- It will abort and wait for the updater to finish automatically when the context is exited.
171
- The following code is equivalent to the code above:
177
+ It will automatically start the updater during the context entry, and abort and wait for the updater to finish automatically when the context is exited.
178
+ The following code is equivalent to the code above (if no early return happens):
172
179
 
173
180
  ```python
174
- async with cocoindex.FlowLiveUpdater(demo_flow) as my_updater:
181
+ with cocoindex.FlowLiveUpdater(demo_flow) as my_updater:
175
182
  # Perform your own logic (e.g. a query loop).
176
183
  ...
177
184
  print(my_updater.update_stats())
178
185
  ```
179
186
 
180
- Within a synchronous function, remove `async` before `with`, like this:
187
+ CocoIndex also provides asynchronous versions of APIs for blocking operations, including:
181
188
 
182
- ```python
183
- with cocoindex.FlowLiveUpdater(demo_flow) as my_updater:
189
+ * `start_async()` and `wait_async()`, e.g.
190
+
191
+ ```python
192
+ my_updater = cocoindex.FlowLiveUpdater(demo_flow)
193
+ # Start the updater.
194
+ await my_updater.start_async()
195
+
196
+ # Perform your own logic (e.g. a query loop).
184
197
  ...
185
- ```
198
+
199
+ # Print the update stats.
200
+ print(my_updater.update_stats())
201
+ # Abort the updater.
202
+ my_updater.abort()
203
+ # Wait for the updater to finish.
204
+ await my_updater.wait_async()
205
+ ```
206
+ * Async context manager, e.g.
207
+
208
+ ```python
209
+ async with cocoindex.FlowLiveUpdater(demo_flow) as my_updater:
210
+ # Perform your own logic (e.g. a query loop).
211
+ ...
212
+ print(my_updater.update_stats())
213
+ ```
186
214
 
187
215
  </TabItem>
188
216
  </Tabs>
@@ -191,8 +219,7 @@ with cocoindex.FlowLiveUpdater(demo_flow) as my_updater:
191
219
 
192
220
  CocoIndex allows you to run the transformations defined by the flow without updating the target storage.
193
221
 
194
- <Tabs queryString="code_lang">
195
- <TabItem value="shell" label="Shell" default>
222
+ ### CLI
196
223
 
197
224
  The `cocoindex evaluate` subcommand runs the transformation and dumps flow outputs.
198
225
  It takes the following options:
@@ -208,7 +235,9 @@ Example:
208
235
  python main.py cocoindex evaluate --output-dir ./eval_output
209
236
  ```
210
237
 
211
- </TabItem>
238
+ ### Library API
239
+
240
+ <Tabs>
212
241
  <TabItem value="python" label="Python">
213
242
 
214
243
  The `evaluate_and_dump()` method runs the transformation and dumps flow outputs to files.
@@ -3,4 +3,4 @@ name = "code-embedding"
3
3
  version = "0.1.0"
4
4
  description = "Simple example for cocoindex: build embedding index based on source code."
5
5
  requires-python = ">=3.10"
6
- dependencies = ["cocoindex>=0.1.32", "python-dotenv>=1.0.1"]
6
+ dependencies = ["cocoindex>=0.1.35", "python-dotenv>=1.0.1"]
@@ -3,4 +3,4 @@ name = "manuals-to-kg"
3
3
  version = "0.1.0"
4
4
  description = "Simple example for cocoindex: extract triples from files and build knowledge graph."
5
5
  requires-python = ">=3.10"
6
- dependencies = ["cocoindex>=0.1.32", "python-dotenv>=1.0.1"]
6
+ dependencies = ["cocoindex>=0.1.35", "python-dotenv>=1.0.1"]
@@ -1,4 +1,4 @@
1
- cocoindex>=0.1.26
1
+ cocoindex>=0.1.35
2
2
  python-dotenv>=1.0.1
3
3
  fastapi==0.115.12
4
4
  fastapi-cli==0.0.7
@@ -53,9 +53,9 @@ query_handler = cocoindex.query.SimpleSemanticsQueryHandler(
53
53
  default_similarity_metric=cocoindex.VectorSimilarityMetric.COSINE_SIMILARITY)
54
54
 
55
55
  @cocoindex.main_fn()
56
- async def _run():
56
+ def _run():
57
57
  # Use a `FlowLiveUpdater` to keep the flow data updated.
58
- async with cocoindex.FlowLiveUpdater(gdrive_text_embedding_flow):
58
+ with cocoindex.FlowLiveUpdater(gdrive_text_embedding_flow):
59
59
  # Run queries in a loop to demonstrate the query capabilities.
60
60
  while True:
61
61
  try:
@@ -74,4 +74,4 @@ async def _run():
74
74
 
75
75
  if __name__ == "__main__":
76
76
  load_dotenv(override=True)
77
- asyncio.run(_run())
77
+ _run()
@@ -3,4 +3,4 @@ name = "gdrive-text-embedding"
3
3
  version = "0.1.0"
4
4
  description = "Simple example for cocoindex: build embedding index based on Google Drive files."
5
5
  requires-python = ">=3.11"
6
- dependencies = ["cocoindex>=0.1.32", "python-dotenv>=1.0.1"]
6
+ dependencies = ["cocoindex>=0.1.35", "python-dotenv>=1.0.1"]
@@ -1,4 +1,4 @@
1
- cocoindex>=0.1.30
1
+ cocoindex>=0.1.35
2
2
  python-dotenv>=1.0.1
3
3
  requests>=2.31.0
4
4
  uvicorn>=0.29.0
@@ -4,7 +4,7 @@ version = "0.1.0"
4
4
  description = "Simple example for cocoindex: extract structured information from a Markdown file using LLM."
5
5
  requires-python = ">=3.10"
6
6
  dependencies = [
7
- "cocoindex>=0.1.32",
7
+ "cocoindex>=0.1.35",
8
8
  "python-dotenv>=1.0.1",
9
9
  "marker-pdf>=1.5.2",
10
10
  ]
@@ -4,7 +4,7 @@ version = "0.1.0"
4
4
  description = "Simple example for cocoindex: build embedding index based on local PDF files."
5
5
  requires-python = ">=3.10"
6
6
  dependencies = [
7
- "cocoindex>=0.1.32",
7
+ "cocoindex>=0.1.35",
8
8
  "python-dotenv>=1.0.1",
9
9
  "marker-pdf>=1.5.2",
10
10
  ]
@@ -3,4 +3,4 @@ name = "cocoindex-ecommerce-taxonomy"
3
3
  version = "0.1.0"
4
4
  description = "Simple example for CocoIndex: extract taxonomy from e-commerce products and build knowledge graph."
5
5
  requires-python = ">=3.10"
6
- dependencies = ["cocoindex>=0.1.30", "python-dotenv>=1.0.1", "jinja2>=3.1.6"]
6
+ dependencies = ["cocoindex>=0.1.35", "python-dotenv>=1.0.1", "jinja2>=3.1.6"]
@@ -3,4 +3,4 @@ name = "text-embedding"
3
3
  version = "0.1.0"
4
4
  description = "Simple example for cocoindex: build embedding index based on local text files."
5
5
  requires-python = ">=3.10"
6
- dependencies = ["cocoindex>=0.1.32", "python-dotenv>=1.0.1"]
6
+ dependencies = ["cocoindex>=0.1.35", "python-dotenv>=1.0.1"]
@@ -3,4 +3,4 @@ name = "text-embedding-qdrant"
3
3
  version = "0.1.0"
4
4
  description = "Simple example for cocoindex: build embedding index based on local text files."
5
5
  requires-python = ">=3.10"
6
- dependencies = ["cocoindex>=0.1.32", "python-dotenv>=1.0.1"]
6
+ dependencies = ["cocoindex>=0.1.35", "python-dotenv>=1.0.1"]
@@ -4,7 +4,7 @@ Cocoindex is a framework for building and running indexing pipelines.
4
4
  from . import functions, query, sources, storages, cli
5
5
  from .flow import FlowBuilder, DataScope, DataSlice, Flow, flow_def
6
6
  from .flow import EvaluateAndDumpOptions, GeneratedField
7
- from .flow import update_all_flows, FlowLiveUpdater, FlowLiveUpdaterOptions
7
+ from .flow import update_all_flows_async, FlowLiveUpdater, FlowLiveUpdaterOptions
8
8
  from .llm import LlmSpec, LlmApiType
9
9
  from .index import VectorSimilarityMetric, VectorIndexDef, IndexOptions
10
10
  from .auth_registry import AuthEntryReference, add_auth_entry, ref_auth_entry
@@ -1,4 +1,3 @@
1
- import asyncio
2
1
  import click
3
2
  import datetime
4
3
 
@@ -7,7 +6,6 @@ from rich.table import Table
7
6
 
8
7
  from . import flow, lib, setting
9
8
  from .setup import sync_setup, drop_setup, flow_names_with_setup, apply_setup_changes
10
- from .runtime import execution_context
11
9
 
12
10
  @click.group()
13
11
  def cli():
@@ -136,13 +134,12 @@ def update(flow_name: str | None, live: bool, quiet: bool):
136
134
  Update the index to reflect the latest data from data sources.
137
135
  """
138
136
  options = flow.FlowLiveUpdaterOptions(live_mode=live, print_stats=not quiet)
139
- async def _update():
140
- if flow_name is None:
141
- await flow.update_all_flows(options)
142
- else:
143
- updater = await flow.FlowLiveUpdater.create(_flow_by_name(flow_name), options)
144
- await updater.wait()
145
- execution_context.run(_update())
137
+ if flow_name is None:
138
+ return flow.update_all_flows(options)
139
+ else:
140
+ with flow.FlowLiveUpdater(_flow_by_name(flow_name), options) as updater:
141
+ updater.wait()
142
+ return updater.update_stats()
146
143
 
147
144
  @cli.command()
148
145
  @click.argument("flow_name", type=str, required=False)
@@ -217,7 +214,7 @@ def server(address: str | None, live_update: bool, quiet: bool, cors_origin: str
217
214
 
218
215
  if live_update:
219
216
  options = flow.FlowLiveUpdaterOptions(live_mode=True, print_stats=not quiet)
220
- execution_context.run(flow.update_all_flows(options))
217
+ flow.update_all_flows(options)
221
218
  if COCOINDEX_HOST in cors_origins:
222
219
  click.echo(f"Open CocoInsight at: {COCOINDEX_HOST}/cocoinsight")
223
220
  input("Press Enter to stop...")
@@ -8,7 +8,6 @@ import asyncio
8
8
  import re
9
9
  import inspect
10
10
  import datetime
11
- import json
12
11
 
13
12
  from typing import Any, Callable, Sequence, TypeVar
14
13
  from threading import Lock
@@ -384,56 +383,71 @@ class FlowLiveUpdater:
384
383
  """
385
384
  A live updater for a flow.
386
385
  """
387
- _engine_live_updater: _engine.FlowLiveUpdater
386
+ _flow: Flow
387
+ _options: FlowLiveUpdaterOptions
388
+ _engine_live_updater: _engine.FlowLiveUpdater | None = None
388
389
 
389
- def __init__(self, arg: Flow | _engine.FlowLiveUpdater, options: FlowLiveUpdaterOptions | None = None):
390
- if isinstance(arg, _engine.FlowLiveUpdater):
391
- self._engine_live_updater = arg
392
- else:
393
- self._engine_live_updater = execution_context.run(_engine.FlowLiveUpdater(
394
- arg.internal_flow(), dump_engine_object(options or FlowLiveUpdaterOptions())))
395
-
396
- @staticmethod
397
- async def create(fl: Flow, options: FlowLiveUpdaterOptions | None = None) -> FlowLiveUpdater:
398
- """
399
- Create a live updater for a flow.
400
- """
401
- engine_live_updater = await _engine.FlowLiveUpdater.create(
402
- await fl.ainternal_flow(),
403
- dump_engine_object(options or FlowLiveUpdaterOptions()))
404
- return FlowLiveUpdater(engine_live_updater)
390
+ def __init__(self, fl: Flow, options: FlowLiveUpdaterOptions | None = None):
391
+ self._flow = fl
392
+ self._options = options or FlowLiveUpdaterOptions()
405
393
 
406
394
  def __enter__(self) -> FlowLiveUpdater:
395
+ self.start()
407
396
  return self
408
397
 
409
398
  def __exit__(self, exc_type, exc_value, traceback):
410
399
  self.abort()
411
- execution_context.run(self.wait())
400
+ self.wait()
412
401
 
413
402
  async def __aenter__(self) -> FlowLiveUpdater:
403
+ await self.start_async()
414
404
  return self
415
405
 
416
406
  async def __aexit__(self, exc_type, exc_value, traceback):
417
407
  self.abort()
418
- await self.wait()
408
+ await self.wait_async()
409
+
410
+ def start(self) -> None:
411
+ """
412
+ Start the live updater.
413
+ """
414
+ execution_context.run(self.start_async())
415
+
416
+ async def start_async(self) -> None:
417
+ """
418
+ Start the live updater.
419
+ """
420
+ self._engine_live_updater = await _engine.FlowLiveUpdater.create(
421
+ await self._flow.internal_flow_async(), dump_engine_object(self._options))
419
422
 
420
- async def wait(self) -> None:
423
+ def wait(self) -> None:
421
424
  """
422
425
  Wait for the live updater to finish.
423
426
  """
424
- await self._engine_live_updater.wait()
427
+ execution_context.run(self.wait_async())
428
+
429
+ async def wait_async(self) -> None:
430
+ """
431
+ Wait for the live updater to finish. Async version.
432
+ """
433
+ await self._get_engine_live_updater().wait()
425
434
 
426
435
  def abort(self) -> None:
427
436
  """
428
437
  Abort the live updater.
429
438
  """
430
- self._engine_live_updater.abort()
439
+ self._get_engine_live_updater().abort()
431
440
 
432
441
  def update_stats(self) -> _engine.IndexUpdateInfo:
433
442
  """
434
443
  Get the index update info.
435
444
  """
436
- return self._engine_live_updater.index_update_info()
445
+ return self._get_engine_live_updater().index_update_info()
446
+
447
+ def _get_engine_live_updater(self) -> _engine.FlowLiveUpdater:
448
+ if self._engine_live_updater is None:
449
+ raise RuntimeError("Live updater is not started")
450
+ return self._engine_live_updater
437
451
 
438
452
 
439
453
  @dataclass
@@ -500,13 +514,20 @@ class Flow:
500
514
  """
501
515
  return self._lazy_engine_flow().name()
502
516
 
503
- async def update(self) -> _engine.IndexUpdateInfo:
517
+ def update(self) -> _engine.IndexUpdateInfo:
518
+ """
519
+ Update the index defined by the flow.
520
+ Once the function returns, the index is fresh up to the moment when the function is called.
521
+ """
522
+ return execution_context.run(self.update_async())
523
+
524
+ async def update_async(self) -> _engine.IndexUpdateInfo:
504
525
  """
505
526
  Update the index defined by the flow.
506
- Once the function returns, the indice is fresh up to the moment when the function is called.
527
+ Once the function returns, the index is fresh up to the moment when the function is called.
507
528
  """
508
- updater = await FlowLiveUpdater.create(self, FlowLiveUpdaterOptions(live_mode=False))
509
- await updater.wait()
529
+ updater = await FlowLiveUpdater.create_async(self, FlowLiveUpdaterOptions(live_mode=False))
530
+ await updater.wait_async()
510
531
  return updater.update_stats()
511
532
 
512
533
  def evaluate_and_dump(self, options: EvaluateAndDumpOptions):
@@ -521,7 +542,7 @@ class Flow:
521
542
  """
522
543
  return self._lazy_engine_flow()
523
544
 
524
- async def ainternal_flow(self) -> _engine.Flow:
545
+ async def internal_flow_async(self) -> _engine.Flow:
525
546
  """
526
547
  Get the engine flow. The async version.
527
548
  """
@@ -587,22 +608,28 @@ def ensure_all_flows_built() -> None:
587
608
  for fl in flows():
588
609
  fl.internal_flow()
589
610
 
590
- async def aensure_all_flows_built() -> None:
611
+ async def ensure_all_flows_built_async() -> None:
591
612
  """
592
613
  Ensure all flows are built.
593
614
  """
594
615
  for fl in flows():
595
- await fl.ainternal_flow()
616
+ await fl.internal_flow_async()
596
617
 
597
- async def update_all_flows(options: FlowLiveUpdaterOptions) -> dict[str, _engine.IndexUpdateInfo]:
618
+ def update_all_flows(options: FlowLiveUpdaterOptions) -> dict[str, _engine.IndexUpdateInfo]:
598
619
  """
599
620
  Update all flows.
600
621
  """
601
- await aensure_all_flows_built()
622
+ return execution_context.run(update_all_flows_async(options))
623
+
624
+ async def update_all_flows_async(options: FlowLiveUpdaterOptions) -> dict[str, _engine.IndexUpdateInfo]:
625
+ """
626
+ Update all flows.
627
+ """
628
+ await ensure_all_flows_built_async()
602
629
  async def _update_flow(fl: Flow) -> _engine.IndexUpdateInfo:
603
- updater = await FlowLiveUpdater.create(fl, options)
604
- await updater.wait()
605
- return updater.update_stats()
630
+ async with FlowLiveUpdater(fl, options) as updater:
631
+ await updater.wait_async()
632
+ return updater.update_stats()
606
633
  fls = flows()
607
634
  all_stats = await asyncio.gather(*(_update_flow(fl) for fl in fls))
608
635
  return {fl.name: stats for fl, stats in zip(fls, all_stats)}
@@ -211,3 +211,28 @@ impl ListTrackedSourceKeyMetadataState {
211
211
  sqlx::query_as(&self.query_str).bind(source_id).fetch(pool)
212
212
  }
213
213
  }
214
+
215
+ #[derive(sqlx::FromRow, Debug)]
216
+ pub struct SourceLastProcessedInfo {
217
+ pub processed_source_ordinal: Option<i64>,
218
+ pub process_logic_fingerprint: Option<Vec<u8>>,
219
+ pub process_time_micros: Option<i64>,
220
+ }
221
+
222
+ pub async fn read_source_last_processed_info(
223
+ source_id: i32,
224
+ source_key_json: &serde_json::Value,
225
+ db_setup: &TrackingTableSetupState,
226
+ pool: &PgPool,
227
+ ) -> Result<Option<SourceLastProcessedInfo>> {
228
+ let query_str = format!(
229
+ "SELECT processed_source_ordinal, process_logic_fingerprint, process_time_micros FROM {} WHERE source_id = $1 AND source_key = $2",
230
+ db_setup.table_name
231
+ );
232
+ let last_processed_info = sqlx::query_as(&query_str)
233
+ .bind(source_id)
234
+ .bind(source_key_json)
235
+ .fetch_optional(pool)
236
+ .await?;
237
+ Ok(last_processed_info)
238
+ }
@@ -11,6 +11,7 @@ use std::collections::BTreeMap;
11
11
  use std::path::{Path, PathBuf};
12
12
  use yaml_rust2::YamlEmitter;
13
13
 
14
+ use super::evaluator::SourceRowEvaluationContext;
14
15
  use super::memoization::EvaluationMemoryOptions;
15
16
  use super::row_indexer;
16
17
  use crate::base::{schema, value};
@@ -77,10 +78,12 @@ impl<'a> Dumper<'a> {
77
78
  'a: 'b,
78
79
  {
79
80
  let data_builder = row_indexer::evaluate_source_entry_with_memory(
80
- self.plan,
81
- import_op,
82
- self.schema,
83
- key,
81
+ &SourceRowEvaluationContext {
82
+ plan: self.plan,
83
+ import_op,
84
+ schema: self.schema,
85
+ key,
86
+ },
84
87
  EvaluationMemoryOptions {
85
88
  enable_cache: self.options.use_cache,
86
89
  evaluation_only: true,
@@ -167,7 +170,7 @@ impl<'a> Dumper<'a> {
167
170
  async fn evaluate_and_dump_for_source(&self, import_op: &AnalyzedImportOp) -> Result<()> {
168
171
  let mut keys_by_filename_prefix: IndexMap<String, Vec<value::KeyValue>> = IndexMap::new();
169
172
 
170
- let mut rows_stream = import_op.executor.list(SourceExecutorListOptions {
173
+ let mut rows_stream = import_op.executor.list(&SourceExecutorListOptions {
171
174
  include_ordinal: false,
172
175
  });
173
176
  while let Some(rows) = rows_stream.next().await {
@@ -446,6 +446,13 @@ async fn evaluate_op_scope(
446
446
  Ok(())
447
447
  }
448
448
 
449
+ pub struct SourceRowEvaluationContext<'a> {
450
+ pub plan: &'a ExecutionPlan,
451
+ pub import_op: &'a AnalyzedImportOp,
452
+ pub schema: &'a schema::FlowSchema,
453
+ pub key: &'a value::KeyValue,
454
+ }
455
+
449
456
  #[derive(Debug)]
450
457
  pub struct EvaluateSourceEntryOutput {
451
458
  pub data_scope: ScopeValueBuilder,
@@ -453,23 +460,20 @@ pub struct EvaluateSourceEntryOutput {
453
460
  }
454
461
 
455
462
  pub async fn evaluate_source_entry(
456
- plan: &ExecutionPlan,
457
- import_op: &AnalyzedImportOp,
458
- schema: &schema::FlowSchema,
459
- key: &value::KeyValue,
463
+ src_eval_ctx: &SourceRowEvaluationContext<'_>,
460
464
  source_value: value::FieldValues,
461
465
  memory: &EvaluationMemory,
462
466
  ) -> Result<EvaluateSourceEntryOutput> {
463
- let root_schema = &schema.schema;
467
+ let root_schema = &src_eval_ctx.schema.schema;
464
468
  let root_scope_value = ScopeValueBuilder::new(root_schema.fields.len());
465
469
  let root_scope_entry = ScopeEntry::new(
466
470
  ScopeKey::None,
467
471
  &root_scope_value,
468
472
  root_schema,
469
- &plan.op_scope,
473
+ &src_eval_ctx.plan.op_scope,
470
474
  );
471
475
 
472
- let table_schema = match &root_schema.fields[import_op.output.field_idx as usize]
476
+ let table_schema = match &root_schema.fields[src_eval_ctx.import_op.output.field_idx as usize]
473
477
  .value_type
474
478
  .typ
475
479
  {
@@ -482,12 +486,12 @@ pub async fn evaluate_source_entry(
482
486
  let scope_value =
483
487
  ScopeValueBuilder::augmented_from(&value::ScopeValue(source_value), table_schema)?;
484
488
  root_scope_entry.define_field_w_builder(
485
- &import_op.output,
486
- value::Value::KTable(BTreeMap::from([(key.clone(), scope_value)])),
489
+ &src_eval_ctx.import_op.output,
490
+ value::Value::KTable(BTreeMap::from([(src_eval_ctx.key.clone(), scope_value)])),
487
491
  );
488
492
 
489
493
  evaluate_op_scope(
490
- &plan.op_scope,
494
+ &src_eval_ctx.plan.op_scope,
491
495
  RefList::Nil.prepend(&root_scope_entry),
492
496
  memory,
493
497
  )