HWCloudEngine / storage-gateway

storage gateway to adapt cloud storage to replicate/snapshot/backup to other different cloud storage.
7 stars 10 forks source link

add Callback to construct callback stack #21

Open yinweiishere opened 7 years ago

yinweiishere commented 7 years ago

Background: From one handler to the other, the two thread pools are synced by the blocking event queue. Usually, event will be piped to the last handler and thus finishes the whole handling. But some handlers may expect post handler's result, no matter success or error. Especially, it will facilitate error handling. Say, in SG client, connection will generate the original journal entry. For any of its post handlers: processor or writer, any failure inside could call connection's callback to reply success/error to iscsi. Callbacks could be pushed into the event's context as a stack, and thus be called one by one.

yinweiishere commented 7 years ago

background: controller needs wait for entry being processed by writer. We need callback after entry persisted.

walk around: condition wait

TBD: optimize to implement callback mechanism.

yinweiishere commented 7 years ago

will work on it next week