Commit graph

35 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
ychescale9
0cd21be2ee Switch POM packaging format to jar for cache, filesystem and store. (#54) 2020-01-07 13:31:19 -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
David Chang
dce8b865c1 Update maven coordinates for Store 4 2019-12-09 11:39:20 -08:00
Mike Nakhimovich
4fa9c252b6
rename package from nytimes to dropbox (#63)
* rename package from nytimes to dropbox

* Update build.gradle

Co-Authored-By: David Chang <changd@gmail.com>
2019-12-05 19:52:47 +01:00
DigitalBuddha
2d3596e4bb fixing tests 2019-02-10 19:23:00 -05:00
ychescale9
59f9c68342 Update SDK, build tools, gradle, AGP, Kotlin, and library dependencies. (#371)
* Update SDK, build tools, gradle, AGP, Kotlin, and library dependencies.

* Update travis config with new SDK version.
2019-01-07 15:05:05 +01:00
Jorge Antonio Díaz-Benito Soriano
d26d50a5b6 Remove unnecessary Android-specific stuff (#319) 2018-05-03 09:39:37 -04:00
Jorge Antonio Díaz-Benito Soriano
dac878e2ce Gradle updates (#266)
* Gradle Wrapper (all) 3.3 -> 4.1

* Gradle plugin for Android 2.3.2 -> 3.0.0-beta2

This requires upgrading the errorprone plugin to 0.0.11. Also, see
https://stackoverflow.com/questions/44196672/aapt2-compile-failed-invalid-dimen-on-android-3-0-canary-1

gradle plugin

* SDK Build Tools 25.0.2 -> 26.0.1

* Remove retrolambda

* Log error from subscription on PersistingStoreActivity for consistency

* Update dependency inclusion directives to those of the 3.0 plugin

Also, jsr305 and javax usages have been taken from compile to compileOnly
since they are not required beyond.

* Add dependencies that previously were resolved through leaked ones from other artifacts

Now dependency leaks are eliminated thanks to 'implementation' from the 3.0 version of the gradle plugin.

* Remove coupling between middlewares and cache

* Replace mockito-all by mockito-core

mockito-all causes problems related to hamcrest when used with JUnit. See
https://tedvinke.wordpress.com/2013/12/17/mixing-junit-hamcrest-and-mockito-explaining-nosuchmethoderror/

* Remove unused dependency.

* Build Tools 26.0.1 on Travis

* Suppress PMD.AvoidThrowingNullPointerException for the time being

* Avoid PMD synthetic accessor warning
2017-08-17 13:48:12 -04:00
Ramona Harrison
982f3baa09 Prepare for release 3.0.0-beta. 2017-07-26 11:31:30 -04:00
Ramona Harrison
047fbf3615 Prepare for release 3.0.0-alpha. 2017-05-23 18:15:13 -04:00
Ramona Harrison
8b4b186aaf Refactor package name to store3 for the Rx2 branch (#220)
* Refactor package name to store3 for the Rx2 branch

* Fix cache autoimports

* Fix LocalCache imports
2017-05-23 13:27:32 -04:00
Ramona Harrison
2c2872504b Include develop changes in Rx2 branch (#214)
* Update README.md

* Update README.md

* Update README.md (#175)

* Update README.md

* Close source after  write to filesystem

* Refactor FSFileTest to rx2 package

* remove null check on source and annotate arg with NonNull

* Standardize store.stream() to only emit new items

* Standardize store.stream() to only emit new items

* Remove unneeded call to asObservable()

* Update README.md

* Update README.md

* Fixed PMD violation God Class for RealInternalStore (#179)

* Update README.md

* Fixing dependency importation typo (#186)

* Mike/test (#195)

* new test

* Refactor NoNetworkTest to rx2 package

* Typo fixed (#202)

* Typo fixed

* Simplified by removing generics

* Update build.gradle (#193)

rename app id for sample app

* Add a missing Source.close() call (#200)

* Add Retrolambda plugin on the rest modules (#205)

* Add Retrolambda plugin on the rest modules and modify sample app for new config

* Suppress PMD violation on equals()

* Add Raw to BufferedSource transformer (#198)

* expireAfterAccess added to MemoryPolicy (#199)

* Add test coverage for MemoryPolicyBuilder (#210)

* Add test coverage for MemoryPolicyBuilder

* Checkstyle new line at EOF

* Fix PMD

* Refactor MemoryPolicyBuilderTest to rx2 package

* Deprecate setExpireAfter and getExpireAfter (#211)
2017-05-19 10:25:04 -04:00
digitalbuddha
f804983b93 Prepare for release 2.0.0. 2017-02-13 11:37:12 -05:00
Mike Nakhimovich
631956cb52 Update Readme.md 2017-02-10 15:07:22 -05:00
Mike Nakhimovich
22a524cd31 Update Readme.md 2017-02-10 15:06:04 -05:00
Mike Nakhimovich
6e93dbf574 Update Readme.md 2017-02-10 15:05:43 -05:00
Mike Nakhimovich
e8e9b9f432 Create Readme.md 2017-02-10 15:04:04 -05:00
Paul Woitaschek
62c7ca39d7 Cleanup (#127)
* Fixed a race condition that would appear when the read was called but not immediately subscribed to. Defer the whole file check till subscription.

* Diamonds

* General cleanup, missing nullity annotations, missing override annotations

* More key naming conventions

* Dependency update

* More key naming conventions

* Parser, not func

* Name outer key different so cache can be evicted correctly

* Another missing override
2017-02-09 13:04:07 -08:00
Plummer
405a15d3b6 start of conversion to javax.annotations 2017-01-30 17:46:05 -05:00
Brian Plummer
be5ba6443a convert store to java, #83 (#85)
convert store to java, #83
2017-01-28 20:52:55 -05:00
Paul Woitaschek
15402e7efe Made future stuff typesafe by not ignoring generics 2017-01-20 15:58:40 +01:00
Paul Woitaschek
b700fc2868 Added missing nonnull and override annotations 2017-01-20 15:52:29 +01:00
Maksim Moiseikin
17987bf15f Add Nullability Annotations (#52) 2017-01-12 05:48:25 -05:00
Brian Plummer
eaa4219dd7 start of checkstyle inclusion... (#48)
* start of checkstyle inclusion

* checkstyle!
2017-01-11 10:04:44 -05:00
digitalbuddha
9badd11494 initial 2017-01-04 14:17:53 -05:00