Commit graph

456 commits

Author SHA1 Message Date
David Chang
4397b4390d Prepare next development version. 2020-02-15 13:33:42 -08:00
David Chang
671bfeaf26 Prepare for release 4.0.0-alpha04 2020-02-15 13:31:51 -08:00
David Chang
a8cd0c98d1
Add signing capabilities to Travis (#105)
* Add signing capabilities to Travis

* Make script executable
2020-02-15 13:24:33 -08:00
Yang
8bc3c76eb1
Start tracking API binary compatibility (#97)
* Configure binary-compatibility-validator plugin.

* Generate current API dumps.

* Update CONTRUBUTON.md with instruction for updating API dumps.
2020-02-15 11:59:42 -05:00
David Chang
47bc665d78
Add code coverage badge (#103) 2020-02-14 05:59:31 -05:00
David Chang
0f2134680f Update issue templates
Updating feature request
2020-02-13 20:35:11 -08:00
Yang
7cc48b79c3
Fix gradle wrapper version. (#102) 2020-02-13 19:59:02 -08:00
Yang
3e27766dad
Fix kotlin compiler warnings in store-rx2 module. (#98) 2020-02-13 20:53:53 -05:00
David Chang
328793cc0e
Add Issue templates (#99) 2020-02-13 20:53:12 -05:00
Stefan Wärting
57d8d1c240
Fix bug where RedditConfig was not persisted properly (#101) 2020-02-13 20:46:36 -05:00
David Chang
536af1f455
Add code coverage (Jacoco) and CodeCov (#100)
* [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
2020-02-13 17:42:05 -08:00
William Clausen
091d81c3f8 Prepare next development version. 2020-02-13 11:45:07 -08:00
William Clausen
12a2600551 Prepare for release 4.0.0-alpha03 2020-02-13 11:40:22 -08:00
Mike Nakhimovich
7b7f01a439
Rxbindings (#93)
RxJava2 extensions
2020-02-12 20:36:10 -05:00
Yang
fd2219fcde
Fix ConcurrentModificationException during Cache eviction (#90)
* Fix a ConcurrentModificationException by synchronizing the accessQueue (MutableSet) before iterating over it.

* Add test to verify ConcurrentModificationException is not thrown when performing evictions concurrently.
2020-02-05 10:25:59 -05:00
David Chang
859c11c0c0 Prepare next development version. 2020-01-29 07:41:07 -08:00
David Chang
8b20e8823e Prepare for release 4.0.0-alpha02 2020-01-29 07:41:07 -08:00
Mike Nakhimovich
d125a7cf29
Update README.md 2020-01-29 10:37:14 -05:00
Yang
613a5c8296 Add support for purging all store entries (#79)
* 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.
2020-01-28 09:02:28 -08:00
Eyal Guthmann
86f7b1b060
introduce piggyback only downstreams to multicaster and fix #59 (#75)
* patched-from-yigit

* piggyback only channels

* cleanup docs and tests

* add yigit's test. piggyback now acks upstreams, pr comments

* tests names

* fix test name

* comments

* Update store/src/test/java/com/dropbox/android/external/store4/impl/FlowStoreTest.kt

Co-Authored-By: Yigit Boyar <yboyar@google.com>

* remove import

Co-authored-by: Yigit Boyar <yboyar@gmail.com>
2020-01-25 13:13:12 -08:00
Yigit Boyar
929b4c40a4 Change flow collection util to drain the flow (#64)
* 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>
2020-01-19 10:56:16 -08:00
ychescale9
ccf9a66f07 Improve README.md. (#70)
* Improve README.md.

* Fix typo, add maven central badge, remove brackets around Store version.
2020-01-18 18:06:59 -08:00
ychescale9
42effd8bd5 Add README.md for new cache module. (#72)
* Add README.md for cache module.

* Update intro.
2020-01-18 07:32:21 -08:00
ychescale9
c29ed5583d Fix an inconsistency between Store's MemoryPolicy and Cache where the default MemoryPolicy created has a maxSize of 1. (#71) 2020-01-18 09:25:05 -05:00
Eyal Guthmann
5f2fb35da9
Avoid illegal cast in RealStore.stream (#69)
* Avoid illegal cast in

* remove commented out code

* remove wildecards

* ktlint

* optimize imports

* don't print  in exception message to avoid PII leak
2020-01-17 16:29:17 -08:00
Stephen Bain
bc6c47833d added docs to MemoryPolicy.setMemorySize (#67) (#68) 2020-01-17 16:45:58 -05:00
ychescale9
7ee32a7468 Clean up build configs (#62)
* Update dependencies, clean up unused dependencies.

* Remove unused checkstyle and pmd rulesets.

* Use `plugins` block.

* Fix compiler warnings.
2020-01-13 12:43:41 -05:00
William Clausen
351f534579 Update README to reflect availability of alpha artifacts in Maven (#61) 2020-01-10 21:13:16 -05:00
William Clausen
c227221b23 Increment version for 4.0.0-alpha01 release and prep next development version (#58)
* 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>
2020-01-10 16:46:02 -05:00
Masataka Hirano
c99db1f05f Refactor README sample code (#60) 2020-01-10 11:01:56 -05:00
ychescale9
062deda898 Cache Rewrite (#49)
* 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.
2020-01-08 06:56:02 -05:00
Mike Nakhimovich
267f803db0
fix dokka, update comments, integrate persister (#56)
* fix dokka, update comments, integrate persister
2020-01-07 14:08:53 -05:00
ychescale9
0cd21be2ee Switch POM packaging format to jar for cache, filesystem and store. (#54) 2020-01-07 13:31:19 -05:00
Eyal Guthmann
54c7ad5113
Add an optional param to Multicaster to keep the fetches alive even if all downstreams are closed. (#40) 2020-01-02 13:14:18 -08:00
Andrey Beryukhov
dab29bd166 Replace Store.fetch() on fresh() methods in ReadMe (#52) 2020-01-02 14:47:08 -05:00
Yigit Boyar
8819cedc2a Properly implement multicast closing (#48)
* 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
2020-01-02 13:29:53 -05:00
ychescale9
ba3bf9fd2e Misc improvements and cleanups (#47)
* 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.
2019-12-26 13:21:52 -05:00
Fabio Collini
3b43bc6283 New sample with a ViewModel and multiple stores (#44)
* New sample with a ViewModel and multiple stores

* Fix warnings
2019-12-25 10:30:01 -05:00
Nuh Koca
14b0646202 Fix README typos (#46) 2019-12-23 12:31:37 -05:00
Yigit Boyar
1dbe5a75c2 unblock upstream when a new downstream arrives (#43)
* 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
2019-12-20 20:19:41 -05:00
Pavlos-Petros Tournaris
6827619744 [Kotlinization] Misc refactors for more Kotlin friendlier code (#37)
* 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
2019-12-18 10:36:36 -08:00
Pavlos-Petros Tournaris
8c435edca0 Simplify few things in root build.gradle (#38) 2019-12-17 14:39:08 -08:00
Eyal Guthmann
1a1eb00673 Hide use of actor in ChannelManager (#33)
* Have ChannelManager delegate to an actor rather then implementing one

* update documentation

* Update multicast/src/main/kotlin/com/dropbox/flow/multicast/ChannelManager.kt
2019-12-17 17:15:14 -05:00
Burak Eregar
a5f0a29d97 Migrate the rest of the module and remove AssertJ dependency (#32) 2019-12-16 13:04:03 -08:00
Eyal Guthmann
689812a7bb
Clean up ChannelManager's interface to make it easier to add more tests (and add some) (#29)
* 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`
2019-12-16 08:50:57 -08:00
Burak Eregar
ee30afb0c9 Implement Truth and migrate store module. (#30) 2019-12-15 16:30:34 -05:00
Yigit Boyar
2b70a2f721 Fix multiple collections on Multicast (#28)
* 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
2019-12-13 13:08:35 -05:00
Eyal Guthmann
fa10e84623
Cleanup StoreBuilder interface and add some documentation (#24)
* 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
2019-12-11 14:52:11 -08:00
David Algar
98062b155b Update Readme.md with correct artifact id (#23)
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.
2019-12-11 11:53:33 -05:00
Gert Dingenen
9f7fd1bd17 Replace Retrofit's deprecated Deferred CallAdapter with its built-in suspend support. (#22) 2019-12-11 10:51:48 -05:00