0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Hypertable::OperationSetState Class Reference

Carries out a set variables operation. More...

#include <OperationSetState.h>

Inheritance diagram for Hypertable::OperationSetState:
Inheritance graph
[legend]
Collaboration diagram for Hypertable::OperationSetState:
Collaboration graph
[legend]

Public Member Functions

 OperationSetState (ContextPtr &context)
 Constructor. More...
 
 OperationSetState (ContextPtr &context, const MetaLog::EntityHeader &header_)
 Constructor. More...
 
 OperationSetState (ContextPtr &context, EventPtr &event)
 Constructor. More...
 
virtual ~OperationSetState ()
 Destructor. More...
 
void execute () override
 Executes "set state" operation. More...
 
const String name () override
 Returns operation name (OperationSetState) More...
 
const String label () override
 Returns textual string describing operation plus state. More...
 
void display_state (std::ostream &os) override
 Displays textual representation of object state. More...
 
uint8_t encoding_version_state () const override
 Returns version of encoding format of state. More...
 
size_t encoded_length_state () const override
 Returns length of encoded state. More...
 
void encode_state (uint8_t **bufp) const override
 Encodes operation state. More...
 
void decode_state (uint8_t version, const uint8_t **bufp, size_t *remainp) override
 Decodes operation state. More...
 
void decode_state_old (uint8_t version, const uint8_t **bufp, size_t *remainp) override
 
- Public Member Functions inherited from Hypertable::Operation
 Operation (ContextPtr &context, int32_t type)
 Constructor with operation type specifier. More...
 
 Operation (ContextPtr &context, EventPtr &event, int32_t type)
 Constructor with request Event and operation type specifier. More...
 
 Operation (ContextPtr &context, const MetaLog::EntityHeader &header_)
 Constructor with MetaLog::EntityHeader. More...
 
virtual ~Operation ()
 Destructor. More...
 
virtual const String graphviz_label ()
 Human readable operation label used in graphviz output. More...
 
virtual bool exclusive ()
 Indicates if operation is exclusive. More...
 
virtual size_t encoded_result_length () const
 Length of encoded operation result. More...
 
virtual void encode_result (uint8_t **bufp) const
 Encode operation result. More...
 
virtual void decode_result (const uint8_t **bufp, size_t *remainp)
 Decode operation result. More...
 
void decode (const uint8_t **bufp, size_t *remainp, uint16_t definition_version) override
 Decode operation. More...
 
void display (std::ostream &os) override
 Write human readable string represenation of operation to output stream. More...
 
int64_t id ()
 Operation identifier. More...
 
ClockT::time_point expiration_time ()
 Returns operation expiration time. More...
 
void set_remove_approval_mask (uint16_t mask)
 Sets the remove approvals bit mask. More...
 
uint16_t get_remove_approval_mask ()
 Gets the remove approvals bit mask. More...
 
bool remove_approval_add (uint16_t approval)
 Sets remove approval bits. More...
 
bool removal_approved ()
 Checks if all remove approvals have been received. More...
 
void record_state (std::vector< MetaLog::EntityPtr > &additional)
 Records operation state and additional entities to the MML. More...
 
void record_state ()
 Records operation state to the MML. More...
 
void complete_error (int error, const String &msg, std::vector< MetaLog::EntityPtr > &additional)
 Completes operation with error. More...
 
void complete_error (int error, const String &msg, MetaLog::EntityPtr additional=MetaLog::EntityPtr())
 Completes operation with error. More...
 
void complete_error (Exception &e, std::vector< MetaLog::EntityPtr > &additional)
 Completes operation with exception. More...
 
void complete_error (Exception &e, MetaLog::EntityPtr additional=MetaLog::EntityPtr())
 Completes operation with exception. More...
 
void complete_ok (std::vector< MetaLog::EntityPtr > &additional)
 
void complete_ok (MetaLog::EntityPtr additional=MetaLog::EntityPtr())
 
virtual int64_t hash_code () const
 
virtual void exclusivities (DependencySet &exclusivities)
 
virtual void dependencies (DependencySet &dependencies)
 
virtual void obstructions (DependencySet &obstructions)
 
void add_exclusivity (const String &exclusivity)
 
void add_dependency (const String &dependency)
 
void add_obstruction (const String &obstruction)
 
void add_obstruction_permanent (const String &obstruction)
 
void fetch_sub_operations (std::vector< std::shared_ptr< Operation > > &sub_ops)
 
void pre_run ()
 
void post_run ()
 
int32_t get_state ()
 
void set_state (int32_t state)
 
