-
Notifications
You must be signed in to change notification settings - Fork 227
feat(DataStore): Start/Stop implementation #917
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #917 +/- ##
==========================================
- Coverage 67.27% 67.19% -0.08%
==========================================
Files 895 895
Lines 35372 35434 +62
==========================================
+ Hits 23796 23810 +14
- Misses 11576 11624 +48
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
Not particularly happy with this this because:
To remedy this, it seems that the only way to get around this is to either expose the state of the sync engine somehow -- either through a published combine event, or a member variable.. or something like this. In any case, I'm sending this review out a bit early in case anyone can think of a better way of implementing this that is thread safe. |
I took another look at the code. Previously, the code storageEngine being instantiated was synonymous with the syncEngine being started (yes, you read that right.. these two actions were tightly coupled). Since we are changing the behavior to not automatically start the syncEngine, there is not a good way to separate out instantiation with starting the sync engine without introducing some state. Option 1 (what is currently implemented): Option 2: |
I am leaving the PR in draft for historical purposes. This approach attempts to introduce a state into the AWSDataStorePlugin to keep track of whether or not we've issued a start() to the sync engine. Doing so, in my opinion, overcomplicates the design.
In addition, it increases overhead by starting a mostly no-op thread for each data store operation.
A couple of test cases to consider:
Known issues:
There is a known issue with this implementation. If customers attempt to call
stop, and then immediately callclear(), the local database will not be cleared because the instance to the storage engine is set tonil. I don't think this is a use case we really have to worry about, so I am holding off on implementing this.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.