DATACASS-529 - Polishing.

Introduce ReactiveResultSet.availableRows() to fetch rows without transparent paging. Refactor QueryUtils to extract a Slice from an Iterable. Add slice(Query, Class) to ReactiveCassandraOperations to expose a consistent API. Convert space indentation to tab indentation. Add tests. Add since tags. Add documentation. Reformat code.

Original pull request: #128.
This commit is contained in:
Mark Paluch
2018-06-18 11:33:20 +02:00
parent d261301e9e
commit c843293fa5
13 changed files with 397 additions and 151 deletions

View File

@@ -11,8 +11,9 @@ This chapter summarizes changes and new features for each release.
* Cassandra Mapped Tuple support via `@Tuple`.
* Support for Cassandra `time` columns via `LocalTime`.
* Support for `map` columns using User-defined/converted types.
* <<cassandra.mapping-usage.events>>
* <<cassandra.mapping-usage.events>>.
* Kotlin extensions for Template API.
* Reactive Paging support through `Mono<Slice<T>>`.
[[new-features.2-0-0]]
== What's new in Spring Data for Apache Cassandra 2.0

View File

@@ -117,7 +117,7 @@ as the following example does by autowiring `PersonRepository`:
====
[source,java]
----
@RunWith(SpringJUnit4ClassRunner.class)
@RunWith(SpringRunner.class)
@ContextConfiguration
public class PersonRepositoryTests {
@@ -139,7 +139,7 @@ Cassandra repositories support paging and sorting for paginated and sorted acces
====
[source,java]
----
@RunWith(SpringJUnit4ClassRunner.class)
@RunWith(SpringRunner.class)
@ContextConfiguration
public class PersonRepositoryTests {

View File

@@ -137,6 +137,35 @@ public class PersonRepositoryTests {
----
====
Cassandra repositories support paging and sorting for paginated and sorted access to the entities. Cassandra paging requires a paging state to forward-only navigate through pages. A `Slice` keeps track of the current paging state and allows for creation of a `Pageable` to request the next page. The following example shows how to set up paging access to `Person` entities:
.Paging access to `Person` entities
====
[source,java]
----
@RunWith(SpringRunner.class)
@ContextConfiguration
public class PersonRepositoryTests {
@Autowired PersonRepository repository;
@Test
public void readsPagesCorrectly() {
Mono<Slice<Person>> firstBatch = repository.findAll(CassandraPageRequest.first(10));
Mono<Slice<Person>> nextBatch = firstBatch.flatMap(it -> repository.findAll(it.nextPageable()));
// …
}
}
----
====
The preceding example creates an application context with Spring's unit test support, which performs annotation-based
dependency injection into the test class. Inside the test cases (the test methods), we use the repository to query
the data store. We invoke the repository query method that requests all `Person` instances.
[[cassandra.reactive.repositories.features]]
== Features