The congress.dse2.data_service Module¶
- 
class 
congress.dse2.data_service.DataService(service_id)¶ Bases:
objectA unit of data and business logic that interfaces with the DSE.
A DataService may publish tables, subscribe to tables, and/or expose RPCs on the DSE. DataService instances are bound to a DseNode which is used for all inter-service communication.
- Attributes:
 service_id: A unique ID of the service. _published_tables_with_subscriber: A set of tables published by self
that has subscribers
- 
add_rpc_endpoint(endpt)¶ 
- 
check_resub_all()¶ Check all subscriptions for long missing update and resubscribe.
- 
get_datasource(datasource_id)¶ 
- 
get_datasources(filter_secret=False)¶ 
- 
get_driver_info(*args)¶ 
- 
get_driver_schema(*args)¶ 
- 
get_drivers_info(*args)¶ 
- 
get_last_published_data_with_seqnum(table)¶ Method that returns the current seqnum & data for given table.
- 
get_snapshot(table)¶ Method that returns the current data for the given table.
Should be overridden.
- 
info¶ 
- 
is_valid_service(service_id)¶ 
- 
make_datasource_dict(*args, **kwargs)¶ 
- 
publish(table, data, use_snapshot=True)¶ 
- 
receive_data(publisher, table, data, is_snapshot=True)¶ Method called when publication data arrives.
Instances will override this method.
- 
receive_data_sequenced(publisher, table, data, seqnum, is_snapshot=False, receipt_time=None)¶ Method called when sequenced publication data arrives.
- 
rpc(service, action, kwargs=None, timeout=None, local=False, retry=None)¶ 
- 
rpc_endpoints()¶ Return list of RPC endpoint objects to be exposed for this service.
A DataService may include zero or more RPC endpoints to be exposed by the DseNode. Each endpoint object must be compatible with the oslo.messaging RPC Server.
- 
start()¶ Start the DataService.
This method is called by a DseNode before any RPCs are invoked.
- 
status¶ 
- 
stop()¶ Stop the DataService.
This method is called by a DseNode when the DataService instance is no longer needed. No RPCs will invoked on stopped DataServices.
- 
subscribe(service, table)¶ 
- 
subscriber_list()¶ Method that returns subscribers list.
It returns list of services subscribed to this service data.
- 
subscription_list()¶ Method that returns subscription list.
It returns list of tuple that represents the service’s subscription. The tuple forms following format: (service_id, table_name).
- 
unsubscribe(service, table)¶ 
- 
wait()¶ Wait for processing to complete.
After a call to stop(), the DataService may have some outstanding work that has not yet completed. The wait() method blocks until all DataService processing is complete.
- 
class 
congress.dse2.data_service.DataServiceEndPoints(service)¶ Bases:
object- 
get_last_published_data_with_seqnum(context, table)¶ Function called on a node when an RPC request is sent.
- 
get_snapshot(context, table)¶ Function called on a node when an RPC request is sent.
- 
ping(client_ctxt, **args)¶ Echo args
- 
 
- 
class 
congress.dse2.data_service.DataServiceInfo(service_id=None, node_id=None, published_tables=None, subscribed_tables=None, rpc_endpoints_info=None)¶ Bases:
objectMetadata for DataService on the DSE.
- Attributes:
 - service_id: The ID of the service. node_id: The ID of the node the service is running on. published_tables: List of table IDs published by this service. subscribed_tables: List of table IDs this service subscribes to. rpc_endpoints_info: List of RPC endpoints exposed by this service.
 
- 
MARSHALL_ATTRS= set([‘published_tables’, ‘subscribed_tables’, ‘service_id’, ‘rpc_endpoints_info’, ‘node_id’])¶ 
- 
classmethod 
from_dict(raw_dict)¶ 
- 
classmethod 
from_json(json_string)¶ 
- 
to_dict()¶ 
- 
to_json()¶