Class: Graphd::ClientStub
- Inherits:
-
Object
- Object
- Graphd::ClientStub
- Defined in:
- lib/graphd/client_stub.rb
Overview
gRPC Client stub for DGraph This stub is a very thin wrapper over ‘GRPC::ClientStub`. It exists purely to provide sensible defaults relevant to DGraph like host and credentials
Instance Attribute Summary collapse
-
#stub ⇒ Object
readonly
Returns the value of attribute stub.
Instance Method Summary collapse
-
#alter(operation) ⇒ Api::Payload
Run operations that alter the DGraph db like set schema and drop_all.
-
#check_version(request) ⇒ Api::Version
Request the version of the DGraph server running on host.
-
#commit_or_abort(transaction_context:) ⇒ Api::TxnContext
Commit a mutation or abort if it fails.
-
#initialize(host = 'localhost:9080', credentials = :this_channel_is_insecure, channel_override: nil, timeout: nil, channel_args: {}) ⇒ ClientStub
constructor
Creates a new Graphd::ClientStub.
-
#query(request) ⇒ Api::Response
Query the db.
Constructor Details
#initialize(host = 'localhost:9080', credentials = :this_channel_is_insecure, channel_override: nil, timeout: nil, channel_args: {}) ⇒ ClientStub
Creates a new Graphd::ClientStub
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/graphd/client_stub.rb', line 25 def initialize( host = 'localhost:9080', credentials = :this_channel_is_insecure, channel_override: nil, timeout: nil, channel_args: {} ) @stub = Api::Dgraph::Stub.new( host, credentials, channel_override: channel_override, timeout: timeout, channel_args: channel_args ) end |
Instance Attribute Details
#stub ⇒ Object (readonly)
Returns the value of attribute stub.
11 12 13 |
# File 'lib/graphd/client_stub.rb', line 11 def stub @stub end |
Instance Method Details
#alter(operation) ⇒ Api::Payload
Run operations that alter the DGraph db like set schema and drop_all
53 54 55 |
# File 'lib/graphd/client_stub.rb', line 53 def alter(operation) @stub.alter(operation) end |
#check_version(request) ⇒ Api::Version
Request the version of the DGraph server running on host
45 46 47 |
# File 'lib/graphd/client_stub.rb', line 45 def check_version(request) @stub.check_version(request) end |
#commit_or_abort(transaction_context:) ⇒ Api::TxnContext
Commit a mutation or abort if it fails
69 70 71 |
# File 'lib/graphd/client_stub.rb', line 69 def commit_or_abort(transaction_context:) @stub.commit_or_abort(transaction_context) end |
#query(request) ⇒ Api::Response
Query the db
61 62 63 |
# File 'lib/graphd/client_stub.rb', line 61 def query(request) @stub.query(request) end |