Options for DSE Graph queries

Specifications:
Options should error out for getting/setting bad attribute
expect { options.foo }.to raise_error NameError
expect { options.foo = 7 }.to raise_error NameError
Options should support initialization with a hash of options
my_options = { graph_name: 'mygraph', junky: 'funky' }
init_options = Dse::Graph::Options.new(my_options)
expect(my_options).to eq(graph_name: 'mygraph', junky: 'funky')
expect(init_options.graph_name).to eq('mygraph')
expect(init_options.graph_source).to be_nil
expect(init_options.graph_language).to be_nil
expect(init_options.graph_read_consistency).to be_nil
expect(init_options.graph_write_consistency).to be_nil
expect(init_options.as_payload).to_not include('junky', :junky)

Inherits

Object

Methods

self.

new

(options = {})

Create an Options object.

Parameters:
Name Type Details
options Hash (defaults to: {}) optional hash containing graph options. Keys are option name symbols (e.g. :graph_name). Unset options will inherit from the defaults.

graph_name

read or write

Returns name of the targeted graph; required unless the statement is a system query.

Returns:
Type Details
String name of the targeted graph; required unless the statement is a system query.

graph_source

read or write

Returns graph traversal source (default “g”)

Returns:
Type Details
String graph traversal source (default “g”)

graph_language

read or write

Returns language used in the graph statement (default “gremlin-groovy”)

Returns:
Type Details
String language used in the graph statement (default “gremlin-groovy”)

graph_read_consistency

read or write

Returns read consistency level for graph statement. Overrides the standard statement consistency level. Defaults to ONE in the server, but the default may be configured differently.

Returns:
Type Details
Cassandra::CONSISTENCIES read consistency level for graph statement. Overrides the standard statement consistency level. Defaults to ONE in the server, but the default may be configured differently.

graph_write_consistency

read or write

Returns write consistency level for graph statement. Overrides the standard statement consistency level. Defaults to QUORUM in the server, but the default may be configured differently.

Returns:
Type Details
Cassandra::CONSISTENCIES write consistency level for graph statement. Overrides the standard statement consistency level. Defaults to QUORUM in the server, but the default may be configured differently.

timeout

read or write

Returns the timeout for graph requests

Returns:
Type Details
Numeric the timeout for graph requests

set

(key, value)

Set an option in this Dse::Graph::Options object. This is primarily used to set “expert” options that are not part of the public api and thus may change over time.

Parameters:
Name Type Details
key (String or Symbol) option to set.
value String value to set for the option.
Returns:
Type Details
Options self, thus allowing method chaining.

delete

(key)

Delete an option from this Dse::Graph::Options object.

Parameters:
Name Type Details
key (String or Symbol) option to delete.
Returns:
Type Details
nil

merge

(other)

Merge another Dse::Graph::Options object with this one to produce a new merged Dse::Graph::Options object. The “other” object’s values take precedence over this one.

Parameters:
Name Type Details
other Options Options object to merge with this one.
Returns:
Type Details
Options new Options object with the merged options.

clear

Clear the options within this Dse::Graph::Options object.

analytics?

Returns whether or not this options object is configured for the analytics graph source.

Returns:
Type Details
Boolean whether or not this options object is configured for the analytics graph source.