-
Notifications
You must be signed in to change notification settings - Fork 191
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
Profile
: do not leak repository implementation in interface
#4891
Profile
: do not leak repository implementation in interface
#4891
Conversation
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.
well perhaps I should say, approved after it doesn't break all the tests lol
They're all syntax and style, essentially. So no worries. |
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.
Thanks @sphuber. Gave the PR a first pass.
00bb1a0
to
1934981
Compare
Alright, this should be much better. If you guys are happy with the design, I will add the necessary tests for the new |
Looking very good indeed! Much cleaner to have these methods on the |
not that it means much to have @mbercx 's seal of a approval |
Indeed. I quickly jumped in to review when I saw I blanketed this PR ... tsk tsk tsk... 😂 |
Does that mean I don't have to review PR's anymore? 🥳 |
Nah. Just means more work for the rest of us 😂 |
aab092a
to
04cd181
Compare
Ok, the docs are failing with the following:
This is most likely becuase of the return type, which I put as a string. The reason being that I cannot import |
yeh its an annoying sphinx thing (sphinx-doc/sphinx#8498), just add it to the |
The `Profile` interface was leaking implementation details of the repository. For example, the method `get_repository_container` returned the `Container` class of the `disk-objectstore` library, but this is an implementation detail. If this ever were to change all client code would break. Instead, we add the `get_repository` method which returns an instance of the generic `Repository` class that will be common to all repository implementations. The backend implementation can still be obtained through this object but this should only be done in exceptional cases. The `Repository` class now has three additional properties and methods: * `def uuid(self) -> typing.Optional[str]:` * `def initialise(self, **kwargs) -> None:` * `def is_initialised(self) -> bool:` These simply call through to the exact same method/property on the backend instance. The `AbstractRepositoryBackend` also now has the exact same attributes and they are implemented for the two currently existing implementations `DiskObjectStoreRepositoryBackend` and the `SandboxRepositoryBackend`.
04cd181
to
8145703
Compare
Codecov Report
@@ Coverage Diff @@
## develop #4891 +/- ##
===========================================
+ Coverage 80.10% 80.12% +0.03%
===========================================
Files 517 517
Lines 36617 36659 +42
===========================================
+ Hits 29327 29368 +41
- Misses 7290 7291 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@mbercx would you still like a gander before we merge? |
LGMT! 🚀 |
Fixes #4890
The
Profile
interface was leaking implementation details of therepository. For example, the method
get_repository_container
returnedthe
Container
class of thedisk-objectstore
library, but this is animplementation detail. If this ever were to change all client code would
break.
Instead, we add the
get_repository
method which returns an instance ofthe generic
Repository
class that will be common to all repositoryimplementations. The backend implementation can still be obtained
through this object but this should only be done in exceptional cases.
The
Repository
class now has three additional properties and methods:def uuid(self) -> typing.Optional[str]:
def initialise(self, **kwargs) -> None:
def is_initialised(self) -> bool:
These simply call through to the exact same method/property on the
backend instance. The
AbstractRepositoryBackend
also now has the exactsame attributes and they are implemented for the two currently existing
implementations
DiskObjectStoreRepositoryBackend
and theSandboxRepositoryBackend
.