# # # patch "ChangeLog" # from [c127509c7849c8f84b689ad5af2a9bfcccd09f8e] # to [0b7921a9392278539f9f182ffc5fb0f96e30078a] # # patch "lua.cc" # from [15ce9164245ecdd634e1bbc24f3199df5ccf17e3] # to [928ccedf924a8a57675b289befd1956bd9654486] # # patch "lua.hh" # from [51b76a94c93113194a0ab5ab2698a71619874487] # to [5298940507cc9dc2fb09cd9ef2abdd3054c6bb8c] # # patch "monotone.texi" # from [fff70064e03cdf1cbeba0ae031155833f81458dd] # to [27e1e101f9974c0ef31bc6b0bb371bd221a90044] # # patch "netsync.cc" # from [9900897d44dfc2ab65bcd3525183f27a1b680ff1] # to [a259724511fd7999b39fe3416291886d24ba4445] # ============================================================ --- ChangeLog c127509c7849c8f84b689ad5af2a9bfcccd09f8e +++ ChangeLog 0b7921a9392278539f9f182ffc5fb0f96e30078a @@ -1,5 +1,15 @@ 2006-03-17 Richard Levitte + * lua.cc, lua.hh (lua::hookshook_note_netsync_revision_received, + lua::hookshook_note_netsync_cert_received, + lua::hookshook_note_netsync_pubkey_received): Change them so nonce + comes last. It means that hooks written for the older inteface + (the once without nonce) will work transparently. + * monotone.texi (Hooks): Change the docs accordingly. + * netsync.cc (session::~session): Change the calls accordingly. + +2006-03-17 Richard Levitte + There are times when it is good to be able to prepare for a bunch of calls to note_netsync* hooks, as well as to know when there are not more such calls to be expected. To that end, I've ============================================================ --- lua.cc 15ce9164245ecdd634e1bbc24f3199df5ccf17e3 +++ lua.cc 928ccedf924a8a57675b289befd1956bd9654486 @@ -1427,17 +1427,16 @@ } bool -lua_hooks::hook_note_netsync_revision_received(string nonce, - revision_id const & new_id, +lua_hooks::hook_note_netsync_revision_received(revision_id const & new_id, revision_data const & rdat, set > > const & certs) + cert_value> > > const & certs, + std::string nonce) { Lua ll(st); ll .func("note_netsync_revision_received") - .push_str(nonce) .push_str(new_id.inner()()) .push_str(rdat.inner()()); @@ -1462,39 +1461,40 @@ ll.set_table(); } + ll.push_str(nonce); ll.call(4, 0); return ll.ok(); } bool -lua_hooks::hook_note_netsync_pubkey_received(string nonce, - rsa_keypair_id const & kid) +lua_hooks::hook_note_netsync_pubkey_received(rsa_keypair_id const & kid, + std::string nonce) { Lua ll(st); ll .func("note_netsync_pubkey_received") - .push_str(nonce) - .push_str(kid()); + .push_str(kid()) + .push_str(nonce); ll.call(2, 0); return ll.ok(); } bool -lua_hooks::hook_note_netsync_cert_received(string nonce, - revision_id const & rid, +lua_hooks::hook_note_netsync_cert_received(revision_id const & rid, rsa_keypair_id const & kid, cert_name const & name, - cert_value const & value) + cert_value const & value, + std::string nonce) { Lua ll(st); ll .func("note_netsync_cert_received") - .push_str(nonce) .push_str(rid.inner()()) .push_str(kid()) .push_str(name()) - .push_str(value()); + .push_str(value()) + .push_str(nonce); ll.call(5, 0); return ll.ok(); ============================================================ --- lua.hh 51b76a94c93113194a0ab5ab2698a71619874487 +++ lua.hh 5298940507cc9dc2fb09cd9ef2abdd3054c6bb8c @@ -117,19 +117,19 @@ std::map const & certs); bool hook_note_netsync_start(std::string nonce); - bool hook_note_netsync_revision_received(std::string nonce, - revision_id const & new_id, + bool hook_note_netsync_revision_received(revision_id const & new_id, revision_data const & rdat, std::set > > const & certs); - bool hook_note_netsync_pubkey_received(std::string nonce, - rsa_keypair_id const & kid); - bool hook_note_netsync_cert_received(std::string nonce, - revision_id const & rid, + cert_value> > > const & certs, + std::string nonce); + bool hook_note_netsync_pubkey_received(rsa_keypair_id const & kid, + std::string nonce); + bool hook_note_netsync_cert_received(revision_id const & rid, rsa_keypair_id const & kid, cert_name const & name, - cert_value const & value); + cert_value const & value, + std::string nonce); bool hook_note_netsync_end(std::string nonce); }; ============================================================ --- monotone.texi fff70064e03cdf1cbeba0ae031155833f81458dd +++ monotone.texi 27e1e101f9974c0ef31bc6b0bb371bd221a90044 @@ -6136,7 +6136,7 @@ session in case several are happening at the same time, and is used throughout all netsync notification hooks. address@hidden note_netsync_revision_received (@var{nonce}, @var{new_id}, @var{revision}, @var{certs}) address@hidden note_netsync_revision_received (@var{new_id}, @var{revision}, @var{certs}, @var{nonce}) Called by monotone after the revision @var{new_id} is received through netsync. @var{revision} is the text of the revision, what would be given @@ -6145,9 +6145,12 @@ cert attached to the revision @var{new_id}. These subtables have fields named "key", "name", and "value", containing the signing key for the cert, the name of the cert, and the value of the cert. There is no default -definition for this hook. +definition for this hook. address@hidden is used together with @code{note_netsync_start} and address@hidden If you're not interested in that type of +tracking, you can ignore that variable entirely. address@hidden note_netsync_cert_received (@var{nonce}, @var{rev_id}, @var{key}, @var{name}, @var{value}) address@hidden note_netsync_cert_received (@var{rev_id}, @var{key}, @var{name}, @var{value}, @var{nonce}) Called by monotone after a cert is received through netsync, iff the revision that the cert is attached to was not also received in the same netsync @@ -6155,11 +6158,17 @@ @var{key} is the key that the cert is signed with, @var{name} is the name of the cert, and @var{value} is the cert value. There is no default definition for this hook. address@hidden is used together with @code{note_netsync_start} and address@hidden If you're not interested in that type of +tracking, you can ignore that variable entirely. address@hidden note_netsync_pubkey_received (@var{nonce}, @var{keyname}) address@hidden note_netsync_pubkey_received (@var{keyname}, @var{nonce}) Called by monotone after a pubkey is received through netsync. @var{keyname} is the name of the key received. There is no default definition for this hook. address@hidden is used together with @code{note_netsync_start} and address@hidden If you're not interested in that type of +tracking, you can ignore that variable entirely. @item note_netsync_end (@var{nonce}) ============================================================ --- netsync.cc 9900897d44dfc2ab65bcd3525183f27a1b680ff1 +++ netsync.cc a259724511fd7999b39fe3416291886d24ba4445 @@ -525,7 +525,7 @@ for (vector::iterator i = written_keys.begin(); i != written_keys.end(); ++i) { - app.lua.hook_note_netsync_pubkey_received(nonce, *i); + app.lua.hook_note_netsync_pubkey_received(*i, nonce); } //Revisions @@ -543,7 +543,7 @@ } revision_data rdat; app.db.get_revision(*i, rdat); - app.lua.hook_note_netsync_revision_received(nonce, *i, rdat, certs); + app.lua.hook_note_netsync_revision_received(*i, rdat, certs, nonce); } //Certs (not attached to a new revision) @@ -552,8 +552,8 @@ { cert_value tmp; decode_base64(i->value, tmp); - app.lua.hook_note_netsync_cert_received(nonce, i->ident, i->key, - i->name, tmp); + app.lua.hook_note_netsync_cert_received(i->ident, i->key, + i->name, tmp, nonce); }