HDFGroup / hsds

Cloud-native, service based access to HDF data
https://www.hdfgroup.org/solutions/hdf-kita/
Apache License 2.0
126 stars 52 forks source link

Multiops #295

Closed jreadey closed 6 months ago

jreadey commented 6 months ago

Add ability to get multiple attributes via PUT attributes or write multiple attributes with POST attributes.

mattjala commented 6 months ago

Here is a list of cases where either HSDS or the client can attempt to use an overlong URL due to attributes or links having long names:

Client request is safe, but can cause HSDS to use an overlong URL

Both client request and resultant HSDS request can use an overlong URL

These API endpoints expect a potentially overlong h5path query string in the URL, and then make a potentially overlong GET_Link request in getObjectIdByPath

POST_Attributes and PUT_Attributes as implemented in this PR would provide a safe alternative to the GET_Attribute/GET_AttributeValue/PUT_Attribute/PUT_AttributeValue API endpoints by storing long attribute names in the request body.

The HDF5 Library doesn't formally specify an attribute name limit, and only attribute names up to 255 bytes are tested. For this reason, I think we can safely consider attribute names that cause a URL to exceed aiohttp's default limit (8190 bytes) to be unsupported. In that case, we wouldn't need to worry about changing DELETE_Attribute.

The changes that would need to be made to avoid all other potentially overlong URLs:

The latter two changes don't seem like perfect ideas - moving all the GET functionality under POST/PUT could be be unintuitive or duplicate behavior. Some other possible solutions to handle the long URL cases in GET_*/DELETE_* endpoints:

mattjala commented 6 months ago

At this point, there are four different ways to "get the value of an attribute" - GET_Attribute, GET_Attributes, GET_AttributeValue, and POST_Attributes, and two different ways to get the values of multiple attributes. Is there a motive for each of these different methods to continue to exist beyond backwards compatibility?