Skip to content

Commit 89829df

Browse files
author
mikefero
committed
Merge branch 'master' into doc_and_stub_updates
Conflicts: README.md
2 parents 574c4fb + 360878e commit 89829df

File tree

4 files changed

+73
-15
lines changed

4 files changed

+73
-15
lines changed

.clang-format

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
BasedOnStyle: LLVM
2+
AlignAfterOpenBracket: true
3+
AlignConsecutiveAssignments: true
4+
AlignEscapedNewlinesLeft: true
5+
AlignOperands: true
6+
AlignTrailingComments: true
7+
AllowAllParametersOfDeclarationOnNextLine: true
8+
AllowShortBlocksOnASingleLine: false
9+
AllowShortCaseLabelsOnASingleLine: false
10+
AllowShortFunctionsOnASingleLine: false
11+
AllowShortIfStatementsOnASingleLine: false
12+
AllowShortLoopsOnASingleLine: false
13+
AlwaysBreakAfterDefinitionReturnType: true
14+
AlwaysBreakBeforeMultilineStrings: true
15+
BinPackArguments: true
16+
BinPackParameters: false
17+
BreakBeforeBinaryOperators: NonAssignment
18+
BreakBeforeBraces: Linux
19+
BreakBeforeTernaryOperators: false
20+
BreakConstructorInitializersBeforeComma: true
21+
ColumnLimit: 0
22+
ContinuationIndentWidth: 2
23+
Cpp11BracedListStyle: false
24+
DerivePointerAlignment: false
25+
IndentCaseLabels: false
26+
IndentWidth: 2
27+
IndentWrappedFunctionNames: false
28+
KeepEmptyLinesAtTheStartOfBlocks: false
29+
MaxEmptyLinesToKeep: 1
30+
PointerAlignment: Left
31+
SpaceAfterCStyleCast: true
32+
SpaceBeforeAssignmentOperators: true
33+
SpaceBeforeParens: ControlStatements
34+
SpaceInEmptyParentheses: false
35+
SpacesBeforeTrailingComments: 1
36+
SpacesInCStyleCastParentheses: false
37+
SpacesInContainerLiterals: false
38+
SpacesInParentheses: false
39+
TabWidth: 2
40+
UseTab: Never

