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
8 changes: 4 additions & 4 deletions modules/concept-docs/pages/transactions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include::{version-common}@sdk:shared:partial$acid-transactions.adoc[tags=intro]

[source,php]
----
include::howtos:example$transactions-example.php[tag=create-simple,indent=0]
include::devguide:example$php/transactions-example.php[tag=create-simple,indent=0]
----

include::{version-common}@sdk:shared:partial$acid-transactions.adoc[tags=mechanics;!library-cleanup-process]
Expand All @@ -36,7 +36,7 @@ The application can use this to signal why it triggered a rollback, as so:

[source,php]
----
include::howtos:example$transactions-example.php[tag=rollback-cause,indent=0]
include::devguide:example$php/transactions-example.php[tag=rollback-cause,indent=0]
----

After a transaction is rolled back, it cannot be committed, no further operations are allowed on it, and the system will not try to automatically commit it at the end of the code block.
Expand All @@ -56,14 +56,14 @@ include::{version-common}@sdk:shared:partial$acid-transactions.adoc[tag=concurre
//
//[source,python]
//----
//include::howtos:example$transactions_example.py[tag=custom_metadata,indent=0]
//include::devguide:example$php/transactions_example.py[tag=custom_metadata,indent=0]
//----
//
//or at an individual transaction level with:
//
//[source,java]
//----
//include::howtos:example$transactions_example.py[tag=custom_metadata_per,indent=0]
//include::devguide:example$php/transactions_example.py[tag=custom_metadata_per,indent=0]
//----
//
//include::{version-common}@sdk:shared:partial$acid-transactions.adoc[tag=integrated-sdk-custom-metadata-2]
1 change: 0 additions & 1 deletion modules/devguide/examples
Submodule examples deleted from 6a59c8
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions modules/hello-world/pages/start-using-sdk.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ If you are connecting to https://docs.couchbase.com/cloud/index.html[Couchbase C

[source,php]
----
include::hello-world:example$cloud.php[tags=**]
include::devguide:example$php/cloud.php[tags=**]
----

The Couchbase Capella free tier version comes with the Travel Sample Bucket, and its Query indexes, loaded and ready.
Expand All @@ -44,7 +44,7 @@ Local Couchbase Server::
--
[source,php]
----
include::hello-world:example$start-using.php[tags=**]
include::devguide:example$php/start-using.php[tags=**]
----

As well as the PHP SDK (see below), and a running instance of Couchbase Server, you will need to load up the Travel Sample Bucket
Expand Down Expand Up @@ -164,7 +164,7 @@ Firstly, you will need to have a few `import` statements at the top of your PHP
[#imports]
[source,php]
----
include::hello-world:example$start-using.php[tag=imports]
include::devguide:example$php/start-using.php[tag=imports]
----

=== Connect
Expand Down
12 changes: 6 additions & 6 deletions modules/howtos/pages/analytics-using-sdk.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Alternatively, the query may be performed with named parameters:

[source,php]
----
include::example$analytics.php[tag=named]
include::devguide:example$php/analytics.php[tag=named]
----

NOTE: As timeouts are propagated to the server by the client, a timeout set on the client side may be used to stop the processing of a request, in order to save system resources.
Expand All @@ -80,7 +80,7 @@ Here, we set a custom, server-side timeout value:

[source,php]
----
include::example$analytics.php[tag=options]
include::devguide:example$php/analytics.php[tag=options]
----


Expand All @@ -92,7 +92,7 @@ as you will have seen when working through our xref:{version-server}@server:anal

[source,php]
----
include::example$analytics.php[tag=results]
include::devguide:example$php/analytics.php[tag=results]
----

// Move these to Error reference doc?
Expand All @@ -115,7 +115,7 @@ Here is a snippet using several items of metadata

[source,php]
----
include::example$analytics.php[tag=metadata]
include::devguide:example$php/analytics.php[tag=metadata]
----


Expand All @@ -139,13 +139,13 @@ We can then query the Dataset as normal, using the fully qualified keyspace:

[source,php]
----
include::example$analytics.php[tag=handle-collection,indent=0]
include::devguide:example$php/analytics.php[tag=handle-collection,indent=0]
----

Note that using the `CREATE DATASET` syntax we could choose any Dataset name in any Dataverse, including the default.
However the SDK supports this standard convention, allowing us to query from the Scope object:

[source,php]
----
include::example$analytics.php[tag=handle-scope,indent=0]
include::devguide:example$php/analytics.php[tag=handle-scope,indent=0]
----
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ For example, the script below:

[source,php]
----
include::example$logging.php[tag=logging, indent=0]
include::devguide:example$php/logging.php[tag=logging, indent=0]
----

...along with this `php.ini` snippet:
Expand Down
4 changes: 2 additions & 2 deletions modules/howtos/pages/concurrent-async-apis.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ you can find the default locations for other Operating Systems in our xref:https

[source,php]
----
include::example$batch.php[tag=loading]
include::devguide:example$php/batch.php[tag=loading]
----

Here we've unzipped the zip file containing the dataset and then set up the relevant number of batches,
Expand All @@ -91,7 +91,7 @@ The parent then uses `pcntl_waitpid` to wait for each child process to complete.

[source,php]
----
include::example$batch.php[tag=batching]
include::devguide:example$php/batch.php[tag=batching]
----

In the output we can see something like:
Expand Down
4 changes: 2 additions & 2 deletions modules/howtos/pages/concurrent-document-mutations.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ include::{version-common}@sdk:shared:partial$cas.adoc[tag=errors]

[source,php]
----
include::example$using-cas.php[tag=increment]
include::devguide:example$php/using-cas.php[tag=increment]
----

Sometimes more logic is needed when performing updates, for example, if a property is mutually exclusive with another property; only one or the other can exist, but not both.
Expand All @@ -28,7 +28,7 @@ include::{version-common}@sdk:shared:partial$cas.adoc[tag=locking]

[source,php]
----
include::example$using-cas.php[tag=locking]
include::devguide:example$php/using-cas.php[tag=locking]
----

The handler will unlock the item either via an explicit unlock operation ([.api]`unlock`) or implicitly via modifying the item with the correct CAS.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ include::{version-common}@sdk:shared:partial$acid-transactions.adoc[tag=creating

[source,php]
----
include::example$transactions-example.php[tag=examples,indent=0]
include::devguide:example$php/transactions-example.php[tag=examples,indent=0]
----

include::{version-common}@sdk:shared:partial$acid-transactions.adoc[tag={lambda}-ctx]
Expand All @@ -66,7 +66,7 @@ To aid troubleshooting, raise the log level on the SDK.

//[source,java]
//----
//include::example$TransactionsExample.java[tag=logging,indent=0]
//include::devguide:example$php/TransactionsExample.java[tag=logging,indent=0]
//----
//
//A failed transaction can involve dozens, even hundreds, of lines of logging, so the application may prefer to write failed transactions into a separate file.
Expand All @@ -75,7 +75,7 @@ To aid troubleshooting, raise the log level on the SDK.
//This will log all lines of any failed transactions, to `WARN` level:
//[source,java]
//----
//include::example$TransactionsExample.java[tag=config_warn,indent=0]
//include::devguide:example$php/TransactionsExample.java[tag=config_warn,indent=0]
//----
//

Expand Down Expand Up @@ -104,7 +104,7 @@ To insert a document within a transaction {lambda}, simply call `ctx.insert()`.

[source,php]
----
include::example$transactions-example.php[tag=insert,indent=0]
include::devguide:example$php/transactions-example.php[tag=insert,indent=0]
----

=== Get
Expand All @@ -113,7 +113,7 @@ From a transaction context you may get a document:

[source,php]
----
include::example$transactions-example.php[tag=get,indent=0]
include::devguide:example$php/transactions-example.php[tag=get,indent=0]
----

If the document does not exist, the transaction will fail with a `TransactionFailedException` (after rolling back any changes, of course).
Expand All @@ -122,7 +122,7 @@ Gets will "Read Your Own Writes", e.g. this will succeed:

[source,php]
----
include::example$transactions-example.php[tag=getReadOwnWrites,indent=0]
include::devguide:example$php/transactions-example.php[tag=getReadOwnWrites,indent=0]
----

=== Replace
Expand All @@ -132,7 +132,7 @@ This is necessary so the SDK can check that the document is not involved in anot

[source,php]
----
include::example$transactions-example.php[tag=replace,indent=0]
include::devguide:example$php/transactions-example.php[tag=replace,indent=0]
----

=== Remove
Expand All @@ -141,7 +141,7 @@ As with replaces, removing a document requires a `$ctx->get()` call first.

[source,php]
----
include::example$transactions-example.php[tag=remove,indent=0]
include::devguide:example$php/transactions-example.php[tag=remove,indent=0]
----

== {sqlpp} Queries
Expand All @@ -158,7 +158,7 @@ Here is an example of selecting some rows from the `travel-sample` bucket:

[source,php]
----
include::example$transactions-example.php[tag=queryExamplesSelect,indent=0]
include::devguide:example$php/transactions-example.php[tag=queryExamplesSelect,indent=0]
----

// TODO: Scope reference stuff doesn't seem to work (marked as deprecated?)
Expand All @@ -167,21 +167,21 @@ include::example$transactions-example.php[tag=queryExamplesSelect,indent=0]

// [source,php]
// ----
// include::example$transactions-example.php[tag=queryExamplesSelectScope,indent=0]
// include::devguide:example$php/transactions-example.php[tag=queryExamplesSelectScope,indent=0]
// ----

// An example using a `Scope` for an UPDATE:

// [source,php]
// ----
// include::example$transactions-example.php[tag=queryExamplesUpdate,indent=0]
// include::devguide:example$php/transactions-example.php[tag=queryExamplesUpdate,indent=0]
// ----

And an example combining `SELECT` and an `UPDATE`.

[source,php]
----
include::example$transactions-example.php[tag=queryExamplesComplex,indent=0]
include::devguide:example$php/transactions-example.php[tag=queryExamplesComplex,indent=0]
----

As you can see from the snippet above, it is possible to call regular PHP functions from the {lambda}, permitting complex logic to be performed.
Expand All @@ -192,7 +192,7 @@ This example shows inserting a document and then selecting it again:

[source,php]
----
include::example$transactions-example.php[tag=queryRYOW,indent=0]
include::devguide:example$php/transactions-example.php[tag=queryRYOW,indent=0]
----
<1> The inserted document is only staged at this point, as the transaction has not yet committed. +
Other transactions, and other non-transactional actors, will not be able to see this staged insert yet.
Expand All @@ -204,7 +204,7 @@ Query options can be provided via `TransactionQueryOptions`, which provides a su

[source,php]
----
include::example$transactions-example.php[tag=queryOptions,indent=0]
include::devguide:example$php/transactions-example.php[tag=queryOptions,indent=0]
----

.Supported Transaction Query Options
Expand Down Expand Up @@ -233,7 +233,7 @@ In this example we insert a document with a key-value operation, and read it wit

[source,php]
----
include::example$transactions-example.php[tag=queryKvMix,indent=0]
include::devguide:example$php/transactions-example.php[tag=queryKvMix,indent=0]
----

<1> The key-value insert operation is only staged, and so it is not visible to other transactions or non-transactional actors.
Expand All @@ -246,7 +246,7 @@ For example, if you want to change the level of durability which must be attaine

[source,php]
----
include::example$transactions-example.php[tag=config,indent=0]
include::devguide:example$php/transactions-example.php[tag=config,indent=0]
----

include::{version-common}@sdk:shared:partial$acid-transactions.adoc[tag=config]
Expand Down
16 changes: 8 additions & 8 deletions modules/howtos/pages/error-handling.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Transient errors -- such as those caused by resource starvation -- are best tack

[source,php]
----
include::example$errors.php[tag=retry]
include::devguide:example$php/errors.php[tag=retry]
----

== Key-Value Errors
Expand All @@ -68,7 +68,7 @@ If a particular key cannot be found it is raised as a `DocumentNotFoundException

[source,php]
----
include::example$errors.php[tag=document-not-found-exception]
include::devguide:example$php/errors.php[tag=document-not-found-exception]
----

=== Key already exists
Expand All @@ -77,14 +77,14 @@ On the other hand if the key already exists and should not (e.g. on an insert) t

[source,php]
----
include::example$errors.php[tag=key-exists-exception]
include::devguide:example$php/errors.php[tag=key-exists-exception]
----

=== Document body too large

[source,php]
----
include::example$errors.php[tag=value-too-big-exception]
include::devguide:example$php/errors.php[tag=value-too-big-exception]
----

=== Concurrency
Expand All @@ -94,7 +94,7 @@ When you get a document you automatically receive its CAS value, and when replac

[source,php]
----
include::example$errors.php[tag=cas-mismatch-exception, indent=0]
include::devguide:example$php/errors.php[tag=cas-mismatch-exception, indent=0]
----


Expand All @@ -113,7 +113,7 @@ For instance, for inserts, they can simply be retried to see if they fail on `Do

[source,scala]
----
include::example$ErrorHandling.scala[tag=insert,indent=0]
include::devguide:example$php/ErrorHandling.scala[tag=insert,indent=0]
----

That example is much closer to what an application will want to be doing. Let's flesh it out further.
Expand All @@ -123,7 +123,7 @@ The application can write wrappers so that it can easily do operations without h

[source,scala]
----
include::example$ErrorHandling.scala[tag=insert-real,indent=0]
include::devguide:example$php/ErrorHandling.scala[tag=insert-real,indent=0]
----

This will make a 'best effort' to do the insert (though its retry strategy is rather naive, and applications may want to implement a more sophisticated approach involving exponential backoff and circuit breaking.)
Expand All @@ -147,7 +147,7 @@ A SQL++ query either returns results or `QueryError`, like so:

[source,scala]
----
include::example$ErrorHandling.scala[tag=query,indent=0]
include::devguide:example$php/ErrorHandling.scala[tag=query,indent=0]
----

Analytics works in an identical fashion, raising an `AnalyticsError`.
Expand Down
Loading
Loading