virtual bool is_perpetual ()
 
bool block ()
 
bool unblock ()
 
bool is_blocked ()
 
bool is_complete ()
 
int32_t get_original_type ()
 
void set_original_type (int32_t original_type)
 
void set_ephemeral ()
 Sets the ephemeral flag to true. More...
 
bool ephemeral ()
 Gets the ephemeral flag. More...
 
int32_t get_error ()
 Get error code. More...
 
String get_error_msg ()
 Get error message. More...
 
- Public Member Functions inherited from Hypertable::MetaLog::Entity
 Entity (int32_t type)
 Constructor from entity type. More...
 
 Entity (const EntityHeader &header_)
 Constructor from entity header. More...
 
virtual ~Entity ()
 Destructor. More...
 
void lock ()
 Locks the entity's mutex. More...
 
void unlock ()
 Unlocks the entity's mutex. More...
 
void mark_for_removal ()
 Marks entity for removal. More...
 
bool marked_for_removal ()
 Checks if entity is marked for removal. More...
 
int64_t id () const
 Returns the entity ID. More...
 
- Public Member Functions inherited from Hypertable::Serializable
virtual size_t encoded_length () const
 Returns serialized object length. More...
 
virtual void encode (uint8_t **bufp) const
 Writes serialized representation of object to a buffer. More...
 
virtual void decode (const uint8_t **bufp, size_t *remainp)
 Reads serialized representation of object from a buffer. More...
 

Private Member Functions

void initialize_dependencies ()
 Initializes operation dependencies. More...
 

Private Attributes

Lib::Master::Request::Parameters::SetState m_params
 Request parmaeters. More...
 
uint64_t m_generation
 Generation number of system state variables (m_specs)a. More...
 
std::vector< SystemVariable::Specm_specs
 Current system state variables. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Hypertable::Operation
uint8_t encoding_version () const override
 Returns encoding version. More...
 
size_t encoded_length_internal () const override
 Returns internal serialized length. More...
 
void encode_internal (uint8_t **bufp) const override
 Writes serialized representation of object to a buffer. More...
 
void decode_internal (uint8_t version, const uint8_t **bufp, size_t *remainp) override
 Reads serialized representation of object from a buffer. More...
 
void decode_old (const uint8_t **bufp, size_t *remainp, uint16_t definition_version)
 
bool validate_subops ()
 Handles the results of sub operations. More...
 
void stage_subop (std::shared_ptr< Operation > operation)
 Stages a sub operation for execution. More...
 
- Protected Member Functions inherited from Hypertable::MetaLog::Entity
void encode_entry (uint8_t **bufp)
 Encodes entity header plus serialized state. More...
 
- Protected Attributes inherited from Hypertable::Operation
ContextPtr m_context
 Pointer to Master context. More...
 
EventPtr m_event
 Pointer to client event (if any) that originated the operation. More...
 
uint16_t m_remove_approvals {}
 Remove approvals received. More...
 
uint16_t m_remove_approval_mask {}
 Remove approval mask. More...
 
int32_t m_original_type {}
 Original entity type read from MML (prior to conversion) More...
 
int32_t m_error {}
 Result error code. More...
 
String m_error_msg
 Result error message. More...
 
bool m_unblock_on_exit {}
 Flag to signal operation to be unblocked on exit (post_run()) More...
 
bool m_blocked {}
 Flag indicating if operation is blocked. More...
 
bool m_ephemeral {}
 Indicates if operation is ephemeral and does not get persisted to MML. More...
 
ClockT::time_point m_expiration_time
 Expiration time (used by ResponseManager) More...
 
int64_t m_hash_code
 Hash code uniqely identifying operation. More...
 
DependencySet m_exclusivities
 Set of exclusivities. More...
 
DependencySet m_dependencies
 Set of dependencies. More...
 
DependencySet m_obstructions
 Set of obstructions. More...
 
DependencySet m_obstructions_permanent
 Set of permanent obstructions. More...
 
std::vector< int64_t > m_sub_ops
 Vector of sub operations IDs. More...
 
- Protected Attributes inherited from Hypertable::MetaLog::Entity
std::mutex m_mutex
 Mutex for serializing access to members More...
 
EntityHeader header
 Entity header More...
 

Detailed Description

Carries out a set variables operation.

Definition at line 44 of file OperationSetState.h.

Constructor & Destructor Documentation

OperationSetState::OperationSetState ( ContextPtr context)

Constructor.

This constructor is used to create a SetState operation that is the result of an automated condition change. Creating an object with this constructor should be done after SystemState::auto_set() is called and returns true. Sets exclusivity "SET VARIABLES".