CONTRIBUTING.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,24 @@ help the maintainer to fix the bug that you've discovered quicker:
1414
* Write a failing test. The PHP Driver uses [PHPUnit test framework](https://phpunit.de/). A reliably
1515
failing test is the fastest way to demonstrate and fix a problem.
1616

17-
## Pull Requests
17+
## Pull requests
1818

1919
If you're able to fix a bug yourself, you can [fork the repository](https://help.github.com/articles/fork-a-repo/) and [submit a pull request](https://help.github.com/articles/using-pull-requests/) with the fix.
2020

2121
To protect DataStax and the community, all contributors are required to [sign the DataStax Contribution License Agreement](http://cla.datastax.com/). The process is completely electronic and should only take a few minutes.
22+
23+
## Style guide
24+
25+
There are 2 distinct coding styles used in the repository. Depending on which part of the codebase you're going to touch, you need to follow one or the other.
26+
27+
### PHP coding style
28+
29+
The API stubs provided by the extension are following [the Symfony 2 coding standard](http://symfony.com/doc/current/contributing/code/standards.html). The only exception are empty method stubs, those have opening and closing brace following the closing parenthesis on the same line.
30+
31+
### C coding style
32+
33+
The main difference here is the spacing, the C code uses 2 spaces for indendation, while the PHP code - 4. For your convenience, a `.clang-format` file is available in the repository's root directory. Using `clang-format`, you can format source files to match the coding style almost completely:
34+
35+
```bash
36+
clang-format -style=file -i ext/php_cassandra.c
37+
```

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ upcoming releases.
2222

2323
## What's new in v1.0.0.beta:
2424

25-
* Persistent sessions.
25+
* [Persistent sessions](http://datastax.github.io/php-driver/features/#persistent-sessions).
2626
* Windows support.
2727
* Configurable logger (file/syslog and level).
28-
* Math functions for numeric types and `Cassandra\Numeric` interface.
28+
* Math functions for numeric types and [`Cassandra\Numeric`](http://datastax.github.io/php-driver/api/interface/Cassandra/Numeric/) interface.
2929
* All classes moved into the extension.
3030
* Upgraded to use the C/C++ driver v2.0.
3131
* Added stub files for IDEs.
@@ -79,8 +79,8 @@ __NOTE__: Apache Cassandra 2.1 support is limited to the Cassandra 2.0 API (nati
7979

8080
The DataStax PHP Driver uses the amazing [Behat Framework](http://docs.behat.org/)
8181
for both end-to-end, or acceptance, testing and documentation. All of the features
82-
supported by the driver have appropriate acceptance tests with easy-to-copy code
83-
examples in the `features/` directory.
82+
supported by the driver have appropriate acceptance tests with [easy-to-copy code
83+
examples in the `features/` directory](https://github.com/datastax/php-driver/tree/master/features).
8484

8585
## Running tests
8686

features/README.md

+12-10
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
### Specifying addresses of Cassandra nodes
66

7-
[`withContactPoints()`](http://datastax.github.io/php-driver/api/class/Cassandra/Cluster/Builder/#with-contact-points) and [`withPort()`](http://datastax.github.io/php-driver/api/class/Cassandra/Cluster/Builder/#with-port) methods of the [`Cassandra\Cluster\Builder`](http://datastax.github.io/php-driver/api/class/Cassandra/Cluster/Builder/) are used to specify ip addresses or hostnames and port number of the nodes in a given Cassandra cluster.
7+
[`withContactPoints()`](http://datastax.github.io/php-driver/api/class/Cassandra/Cluster/Builder/#with-contact-points) and [`withPort()`](http://datastax.github.io/php-driver/api/class/Cassandra/Cluster/Builder/#with-port) methods of the [`Cassandra\Cluster\Builder`](http://datastax.github.io/php-driver/api/class/Cassandra/Cluster/Builder/) are used to specify IP addresses or hostnames and port number of the nodes in a given Cassandra cluster.
88

9-
Note that you don't have to specify the addresses of all hosts in your cluster. Once the driver has established a connection to any host, it will perform auto-discovery of and connect to all hosts in the cluster.
9+
Note that you don't have to specify the addresses of all hosts in your cluster. Once the driver has established a connection to any host, it will perform auto-discovery and connect to all hosts in the cluster.
1010

1111
```php
1212
<?php
@@ -20,7 +20,7 @@ $session = $cluster->connect();
2020

2121
### Discovering nodes in the cluster
2222

23-
After the initial connection to one of the hosts specified via `withContactPoints()` succeeded, the driver discovers the addresses and connects to all members of the cluster automatically. You can also see the nodes that the driver discovered by running `SELECT * FROM system.peers`.
23+
After the initial connection to one of the hosts specified via `withContactPoints()` succeeds, the driver discovers the addresses and connects to all members of the cluster automatically. You can also see the nodes that the driver discovered by running `SELECT * FROM system.peers`.
2424

2525
### Persistent sessions
2626

@@ -43,9 +43,9 @@ Persistent sessions stay alive for the duration of the parent process, typically
4343

4444
### Configuring load balancing policy
4545

46-
PHP Driver comes with a variety of load balancing policies. By default it uses a combination of token aware data center round robin.
46+
The PHP Driver comes with a variety of load balancing policies. By default it uses a combination of token aware data center round robin.
4747

48-
The token aware load balancing policy uses the same hashing algorithms as the Apache Cassandra to route prepared statements execution directly to replica nodes, avoiding an additional network hop to/from the coordinator. You can toggle its usage with [`Cassandra\Cluster\Builder::withTokenAwareRouting()`](http://datastax.github.io/php-driver/api/class/Cassandra/Cluster/Builder/#with-token-aware-routing).
48+
The token aware load balancing policy uses the same hashing algorithms as the Apache Cassandra to directly route the execution of prepared statements to the replica node, avoiding an additional network hop to/from the coordinator. You can toggle its usage with [`Cassandra\Cluster\Builder::withTokenAwareRouting()`](http://datastax.github.io/php-driver/api/class/Cassandra/Cluster/Builder/#with-token-aware-routing).
4949

5050
```php
5151
<?php
@@ -141,9 +141,9 @@ $session->execute(
141141

142142
For frequently executed queries, it's strongly recommended to use prepared statements. As a rule of thumb, if your application is sending a request more than once, a prepared statement is almost always the right choice.
143143

144-
### Prepared Statements
144+
### Prepared statements
145145

146-
The driver supports prepared statements. Use [`Cassandra\Session::prepare()`](http://datastax.github.io/php-driver/api/interface/Cassandra/Session/#prepare) to create a [`Cassandra\PreparedStatement` object](http://datastax.github.io/php-driver/api/class/Cassandra/PreparedStatement/), and then call [`Cassandra\Session::execute()`](http://datastax.github.io/php-driver/api/interface/Cassandra/Session/#execute).
146+
The driver supports prepared statements. Use [`Cassandra\Session::prepare()`](http://datastax.github.io/php-driver/api/interface/Cassandra/Session/#prepare) to create a [`Cassandra\PreparedStatement`](http://datastax.github.io/php-driver/api/class/Cassandra/PreparedStatement/) object, and then call [`Cassandra\Session::execute()`](http://datastax.github.io/php-driver/api/interface/Cassandra/Session/#execute).
147147

148148
```php
149149
<?php
@@ -159,7 +159,7 @@ A prepared statement can be run many times, but the CQL parsing will only be don
159159

160160
### Executing statements in parallel
161161

162-
With fully asynchronous api, it is very easy to run queries in parallel:
162+
With fully asynchronous API, it is very easy to run queries in parallel:
163163

164164
```php
165165
<?php
@@ -347,7 +347,9 @@ cassandra.log=syslog
347347
cassandra.log_level=INFO
348348
```
349349

350-
You can specify any file path as `cassandra.log`. The special value `syslog` can be used to for the driver to use syslog for logging.
350+
You can specify any file path as `cassandra.log`.
351+
352+
The special value `syslog` can be used to for the driver to use syslog for logging. Syslog is only supported on \*nix systems.
351353

352354
The possible log levels are:
353355

@@ -364,6 +366,6 @@ Most of the logging will be when the driver connects and discovers new nodes, wh
364366

365367
The PHP Driver follows the architecture of [the C/C++ Driver](http://datastax.github.io/cpp-driver/topics/#architecture) that it wraps.
366368

367-
### Persistent Sessions
369+
### Persistent sessions
368370

369371
By default, the driver uses persistent sessions to prevent each request from creating completely new TCP connections to a Cassandra cluster. You can toggle this functionality using [`Cassandra\Cluster\Builder::withPersistentSessions`](http://datastax.github.io/php-driver/api/class/Cassandra/Cluster/Builder/#with-persistent-sessions)

0 commit comments

Comments
 (0)