PIPELINE: compose the collectors + promoters + boundaries into the single-entry relocate operation. All-Result; first :err short-circuits.
The flow:
collect-existing-entry ;; COLLECT → compute-target ;; PROMOTE (pure) → classify-relocation-need ;; PROMOTE (pure) → IF :no-op → return r/ok with :moved? false IF :move → ensure-target-collection ;; PROMOTE/BOUNDARY edge → build-target-record ;; PROMOTE (calls embedder) → milvus-write! ;; BOUNDARY → milvus-delete! ;; BOUNDARY → return r/ok with :moved? true
Replaces the body of hive-milvus.store.entries/relocate-entry!
with a Result-tracked, layer-disciplined version.
PIPELINE: compose the collectors + promoters + boundaries into the
single-entry relocate operation. All-Result; first :err short-circuits.
The flow:
collect-existing-entry ;; COLLECT
→ compute-target ;; PROMOTE (pure)
→ classify-relocation-need ;; PROMOTE (pure)
→ IF :no-op → return r/ok with :moved? false
IF :move → ensure-target-collection ;; PROMOTE/BOUNDARY edge
→ build-target-record ;; PROMOTE (calls embedder)
→ milvus-write! ;; BOUNDARY
→ milvus-delete! ;; BOUNDARY
→ return r/ok with :moved? true
Replaces the body of `hive-milvus.store.entries/relocate-entry!`
with a Result-tracked, layer-disciplined version.(copy-one config-atom id)Copy the entry at id into its canonical collection, LEAVING the source row
in place. Non-destructive: the old collection remains a complete backup.
Copy the entry at `id` into its canonical collection, LEAVING the source row in place. Non-destructive: the old collection remains a complete backup.
(delete-source)Move: the source row is removed once the target write has landed.
Move: the source row is removed once the target write has landed.
(-after-write this bundle)What becomes of the source row once the target write has landed.
What becomes of the source row once the target write has landed.
(-describe-disposition this)(keep-source)Copy: the source row is left exactly where it is. The old collection stays a readable backup, at the cost of holding the entry twice.
Copy: the source row is left exactly where it is. The old collection stays a readable backup, at the cost of holding the entry twice.
(place-one config-atom id disposition)(place-one config-atom id disposition overrides)Put the entry at id into its canonical collection, then let disposition
decide what happens to the source row. overrides (optional) is merged
into the collected entry before it is re-embedded: {:embed-text s} lets
a caller whose stored :content is not embeddable (a store decorator that
encrypts at rest) supply the text; :embed-text never reaches the record.
Returns: (r/ok {:placed? true :source-kept? bool :from src :to target :id id}) (r/ok {:placed? false :from src :to target :id id}) on no-op (r/err :collector/not-found | :routing/no-target | :embedder/embed-failed | :boundary/milvus-write-failed | ...)
Idempotent: the target write is an upsert, and an entry already in its canonical collection is a no-op.
Put the entry at `id` into its canonical collection, then let `disposition`
decide what happens to the source row. `overrides` (optional) is merged
into the collected entry before it is re-embedded: `{:embed-text s}` lets
a caller whose stored `:content` is not embeddable (a store decorator that
encrypts at rest) supply the text; `:embed-text` never reaches the record.
Returns:
(r/ok {:placed? true :source-kept? bool :from src :to target :id id})
(r/ok {:placed? false :from src :to target :id id}) on no-op
(r/err :collector/not-found | :routing/no-target |
:embedder/embed-failed | :boundary/milvus-write-failed | ...)
Idempotent: the target write is an upsert, and an entry already in its
canonical collection is a no-op.(relocate-one config-atom id)(relocate-one config-atom id overrides)Relocate the entry at id to its canonical collection, REMOVING it from the
source. See place-one (and its overrides); :moved? mirrors :placed?
for legacy callers.
Relocate the entry at `id` to its canonical collection, REMOVING it from the source. See `place-one` (and its `overrides`); `:moved?` mirrors `:placed?` for legacy callers.
(relocate-update config-atom id updates)Update-with-relocation: merge updates into the entry, recompute
its target collection from the merged shape, and either upsert in
place (target == src) or move via relocate-one (target ≠ src).
Replaces the body of entries/update-entry! for the routing-aware
path. Returns r/ok merged-entry on success or r/err on failure.
Note: relocate-one only relocates the entry as it CURRENTLY is.
When updates change the :type and the new :type routes to a
different collection, we do NOT use relocate-one — we explicitly
write the merged entry to the new collection, then delete from src.
This subtle difference is why relocate-update is its own fn
rather than a wrapper over relocate-one.
Update-with-relocation: merge `updates` into the entry, recompute its target collection from the merged shape, and either upsert in place (target == src) or move via `relocate-one` (target ≠ src). Replaces the body of `entries/update-entry!` for the routing-aware path. Returns r/ok merged-entry on success or r/err on failure. Note: `relocate-one` only relocates the entry as it CURRENTLY is. When updates change the :type and the new :type routes to a different collection, we do NOT use relocate-one — we explicitly write the merged entry to the new collection, then delete from src. This subtle difference is why `relocate-update` is its own fn rather than a wrapper over `relocate-one`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |