Commit graph

679 commits

Author SHA1 Message Date
Claus Holst
031d92e5b4
Use AtomicFu to replace Java's AtomicBoolean and ReentrantLock (#147)
* Use AtomicFu instead of AtomicBoolean

* Use AtomicFu for ReentrantLock in KeyedSynchronizer
2020-04-10 08:38:54 -07:00
Said Tahsin Dane
d3a20e7866
Small: Remove Collections.unmodifiableMap (#145)
* Remove unnecessary Collections.unmodifiableMap since we already return a defensive copy. Also write test to verify we returns a copy

* Update cache/src/test/kotlin/com/dropbox/android/external/cache4/DefaultCacheTest.kt

Co-authored-by: Mike Nakhimovich <digitalbuddha@users.noreply.github.com>
2020-04-07 13:08:18 -04:00
Said Tahsin Dane
b9f42860ed
Remove unneeded java.util packages (#141) 2020-04-07 11:50:21 -04:00
Claus Holst
f809dc688e
Migrate Multicast to Kotlin Test (#146) 2020-04-07 11:48:04 -04:00
Mohammad Sianaki
59967d12fd Update AGP version 2020-04-06 11:07:40 -07:00
Dave Parker
d0d28a2c57 Prepare next development version. 2020-04-06 10:55:00 -07:00
Dave Parker
fc6505f2d0 Prepare for release 4.0.0-alpha04 2020-04-06 10:55:00 -07:00
Mez Pahlan
c512408a00
Rx get fresh bindings (#130)
* Add Rx returning equivalents of get and fetch convenience functions

* Add RxSingleStoreExtensionsTest.kt

Shows usage of Rx extension functions on Store.

* Fix test assertion

* Rename extension functions to match main module

* Add new line to end of files

Required by ktlint rules.

* Update public API

Adds the two new extension functions from this change set.

* Rename extension function names

Avoid confusion with extension functions from the main artefact.

* Add ExperimentalStdlibApi annotation to RxSingleStoreExtensionsTest
2020-03-18 08:14:35 -07:00
Claus Holst
ee133dc5a0
#126 [Feature Request] Migrate cache library to use kotlin.time APIs (#129)
* Migrate cache library to use kotlin.time APIs

* Fix docs and inline durations in tests

* Migrate cache library to use kotlin.time APIs

* Only require ExperimentalTime when setting cache expiration

* Set ExperimentalTime on RealStore to use it on MemoryPolicy

* Set ExperimentalTime on Cache interface and not on functions

* Avoid ExperimentalTime annotation in filesystem module

* Remove unneeded ExpirationTime annotation

* Remove unneeded ExpirationTime annotation
2020-03-16 14:29:19 -07:00
Claus Holst
a7ffc78c1f
Migrate filesystem library to use kotlin.time APIs #132 (#133)
* Migrate filesystem library to use kotlin.time APIs

* Remove usage of javax.inject
2020-03-16 08:09:16 -07:00
Claus Holst
5d5e89b13b
Use Kotlin version of ArrayDeque in ChannelManager (#134) 2020-03-16 08:08:32 -07:00
Said Tahsin Dane
b2ba3f76cb
Add asMap function to Cache for backward compat (#136)
* Add `asMap` function to Cache for backward compat

* Add API change
2020-03-16 08:03:38 -07:00
Yang
38baeb7c8b
Kotlin 1.3.70 and other dependencies updates. (#125)
* Update Kotlin, Gradle, binary-compatibility-validator, AGP, AndroidX, retrofit, okhttp, rx2.

* Replace deprecated @UseExperimental with @OptIn.

* Gradle 6.2.2.

* Update Coroutines to 1.3.4. Fix more compiler warnings.

* Update build-tools for travis.
2020-03-07 09:38:02 -05:00
Yigit Boyar
daa1c13ff7
Make SharedFlowProducer APIs safe (#121)
* MakeSharedFlowProducer APIs safe

This PR fixes a bug in SharedFlowProducer where it would not handle start being called
multiple times or cancel being called before start is completed. It could even consume
the upstream flow multiple times if start is called multiple times.

Fixes: #120
Test: SharedFlowProducerTest

* get rid of unnecessary start call
2020-02-29 10:01:53 -08:00
Amokrane Chentir
5be4e580a6
Fix dependency declaration in README (#122)
Use double quotes for string interpolation
2020-02-28 12:00:55 -08:00
Mez Pahlan
2a1c4b291a
Fix typo in RxStore (#119)
* Update KDoc for Store::observe

Refer to RxJava Flowable instead of Coroutine Flow.

* Update KDoc for StoreBuilder::withSinglePersister

The function `persister` is in a different class so we need to refer to
it by its FQN otherwise the IDE whinges at us.
2020-02-26 21:00:08 -05:00
S. Fatih Giriş
3c93b2465e
Update samples (#91) (#117)
* Convert RedditActivity, RoomActivity, and StreamActivity to fragment

* Add bottom navigation bar and icons

* Add navigation component and constraint layout dependency
2020-02-21 11:48:38 -05:00
Yang
66a3d3a071
Gradle 6.2. (#111)
* Gradle 6.2.

* Use single-threaded scheduler for test.

* Revert "Use single-threaded scheduler for test."
2020-02-19 13:14:14 -05:00
Yigit Boyar
6b1d5c1965
Ensure network starts after disk is established (#115)
* 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>
2020-02-18 19:56:37 -08:00
Mike Nakhimovich
6fec8d8924
Update README.md 2020-02-18 20:12:07 -05:00
David Chang
f6f58c42c0
Fix CodeCov by changing gradle-wrapper to 6.1 (#108)
* Revert "Fix gradle wrapper version. (#102)"

This reverts commit 7cc48b79c3.

* Update gradle-wrapper

* Update gradle-wrapper
2020-02-17 06:29:53 -05:00
Mike Nakhimovich
9111d667c5
more tests! (#106)
* 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>
2020-02-16 08:35:35 -05:00
David Chang
a44de986ac
Revert the version bump (#107)
* Revert "Prepare next development version."

This reverts commit 4397b4390d.

* Revert "Prepare for release 4.0.0-alpha04"

This reverts commit 671bfeaf26.
2020-02-15 14:04:11 -08:00
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