Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ in your Antora playbook.

If you are not sure the best way to update the docs, please raise a JIRA ticket with your suggestion, putting in as much information as possible.

TODO: Add in link to new JIRA.


== Notes for Docs Maintainers

The philosophy behind the Information Architecture can be found in the https://docs.couchbase.com/scala-sdk/1.8/project-docs/metadoc-about-these-sdk-docs.html[meta doc].
The philosophy behind the Information Architecture can be found in the https://docs.couchbase.com/scala-sdk/3.9/project-docs/metadoc-about-these-sdk-docs.html[meta doc].

=== Directory Structure

Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ repositories {
sourceSets {
main {
scala {
srcDirs = ['modules/hello-world/examples',
'modules/howtos/examples',
'modules/ref/examples',
'modules/ROOT/examples']
// Include the actual location of the Scala example sources that ship with the documentation.
// The previous paths pointed to now-non-existent directories, so Gradle found no source files
// and therefore appeared to "do nothing" when you ran the build.
srcDirs = ['modules/devguide/examples/scala']
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
** xref:project-docs:sdk-release-notes.adoc[Release Notes]
*** https://docs-archive.couchbase.com/home/index.html[Older Versions Archive^]
** xref:project-docs:compatibility.adoc[]
*** xref:project-docs:migrating-sdk-code-to-3.n.adoc[]
*** xref:project-docs:migrating-to-scala-3.adoc[]
// *** xref:project-docs:distributed-acid-transactions-migration-guide.adoc[]
*** xref:project-docs:third-party-integrations.adoc[]
** xref:project-docs:sdk-full-installation.adoc[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ A practical look at this -- using the `durability` parameter with mutating opera



This durability is enforced by the cluster,

// *TODO* Durability section

// Worth putting in?
Expand All @@ -181,14 +179,15 @@ The method can either be one to return the first result returned -- active or re
which is useful if a node is timing out;
or to return _all_ of the results, for client code to handle any inconsistency, or to build a consensus answer.

NOTE: Reading from replicas is not supported in the Scala 3 version of the SDK. Please see xref:project-docs:migrating-to-scala-3.adoc[Migrating to Scala 3] for guidance on these and other changes.

=== Preferred Server Group Replica Reads

IMPORTANT: Preferred Server Group Replica Reads are only accessible with the {name-sdk} working with Couchbase Server 7.6.2 or newer (Capella or self-managed), and from SDK 1.8.0.

xref:server:learn:clusters-and-availability/groups.adoc#understanding-server-group-awareness[Server Groups]
can be used to define subsets of nodes within a Couchbase cluster, which contain a complete set of vbuckets (active or replica).
As well as high availability use cases, Servre Groups can also be used to keep much traffic within the same cloud Availability Zone.
As well as high availability use cases, Server Groups can also be used to keep much traffic within the same cloud Availability Zone.

For Capella users with high data volumes, egress charges for reads from other Availability Zones (AZ) in AWS can be a significant cost.
The {name-sdk}, when making read replica requests, can make a request to a preferred Server Group --
Expand Down
9 changes: 4 additions & 5 deletions modules/devguide/examples/scala/ErrorHandling.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@

// #tag::imports[]
import java.util.concurrent.TimeUnit

import com.couchbase.client.core.error._
import com.couchbase.client.scala._
import com.couchbase.client.scala.durability._
import com.couchbase.client.scala.json._
import com.couchbase.client.scala.kv.MutationResult
import com.couchbase.client.scala.kv.{InsertOptions, MutationResult, ReplaceOptions}

import scala.concurrent.duration._
import scala.util.{Failure, Success, Try}
Expand Down Expand Up @@ -86,7 +85,7 @@ object ErrorHandling {
// #tag::cas[]
def doOperation(guard: Int = 3): Try[MutationResult] = {
collection.get("doc")
.flatMap(doc => collection.replace(doc.id, newJson, cas = doc.cas)) match {
.flatMap(doc => collection.replace(doc.id, newJson, ReplaceOptions().cas(doc.cas))) match {

case Success(value) => Success(value)

Expand All @@ -107,7 +106,7 @@ object ErrorHandling {

// #tag::insert[]
def doInsert(docId: String, json: JsonObject, guard: Int = InitialGuard): Try[String] = {
val result = collection.insert(docId, json, durability = Durability.Majority)
val result = collection.insert(docId, json, InsertOptions().durability(Durability.Majority))

result match {

Expand Down Expand Up @@ -143,7 +142,7 @@ object ErrorHandling {
json: JsonObject,
guard: Int = InitialGuard,
delay: Duration = Duration(10, TimeUnit.MILLISECONDS)): Try[String] = {
val result = collection.insert(docId, json, durability = Durability.Majority)
val result = collection.insert(docId, json, InsertOptions().durability(Durability.Majority))

result match {

Expand Down
4 changes: 2 additions & 2 deletions modules/devguide/examples/scala/Queries.scala
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ object Queries {
// ReactiveQueryResult contains a rows: Flux[QueryRow]
.flatMapMany(result => result.rowsAs[JsonObject])

// Just for example, block on the rows. This is not best practice and apps
// should generally not block.
// Just for example, block on the rows. This is not best practice and apps
// should generally not block.
val allRows: Seq[JsonObject] = rows
.doOnNext(row => println(row))
.doOnError(err => println(s"Error: $err"))
Expand Down
6 changes: 3 additions & 3 deletions modules/devguide/examples/scala/SubDocument.scala
Original file line number Diff line number Diff line change
Expand Up @@ -321,23 +321,23 @@ def cas() {
val result = collection.get("player432")
.flatMap(doc => collection.mutateIn("player432", Array(
decrement("gold", 150)
), cas = doc.cas))
), MutateInOptions().cas(doc.cas)))
// #end::cas[]
}

def durability() {
// #tag::durability[]
val result = collection.mutateIn("key", Array(
insert("name", "andy")
), durability = Durability.ClientVerified(ReplicateTo.One, PersistTo.One))
), MutateInOptions().durability(Durability.ClientVerified(ReplicateTo.One, PersistTo.One)))
// #end::durability[]
}

def syncDurability() {
// #tag::sync-durability[]
val result = collection.mutateIn("key", Array(
insert("name", "andy")
), durability = Durability.Majority)
), MutateInOptions().durability(Durability.Majority))
// #end::sync-durability[]
}

Expand Down
Loading