Module: Cassie

Extended by:
Configuration::Core, ConnectionHandler
Defined in:
lib/cassie.rb,
lib/cassie/query.rb,
lib/cassie/tasks.rb,
lib/cassie/logger.rb,
lib/cassie/schema.rb,
lib/cassie/support.rb,
lib/cassie/testing.rb,
lib/cassie/version.rb,
lib/cassie/connection.rb,
lib/cassie/definition.rb,
lib/cassie/statements.rb,
lib/cassie/modification.rb,
lib/cassie/configuration.rb,
lib/cassie/instrumentation.rb,
lib/cassie/tasks/task_runner.rb,
lib/cassie/connection_handler.rb,
lib/cassie/testing/fake/query.rb,
lib/cassie/support/server_process.rb,
lib/cassie/support/system_command.rb,
lib/cassie/configuration/generator.rb,
lib/cassie/testing/fake/definition.rb,
lib/cassie/testing/fake/modification.rb

Defined Under Namespace

Modules: Configuration, Connection, ConnectionHandler, Extensions, Logger, Schema, Statements, Support, Tasks, Testing Classes: Definition, FakeDefinition, FakeModification, FakeQuery, Modification, Query

Constant Summary collapse

VERSION =
"1.0.4"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#clusterCassandra::Cluster (readonly) Originally defined in module ConnectionHandler::Cluster

The cluster connection and metadata. This cluster connection is lazy-loaded, not calling out to Cassandra until it is first accessed. The single cluster object is cached for the entire process.

Returns:

  • (Cassandra::Cluster)

    The underlying driver cluster object

#configurationHash{String,Symbol => Object} Originally defined in module Configuration::Core

The currently active configuration used for initializing new cluster connections. If none has been set, the configuration for the current #env is used from #configuration

Note: setting a #configuration value will override the #configurations attribute, rendering it useless

Returns:

  • (Hash{String,Symbol => Object})

    Hash of cassandra-driver supported cluster configuration attributes

#configurationsHash{String => [Hash]} Originally defined in module Configuration::Core

The cluster configurations available for all environments

Returns:

  • (Hash{String => [Hash]})

    Cluster configurations, keyed by environment.

#envObject Originally defined in module Configuration::Core

The currently active environment. Used to select which configuration will be used

#keyspaceObject Originally defined in module Configuration::Core

The currently selected keyspace. If no keyspace has been explicitly set, then the default :keyspace from #configuration is used.

#sessionsHash{String => Cassandra::Session} (readonly) Originally defined in module ConnectionHandler::Sessions

Sessions cache containint sessions that have been opened to the Cluster#cluster

Returns:

  • (Hash{String => Cassandra::Session})

    The underlying driver sessions, keyed by keyspaced name

Class Method Details

.cluster_configurationsHash{String => Object} Originally defined in module Configuration::Loading

Fetch cluster configurations from configuraiton file located at +paths+

Returns:

  • (Hash{String => Object})

    Configuration loaded from yml file

.instrumenterObject

Instrumentor used for notifications for events such as connecting clusters, openeing sessions, and executing queries


6
7
8
# File 'lib/cassie/instrumentation.rb', line 6

def self.instrumenter
  @instrumenter ||= ActiveSupport::Notifications
end

.keyspace_exists?(name) ⇒ Boolean Originally defined in module ConnectionHandler::Cluster

Returns indicating if the cluster has the keyspace defined

Parameters:

  • name (String, Symbol)

    The keyspace name to search for

Returns:

  • (Boolean)

    indicating if the cluster has the keyspace defined

.loggerObject

Logger used for logging by Cassandra instrumentation


31
32
33
# File 'lib/cassie.rb', line 31

def self.logger
  Logger.logger
end

.logger=(logger) ⇒ Object

Assigns a custom logger for use by Cassandra instrumentation


36
37
38
# File 'lib/cassie.rb', line 36

def self.logger=(logger)
  Logger.logger = logger
end

.pathsHash Originally defined in module Configuration::Core

Paths used for configuration loading.

Returns:

  • (Hash)
    • :cluster_configurations - The .yml file defining the configuration for your cluster for various environments.

.session(keyspace = self.keyspace) ⇒ Cassandra::Session Originally defined in module ConnectionHandler::Sessions

Fetches a session from the sessions cache. If no session has been opened to the requested keyspace a new session is created to the Cluster#cluster and cached.

Parameters:

  • keyspace (String) (defaults to: self.keyspace)

    The keyspace used for session scope. If nil, session will not be scoped (scoped to global space).

Returns:

  • (Cassandra::Session)