Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
7dada20
Upgrade to Elixir 1.8
ospaarmann Aug 2, 2019
64ab24b
Update api.ex
ospaarmann Aug 3, 2019
84ee37d
Upgrade to DBConnection 2.
ospaarmann Aug 3, 2019
629c6ab
Update README.md
ospaarmann Aug 3, 2019
e35f509
Switch from Poison to Jason.
ospaarmann Aug 7, 2019
dfe7b53
Start moving connection related functionality to an Adapter module.
ospaarmann Aug 7, 2019
e3361d8
Require at least Elixir 1.7. and also test against 1.9.
ospaarmann Aug 7, 2019
d7f3caa
Remove adapter.
ospaarmann Aug 7, 2019
8c70785
Remove Retry since it is handled by DBConnection 2.
ospaarmann Aug 7, 2019
5486b5d
Add DBConnection config options.
ospaarmann Aug 7, 2019
b578931
Delete config_test.exs
ospaarmann Sep 2, 2019
f50db88
Update test_helper.exs
ospaarmann Sep 2, 2019
ded0ea3
Always use latest version of ex_doc.
ospaarmann Sep 2, 2019
dfa07df
Remove ConfigAgent.
ospaarmann Sep 2, 2019
0d9a65a
Upgrade Dgraph to 1.0.17.
ospaarmann Sep 2, 2019
7c72975
Set show_sensitive_data_on_connection_error to true when testing.
ospaarmann Sep 2, 2019
0118f45
Add tls folder to gitignore.
ospaarmann Sep 2, 2019
aca5eeb
Add docker compose file for testing with tls.
ospaarmann Sep 2, 2019
95eb584
Remove QueryStatement.
ospaarmann Sep 4, 2019
cefd906
Add key :code to Error.
ospaarmann Sep 5, 2019
31ee6b7
Rewrite protocol, keep opts in state and change how ssl configuration…
ospaarmann Sep 5, 2019
6417488
Move Error to structs file.
ospaarmann Sep 5, 2019
f82d89e
Add Result struct.
ospaarmann Sep 5, 2019
3a5c58f
Rewrite Query.
ospaarmann Sep 5, 2019
f92a2a7
Update test setup.
ospaarmann Sep 5, 2019
16bd729
Use new test setup in query test.
ospaarmann Sep 5, 2019
e98fe13
Remove default_config from Utils.
ospaarmann Sep 5, 2019
229787c
Remove dependency morphix.
ospaarmann Sep 5, 2019
d01398d
Update mix.lock
ospaarmann Sep 5, 2019
c943253
Test connection errors.
ospaarmann Sep 5, 2019
104a6b1
Add ProtocolTest and test ssl errors.
ospaarmann Sep 5, 2019
2ab83f8
Rewrite start_link in ExDgraph.
ospaarmann Sep 5, 2019
a8eadfd
Move query to ExDgraph.
ospaarmann Sep 5, 2019
1079d47
Use to_atom instead of to_existing_atom.
ospaarmann Sep 5, 2019
0fb4a64
Remove QueryStatement from Protocol.
ospaarmann Sep 5, 2019
5c48429
Return ExDgraph.Error and state from handle_prepare.
ospaarmann Sep 5, 2019
d684da8
Properly raise for query!/2.
ospaarmann Sep 5, 2019
649cc3d
Fix query tests.
ospaarmann Sep 5, 2019
fab9427
Test start/2
ospaarmann Sep 5, 2019
846ba49
Add tests for ExDgraph.start_link/1.
ospaarmann Sep 5, 2019
31c6a4d
Cleanup.
ospaarmann Sep 5, 2019
3032561
Add typespecs.
ospaarmann Sep 5, 2019
88354e3
Fix warnings.
ospaarmann Sep 5, 2019
976057d
Update docs and specs.
ospaarmann Sep 6, 2019
d635df5
Add Payload struct.
ospaarmann Sep 6, 2019
30b8dfe
Use correct types and explicit parameter names in callbacks.
ospaarmann Sep 6, 2019
72f76bf
Rewrite Operation and add alter/3 function.
ospaarmann Sep 6, 2019
3242d83
Cleanup.
ospaarmann Sep 6, 2019
6efdf07
Cleanup and add typespecs.
ospaarmann Sep 6, 2019
6534f4b
Upgrade credo.
ospaarmann Sep 6, 2019
b1faa11
Implement missing DBConnection callbacks.
ospaarmann Sep 6, 2019
e01ad16
Move query tests to separate file.
ospaarmann Sep 6, 2019
269350e
Adapt TestHelper to removal of ExDgraph.operation/2.
ospaarmann Sep 6, 2019
837cd51
Fix operation tests.
ospaarmann Sep 6, 2019
bf5068a
Add additional tests.
ospaarmann Sep 6, 2019
667cde3
Formatting.
ospaarmann Sep 6, 2019
fac80fa
Rename Result -> QueryResult.
ospaarmann Sep 10, 2019
b846b31
Pass in opts to query!/3
ospaarmann Sep 10, 2019
f8de15f
Rewrite mutations.
ospaarmann Sep 10, 2019
8ada086
Use proper alias.
ospaarmann Sep 10, 2019
ff8244f
Rename txn_context in result structs.
ospaarmann Sep 10, 2019
2711bc7
Cleanup.
ospaarmann Sep 10, 2019
5d2d1bf
Implement handle_execute for mutations.
ospaarmann Sep 10, 2019
2cbe97e
Fix mutation tests.
ospaarmann Sep 10, 2019
d67809d
Cleanup.
ospaarmann Sep 11, 2019
6f86e8d
Remove elixir_uuid as dependency.
ospaarmann Sep 11, 2019
7f87dcb
Cleanup Utils.
ospaarmann Sep 11, 2019
bc49c18
Add function query_schema/2 and query_schema!/2
ospaarmann Sep 11, 2019
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ exdgraph-*.tar

