Coverage for ion/core/data/storage_configuration_utility : 91.43%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
#!/usr/bin/env python
@file ion/core/data/storage_configuration_utility.py @author David Stuebe @TODO """
# get configuration
# Defined Terms:
### PRESERVATION SERVICE TERMS
### BLOB CACHE SETUP
### COMMIT CACHE SETUP
PREDICATE_BRANCH, PREDICATE_COMMIT, OBJECT_KEY, OBJECT_BRANCH, OBJECT_COMMIT, KEYWORD, RESOURCE_LIFE_CYCLE_STATE, RESOURCE_OBJECT_TYPE]
# Common Columns:
### Build up datastructures
'validation_class':'org.apache.cassandra.db.marshal.BytesType', 'index_type':None, 'index_name':None}
'keyspace' : DEFAULT_KEYSPACE_NAME, 'name' : None, 'column_type' : 'Standard', 'comparator_type' : 'org.apache.cassandra.db.marshal.BytesType', 'subcomparator_type' : None, 'comment' : None, 'column_metadata' : None, 'default_validation_class':'org.apache.cassandra.db.marshal.BytesType', }
'name':DEFAULT_KEYSPACE_NAME, 'strategy_class':'org.apache.cassandra.locator.SimpleStrategy', #'strategy_options':'', 'replication_factor':1, 'cf_defs':None, }
# No columns to declare for indexing
### Storage Keyspace Name is provided by the sysname!!! #ion_ks = base_ks_def.copy() #ion_ks['cf_defs'] = [blob_cf, commit_cf]
### # CREATE A SINGLE EXPORTABLE DATA STRUCTURE
### This is the cassandra cluster details - do not put credentials in a config file! 'port':9160, }
''' An exception thrown due to invalid configuration of the cassandra storage '''
""" Create a copy of all the components and over ride settings based on the configuration entry for this module
'ion.core.data.storage_configuration_utility':{ 'storage provider':{'host':'ec2-184-72-14-57.us-west-1.compute.amazonaws.com','port':9160}, 'persistent archive':{'strategy_class':'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor':1,} },
"""
# Create the return value object STORAGE_PROVIDER:storage_provider.copy(), PERSISTENT_ARCHIVE:ion_ks, }
# set the storage provider information - host and port raise StorageConfigurationError('Invalid storage provider configuration: key - "%s", value - "%s"' % (k,v)) else:
# Set the values in the Key Space configuration raise StorageConfigurationError('Invalid Configuration for Persistent Archive: the name of the keyspace can not be specified in the CONF file. The sysname is always used.')
if k not in base_ks_def: raise StorageConfigurationError('Invalid keyspace configuration: key - "%s", value - "%s"' % (k,v)) else: ion_ks[k]=v
# The blob cache and the commit cache are not configurable in this object!
# update the sysname #Keyspaces cannot have hyphens in their name. Replace hyphens with underscores. raise StorageConfigurationError("storage_configuration_utility.py: no ioninit.sysname or sysname provided to get_cassandra_configuration")
# Set the keyspace name to the sysname!
|