* Ensure network starts after disk is established
This PR fixes a bug in the ordering where if disk is skipped and network
is super fast, there is a tiny chance that we wouldn't latch onto source
of truth before triggering network and that would make SourceOfTruth think
that the value was written to disk before it observed, hence become a disk
value rather than fetcher.
This PR ensures that we unlock the network only after we establish a position
in the disk read queue so that we'll know the fetcher value came afterwards.
Fixes: 114
Test: RxSingleStoreTest
* Apply suggestions from code review
* move network unlock to disk flow setup for clarity
Co-authored-by: Mike Nakhimovich <digitalbuddha@users.noreply.github.com>
* more tests!
* Start tracking API binary compatibility (#97)
* Configure binary-compatibility-validator plugin.
* Generate current API dumps.
* Update CONTRUBUTON.md with instruction for updating API dumps.
* ktlint fix
* newlines
* put fs eraser back in
* more tests!
* ktlint fix
* newlines
* put fs eraser back in
* run api checks
* lint
* lint
Co-authored-by: Yang <ychescale9@gmail.com>
* Revert "Prepare next development version."
This reverts commit 4397b4390d.
* Revert "Prepare for release 4.0.0-alpha04"
This reverts commit 671bfeaf26.
* [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