rusty-haystack 0.5.3__tar.gz → 0.5.4__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 (158) hide show
  1. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/Cargo.lock +6 -5
  2. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/Cargo.toml +1 -1
  3. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/PKG-INFO +1 -1
  4. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-client/Cargo.toml +1 -1
  5. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-client/src/lib.rs +1 -1
  6. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/Cargo.toml +1 -0
  7. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/codecs/zinc/encoder.rs +23 -24
  8. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/graph/adjacency.rs +15 -0
  9. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/graph/entity_graph.rs +134 -93
  10. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/graph/query_planner.rs +38 -14
  11. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/graph/value_index.rs +16 -0
  12. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/Cargo.toml +2 -2
  13. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/benches/benchmarks.rs +1 -0
  14. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/benches/federation.rs +1 -0
  15. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/connector.rs +103 -66
  16. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/about.rs +2 -2
  17. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/read.rs +21 -31
  18. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/Cargo.toml +3 -3
  19. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/README.md +0 -0
  20. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-client/src/auth.rs +0 -0
  21. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-client/src/client.rs +0 -0
  22. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-client/src/error.rs +0 -0
  23. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-client/src/tls.rs +0 -0
  24. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-client/src/transport/http.rs +0 -0
  25. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-client/src/transport/mod.rs +0 -0
  26. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-client/src/transport/ws.rs +0 -0
  27. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/benches/benchmarks.rs +0 -0
  28. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/defs.trio +0 -0
  29. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/tz_map.txt +0 -0
  30. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/units.txt +0 -0
  31. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/xeto/ph.attrs.xeto +0 -0
  32. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/xeto/ph.equips.xeto +0 -0
  33. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/xeto/ph.examples.xeto +0 -0
  34. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/xeto/ph.points.elec.xeto +0 -0
  35. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/xeto/ph.points.xeto +0 -0
  36. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/xeto/ph.protocols.xeto +0 -0
  37. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/xeto/ph.xeto +0 -0
  38. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/xeto/sys.api.xeto +0 -0
  39. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/xeto/sys.comp.xeto +0 -0
  40. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/xeto/sys.files.xeto +0 -0
  41. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/xeto/sys.template.xeto +0 -0
  42. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/data/xeto/sys.xeto +0 -0
  43. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/auth.rs +0 -0
  44. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/codecs/csv.rs +0 -0
  45. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/codecs/json/mod.rs +0 -0
  46. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/codecs/json/v3.rs +0 -0
  47. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/codecs/json/v4.rs +0 -0
  48. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/codecs/mod.rs +0 -0
  49. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/codecs/rdf.rs +0 -0
  50. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/codecs/shared.rs +0 -0
  51. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/codecs/trio/encoder.rs +0 -0
  52. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/codecs/trio/mod.rs +0 -0
  53. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/codecs/trio/parser.rs +0 -0
  54. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/codecs/zinc/mod.rs +0 -0
  55. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/codecs/zinc/parser.rs +0 -0
  56. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/data/dict.rs +0 -0
  57. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/data/grid.rs +0 -0
  58. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/data/list.rs +0 -0
  59. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/data/mod.rs +0 -0
  60. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/filter/ast.rs +0 -0
  61. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/filter/eval.rs +0 -0
  62. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/filter/mod.rs +0 -0
  63. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/filter/parser.rs +0 -0
  64. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/graph/bitmap.rs +0 -0
  65. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/graph/changelog.rs +0 -0
  66. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/graph/columnar.rs +0 -0
  67. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/graph/csr.rs +0 -0
  68. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/graph/mod.rs +0 -0
  69. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/graph/shared.rs +0 -0
  70. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/kinds/coord.rs +0 -0
  71. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/kinds/datetime.rs +0 -0
  72. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/kinds/kind.rs +0 -0
  73. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/kinds/mod.rs +0 -0
  74. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/kinds/number.rs +0 -0
  75. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/kinds/ref_.rs +0 -0
  76. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/kinds/singletons.rs +0 -0
  77. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/kinds/symbol.rs +0 -0
  78. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/kinds/tz.rs +0 -0
  79. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/kinds/units.rs +0 -0
  80. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/kinds/uri.rs +0 -0
  81. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/kinds/xstr.rs +0 -0
  82. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/lib.rs +0 -0
  83. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/ontology/conjunct.rs +0 -0
  84. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/ontology/def.rs +0 -0
  85. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/ontology/lib.rs +0 -0
  86. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/ontology/mod.rs +0 -0
  87. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/ontology/namespace.rs +0 -0
  88. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/ontology/taxonomy.rs +0 -0
  89. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/ontology/trio_loader.rs +0 -0
  90. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/ontology/validation.rs +0 -0
  91. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/xeto/ast.rs +0 -0
  92. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/xeto/bundled.rs +0 -0
  93. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/xeto/export.rs +0 -0
  94. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/xeto/fitting.rs +0 -0
  95. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/xeto/lexer.rs +0 -0
  96. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/xeto/loader.rs +0 -0
  97. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/xeto/mod.rs +0 -0
  98. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/xeto/parser.rs +0 -0
  99. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/xeto/resolver.rs +0 -0
  100. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/src/xeto/spec.rs +0 -0
  101. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/tests/e2e.rs +0 -0
  102. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/tests/graph_integration.rs +0 -0
  103. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-core/tests/ontology_integration.rs +0 -0
  104. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/actions.rs +0 -0
  105. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/app.rs +0 -0
  106. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/auth/mod.rs +0 -0
  107. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/auth/users.rs +0 -0
  108. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/content.rs +0 -0
  109. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/demo.rs +0 -0
  110. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/error.rs +0 -0
  111. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/federation.rs +0 -0
  112. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/his_store.rs +0 -0
  113. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/lib.rs +0 -0
  114. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/changes.rs +0 -0
  115. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/data.rs +0 -0
  116. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/defs.rs +0 -0
  117. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/federation.rs +0 -0
  118. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/formats.rs +0 -0
  119. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/graph.rs +0 -0
  120. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/his.rs +0 -0
  121. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/invoke.rs +0 -0
  122. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/libs.rs +0 -0
  123. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/mod.rs +0 -0
  124. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/nav.rs +0 -0
  125. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/ops_handler.rs +0 -0
  126. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/point_write.rs +0 -0
  127. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/rdf.rs +0 -0
  128. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/system.rs +0 -0
  129. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ops/watch.rs +0 -0
  130. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/state.rs +0 -0
  131. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/src/ws.rs +0 -0
  132. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/haystack-server/tests/federation_integration.rs +0 -0
  133. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/pyproject.toml +0 -0
  134. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/README.md +0 -0
  135. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/rusty_haystack.pyi +0 -0
  136. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/src/auth.rs +0 -0
  137. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/src/client.rs +0 -0
  138. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/src/codecs.rs +0 -0
  139. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/src/convert.rs +0 -0
  140. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/src/data.rs +0 -0
  141. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/src/exceptions.rs +0 -0
  142. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/src/filter.rs +0 -0
  143. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/src/graph.rs +0 -0
  144. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/src/kinds.rs +0 -0
  145. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/src/lib.rs +0 -0
  146. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/src/ontology.rs +0 -0
  147. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/src/server.rs +0 -0
  148. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/tests/__init__.py +0 -0
  149. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/tests/conftest.py +0 -0
  150. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/tests/test_auth.py +0 -0
  151. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/tests/test_codecs.py +0 -0
  152. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/tests/test_data.py +0 -0
  153. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/tests/test_exceptions.py +0 -0
  154. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/tests/test_filter.py +0 -0
  155. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/tests/test_graph.py +0 -0
  156. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/tests/test_kinds.py +0 -0
  157. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/tests/test_ontology.py +0 -0
  158. {rusty_haystack-0.5.3 → rusty_haystack-0.5.4}/rusty-haystack/tests/test_server.py +0 -0
