Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::Statestore::Subscriber Class Reference
Collaboration diagram for impala::Statestore::Subscriber:

Classes

struct  TopicState
 

Public Types

typedef boost::unordered_map
< TopicId, TopicState
Topics
 
typedef boost::unordered_map
< std::pair< TopicId,
TopicEntryKey >
, TopicEntry::Version
TransientEntryMap
 

Public Member Functions

 Subscriber (const SubscriberId &subscriber_id, const TUniqueId &registration_id, const TNetworkAddress &network_address, const std::vector< TTopicRegistration > &subscribed_topics)
 
const Topicssubscribed_topics () const
 
const TNetworkAddress & network_address () const
 
const SubscriberIdid () const
 
const TUniqueId & registration_id () const
 
void AddTransientUpdate (const TopicId &topic_id, const TopicEntryKey &topic_key, TopicEntry::Version version)
 
const TransientEntryMaptransient_entries () const
 
const TopicEntry::Version LastTopicVersionProcessed (const TopicId &topic_id) const
 
void SetLastTopicVersionProcessed (const TopicId &topic_id, TopicEntry::Version version)
 

Static Public Attributes

static const TopicEntry::Version TOPIC_INITIAL_VERSION = 0L
 The Version value used to initialize new Topic subscriptions for this Subscriber. More...
 

Private Attributes

const SubscriberId subscriber_id_
 
const TUniqueId registration_id_
 
const TNetworkAddress network_address_
 The location of the subscriber service that this subscriber runs. More...
 
Topics subscribed_topics_
 
TransientEntryMap transient_entries_
 

Detailed Description

The statestore-side representation of an individual subscriber client, which tracks a variety of bookkeeping information. This includes the list of subscribed topics (and whether updates to them should be deleted on failure), the list of updates made by this subscriber (in order to be able to efficiently delete them on failure), and the subscriber's ID and network location.

Definition at line 265 of file statestore.h.

Member Typedef Documentation

The set of topics subscribed to, and current state (as seen by this subscriber) of the topic.

Definition at line 281 of file statestore.h.

Map from the topic / key pair to the version of a transient update made by this subscriber.

Definition at line 302 of file statestore.h.

Constructor & Destructor Documentation

Statestore::Subscriber::Subscriber ( const SubscriberId subscriber_id,
const TUniqueId &  registration_id,
const TNetworkAddress &  network_address,
const std::vector< TTopicRegistration > &  subscribed_topics 
)

Member Function Documentation

void Statestore::Subscriber::AddTransientUpdate ( const TopicId topic_id,
const TopicEntryKey topic_key,
TopicEntry::Version  version 
)

Records the fact that an update to this topic is owned by this subscriber. The version number of the update is saved so that only those updates which are made most recently by this subscriber - and not overwritten by another subscriber - are deleted on failure. If the topic the entry belongs to is not marked as transient, no update will be recorded.

Definition at line 189 of file statestore.cc.

Referenced by impala::Statestore::SendTopicUpdate().

const SubscriberId& impala::Statestore::Subscriber::id ( ) const
inline
const Statestore::TopicEntry::Version Statestore::Subscriber::LastTopicVersionProcessed ( const TopicId topic_id) const

Returns the last version of the topic which this subscriber has successfully processed. Will never decrease.

Definition at line 199 of file statestore.cc.

Referenced by impala::Statestore::GatherTopicUpdates().

const TNetworkAddress& impala::Statestore::Subscriber::network_address ( ) const
inline
const TUniqueId& impala::Statestore::Subscriber::registration_id ( ) const
inline
void Statestore::Subscriber::SetLastTopicVersionProcessed ( const TopicId topic_id,
TopicEntry::Version  version 
)

Sets the subscriber's last processed version of the topic to the given value. This should only be set when once a subscriber has succesfully processed the given update corresponding to this version.

Definition at line 206 of file statestore.cc.

Referenced by impala::Statestore::SendTopicUpdate().

const Topics& impala::Statestore::Subscriber::subscribed_topics ( ) const
inline

Definition at line 286 of file statestore.h.

References subscribed_topics_.

Referenced by impala::Statestore::GatherTopicUpdates().

const TransientEntryMap& impala::Statestore::Subscriber::transient_entries ( ) const
inline

Definition at line 304 of file statestore.h.

References transient_entries_.

Referenced by impala::Statestore::UnregisterSubscriber().

Member Data Documentation

const TNetworkAddress impala::Statestore::Subscriber::network_address_
private

The location of the subscriber service that this subscriber runs.

Definition at line 328 of file statestore.h.

Referenced by network_address().

const TUniqueId impala::Statestore::Subscriber::registration_id_
private

Unique identifier for the current registration of this subscriber. A new registration ID is handed out every time a subscriber successfully calls RegisterSubscriber() to distinguish between distinct connections from subscribers with the same subscriber_id_.

Definition at line 325 of file statestore.h.

Referenced by registration_id().

Topics impala::Statestore::Subscriber::subscribed_topics_
private

Map of topic subscriptions to current TopicState. The the state describes whether updates on the topic are 'transient' (i.e., to be deleted upon subscriber failure) or not and contains the version number of the last update processed by this Subscriber on the topic.

Definition at line 334 of file statestore.h.

Referenced by subscribed_topics(), and Subscriber().

const SubscriberId impala::Statestore::Subscriber::subscriber_id_
private

Unique human-readable identifier for this subscriber, set by the subscriber itself on a Register call.

Definition at line 319 of file statestore.h.

Referenced by id().

const Statestore::TopicEntry::Version Statestore::Subscriber::TOPIC_INITIAL_VERSION = 0L
static

The Version value used to initialize new Topic subscriptions for this Subscriber.

Definition at line 284 of file statestore.h.

Referenced by impala::Statestore::GatherTopicUpdates(), impala::Statestore::GetMinSubscriberTopicVersion(), and Subscriber().

TransientEntryMap impala::Statestore::Subscriber::transient_entries_
private

List of updates made by this subscriber so that transient entries may be deleted on failure.

Definition at line 338 of file statestore.h.

Referenced by transient_entries().


The documentation for this class was generated from the following files: