comb.slot
— Slot base class¶
Slot¶
-
class
comb.slot.
Slot
(combd)[source]¶ To use comb, you should create a python module file. we named slot.
A legal slot must be named ‘Slot’ in your module file and it must be at least contain four method:
initial resource, e.g: database handle
get next data to do,you can fetch one or more data.
user custom code
when slot finished, call this method
Don’t override this method unless what you’re doing.
-
Slot.
__enter__
()[source]¶ You MUST return False when no data to do.
The return value will be used in
Slot.slot
-
Slot.
initialize
()[source]¶ Hook for subclass initialization.
This block is execute before thread initial
Example:
class UserSlot(Slot): def initialize(self): self.threads_num = 10 def slot(self, result): ...
-
Slot.
slot
(msg)[source]¶ Add your custom code at here.
For example, look at:
comb.demo.list
comb.demo.mongo
comb.demo.redis