# Data directory when running Dgraph from docker-compose for test purposes
/dgraph_data

# TLS folder with certificates for testing
/tls/*
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
language: elixir

elixir:
- 1.6
- 1.7
- 1.8
- 1.9

otp_release:
- 20.0
Expand All @@ -11,6 +12,9 @@ matrix:
include:
- elixir: 1.8
otp_release: 21.2
- elixir: 1.9
otp_release:
otp_release: 22.0

cache:
directories:
Expand Down
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

- Remove retry since DBConnection 2 implements a retry mechanism.

## [0.2.0-beta.3] - 2019-07-31

- Test against Dgraph `v1.0.16`
Expand Down
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**ExDgraph is functional but I would be careful using it in production. If you want to help, please drop me a message. Any help is greatly appreciated!**

ExDgraph is a gRPC based client for the [Dgraph](https://github.com/dgraph-io/dgraph) database. It uses the [DBConnection](https://hexdocs.pm/db_connection/DBConnection.html) behaviour to support transactions and connection pooling via [Poolboy](https://github.com/devinus/poolboy). Works with Dgraph v1.0.16 (latest).
ExDgraph is a gRPC based client for the [Dgraph](https://github.com/dgraph-io/dgraph) database. It uses [DBConnection](https://hexdocs.pm/db_connection/DBConnection.html) to support transactions and connection pooling. Works with Dgraph v1.0.16 (latest).

> Dgraph is an open source, horizontally scalable and distributed graph database, providing ACID transactions, consistent replication and linearizable reads. [...] Dgraph's goal is to provide Google production level scale and throughput, with low enough latency to be serving real time user queries, over terabytes of structured data. ([Source](https://github.com/dgraph-io/dgraph))

Expand Down Expand Up @@ -62,8 +62,7 @@ Add the configuration to your respective configuration file:
config :ex_dgraph, ExDgraph,
hostname: 'localhost',
port: 9080,
pool_size: 5,
max_overflow: 1
pool_size: 5
```

And finally don't forget to add ExDgraph to the supervisor tree of your app:
Expand Down Expand Up @@ -299,7 +298,7 @@ request = ExDgraph.Api.Request.new(query: query)
{:ok, msg} = channel |> ExDgraph.Api.Dgraph.Stub.query(request)

# Parse result
json = Poison.decode!(msg.json)
json = Jason.decode!(msg.json)
```

## Using SSL
Expand All @@ -311,7 +310,6 @@ config :ex_dgraph, ExDgraph,
# default port considered to be: 9080
hostname: 'localhost',
pool_size: 5,
max_overflow: 1,
ssl: true,
cacertfile: '/path/to/MyRootCA.pem'
```
Expand All @@ -332,7 +330,6 @@ config :ex_dgraph, ExDgraph,
# default port considered to be: 9080
hostname: 'localhost',
pool_size: 5,
max_overflow: 1,
ssl: true,
cacertfile: '/path/to/MyRootCA.pem',
certfile: '/path/to/MyClient1.pem',
Expand Down
9 changes: 0 additions & 9 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,4 @@ config :ex_dgraph, ExDgraph,
# default port considered to be: 9080
hostname: 'localhost',
pool_size: 5,
max_overflow: 1,
# retry the request, in case of error - in the example below the retry will
# linearly increase the delay from 150ms following a Fibonacci pattern,
# cap the delay at 15 seconds (the value defined by the default `:timeout`
# parameter) and giving up after 3 attempts
retry_linear_backoff: [delay: 150, factor: 2, tries: 3],
enforce_struct_schema: false

# the `retry_linear_backoff` values above are also the default driver values,
# re-defined here mostly as a reminder
12 changes: 2 additions & 10 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,5 @@ config :ex_dgraph, ExDgraph,
# default port considered to be: 9080
hostname: '0.0.0.0',
pool_size: 5,
max_overflow: 1,
# retry the request, in case of error - in the example below the retry will
# linearly increase the delay from 150ms following a Fibonacci pattern,
# cap the delay at 15 seconds (the value defined by the default `:timeout`
# parameter) and giving up after 3 attempts
retry_linear_backoff: [delay: 150, factor: 2, tries: 3],
enforce_struct_schema: true

# the `retry_linear_backoff` values above are also the default driver values,
# re-defined here mostly as a reminder
enforce_struct_schema: true,
show_sensitive_data_on_connection_error: true
42 changes: 42 additions & 0 deletions docker-compose-tls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: "3.2"
services:
zero:
image: dgraph/dgraph:v1.0.17
volumes:
- type: bind
source: ./dgraph_data
target: /dgraph
volume:
nocopy: true
ports:
- 5080:5080
- 6080:6080
restart: on-failure
command: dgraph zero --my=zero:5080
server:
image: dgraph/dgraph:v1.0.17
volumes:
- type: bind
source: ./dgraph_data
target: /dgraph
volume:
nocopy: true
ports:
- 8080:8080
- 9080:9080
restart: on-failure
command: dgraph alpha --my=server:7080 --lru_mb=2048 --zero=zero:5080 --tls_dir tls
ratel:
image: dgraph/dgraph:v1.0.17
volumes:
- type: bind
source: ./dgraph_data
target: /dgraph
volume:
nocopy: true
ports:
- 8000:8000
command: dgraph-ratel

volumes:
dgraph:
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.2"
services:
zero:
image: dgraph/dgraph:v1.0.16
image: dgraph/dgraph:v1.0.17
volumes:
- type: bind
source: ./dgraph_data
Expand All @@ -14,7 +14,7 @@ services:
restart: on-failure
command: dgraph zero --my=zero:5080
server:
image: dgraph/dgraph:v1.0.16
image: dgraph/dgraph:v1.0.17
volumes:
- type: bind
source: ./dgraph_data
Expand All @@ -27,7 +27,7 @@ services:
restart: on-failure
command: dgraph alpha --my=server:7080 --lru_mb=2048 --zero=zero:5080
ratel:
image: dgraph/dgraph:v1.0.16
image: dgraph/dgraph:v1.0.17
volumes:
- type: bind
source: ./dgraph_data
Expand Down
Loading