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
UIDGenerator.py
Go to the documentation of this file.
1
'''
2
Created on Feb 11, 2014
3
4
@author: igor, bgv
5
'''
6
7
8
import
time
9
import
binascii
10
from
transport.IDGenerator
import
IDGenerator
11
12
14
class
UIDGenerator
(object):
15
16
17
19
def
__init__
(self):
20
'''
21
Constructor
22
'''
23
#@var _start
24
#a member variable, holds generator internal state
25
self.
_start
= 0
26
27
28
31
def
get_uid
(self, idType=0):
32
self.
_start
= self.
_start
+ 1
33
if
idType == 0:
34
idGenerator =
IDGenerator
()
35
#return str(binascii.crc32(idGenerator.get_connection_uid() + str(self._start)))
36
return
"%d"
% binascii.crc32(idGenerator.get_connection_uid() + str(self.
_start
), int(time.time()))
37
else
:
38
return
str(self.
_start
)
39
transport.UIDGenerator.UIDGenerator.get_uid
def get_uid(self, idType=0)
get_uid
Definition:
UIDGenerator.py:31
transport.IDGenerator
Definition:
IDGenerator.py:1
transport.UIDGenerator.UIDGenerator._start
_start
Definition:
UIDGenerator.py:25
transport.UIDGenerator.UIDGenerator
UIDGenerator is used to generate unique message id.
Definition:
UIDGenerator.py:14
transport.UIDGenerator.UIDGenerator.__init__
def __init__(self)
constructor
Definition:
UIDGenerator.py:19
transport.IDGenerator.IDGenerator
IDGenerator is used to generate unique id for connections.
Definition:
IDGenerator.py:15
sources
hce
transport
UIDGenerator.py
Generated on Fri Nov 24 2017 18:54:03 for HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings. by
1.8.13