<div>HI:</div>
<div> </div>
<div>I'm reading mnesia source code right now. I found all the mnesia operation such as read/write/transform_table are divided into two parts.One part is in mnesia_shcema:read ,the other part is in mnesia_shcmma:prepare_op.</div>
<div> </div>
<div>Take transform_table for example,the transform_table function calls make_transform_table to return "[{op, transform, Fun, cs2list(Cs2)}];". </div>
<div>And the real transform_table is done in </div>
<div> </div>
<div>"prepare_op(_Tid, {op, transform, Fun, TabDef}, _WaitFor) " </div>
<div> </div>
<div>,then the prepare_op finally call the Fun the do the transform.</div>
<div> </div>
<div>Now I know the the two parts are done in sperate process,the make_transform is done in user-process,the prepare_op is in mnesia kernel process .The function make_transform insert op "transform " into a ets table,the prepare_ops parse the op "transform" to many small ops on the fly.</div>
<div> </div>
<div>
<div>My problem is</div>
<div>1. I can't see why the main work is put into prepare_op. Why don't do all the work in make_transform function?</div>
<div>2. What the function prepare_op is used for? I see many mnesia operations are done in this way.</div>
<div> </div></div>
<div>Could someone explain more to me? </div>
<div> </div>
<div>Regards.</div>