HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings.  2.0.0-chaika
Hierarchical Cluster Engine Python language binding
transport.IDGenerator.IDGenerator Class Reference

IDGenerator is used to generate unique id for connections. More...

Inheritance diagram for transport.IDGenerator.IDGenerator:
Collaboration diagram for transport.IDGenerator.IDGenerator:

Public Member Functions

def __init__ (self)
 
def get_connection_uid (self, idType=0)
 generate unique connection id More...
 

Private Attributes

 _connection_uid
 

Static Private Attributes

 __metaclass__ = Singleton
 

Detailed Description

IDGenerator is used to generate unique id for connections.

The class is used to generate unique ID for connections

Definition at line 15 of file IDGenerator.py.

Constructor & Destructor Documentation

◆ __init__()

def transport.IDGenerator.IDGenerator.__init__ (   self)
Constructor

Definition at line 21 of file IDGenerator.py.

21  def __init__(self):
22  '''
23  Constructor
24  '''
25  #@var _connection_uid
26  #a member variable, holds generator internal state
27  self._connection_uid = 0
28 
29 
def __init__(self)
constructor
Definition: UIDGenerator.py:19

Member Function Documentation

◆ get_connection_uid()

def transport.IDGenerator.IDGenerator.get_connection_uid (   self,
  idType = 0 
)

generate unique connection id

Returns
unique id as string

Definition at line 36 of file IDGenerator.py.

36  def get_connection_uid(self, idType=0):
37  ret = None
38 
39  self._connection_uid = self._connection_uid + 1
40  if idType == 0:
41  ret = socket.gethostname() + "-" + str(time.time()) + "-" + uuid.uuid1().hex + "-" + str(self._connection_uid)
42  else:
43  ret = str(self._connection_uid)
44 
45  return ret
46 
47 

Member Data Documentation

◆ __metaclass__

transport.IDGenerator.IDGenerator.__metaclass__ = Singleton
staticprivate

Definition at line 19 of file IDGenerator.py.

◆ _connection_uid

transport.IDGenerator.IDGenerator._connection_uid
private

Definition at line 27 of file IDGenerator.py.


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