Commit graph

421 commits

Author SHA1 Message Date
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
ychescale9
b4c0877732 Fix a bunch of kotlin compiler warnings. (#20) 2019-12-11 09:44:45 -05:00
Mike Nakhimovich
7cb52099f6
Update README.md 2019-12-10 20:46:08 -05:00
ychescale9
1810355341 Update dependencies and clean up unused ones (#16)
* Update dependencies and clean up unused ones.

* Update okio to 2.4.1 and migrate deprecated APIs to extension functions.

* Update platform and build-tools in travis config.
2019-12-10 20:12:51 -05:00
Mike Nakhimovich
02fa6facbe
We are using travis for ci (#17) 2019-12-10 16:10:19 -05:00
Mike Nakhimovich
ff06e28697
Update readme to trigger travis build (#15)
* Update readme to trigger travis build

* fix deploy script to not refer to nytimes

* Update deploy_snapshot.sh
2019-12-10 13:48:43 -05:00
David Chang
a19a9be424 Update Travis secure variables (#18) 2019-12-10 12:43:40 -05:00
ychescale9
8ddbe3c76f Add ktlint and fix all issues. (#11) 2019-12-10 10:51:14 -05:00
David Chang
dd5a5c8a78
Merge pull request #13 from dropbox/changusmc-patch-1
Update README with Store maven gradle dependency
2019-12-09 12:59:05 -08:00
David Chang
03c7ef6267
Update README with Store maven gradle dependency 2019-12-09 12:11:19 -08:00
David Chang
93112069a5
Merge pull request #12 from changusmc/master
Update maven coordinates for Store 4
2019-12-09 11:43:26 -08:00
David Chang
dce8b865c1 Update maven coordinates for Store 4 2019-12-09 11:39:20 -08:00
Yigit Boyar
6d97c399fa move multicast to its own module (#9)
Fixes #8
2019-12-08 19:12:11 +01:00
Mike Nakhimovich
a362c33c0a
Remove parsing blurb from Readme (#4)
Store3 took a parser, store4 doesn't need to due to how easy it is to add transformations to the fetcher or reader flows
2019-12-07 00:51:29 +01:00
Mike Nakhimovich
088be08376
Update license to include Dropbox copyright (#7) 2019-12-07 00:51:17 +01:00
Mike Nakhimovich
fed4430397
Create pull_request_template.md 2019-12-07 00:49:00 +01:00
Mike Nakhimovich
1314546bb9
Update CONTRIBUTING.md 2019-12-07 00:30:10 +01:00
Mike Nakhimovich
59ab3f0889
Add not about missing maven artifact (#6)
Add how to build from source and install into local m2 repo
2019-12-07 00:19:36 +01:00
Júlio Zynger
5d6ccf8422 Fix link in README (#3)
* Fix link in README

* Oops bracket
2019-12-07 00:10:40 +01:00
Yigit Boyar
2e80c6d7df Update readme (#2)
* update readme to show new streaming APIs

* more readme fixes, styles etc

* fix version to snapshot
2019-12-06 16:59:07 +01:00
William Clausen
2cc626013d
Merge pull request #1 from yigit/google-header
add missing google copyright header
2019-12-05 15:32:52 -08:00
Yigit Boyar
1a750f54db add missing google copyright header 2019-12-06 00:28:31 +01: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
Yigit Boyar
5816adabe5 Cleanup (#62)
* add dokka for store module

move key parser to tests

* remove parser exception

* move RealStore and SourceOfTruth to internal

* move cache type to internal

* move Clearable to tests

* move fetcher to tests

* move multiplexer to internal

* move map indexed to internal
2019-12-04 09:40:29 +01:00
Yigit Boyar
b12aad7d2d
store fluent API prototype (#60)
StoreBuilder API that does not require excessive type arguments.
2019-12-02 14:30:45 -08:00
Yigit Boyar
3b44944fc5 Rename Multiplex to Multicast (#59)
Appearantly, multiplex is N to 1 while this thing is 1 to N. Yigit should consider checking what things mean before using them in code ¯\_(ツ)_/¯
2019-11-27 20:55:19 -05:00
Yigit Boyar
d5e7f196d1 faster builds (#58)
enable build cache
enable configure on demand
remove snapshot repo from repositories as we never use it
but it is very slow
2019-11-23 21:34:10 -05:00
Yigit Boyar
52aefe0094 random code cleanups (#57)
* random cleanup.

Fixed a bunch of warnings.
Moved SimplePersisterAsFlowable into tests as it is not used anymore but
FlowTest uses it.
Moved MemoryPolicyBuilder test to kotlin to make DEFAULT_POLICY a const

* massive file migration
Rename pipeline tests into impl tests
2019-11-23 14:00:34 -05:00
Yigit Boyar
c223e44d8d
Close channels w/ a suspend function. (#56)
This PR fixes a bug in StoreRealActor where we could call onClose
while actor is processing some messages. Now instead we send a token
to close and inside the message handler we close the channel so that
no new messages can arrive after close meanwhile messages that arrived
before that close is handled properly.

Also set version to 4.0.0 and cleaned up some code.

Fixes #55
2019-11-20 07:11:31 -08:00
Yigit Boyar
8347de79aa Remove suspend cache (#52)
* remove suspend cache

This PR replaces suspend cahce usages w/ direct guava cache usage.
I think we should also get rid of guava cache.
First of all it is in java so needs to be moved to kotlin at least for
future multi-platform support.
Second, it would be nicer to have something that uses kotlin's time so
that people can provide a scope w/ a delay functionality (like the
TestCoroutineScope) and also test time related stuff. An alternative might
be letting people pass a Timer in the builder

Fixes #41

* remove commented code :/
2019-11-14 07:31:07 -05:00
miken
b7a4c89cc0 uml diagram 2019-11-12 11:16:10 -05:00
Yigit Boyar
42c37d7656 Spotless integration (#51)
* apply spotless for unified code style

* configure circleci to run spotless
2019-11-09 17:02:01 -05:00
Yigit Boyar
3e84b6bdb5
Stream without persister (#48)
This PR implements piggybacking in fetch controller which means even if
upstream closes, we never close downstream flows in fetcher multiplexing.
Instead, we keep them around and if a new request comes in, they'll receive
the same data as well or even keep the upstream open.

This is implemented as a feature of multiplexer as it already has all of the
machinery to do such re-distribution of data.
It is a bit questionable behavior for multiplexer but it is already very
specific to our use case so I thought it might be fine to do it there
2019-11-09 08:18:11 -08:00
Mike Nakhimovich
1356a27975
clean up readm (#45) 2019-11-04 21:11:07 -05:00
Mike Nakhimovich
b14b307c2c
Miken/kill2 (#43)
* cleanup with no explanation

* collapse interfaces to only Store, remove parsers

* collapse interfaces to only Store, remove parsers
2019-11-03 15:06:12 -05:00
Mike Nakhimovich
ca8c957a2d
cleanup with no explanation (#42) 2019-11-03 14:53:38 -05:00