Commit graph

53 commits

Author SHA1 Message Date
Matt Ramotar
74bb49ddb5
Migrate to version catalogs (#561)
Signed-off-by: Matt Ramotar <mramotar@dropbox.com>
2023-07-05 18:31:37 -04:00
Matt Ramotar
fbcd34fd16
Make it easier to work with lists (#548)
* Make it possible to provide memory cache

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Format

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Add HybridCache

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Fix putList

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Enable memory cache delegation with Guava as default

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Add MutableStoreWithHybridCacheTests

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Support all cache methods

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Rename to multicache

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Refactor from list decomposition to collection decomposition

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Remove ReactiveCircus/android-emulator-runner

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Remove MemoryCache

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Update .ci_test_and_publish.yml

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Update .ci_test_and_publish.yml

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Update .ci_test_and_publish.yml

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Update .ci_test_and_publish.yml

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Format

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Prepare for release 5.0.0-beta01

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

---------

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>
2023-05-19 16:41:42 -04:00
Matt Ramotar
1d6d9c77af
Target linuxX64 (#537) 2023-03-15 16:26:14 -04:00
Matt Ramotar
022bdb782b
Remove KMMBridge (#530)
Signed-off-by: Matt Ramotar <mramotar@dropbox.com>
2023-03-05 12:11:07 -05:00
Emanuele
2cbce8ac20
Add iOS simulator support for KMM projects (#516)
Signed-off-by: Emanuele Papa <ema987@gmail.com>
2023-02-25 12:29:09 -05:00
Matt
5eff430629 Expose AtomicFU (#505)
Signed-off-by: mramotar <mramotar@dropbox.com>

Signed-off-by: mramotar <mramotar@dropbox.com>
2023-01-16 16:31:12 -05:00
Matt
ae07e0672c Clean Up (#499)
* Remove "Representation" from generics

Signed-off-by: mramotar <mramotar@dropbox.com>

* Remove "Representation" from generics

Signed-off-by: mramotar <mramotar@dropbox.com>

* Rename to Validator

Signed-off-by: mramotar <mramotar@dropbox.com>

* Add logo!

Signed-off-by: mramotar <mramotar@dropbox.com>

* Update README.md

Signed-off-by: mramotar <mramotar@dropbox.com>

* Format

Signed-off-by: mramotar <mramotar@dropbox.com>

* Update CI

Signed-off-by: Matt <mramotar@dropbox.com>

* Remove "Representation" from generics

Signed-off-by: mramotar <mramotar@dropbox.com>

* Remove "Representation" from generics

Signed-off-by: mramotar <mramotar@dropbox.com>

* Rename to Validator

Signed-off-by: mramotar <mramotar@dropbox.com>

* Add logo!

Signed-off-by: mramotar <mramotar@dropbox.com>

* Update README.md

Signed-off-by: mramotar <mramotar@dropbox.com>

* Format

Signed-off-by: mramotar <mramotar@dropbox.com>

* Rename generics

Signed-off-by: mramotar <mramotar@dropbox.com>

* Rename input to value

Signed-off-by: mramotar <mramotar@dropbox.com>

* Update README

Signed-off-by: mramotar <mramotar@dropbox.com>

* Update README

Signed-off-by: mramotar <mramotar@dropbox.com>

Signed-off-by: mramotar <mramotar@dropbox.com>
Signed-off-by: Matt <mramotar@dropbox.com>
2023-01-16 16:31:12 -05:00
Matt
1b21081986 Add Write + Conflict Resolution (#496)
* Stub Store write

Signed-off-by: mramotar <mramotar@dropbox.com>

* Format

Signed-off-by: mramotar <mramotar@dropbox.com>

* Compile

Signed-off-by: mramotar <mramotar@dropbox.com>

* Fix tests

Signed-off-by: mramotar <mramotar@dropbox.com>

* Stash M1

Signed-off-by: mramotar <mramotar@dropbox.com>

* Make Updater and Bookkeeper optional

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Add conflict resolution

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Cover simple write

Signed-off-by: Matt Ramotar <mramotar@dropbox.com>

* Add MutableStore

Signed-off-by: mramotar <mramotar@dropbox.com>

* Add RealMutableStore

Signed-off-by: mramotar <mramotar@dropbox.com>

* Update workflows

Signed-off-by: mramotar <mramotar@dropbox.com>

* Format

Signed-off-by: mramotar <mramotar@dropbox.com>

* Remove references to Market

Signed-off-by: mramotar <mramotar@dropbox.com>

* Remove Converter interface

Signed-off-by: mramotar <mramotar@dropbox.com>

* Move Converter typealias

Signed-off-by: mramotar <mramotar@dropbox.com>

* Remove Google copyright

Signed-off-by: mramotar <mramotar@dropbox.com>

* Update CHANGELOG.md

Signed-off-by: mramotar <mramotar@dropbox.com>

Signed-off-by: mramotar <mramotar@dropbox.com>
Signed-off-by: Matt Ramotar <mramotar@dropbox.com>
2023-01-16 16:31:12 -05:00
mnakhimovich
fee0bccde7 [Store5] Target Android, iOS, JVM, JS (#493)
* [Temp] Remove all modules

* Remove references to Store 4

* Update CHANGELOG

* Update README

* Add Store 5 foundation
Co-authored-by: Andre Claßen <aclassen@users.noreply.github.com>
Co-authored-by: Mike Nakhimovich <mnakhimovich@Mikes-MBP.localdomain>
2023-01-16 16:31:12 -05:00
matt-ramotar
59a20f91dd
Bump Maven publish plugin (#467)
* Bump Maven publish plugin

Signed-off-by: mramotar <mramotar@dropbox.com>

* Use Dropbox Store

Signed-off-by: mramotar <mramotar@dropbox.com>

Signed-off-by: mramotar <mramotar@dropbox.com>
2022-11-29 09:33:26 -05:00
matt-ramotar
157a2161a9
Flip coordinates (#463)
Signed-off-by: mramotar <mramotar@dropbox.com>

Signed-off-by: mramotar <mramotar@dropbox.com>
2022-11-20 11:16:52 -05:00
David Chang
bf2adbf127
Move to Maven Publish Gradle Plugin (#358)
* Move to Maven Publish Gradle Plugin

* Remove release scripts

* Update release docs
2021-12-08 12:45:33 -05:00
Rahul Sainani
bad46e13a9
Fix cache artifact id and version (#347)
Added link to the Store Readme for the latest version to avoid duplication.
2021-11-19 11:45:21 -05:00
Eyal Guthmann
e773021fec
Revert to use the old guava port cache (via jar) (#200)
* Revert to using guava port cache by depending on jar

* Apply suggestions from code review

* revert code to old cache

* clean up build.gradle

* manually remove cache4 entries that are regenerated locally because of some dirty cache?

* bump gradle

* rerun tasks

* try to deflake rx tests

* cache builder tests

* api dump

* bump ktlint to work with 1.4 features

* formatting

Co-authored-by: Mike Nakhimovich <digitalbuddha@users.noreply.github.com>
2020-09-14 14:49:34 -07:00
Yang
a0477c1ed2
Update to Kotlin 1.4.0, Coroutines 1.3.9 and revert to using Duration.INFINITE (#195)
* Update to Kotlin 1.4.0-rc and Coroutines 1.3.8-1.4.0-rc, fix type inference issues.

* Kotlin 1.4.0.

* Coroutines 1.3.9.
2020-08-14 14:17:17 -04:00
Chris Banes
9c9f70a16d
Avoid using Duration.INFINITE (#189)
It currently breaks consumers compiling with Kotlin
1.4-M3 (not sure why).

Added some TODOs to revert back to using Duration.INFINITE
once Store is compiled with Kotlin 1.4

Closes #188
2020-07-23 09:08:10 -07:00
Yang
e6158669d4
Fix a deadlock during cache eviction (#155)
* Fix a deadlock during cache eviction due to duplicate CacheEntries with different accessTime being added to accessOrder HashSet.

* Rename test.
2020-04-19 19:50:12 -04:00
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
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