* [WIP] Add code coverage
* Get multi-module and merging working
* Add CodeCov
* Update location of report.xml
* Check instead of build depends on Jacoco
* Do not merge coverage
* Ignore tests
* update comment
* Fix a ConcurrentModificationException by synchronizing the accessQueue (MutableSet) before iterating over it.
* Add test to verify ConcurrentModificationException is not thrown when performing evictions concurrently.
* Fix typos.
* Gradle 6.1, AGP 4.0.0-alpha09, lifecycle 2.2.0.
* Add experimental invalidateAll() support and @ExperimentalStoreAPI annotation.
* Update sample with deleteAll function.
* Update README.md with deleteAll function.
* Add a section to README.md on clearing store entries.
* Rewrite tests without mocking. Move test utils / helpers to a single package.
* Code formatting and cleanups.
* Use StoreResponse.Data instead of DataWithOrigin in ClearAllStoreTest and ClearStoreByKeyTest.
* Simplified samples. Refactor tests.
* Gradle 6.1.1.
* Change flow collection util to drain the flow
This PR changes the assertItems util method in tests to drain the
flow to ensure we don't produce unwated items.
* reformat code
* Use a test subject for flow assertions
* update test subject messsages, add tests for it (so meta :p)
* Apply suggestions from code review
Co-Authored-By: Eyal Guthmann <eyalgu@users.noreply.github.com>
* fix code style
* Don't try to get exception unless collection finished
This fixes a bug in FlowSubject where it would try to get the cancelation
exception from an unfinished job. Also added a test.
Co-authored-by: Eyal Guthmann <eyalgu@users.noreply.github.com>
* Prepare for release 4.0.0-alpha01
* Prepare next development version
* Update build.gradle
Co-Authored-By: Mike Nakhimovich <digitalbuddha@users.noreply.github.com>
Co-authored-by: Mike Nakhimovich <digitalbuddha@users.noreply.github.com>
* Rewrite cache module in Kotlin.
* Migrate RealStore to use new cache.
* Migrate FileSystemImpl to use new cache.
* Migrate StoreTest to new cache.
* Remove Guava Cache.
* Migrate remaining Java file to Kotlin.
* Fix ktlint error.
* Fix package.
* Add support for CacheLoader.
* Remove unnecessary mockito-inline.
* Remove volatile keyword from CacheEntry fields and add docs re. cache entry reuse and thread-safty assumption.
* - Refactor CacheBuilder.
- Update docs.
- Update Key, Value, Input, Output generic types to be bound by Any.
- Replace spy with TestLoader for asserting invocation.
* Support key-based synchronization for get(key: Key, loader: () -> Value): Value.
* Document loader exception propagation.
* Small clean ups.
* Make CacheEntry's Key and Value bound to Any, move CacheEntry to RealCache.kt as a private class.
* Add reference counting key-based synchronization for cache loader.
* Improve KeyedSynchronizer and docs.
* Refactor tests and add a missing test case to reach 100% coverage.
* Add memory barrier after updating access time in cache entry.
* Only process access queue if expiresAfterAccess == true.
* Support configurable concurrency level.
* Increase delay for concurrency test.
* Explicitly set concurrency level for concurrency tests.
* Only add memory barrier after recordRead if expiresAfterAccess is enabled.
* Fix a potential memory leak caused by thread preemption.
* Allow retries (3 times) for concurrency tests.
* Move performMaintenance function to bottom of the class.
* Fix typos, rename performMaintenance() to cleanUpDeadEntries(), improve docs.
* Fix more typos.
* Only remove entries in map but not in queue.
* Replace memory barrier with @Volatile fields in CacheEntry.
* Fix deadlock while iterating sets.
* Remove stale cache/README.md, remove commented out java file.
* Properly implement multicast closing
This PR defines the behavior of Multicast Flow.
Previously, it could crash if new observers are added to the
multicaster or if it is closed while there is an active
collector. Now, both of these operations complete without
an error. Collecting on a closed multicaster receives 0
values and closes immediately.
Fixes: #45
Test: ChannelManagerTest, MulticastTest
* remove empty line to fix lint error
* improve tests
* Add kotlin plugin to cache module
* Remove custom accessors in StoreDefaults as default values are effectively constant.
* Update JUnit to 4.13 RC2 to enable asserting specific error message on expected exception.
* Remove custom accessors in MemoryPolicy as all values are calculated from constants.
* Remove checkstyle and pmd as the codebase will be 100% Kotlin.
* Fix IDE warning in build.gradle by removing static imports.
* Remove unused guava dependencies.
* Improve StoreDefaults docs.
* Failing test for downstream closing w/o ack
Add test case that fails when a downstream closes w/o acking the message
and indefinitely suspending the stream for other active downstreams
Issue: #41
* add test with buffer
* ack latest message when a new upsteam arrives
Previously, a new downstream would be suspended on the ack of
messages that arrived before it, even when buffer is 0.
This PR changes that behavior such that if there is no buffer,
we ack latest message immediately so that new downstream can
get values instead of waiting for values that it'll never receive
* re-apply ktlint
* Make MemoryPolicy Kotlin friendlier
* Make MemoryPolicy usage more Kotlin like
* Format code in FSReader
* Format code in FSWriter
* Format code in FileSystemRecordPersister
* Format code in FileSystemPersister
* Convert BarCodeReadAllPathResolver to Object instead of Class
* Convert BarCodePathResolver to Object instead of Class
* Fix wrong control flow conversion
* Have ChannelManager delegate to an actor rather then implementing one
* update documentation
* Update multicast/src/main/kotlin/com/dropbox/flow/multicast/ChannelManager.kt
* Clean up ChannelManager's interface to make it easier to add more tests (and add them)
Main changes:
* ~`ChannelManager` no longer inherits from `StoreRealActor` but rather
delegates to one.~ - Moved to followup PR
* messages coming from the upstream were placed under `Message.Dispach`
rather than `Message`. These are the only messages accepted from outside
`ChannelManager`
* `ChannelManager` now only exposes `plusAsign`, `minusAsign` for
adding/removing channels, close for closing and send(msg, Message.Dispatch)
for upstream events
* `SharedFlowProducer` no longer has a back dependency on
`ChannelManager`, rather it accepts a `suspend (Message.Dispatch) ->
Unit`
* `ChannelManager` is now built with the upstream flow rather than a
flow factory. Given that a flow is stateless, passing in a flow that can
be re-consumed seems like the simpler API.
* New `ChannelManager` tests
* make changes to existing test minimal
* revert actor delegation to reduce PR size
* comments
* clean up tests
* Bump travis
* lint
* rename `channelManagerInbox` ->``sendUpsteamMessage`
* Fix multiple collections on Multicast
Multicast implementation had a bug where the returned flow could
not be collected multiple times as it was using the same channel
it created when was called.
This PR changes it to create per collection to avoid this issue.
I've also replaced function with a field as there
is no reason to keep creating a new one, it can be just a flow
Test: MultiplexTest#multipleCollections
Fixes: #26
* remove create function
* Cleanup StoreBuilder interface and add some documentation
* Update store/src/main/java/com/dropbox/android/external/store4/StoreBuilder.kt
Co-Authored-By: Mike Nakhimovich <digitalbuddha@users.noreply.github.com>
* A little more docs around persistence
The artifact id `store4`, so the current included example dependency line doesn't locate the library. Changing it to `store4` correctly finds the library in the local repository.