@@ -2077,7 +2077,7 @@ dependencies = [
2077
2077
 
2078
2078
  [[package]]
2079
2079
  name = "rusty-haystack"
2080
- version = "0.5.3"
2080
+ version = "0.5.4"
2081
2081
  dependencies = [
2082
2082
  "chrono",
2083
2083
  "pyo3",
@@ -2089,7 +2089,7 @@ dependencies = [
2089
2089
 
2090
2090
  [[package]]
2091
2091
  name = "rusty-haystack-cli"
2092
- version = "0.5.3"
2092
+ version = "0.5.4"
2093
2093
  dependencies = [
2094
2094
  "clap",
2095
2095
  "env_logger",
@@ -2103,7 +2103,7 @@ dependencies = [
2103
2103
 
2104
2104
  [[package]]
2105
2105
  name = "rusty-haystack-client"
2106
- version = "0.5.3"
2106
+ version = "0.5.4"
2107
2107
  dependencies = [
2108
2108
  "base64",
2109
2109
  "dashmap",
@@ -2125,13 +2125,14 @@ dependencies = [
2125
2125
 
2126
2126
  [[package]]
2127
2127
  name = "rusty-haystack-core"
2128
- version = "0.5.3"
2128
+ version = "0.5.4"
2129
2129
  dependencies = [
2130
2130
  "base64",
2131
2131
  "chrono",
2132
2132
  "criterion",
2133
2133
  "dashmap",
2134
2134
  "hmac",
2135
+ "indexmap",
2135
2136
  "parking_lot",
2136
2137
  "pbkdf2",
2137
2138
  "proptest",
@@ -2151,7 +2152,7 @@ dependencies = [
2151
2152
 
2152
2153
  [[package]]
2153
2154
  name = "rusty-haystack-server"
2154
- version = "0.5.3"
2155
+ version = "0.5.4"
2155
2156
  dependencies = [
2156
2157
  "actix-http",
2157
2158
  "actix-rt",
@@ -3,7 +3,7 @@ resolver = "2"
3
3
  members = ["haystack-core", "rusty-haystack", "haystack-server", "haystack-client"]
4
4
 
5
5
  [workspace.package]
6
- version = "0.5.3"
6
+ version = "0.5.4"
7
7
  edition = "2024"
8
8
  rust-version = "1.93"
9
9
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rusty-haystack
3
- Version: 0.5.3
3
+ Version: 0.5.4
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: 3.11
@@ -13,7 +13,7 @@ categories.workspace = true
13
13
  name = "haystack_client"
14
14
 
15
15
  [dependencies]
16
- haystack-core = { package = "rusty-haystack-core", version = "0.5.3", path = "../haystack-core" }
16
+ haystack-core = { package = "rusty-haystack-core", version = "0.5.4", path = "../haystack-core" }
17
17
  reqwest = { version = "0.13", features = ["rustls-no-provider"], default-features = false }
18
18
  rustls = { version = "0.23", features = ["ring", "tls12", "std"], default-features = false }
19
19
  tokio-tungstenite = { version = "0.28", features = ["rustls-tls-webpki-roots"] }
@@ -44,6 +44,6 @@ pub use error::ClientError;
44
44
  ///
45
45
  /// Called automatically by client constructors. Safe to call multiple times;
46
46
  /// only the first call has effect.
47
- fn ensure_crypto_provider() {
47
+ pub fn ensure_crypto_provider() {
48
48
  let _ = rustls::crypto::ring::default_provider().install_default();
49
49
  }
@@ -21,6 +21,7 @@ slotmap = "1.1"
21
21
  smallvec = { version = "1.15", features = ["serde"] }
22
22
  parking_lot = "0.12"
23
23
  rayon = "1.11"
24
+ indexmap = "2"
24
25
  dashmap = "6"
25
26
  tokio = { version = "1", features = ["rt-multi-thread", "macros", "time", "sync"] }
26
27
  sha2 = "0.10"
@@ -124,6 +124,8 @@ pub fn encode_meta(d: &HDict) -> Result<String, CodecError> {
124
124
 
125
125
  /// Encode an HGrid to the Zinc wire format.
126
126
  pub fn encode_grid(grid: &HGrid) -> Result<String, CodecError> {
127
+ use std::fmt::Write;
128
+
127
129
  let mut buf = String::new();
128
130
 
129
131
  // Line 1: version + grid meta
@@ -134,37 +136,34 @@ pub fn encode_grid(grid: &HGrid) -> Result<String, CodecError> {
134
136
  }
135
137
  buf.push('\n');
136
138
 
137
- // Line 2: columns
139
+ // Line 2: columns — write directly, comma-delimited.
138
140
  if grid.cols.is_empty() {
139
141
  buf.push_str("empty\n");
140
142
  } else {
141
- let col_parts: Result<Vec<String>, CodecError> = grid
142
- .cols
143
- .iter()
144
- .map(|col| {
145
- let mut s = col.name.clone();
146
- if !col.meta.is_empty() {
147
- s.push(' ');
148
- s.push_str(&encode_meta(&col.meta)?);
149
- }
150
- Ok(s)
151
- })
152
- .collect();
153
- buf.push_str(&col_parts?.join(","));
143
+ for (i, col) in grid.cols.iter().enumerate() {
144
+ if i > 0 {
145
+ buf.push(',');
146
+ }
147
+ buf.push_str(&col.name);
148
+ if !col.meta.is_empty() {
149
+ buf.push(' ');
150
+ buf.push_str(&encode_meta(&col.meta)?);
151
+ }
152
+ }
154
153
  buf.push('\n');
155
154
  }
156
155
 
157
- // Rows
156
+ // Rows — write cells directly, comma-delimited.
158
157
  for row in &grid.rows {
159
- let cells: Result<Vec<String>, CodecError> = grid
160
- .cols
161
- .iter()
162
- .map(|col| match row.get(&col.name) {
163
- Some(val) => encode_scalar(val),
164
- None => Ok("N".to_string()),
165
- })
166
- .collect();
167
- buf.push_str(&cells?.join(","));
158
+ for (i, col) in grid.cols.iter().enumerate() {
159
+ if i > 0 {
160
+ buf.push(',');
161
+ }
162
+ match row.get(&col.name) {
163
+ Some(val) => write!(buf, "{}", encode_scalar(val)?).unwrap(),
164
+ None => buf.push('N'),
165
+ }
166
+ }
168
167
  buf.push('\n');
169
168
  }
170
169
 
@@ -96,6 +96,21 @@ impl RefAdjacency {
96
96
  pub fn reverse_raw(&self) -> &HashMap<String, SmallVec<[(String, usize); 4]>> {
97
97
  &self.reverse
98
98
  }
99
+
100
+ /// Get entity IDs that reference `target_ref_val` via `ref_tag`.
101
+ ///
102
+ /// Used by the query planner to produce bitmap candidates for ref equality
103
+ /// filters (e.g. `siteRef == @site-0`) without a full entity scan.
104
+ pub fn sources_for(&self, ref_tag: &str, target_ref_val: &str) -> Vec<usize> {
105
+ match self.reverse.get(target_ref_val) {
106
+ Some(edges) => edges
107
+ .iter()
108
+ .filter(|(rt, _)| rt == ref_tag)
109
+ .map(|(_, eid)| *eid)
110
+ .collect(),
111
+ None => Vec::new(),
112
+ }
113
+ }
99
114
  }
100
115
 
101
116
  #[cfg(test)]
@@ -2,11 +2,12 @@
2
2
 
3
3
  use std::collections::HashMap;
4
4
 
5
+ use indexmap::IndexMap;
5
6
  use parking_lot::Mutex;
6
7
  use rayon::prelude::*;
7
8
 
8
9
  use crate::data::{HCol, HDict, HGrid};
9
- use crate::filter::{matches_with_ns, parse_filter};
10
+ use crate::filter::{FilterNode, matches_with_ns, parse_filter};
10
11
  use crate::kinds::{HRef, Kind};
11
12
  use crate::ontology::{DefNamespace, ValidationIssue};
12
13
 
@@ -56,6 +57,8 @@ pub struct EntityGraph {
56
57
  /// LRU query cache: (filter, version) → matching ref_vals.
57
58
  /// Uses Mutex for interior mutability since read_all takes &self.
58
59
  query_cache: Mutex<QueryCache>,
60
+ /// Parsed filter AST cache: filter_string → AST (version-independent).
61
+ ast_cache: Mutex<HashMap<String, FilterNode>>,
59
62
  /// Optional B-Tree value indexes for comparison-based filter acceleration.
60
63
  value_index: ValueIndex,
61
64
  /// CSR snapshot of adjacency for cache-friendly traversal.
@@ -67,61 +70,53 @@ pub struct EntityGraph {
67
70
  columnar: ColumnarStore,
68
71
  }
69
72
 
70
- /// Simple fixed-capacity LRU cache for filter query results.
73
+ /// Fixed-capacity LRU cache for filter query results using IndexMap for O(1) ops.
71
74
  struct QueryCache {
72
- entries: Vec<QueryCacheEntry>,
75
+ /// (filter, version) → matching ref_vals. Most-recently-used at the back.
76
+ entries: IndexMap<(String, u64), Vec<String>>,
73
77
  capacity: usize,
74
78
  }
75
79
 
76
- struct QueryCacheEntry {
77
- filter: String,
78
- version: u64,
79
- ref_vals: Vec<String>,
80
- }
81
-
82
80
  impl QueryCache {
83
81
  fn new(capacity: usize) -> Self {
84
82
  Self {
85
- entries: Vec::with_capacity(capacity),
83
+ entries: IndexMap::with_capacity(capacity),
86
84
  capacity,
87
85
  }
88
86
  }
89
87
 
90
88
  fn get(&mut self, filter: &str, version: u64) -> Option<&[String]> {
91
- let pos = self
92
- .entries
93
- .iter()
94
- .position(|e| e.version == version && e.filter == filter)?;
95
- // Move to front (most recently used)
96
- if pos > 0 {
97
- let entry = self.entries.remove(pos);
98
- self.entries.insert(0, entry);
99
- }
100
- Some(&self.entries[0].ref_vals)
89
+ // Move to back (most recently used) on access.
90
+ let key = (filter.to_string(), version);
91
+ let idx = self.entries.get_index_of(&key)?;
92
+ self.entries.move_index(idx, self.entries.len() - 1);
93
+ self.entries.get(&key).map(|v| v.as_slice())
101
94
  }
102
95
 
103
96
  fn insert(&mut self, filter: String, version: u64, ref_vals: Vec<String>) {
104
- // Evict oldest if at capacity
105
97
  if self.entries.len() >= self.capacity {
106
- self.entries.pop();
98
+ // Evict least recently used (front).
99
+ self.entries.shift_remove_index(0);
107
100
  }
108
- self.entries.insert(
109
- 0,
110
- QueryCacheEntry {
111
- filter,
112
- version,
113
- ref_vals,
114
- },
115
- );
101
+ self.entries.insert((filter, version), ref_vals);
116
102
  }
117
103
  }
118
104
 
119
105
  const MAX_CHANGELOG: usize = 10_000;
120
106
  const QUERY_CACHE_CAPACITY: usize = 256;
121
107
 
108
+ /// Common Haystack fields to auto-index for O(log N) value lookups.
109
+ const AUTO_INDEX_FIELDS: &[&str] = &[
110
+ "siteRef", "equipRef", "dis", "curVal", "area", "geoCity", "kind", "unit",
111
+ ];
112
+
122
113
  impl EntityGraph {
123
- /// Create an empty entity graph.
114
+ /// Create an empty entity graph with standard Haystack fields auto-indexed.
124
115
  pub fn new() -> Self {
116
+ let mut value_index = ValueIndex::new();
117
+ for field in AUTO_INDEX_FIELDS {
118
+ value_index.index_field(field);
119
+ }
125
120
  Self {
126
121
  entities: HashMap::new(),
127
122
  id_map: HashMap::new(),
@@ -133,7 +128,8 @@ impl EntityGraph {
133
128
  version: 0,
134
129
  changelog: std::collections::VecDeque::new(),
135
130
  query_cache: Mutex::new(QueryCache::new(QUERY_CACHE_CAPACITY)),
136
- value_index: ValueIndex::new(),
131
+ ast_cache: Mutex::new(HashMap::new()),
132
+ value_index,
137
133
  csr: None,
138
134
  csr_version: 0,
139
135
  columnar: ColumnarStore::new(),
@@ -371,14 +367,26 @@ impl EntityGraph {
371
367
  }
372
368
  }
373
369
 
374
- let ast = parse_filter(filter_expr).map_err(|e| GraphError::Filter(e.to_string()))?;
370
+ // Use cached AST or parse and cache it (ASTs are version-independent).
371
+ let ast = {
372
+ let mut ast_cache = self.ast_cache.lock();
373
+ if let Some(cached) = ast_cache.get(filter_expr) {
374
+ cached.clone()
375
+ } else {
376
+ let parsed =
377
+ parse_filter(filter_expr).map_err(|e| GraphError::Filter(e.to_string()))?;
378
+ ast_cache.insert(filter_expr.to_string(), parsed.clone());
379
+ parsed
380
+ }
381
+ };
375
382
 
376
- // Phase 1: bitmap acceleration (with value index enhancement).
383
+ // Phase 1: bitmap acceleration (with value index + adjacency).
377
384
  let max_id = self.next_id;
378
385
  let candidates = query_planner::bitmap_candidates_with_values(
379
386
  &ast,
380
387
  &self.tag_index,
381
388
  &self.value_index,
389
+ &self.adjacency,
382
390
  max_id,
383
391
  );
384
392
 
@@ -386,16 +394,17 @@ impl EntityGraph {
386
394
  let resolver = |r: &HRef| -> Option<&HDict> { self.entities.get(&r.val) };
387
395
  let ns = self.namespace.as_ref();
388
396
 
389
- /// Threshold for parallel evaluation — below this, sequential is faster.
397
+ // Use parallel evaluation only for large unlimited queries where rayon
398
+ // overhead is worthwhile. Bounded queries always use sequential + early exit.
390
399
  const PARALLEL_THRESHOLD: usize = 500;
400
+ let use_parallel = effective_limit == usize::MAX;
391
401
 
392
402
  let mut results: Vec<&HDict>;
393
403
 
394
404
  if let Some(ref bitmap) = candidates {
395
405
  let candidate_ids: Vec<usize> = TagBitmapIndex::iter_set_bits(bitmap).collect();
396
406
 
397
- if candidate_ids.len() >= PARALLEL_THRESHOLD && effective_limit == usize::MAX {
398
- // Parallel path for large, unlimited queries.
407
+ if candidate_ids.len() >= PARALLEL_THRESHOLD && use_parallel {
399
408
  results = candidate_ids
400
409
  .par_iter()
401
410
  .filter_map(|&eid| {
@@ -409,7 +418,6 @@ impl EntityGraph {
409
418
  })
410
419
  .collect();
411
420
  } else {
412
- // Sequential path for small sets or limited queries.
413
421
  results = Vec::new();
414
422
  for eid in TagBitmapIndex::iter_set_bits(bitmap) {
415
423
  if results.len() >= effective_limit {
@@ -426,8 +434,7 @@ impl EntityGraph {
426
434
  } else {
427
435
  let entity_count = self.entities.len();
428
436
 
429
- if entity_count >= PARALLEL_THRESHOLD && effective_limit == usize::MAX {
430
- // Parallel full scan for large, unlimited queries.
437
+ if entity_count >= PARALLEL_THRESHOLD && use_parallel {
431
438
  results = self
432
439
  .entities
433
440
  .par_iter()
@@ -440,7 +447,6 @@ impl EntityGraph {
440
447
  })
441
448
  .collect();
442
449
  } else {
443
- // Sequential full scan.
444
450
  results = Vec::new();
445
451
  for entity in self.entities.values() {
446
452
  if results.len() >= effective_limit {
@@ -453,7 +459,6 @@ impl EntityGraph {
453
459
  }
454
460
  }
455
461
 
456
- // Apply limit to parallel results.
457
462
  if results.len() > effective_limit {
458
463
  results.truncate(effective_limit);
459
464
  }
@@ -552,43 +557,53 @@ impl EntityGraph {
552
557
  ) -> (Vec<&HDict>, Vec<(String, String, String)>) {
553
558
  use std::collections::{HashSet, VecDeque};
554
559
 
555
- let mut visited: HashSet<String> = HashSet::new();
556
- let mut queue: VecDeque<(String, usize)> = VecDeque::new();
560
+ let start_eid = match self.id_map.get(ref_val) {
561
+ Some(&eid) => eid,
562
+ None => return (Vec::new(), Vec::new()),
563
+ };
564
+
565
+ let mut visited: HashSet<usize> = HashSet::new();
566
+ let mut queue: VecDeque<(usize, usize)> = VecDeque::new();
557
567
  let mut result_entities: Vec<&HDict> = Vec::new();
558
568
  let mut result_edges: Vec<(String, String, String)> = Vec::new();
559
569
 
560
- visited.insert(ref_val.to_string());
561
- queue.push_back((ref_val.to_string(), 0));
570
+ visited.insert(start_eid);
571
+ queue.push_back((start_eid, 0));
562
572
 
563
573
  if let Some(entity) = self.entities.get(ref_val) {
564
574
  result_entities.push(entity);
565
575
  }
566
576
 
567
- while let Some((current, depth)) = queue.pop_front() {
577
+ while let Some((current_eid, depth)) = queue.pop_front() {
568
578
  if depth >= hops {
569
579
  continue;
570
580
  }
581
+ let current_ref = match self.reverse_id.get(&current_eid) {
582
+ Some(s) => s.as_str(),
583
+ None => continue,
584
+ };
585
+
571
586
  // Traverse forward edges
572
- if let Some(&eid) = self.id_map.get(&current)
573
- && let Some(fwd) = self.adjacency.forward_raw().get(&eid)
574
- {
587
+ if let Some(fwd) = self.adjacency.forward_raw().get(&current_eid) {
575
588
  for (ref_tag, target) in fwd {
576
589
  if let Some(types) = ref_types
577
590
  && !types.iter().any(|t| t == ref_tag)
578
591
  {
579
592
  continue;
580
593
  }
581
- result_edges.push((current.clone(), ref_tag.clone(), target.clone()));
582
- if visited.insert(target.clone()) {
594
+ result_edges.push((current_ref.to_string(), ref_tag.clone(), target.clone()));
595
+ if let Some(&target_eid) = self.id_map.get(target.as_str())
596
+ && visited.insert(target_eid)
597
+ {
583
598
  if let Some(entity) = self.entities.get(target.as_str()) {
584
599
  result_entities.push(entity);
585
600
  }
586
- queue.push_back((target.clone(), depth + 1));
601
+ queue.push_back((target_eid, depth + 1));
587
602
  }
588
603
  }
589
604
  }
590
605
  // Traverse reverse edges
591
- if let Some(rev) = self.adjacency.reverse_raw().get(&current) {
606
+ if let Some(rev) = self.adjacency.reverse_raw().get(current_ref) {
592
607
  for (ref_tag, source_eid) in rev {
593
608
  if let Some(types) = ref_types
594
609
  && !types.iter().any(|t| t == ref_tag)
@@ -596,12 +611,16 @@ impl EntityGraph {
596
611
  continue;
597
612
  }
598
613
  if let Some(source_ref) = self.reverse_id.get(source_eid) {
599
- result_edges.push((source_ref.clone(), ref_tag.clone(), current.clone()));
600
- if visited.insert(source_ref.clone()) {
614
+ result_edges.push((
615
+ source_ref.clone(),
616
+ ref_tag.clone(),
617
+ current_ref.to_string(),
618
+ ));
619
+ if visited.insert(*source_eid) {
601
620
  if let Some(entity) = self.entities.get(source_ref.as_str()) {
602
621
  result_entities.push(entity);
603
622
  }
604
- queue.push_back((source_ref.clone(), depth + 1));
623
+ queue.push_back((*source_eid, depth + 1));
605
624
  }
606
625
  }
607
626
  }
@@ -628,41 +647,59 @@ impl EntityGraph {
628
647
  if from == to {
629
648
  return vec![from.to_string()];
630
649
  }
631
- if !self.entities.contains_key(from) || !self.entities.contains_key(to) {
632
- return Vec::new();
633
- }
650
+ let from_eid = match self.id_map.get(from) {
651
+ Some(&eid) => eid,
652
+ None => return Vec::new(),
653
+ };
654
+ let to_eid = match self.id_map.get(to) {
655
+ Some(&eid) => eid,
656
+ None => return Vec::new(),
657
+ };
658
+
659
+ // parent map: child_eid -> parent_eid (usize::MAX = root sentinel)
660
+ let mut parents: StdHashMap<usize, usize> = StdHashMap::new();
661
+ let mut queue: VecDeque<usize> = VecDeque::new();
662
+ parents.insert(from_eid, usize::MAX);
663
+ queue.push_back(from_eid);
634
664
 
635
- let mut visited: StdHashMap<String, String> = StdHashMap::new(); // child -> parent
636
- let mut queue: VecDeque<String> = VecDeque::new();
637
- visited.insert(from.to_string(), String::new());
638
- queue.push_back(from.to_string());
665
+ while let Some(current_eid) = queue.pop_front() {
666
+ let current_ref = match self.reverse_id.get(&current_eid) {
667
+ Some(s) => s.as_str(),
668
+ None => continue,
669
+ };
639
670
 
640
- while let Some(current) = queue.pop_front() {
641
671
  // Forward edges
642
- if let Some(&eid) = self.id_map.get(&current)
643
- && let Some(fwd) = self.adjacency.forward_raw().get(&eid)
644
- {
672
+ if let Some(fwd) = self.adjacency.forward_raw().get(&current_eid) {
645
673
  for (_, target) in fwd {
646
- if !visited.contains_key(target) {
647
- visited.insert(target.clone(), current.clone());
648
- if target == to {
649
- return Self::reconstruct_path(&visited, to);
674
+ if let Some(&target_eid) = self.id_map.get(target.as_str())
675
+ && let std::collections::hash_map::Entry::Vacant(e) =
676
+ parents.entry(target_eid)
677
+ {
678
+ e.insert(current_eid);
679
+ if target_eid == to_eid {
680
+ return Self::reconstruct_path_usize(
681
+ &parents,
682
+ to_eid,
683
+ &self.reverse_id,
684
+ );
650
685
  }
651
- queue.push_back(target.clone());
686
+ queue.push_back(target_eid);
652
687
  }
653
688
  }
654
689
  }
655
690
  // Reverse edges
656
- if let Some(rev) = self.adjacency.reverse_raw().get(&current) {
691
+ if let Some(rev) = self.adjacency.reverse_raw().get(current_ref) {
657
692
  for (_, source_eid) in rev {
658
- if let Some(source_ref) = self.reverse_id.get(source_eid)
659
- && !visited.contains_key(source_ref)
660
- {
661
- visited.insert(source_ref.clone(), current.clone());
662
- if source_ref == to {
663
- return Self::reconstruct_path(&visited, to);
693
+ if !parents.contains_key(source_eid) {
694
+ parents.insert(*source_eid, current_eid);
695
+ if *source_eid == to_eid {
696
+ return Self::reconstruct_path_usize(
697
+ &parents,
698
+ to_eid,
699
+ &self.reverse_id,
700
+ );
664
701
  }
665
- queue.push_back(source_ref.clone());
702
+ queue.push_back(*source_eid);
666
703
  }
667
704
  }
668
705
  }
@@ -671,22 +708,26 @@ impl EntityGraph {
671
708
  Vec::new() // No path found
672
709
  }
673
710
 
674
- /// Reconstruct path from BFS parent map.
675
- fn reconstruct_path(
676
- parents: &std::collections::HashMap<String, String>,
677
- to: &str,
711
+ /// Reconstruct path from usize-based BFS parent map.
712
+ fn reconstruct_path_usize(
713
+ parents: &std::collections::HashMap<usize, usize>,
714
+ to_eid: usize,
715
+ reverse_id: &HashMap<usize, String>,
678
716
  ) -> Vec<String> {
679
- let mut path = vec![to.to_string()];
680
- let mut current = to.to_string();
681
- while let Some(parent) = parents.get(&current) {
682
- if parent.is_empty() {
717
+ let mut path_eids = vec![to_eid];
718
+ let mut current = to_eid;
719
+ while let Some(&parent) = parents.get(&current) {
720
+ if parent == usize::MAX {
683
721
  break;
684
722
  }
685
- path.push(parent.clone());
686
- current = parent.clone();
723
+ path_eids.push(parent);
724
+ current = parent;
687
725
  }
688
- path.reverse();
689
- path
726
+ path_eids.reverse();
727
+ path_eids
728
+ .iter()
729
+ .filter_map(|eid| reverse_id.get(eid).cloned())
730
+ .collect()
690
731
  }
691
732
 
692
733
  /// Return the subtree rooted at `root` up to `max_depth` levels.