Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch write path to transact in URLs #109

Merged
merged 1 commit into from
Jul 15, 2019
Merged

Switch write path to transact in URLs #109

merged 1 commit into from
Jul 15, 2019

Conversation

ttung
Copy link
Collaborator

@ttung ttung commented Jul 12, 2019

Previously, the read path for slicedimage operated with URLs. This allowed us to have manifests on local disk that referred to network resources for tiles. This PR will use URLs as the destination for manifest files and tile data.

This PR also changes the way users can control the behavior of writing. Previously, we allowed for two callbacks: one allowed callers to designate where a sub-manifest is located on disk, and the other allowed callers to open a file for writing tile data. This turns out not to capture all the use cases for how we might want to control writing, so this PR creates WriterContract. It has three callbacks: one to designate where a sub-manifest is located in URL-space, another to designate where a tile is located in URL space, and one to write tile data to a URL.

Furthermore, we provide a CompatibilityWriterContract that mostly mimics the behavior of the old callbacks. The one notable exception is that the tricks utilized to perform in-place tile writing no longer work. CompatibilityWriterContract finds the destination in tile_url_generator by opening the tile data file, find out where it is on disk, and then closing the file. The new callback (write_tile_data) just opens the path and writes to it. There is not a way to maintain the file handle between tile_url_generator and write_tile_data.

Because this is a slight change in behavior, we bump the version of the library to 4.0.0.

Test plan: verified existing tests pass. verify existing starfish imagestack and experiment tests pass with this library (except for in-place tile construction). verify that the new in-place code for starfish passes with this library.

@ttung ttung requested a review from ambrosejcarr July 12, 2019 17:59
@ttung ttung requested review from shanaxel42 and removed request for ambrosejcarr July 12, 2019 18:08
@codecov-io
Copy link

codecov-io commented Jul 12, 2019

Codecov Report

Merging #109 into master will decrease coverage by 3.57%.
The diff coverage is 51.56%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #109      +/-   ##
==========================================
- Coverage   78.96%   75.38%   -3.58%     
==========================================
  Files          29       29              
  Lines         832      902      +70     
==========================================
+ Hits          657      680      +23     
- Misses        175      222      +47
Impacted Files Coverage Δ
slicedimage/io/__init__.py 100% <100%> (ø) ⬆️
slicedimage/__init__.py 100% <100%> (ø) ⬆️
slicedimage/backends/_disk.py 100% <100%> (+4.76%) ⬆️
slicedimage/io/_v0_0_0.py 95.55% <100%> (-0.41%) ⬇️
slicedimage/io/_v0_1_0.py 58.24% <20%> (+3.24%) ⬆️
slicedimage/io/_base.py 58.75% <48.07%> (-25.98%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a84941...3273775. Read the comment docs.

@ttung ttung force-pushed the tonytung-url branch 2 times, most recently from 212472f to fc624e8 Compare July 12, 2019 18:44
@ttung ttung changed the base branch from tonytung-abstractmethod to tonytung-url-base July 12, 2019 18:56
@ttung ttung force-pushed the tonytung-url-base branch from 9f1e964 to f8cbdc0 Compare July 12, 2019 19:10
Previously, the read path for slicedimage operated with URLs.  This allowed us to have manifests on local disk that referred to network resources for tiles.  This PR will use URLs as the destination for manifest files and tile data.

This PR also changes the way users can control the behavior of writing.  Previously, we allowed for two callbacks: one allowed callers to designate where a sub-manifest is located on disk, and the other allowed callers to open a file for writing tile data.  This turns out not to capture all the use cases for how we might want to control writing, so this PR creates WriterContract.  It has three callbacks: one to designate where a sub-manifest is located in URL-space, another to designate where a tile is located in URL space, and one to write tile data to a URL.

Furthermore, we provide a CompatibilityWriterContract that _mostly_ mimics the behavior of the old callbacks.  The one notable exception is that the tricks utilized to perform in-place tile writing no longer work.  CompatibilityWriterContract finds the destination in `tile_url_generator` by opening the tile data file, find out where it is on disk, and then closing the file.  The new callback (write_tile_data) just opens the path and writes to it.  There is not a way to maintain the file handle between `tile_url_generator` and `write_tile_data`.

Because this is a slight change in behavior, we bump the version of the library to 4.0.0.

Test plan: verified existing tests pass.  verify existing starfish imagestack and experiment tests pass with this library (except for in-place tile construction).  verify that the new in-place code for starfish passes with this library.
@ttung ttung changed the base branch from tonytung-url-base to master July 15, 2019 21:53
@ttung ttung merged commit e1c9add into master Jul 15, 2019
@ttung ttung deleted the tonytung-url branch July 15, 2019 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants