Skip to content

ops functions cannot see write guards, value caches or preset hooks of a wrapper #3

Closed

Description

@thorwhalen

Follow-up from the adversarial review of #2 (fix for #1).

The free functions in cosmodol.ops (replace_item, batch_items, delete_container, ...) resolve keys through every wrapping layer (_id_of_key), values through _data_of_obj, and, since #2, check k in store through the outer store before acting on an existing resource (so filt_iter scopes are honoured). Three things a function still cannot see, all documented in the cosmodol/ops.py module docstring:

  1. Write guards: a layer whose own __setitem__/__delitem__ refuses (a read-only wrapper) is bypassed.
  2. Value caches: cache_vals-style layers keep the pre-write value after replace_item/batch_items.
  3. Key-aware preset= hooks (wrap_kvs(preset=...)) are not applied to replace_item/batch_items values; returned documents are in stored (leaf) form.
  4. Creating operations (batch create/upsert, add_container, add_database) cannot consult a scope filter, since the key does not exist yet.

None of these is a regression (the old methods bypassed all of them too). Options: refuse when any layer overrides __setitem__/__delitem__ beyond dol.base.Store and is not a known-transparent dol wrapper (but filt_iter/cached_keys override them too, and the prefix-view pattern needs them); or wait for dol's is-a wrapping direction (i2mint/dol discussion #86), which would make methods correct again.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions