Revision 0e46916d
b/lib/opcodes.py | ||
---|---|---|
24 | 24 |
This module implements the data structures which define the cluster |
25 | 25 |
operations - the so-called opcodes. |
26 | 26 |
|
27 |
|
|
28 |
This module implements the logic for doing operations in the cluster. There |
|
29 |
are two kinds of classes defined: |
|
30 |
- opcodes, which are small classes only holding data for the task at hand |
|
31 |
- logical units, which know how to deal with their specific opcode only |
|
27 |
Every operation which modifies the cluster state is expressed via |
|
28 |
opcodes. |
|
32 | 29 |
|
33 | 30 |
""" |
34 | 31 |
|
... | ... | |
37 | 34 |
# pylint: disable-msg=R0903 |
38 | 35 |
|
39 | 36 |
|
40 |
class BaseJO(object):
|
|
37 |
class BaseOpCode(object):
|
|
41 | 38 |
"""A simple serializable object. |
42 | 39 |
|
43 |
This object serves as a parent class for both OpCode and Job since |
|
44 |
they are serialized in the same way. |
|
40 |
This object serves as a parent class for OpCode without any custom |
|
41 |
field handling. |
|
42 |
|
|
45 | 43 |
|
46 | 44 |
""" |
47 | 45 |
__slots__ = [] |
... | ... | |
73 | 71 |
setattr(self, name, state[name]) |
74 | 72 |
|
75 | 73 |
|
76 |
class OpCode(BaseJO):
|
|
74 |
class OpCode(BaseOpCode):
|
|
77 | 75 |
"""Abstract OpCode""" |
78 | 76 |
OP_ID = "OP_ABSTRACT" |
79 | 77 |
__slots__ = [] |
... | ... | |
82 | 80 |
"""Specialized getstate for opcodes. |
83 | 81 |
|
84 | 82 |
""" |
85 |
data = BaseJO.__getstate__(self)
|
|
83 |
data = BaseOpCode.__getstate__(self)
|
|
86 | 84 |
data["OP_ID"] = self.OP_ID |
87 | 85 |
return data |
88 | 86 |
|
Also available in: Unified diff