-
Notifications
You must be signed in to change notification settings - Fork 26
Abstract reader/writer design #80
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
base: master
Are you sure you want to change the base?
Conversation
src/h5json/hdf5db.py
Outdated
| stop = start + sel_inter.count[dim] | ||
| slices.append(slice(start, stop, 1)) | ||
| slices = tuple(slices) | ||
| # TBD: needs updating to work in the general case! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this TBD been addressed?
| raise IOError(errno.EINVAL, msg) | ||
| return link_json | ||
|
|
||
| def _addLink(self, grp_id, name, link_json): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If _addLink is meant to be an internal function, should it be moved to utils?
|
|
||
| for obj_id in self.db: | ||
| # skip deleted objects | ||
| if self.db[obj_id] is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it will still count objects that have been marked as deleted with "DELETED" and marked dirty, since e.g. deleteLink doesn't appear to remove the link from the database.
| try: | ||
| linkObj = parent.get(link_name, None, False, True) | ||
| linkClass = linkObj.__class__.__name__ | ||
| except TypeError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no way to distinguish a UD link from other potential causes of TypeError here and in _getLink?
| self._flush_time = 0.0 | ||
| self._f = None # h5py file handle | ||
|
|
||
| def _copy_element(self, val, src_dt, tgt_dt, fout=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the _copy_* routines here and in h5py_reader should be renamed to indicate that they're also performing a conversion, and the direction of that conversion. Something like _element_json_to_h5py_rep()/_element_h5py_to_json_rep() would prevent confusion between the two identically named functions that perform opposite operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same goes for _copy_array.
| for title in titles: | ||
| link_json = links_json[title] | ||
| link_class = link_json["class"] | ||
| if "DELETED" in link_json: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this also handles deletion, would it be more accurate to call _createObjects() something like _syncObjects()?
hdf5db now supports interaces for reader and/or writer objects.
Currently json and hdf5 (using h5py) are supported.