Parameters
contextMaster context

Definition at line 48 of file OperationSetState.cc.

OperationSetState::OperationSetState ( ContextPtr context,
const MetaLog::EntityHeader header_ 
)

Constructor.

This constructor is used to create a SetState operation from a Metalog (MML) entry.

Parameters
contextMaster context
header_MML entity header

Definition at line 53 of file OperationSetState.cc.

OperationSetState::OperationSetState ( ContextPtr context,
EventPtr event 
)

Constructor.

This constructor is used to create a SetState operation from a client request event. It decodes the request, which populates the m_specs vector, and then calls SystemState::admin_set() passing in m_specs. Sets exclusivity "SET VARIABLES".

Parameters
contextMaster context
eventReference to event object

Definition at line 58 of file OperationSetState.cc.

virtual Hypertable::OperationSetState::~OperationSetState ( )
inlinevirtual

Destructor.

Definition at line 75 of file OperationSetState.h.

Member Function Documentation

void OperationSetState::decode_state ( uint8_t  version,
const uint8_t **  bufp,
size_t *  remainp 
)
overridevirtual

Decodes operation state.

See encode_state() for format description.

Parameters
versionEncoding version
bufpAddress of destination buffer pointer (advanced by call)
remainpAddress of integer holding amount of remaining buffer

Implements Hypertable::Operation.

Definition at line 192 of file OperationSetState.cc.

void OperationSetState::decode_state_old ( uint8_t  version,
const uint8_t **  bufp,
size_t *  remainp 
)
overridevirtual

Implements Hypertable::Operation.

Definition at line 203 of file OperationSetState.cc.

void OperationSetState::display_state ( std::ostream &  os)
overridevirtual

Displays textual representation of object state.

This method prints each variable and value in m_specs vector.

Implements Hypertable::Operation.

Definition at line 162 of file OperationSetState.cc.

void OperationSetState::encode_state ( uint8_t **  bufp) const
overridevirtual

Encodes operation state.

This method encodes the operation state formatted as follows:

  Format version number
  System state generation number
  Number of variable specs to follow
  foreach variable spec {
    variable code
    variable value
  }
  Client originated flag
Parameters
bufpAddress of destination buffer pointer (advanced by call)

Implements Hypertable::Operation.

Definition at line 184 of file OperationSetState.cc.

size_t OperationSetState::encoded_length_state ( ) const
overridevirtual

Returns length of encoded state.

Implements Hypertable::Operation.

Definition at line 177 of file OperationSetState.cc.

uint8_t OperationSetState::encoding_version_state ( ) const
overridevirtual

Returns version of encoding format of state.

This is method returns the version of the encoding format of the state.

Returns
Version of encoding format of state.

Implements Hypertable::Operation.

Definition at line 173 of file OperationSetState.cc.

void OperationSetState::execute ( )
overridevirtual

Executes "set state" operation.

This method transitions through the following states:

State Description
INITIAL
  • Fetches and delivers admin notifications from the SystemState object
  • Fetches the variables specs with a call to SystemState::get()
  • Transitions to the STARTED state
  • Persists operation and the SystemState object in the MML
STARTED
  • Variable specs obtained in the INITIAL state are passed to all range servers via a call to RangeServer::set_state().
  • Transitions to the COMPLETED state

Implements Hypertable::Operation.

Definition at line 93 of file OperationSetState.cc.

void Hypertable::OperationSetState::initialize_dependencies ( )
private

Initializes operation dependencies.

This method initializes the operation dependencies which include:

  • exclusivity: "SET VARIABLES"
const String OperationSetState::label ( )
overridevirtual

Returns textual string describing operation plus state.

Returns
String label

Implements Hypertable::Operation.

Definition at line 221 of file OperationSetState.cc.

const String OperationSetState::name ( )
overridevirtual

Returns operation name (OperationSetState)

Returns
Operation name

Implements Hypertable::Operation.

Definition at line 217 of file OperationSetState.cc.

Member Data Documentation

uint64_t Hypertable::OperationSetState::m_generation
private

Generation number of system state variables (m_specs)a.

Definition at line 141 of file OperationSetState.h.

Lib::Master::Request::Parameters::SetState Hypertable::OperationSetState::m_params
private

Request parmaeters.

Definition at line 138 of file OperationSetState.h.

std::vector<SystemVariable::Spec> Hypertable::OperationSetState::m_specs
private

Current system state variables.

Definition at line 144 of file OperationSetState.h.


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