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

Refactor Class Structure for Dataset, Pool, Snapshot #34

Open
JavaScriptDude opened this issue Dec 13, 2020 · 6 comments
Open

Refactor Class Structure for Dataset, Pool, Snapshot #34

JavaScriptDude opened this issue Dec 13, 2020 · 6 comments

Comments

@JavaScriptDude
Copy link
Contributor

With current class design, its not possible to distinguish objects using isinstance(obj, <type>) because Pool and Snapshot both inherit from Dataset.

Refactor the class layout to include an 'abstract' class ZfsItem(object) which Pool, Dataset and Snapshot would all inherit from. This would give you the ability to share properties / methods whilst allowing usage of strong type assertions of all the key Objects.

I have a hard fork of your code in my own library that I'm writing called [zfslib](https://github.com/JavaScriptDude/zfslib) that includes this change. I just made the tweak and so its not fully tested but basic smoke testing passed.

@Rudd-O
Copy link
Owner

Rudd-O commented Dec 28, 2020

Hm. I think I would like to use your library and delete the matching code on my project instead.

@Rudd-O Rudd-O reopened this Dec 28, 2020
@Rudd-O
Copy link
Owner

Rudd-O commented Dec 28, 2020

Send me a ping to see how we can collab.

@JavaScriptDude
Copy link
Contributor Author

I definitely welcome the collab opportunity. I sent you a message to your website Rudd-O.com regarding switching license for zfslib to Simplified BSD.

I have refactored quite a bit but we should be able to make your test suite work with my library. Will need to do some back porting to support older Python as I presently only target Python 3.7+

@JavaScriptDude
Copy link
Contributor Author

I just added tooling tonight to allow for testing but have not written any unit tests on my end yet. I only have manual hand testing at this point but hope to start writing formal tests in the coming days.

@JavaScriptDude
Copy link
Contributor Author

FYI - For test data, see PoolSet._load(_test_data:="<test_data>") -or- Connection.load_poolset(..., _test_data="<test_data>")

@JavaScriptDude
Copy link
Contributor Author

FYI - Just did a manual integration of your test_sync.py script and got them to run with some bug fixes on my end and some minor tweaks in the test code. All tests passed.

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

No branches or pull requests

2 participants