Title: SciJava Location API Improvements · Issue #251 · scijava/scijava-common · GitHub
Open Graph Title: SciJava Location API Improvements · Issue #251 · scijava/scijava-common
X Title: SciJava Location API Improvements · Issue #251 · scijava/scijava-common
Description: During a conversation with @ctrueden we created the following plan for further improvements of the scijava-location API: Abstraction structure: Location: Contains the metadata, where a file is located, what credentials are needed for acc...
Open Graph Description: During a conversation with @ctrueden we created the following plan for further improvements of the scijava-location API: Abstraction structure: Location: Contains the metadata, where a file is loca...
X Description: During a conversation with @ctrueden we created the following plan for further improvements of the scijava-location API: Abstraction structure: Location: Contains the metadata, where a file is loca...
Opengraph URL: https://github.com/scijava/scijava-common/issues/251
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"SciJava Location API Improvements","articleBody":"During a conversation with @ctrueden we created the following plan for further improvements of the scijava-location API:\r\n\r\n## Abstraction structure:\r\n\r\n1. __Location:__\r\n Contains the metadata, where a file is located, what credentials are needed for access, etc.\r\n2. __Session:__\r\n Provides access to data sources on a host.\r\n3. __DataHandle:__\r\n Provides access to the bytes in a data source, is used e.g. by scifio formats to read images.\r\n\r\n## SessionService\r\n- can create a Session for a remote, takes Location as input\r\n - \"remote\" = the host/non-path part of a location URI)\r\n- caches Sessions for each remote\r\n- whenever a Session is handed out, increment a usage ref\r\n- whenever a DataHandle is closed, it decrements its session's usage ref\r\n - if applicable -- some DataHandles don't need Sessions\r\n\r\n## Protocols\r\n- List of protocols we want:\r\n - [ ] SSH SCP\r\n - [ ] (S)FTP\r\n - [ ] HTTP/HTTPS:\r\n - with resume, to avoid excessive rereading\r\n - support PUT for uploads?\r\n - [ ] OMERO\r\n - [ ] HDFS\r\n - [ ] Cloud block storage:\r\n - [ ] Amazon S3\r\n - [ ] Openstack Swift\r\n - [ ] Azure Block Storage\r\n - [ ] Google Cloud Storage\r\n\r\n## Service/plugin architecture\r\n- Session will need to be a new Plugin type\r\n- SessionService will be a HandlerService\r\n - Model it after DataHandleService; it is very similar\r\n but with additional API, obviously -- e.g., fetchOrCreate or some such\r\n- Update the DataHandleService to have a new method:\r\n - `create(L extends Location, Session\u003cL\u003e)`\r\n - This method allows reusing a specific session.\r\n - This session may not be closed when the handle is closed \r\n- The existing DataHandleService method `create(Location)` will simply ask the SessionService to `fetchOrCreate` a session for that Location.\r\n- Naively, it might seem like we need a \"Remote\" interface or some such, but I\r\n actually think we won't need it. I think each Session will be able to extract\r\n the information it needs from its associated type of Location, and that will be\r\n good enough, and simpler.\r\n- Finish the StreamHandle interface(?) for DataHandles that are built on InputStream/OutputStreams.\r\n - Some location types like URLHandle would probably(?) benefit from extending StreamHandle\r\n - But if none of the protocols would actually benefit from extending StreamHandle, we could decide not to do it.\r\n\r\n### Protocol specific notes\r\n\r\n- Native HTTP / HTTPS support in Java seems to lack support for resume, looks like we need an external library for that.\r\n- We need to make sure that we only cache sessions that support concurrent access. -\u003e Need method `public boolean isConcurent()` in interface.\r\n- Sessions might only allow for limited concurrent access, if we encounter this we will need a `public int concurentAccessLimit()` method.\r\n- When do we close automatically created sessions?\r\n - Need a cache eviction strategy like LRU\r\n - Don't immediately close Session when reference count reaches 0\r\n - Maybe use a connection pool with a modifiable limit?\r\n\r\n\r\n### Implementation specific notes\r\n- calling `dispose()` on the SessionService will close all connections.\r\n- Currently working on this on the \r\n","author":{"url":"https://github.com/gab1one","@type":"Person","name":"gab1one"},"datePublished":"2016-12-15T12:11:25.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/251/scijava-common/issues/251"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bd03cf4b-8da8-f4e9-a314-328467ce960a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EBFE:275F42:D0C6B9:1200CE2:696A8DCD |
| html-safe-nonce | 9a92eaa843db1fba12099daa54cfb174e65a4e55cedbd20c6b491725da2ec58b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkZFOjI3NUY0MjpEMEM2Qjk6MTIwMENFMjo2OTZBOERDRCIsInZpc2l0b3JfaWQiOiI4MzkzMjUxOTYwOTI3MTk0NTczIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | afd7b66ac18a3d74f6cf52bfe5ffc1ae5d76732e7d20589e2804bbe5d318127a |
| hovercard-subject-tag | issue:195790290 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/scijava/scijava-common/251/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8a7f0ea4e1f89c9b6f74d7226408456876ab19539cca9ed4d87cedf03c8235bd/scijava/scijava-common/issues/251 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8a7f0ea4e1f89c9b6f74d7226408456876ab19539cca9ed4d87cedf03c8235bd/scijava/scijava-common/issues/251 |
| og:image:alt | During a conversation with @ctrueden we created the following plan for further improvements of the scijava-location API: Abstraction structure: Location: Contains the metadata, where a file is loca... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gab1one |
| hostname | github.com |
| expected-hostname | github.com |
| None | d2aa6dedd7d97fa651b17c40401f2605f309df5ca5fb659bf0554cf34f1de825 |
| turbo-cache-control | no-preview |
| go-import | github.com/scijava/scijava-common git https://github.com/scijava/scijava-common.git |
| octolytics-dimension-user_id | 1262770 |
| octolytics-dimension-user_login | scijava |
| octolytics-dimension-repository_id | 3594497 |
| octolytics-dimension-repository_nwo | scijava/scijava-common |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3594497 |
| octolytics-dimension-repository_network_root_nwo | scijava/scijava-common |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c1dbca8981c5e3d6a69bce2f1d289e732b86241d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width