| 728 | } |
| 729 | |
| 730 | void lock_struct::remove_my_locknode(std::string &&znode_path, |
| 731 | bool ignore_callback, |
| 732 | bool remove_for_unlock) |
| 733 | { |
| 734 | lock_struct_ptr _this = this; |
| 735 | auto result_wrapper = |
| 736 | [_this, ignore_callback, remove_for_unlock](zookeeper_session::zoo_opcontext *op) { |
| 737 | LOG_INFO("delete node {}, result({})", op->_input._path, zerror(op->_output.error)); |
| 738 | if (is_zookeeper_timeout(op->_output.error)) { |
| 739 | __add_ref_and_delay_call(op, _this); |
| 740 | return; |
| 741 | } |
| 742 | |
| 743 | if (IGNORE_CALLBACK != ignore_callback) { |
| 744 | __execute(std::bind(&lock_struct::after_remove_my_locknode, |
| 745 | _this, |
| 746 | op->_output.error, |
| 747 | remove_for_unlock), |
| 748 | _this); |
| 749 | } |
| 750 | }; |
| 751 | zookeeper_session::zoo_opcontext *op = zookeeper_session::create_context(); |
| 752 | op->_optype = zookeeper_session::ZOO_DELETE; |
| 753 | op->_input._path = std::move(znode_path); |
| 754 | op->_callback_function = result_wrapper; |
| 755 | _dist_lock_service->session()->visit(op); |
| 756 | } |
| 757 | |
| 758 | /*static*/ |
| 759 | void lock_struct::cancel_pending_lock(lock_struct_ptr _this, lock_future_ptr cancel_callback) |
no test coverage detected