Skip to content

Conversation

@maxrjones
Copy link
Member

When working on #2614 in https://github.com/maxrjones/zarr-python/tree/testing-storage, I found that the current implementation of set_partial_values for local store cannot work as written because it passes BytesLike to _put which expects a buffer. None of the other stores implement set_partial_values, so it's not possible to look to them for the correct way of implementing this method.

I believe that one of the following needs to happen in order for stores to correctly implement set_partial_values:

  • Add a prototype argument to set_partial_values that can be used to go from BytesLike -> Buffer
  • Update set_partial_values to accept Buffer types rather than BytesLike types

I chose the second option for this PR because all the other set methods seem to accept Buffer types. Of course, I welcome corrections if I am not understanding something here and the function signature should work as-is.

"""
assert not store.read_only
# Create empty key
await store.set(key, self.buffer_cls.from_bytes(b""))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set_partial_values for a LocalStore requires that a key exist. This test assumes this is the intended behavior and creates a key containing no data prior to testing set_partial_values.

supports_writes: bool = True
supports_deletes: bool = True
supports_partial_writes: bool = True
supports_partial_writes: bool = False
Copy link
Member Author

@maxrjones maxrjones Jan 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm realizing this may be wrong. I interpreted supports_partial_writes to refer to whether set_partial_values is implemented whereas it may actually refer to whether set includes a byte_range parameter. I am not sure which, if either, is correct because MemoryStore had supports_partial_writes=True with byte_range implemented for set but no implemented set_partial_values whereas LocalStore had supports_partial_writes=True with no byte_range implemented for set but included a set_partial_values implementation.

@dstansby dstansby added the needs release notes Automatically applied to PRs which haven't added release notes label Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs release notes Automatically applied to PRs which haven't added release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants