blob: 9861c44c4dcb3d3ed5bbf022747f943a592d8a16 [file] [log] [blame]
Zhenkai Zhu8224bb62013-01-06 15:58:02 -08001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
Alexander Afanasyev20bc8e22013-01-17 10:56:04 -080018 * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
19 * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
Zhenkai Zhu8224bb62013-01-06 15:58:02 -080020 */
21
22#include "sync-core.h"
23
Alexander Afanasyevabe952a2013-01-17 17:06:32 -080024#include "one-time-task.h"
25#include "random-interval-generator.h"
26
Zhenkai Zhue851b952013-01-13 22:29:57 -080027const string SyncCore::RECOVER = "RECOVER";
Zhenkai Zhue573ae82013-01-15 13:15:52 -080028const double SyncCore::WAIT = 0.05;
Zhenkai Zhue851b952013-01-13 22:29:57 -080029const double SyncCore::RANDOM_PERCENT = 0.5;
30
Zhenkai Zhu4e1c1d92013-01-17 14:12:46 -080031// for debugging
32static void
33printMsg(SyncStateMsgPtr &msg)
34{
Alexander Afanasyevf278db32013-01-21 14:41:01 -080035 cerr << " ===== start Msg ======" << endl;
Zhenkai Zhu4e1c1d92013-01-17 14:12:46 -080036 int size = msg->state_size();
37 if (size > 0)
38 {
39 int index = 0;
40 while (index < size)
41 {
42 SyncState state = msg->state(index);
43 string strName = state.name();
44 string strLocator = state.locator();
45 sqlite3_int64 seq = state.seq();
Alexander Afanasyevf278db32013-01-21 14:41:01 -080046 cerr << "Name: " << Name((const unsigned char *)strName.c_str(), strName.size());
47 cerr << ", Locator: " << Name((const unsigned char *)strLocator.c_str(), strLocator.size());
48 cerr << ", seq: " << seq << endl;
Zhenkai Zhu4e1c1d92013-01-17 14:12:46 -080049 index ++;
50 }
51 }
52 else
53 {
Alexander Afanasyevf278db32013-01-21 14:41:01 -080054 cerr << "Msg size 0" << endl;
Zhenkai Zhu4e1c1d92013-01-17 14:12:46 -080055 }
Alexander Afanasyevf278db32013-01-21 14:41:01 -080056 cerr << " ++++++++ end Msg ++++++++ \n\n" << endl;
Zhenkai Zhu4e1c1d92013-01-17 14:12:46 -080057}
58
Zhenkai Zhub330aed2013-01-17 13:29:37 -080059SyncCore::SyncCore(SyncLogPtr syncLog, const Name &userName, const Name &localPrefix, const Name &syncPrefix, const StateMsgCallback &callback, const CcnxWrapperPtr &handle, const SchedulerPtr &scheduler)
60 : m_log(syncLog)
61 , m_scheduler(scheduler)
Alexander Afanasyeva44a7a22013-01-14 17:37:06 -080062 , m_stateMsgCallback(callback)
Alexander Afanasyev7326a252013-01-20 23:43:25 -080063 // , m_userName(userName)
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -080064 , m_syncPrefix(syncPrefix)
Zhenkai Zhu8224bb62013-01-06 15:58:02 -080065 , m_handle(handle)
Alexander Afanasyevd6c2a902013-01-19 21:24:30 -080066 , m_syncClosure (boost::bind(&SyncCore::handleSyncData, this, _1, _2),
67 boost::bind(&SyncCore::handleSyncInterestTimeout, this, _1))
68 , m_recoverClosure (boost::bind(&SyncCore::handleRecoverData, this, _1, _2),
69 boost::bind(&SyncCore::handleRecoverInterestTimeout, this, _1))
Zhenkai Zhue573ae82013-01-15 13:15:52 -080070 , m_recoverWaitGenerator(new RandomIntervalGenerator(WAIT, RANDOM_PERCENT, RandomIntervalGenerator::UP))
Zhenkai Zhu8224bb62013-01-06 15:58:02 -080071{
Zhenkai Zhub330aed2013-01-17 13:29:37 -080072 m_rootHash = m_log->RememberStateInStateLog();
Alexander Afanasyevd6c2a902013-01-19 21:24:30 -080073
Zhenkai Zhue851b952013-01-13 22:29:57 -080074 m_handle->setInterestFilter(m_syncPrefix, boost::bind(&SyncCore::handleInterest, this, _1));
Alexander Afanasyevdac84922013-01-20 23:32:17 -080075 // m_log->initYP(m_yp);
Alexander Afanasyev7326a252013-01-20 23:43:25 -080076 m_log->UpdateLocalLocator (localPrefix);
77
Zhenkai Zhue573ae82013-01-15 13:15:52 -080078 m_scheduler->start();
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -080079 sendSyncInterest();
80}
81
82SyncCore::~SyncCore()
83{
Alexander Afanasyevd6c2a902013-01-19 21:24:30 -080084 // need to "deregister" closures
Zhenkai Zhue851b952013-01-13 22:29:57 -080085}
86
Alexander Afanasyevdac84922013-01-20 23:32:17 -080087// Name
88// SyncCore::yp(const Name &deviceName)
89// {
90// Name locator;
91// ReadLock lock(m_ypMutex);
92// if (m_yp.find(deviceName) != m_yp.end())
93// {
94// locator = m_yp[deviceName];
95// }
96// else
97// {
98// cout << "self: " << m_userName << ", deviceName: " << deviceName << " not found in yp " << endl;
99// }
100// return locator;
101// }
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800102
Alexander Afanasyevdac84922013-01-20 23:32:17 -0800103// void
104// SyncCore::updateLocalPrefix(const Name &localPrefix)
105// {
106// m_localPrefix = localPrefix;
107// // optionally, we can have a sync action to announce the new prefix
108// // we are not doing this for now
109// }
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800110
111void
Zhenkai Zhue851b952013-01-13 22:29:57 -0800112SyncCore::updateLocalState(sqlite3_int64 seqno)
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800113{
Alexander Afanasyev7326a252013-01-20 23:43:25 -0800114 m_log->UpdateLocalSeqNo (seqno);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800115 // choose to update locator everytime
Alexander Afanasyev7326a252013-01-20 23:43:25 -0800116 // m_log->UpdateLocator(m_userName, m_localPrefix);
Alexander Afanasyevdac84922013-01-20 23:32:17 -0800117 // {
118 // WriteLock lock(m_ypMutex);
119 // m_yp[m_userName] = m_localPrefix;
120 // }
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800121 HashPtr oldHash = m_rootHash;
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800122 m_rootHash = m_log->RememberStateInStateLog();
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800123
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800124 SyncStateMsgPtr msg = m_log->FindStateDifferences(*oldHash, *m_rootHash);
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800125
126 // reply sync Interest with oldHash as last component
127 Name syncName = constructSyncName(oldHash);
128 Bytes syncData;
129 msgToBytes(msg, syncData);
130 m_handle->publishData(syncName, syncData, FRESHNESS);
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800131 cerr << m_log->GetLocalName () << " publishes: " << *oldHash << endl;
Zhenkai Zhu4e1c1d92013-01-17 14:12:46 -0800132 printMsg(msg);
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800133
134 // no hurry in sending out new Sync Interest; if others send the new Sync Interest first, no problem, we know the new root hash already;
135 // this is trying to avoid the situation that the order of SyncData and new Sync Interest gets reversed at receivers
136 ostringstream ss;
Zhenkai Zhue851b952013-01-13 22:29:57 -0800137 ss << *m_rootHash;
Zhenkai Zhu6e7d4d22013-01-15 18:18:18 -0800138 TaskPtr task(new OneTimeTask(boost::bind(&SyncCore::sendSyncInterest, this), ss.str(), m_scheduler, 0.1));
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800139 m_scheduler->addTask(task);
Zhenkai Zhue573ae82013-01-15 13:15:52 -0800140 sendSyncInterest();
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800141}
142
143void
Zhenkai Zhue851b952013-01-13 22:29:57 -0800144SyncCore::handleInterest(const Name &name)
145{
146 int size = name.size();
147 int prefixSize = m_syncPrefix.size();
148 if (size == prefixSize + 1)
149 {
150 // this is normal sync interest
151 handleSyncInterest(name);
152 }
153 else if (size == prefixSize + 2 && name.getCompAsString(m_syncPrefix.size()) == RECOVER)
154 {
155 // this is recovery interest
156 handleRecoverInterest(name);
157 }
158}
159
160void
161SyncCore::handleRecoverInterest(const Name &name)
162{
163 Bytes hashBytes = name.getComp(name.size() - 1);
164 // this is the hash unkonwn to the sender of the interest
165 Hash hash(head(hashBytes), hashBytes.size());
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800166 if (m_log->LookupSyncLog(hash) > 0)
Zhenkai Zhue851b952013-01-13 22:29:57 -0800167 {
168 // we know the hash, should reply everything
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800169 SyncStateMsgPtr msg = m_log->FindStateDifferences(*(Hash::Origin), *m_rootHash);
Zhenkai Zhue573ae82013-01-15 13:15:52 -0800170 // DEBUG
Zhenkai Zhu6e7d4d22013-01-15 18:18:18 -0800171 /*
Zhenkai Zhue573ae82013-01-15 13:15:52 -0800172 assert(msg->state_size() > 0);
173 int size = msg->state_size();
174 int index = 0;
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800175 cerr << "Reply recover interest with: " << endl;
Zhenkai Zhue573ae82013-01-15 13:15:52 -0800176 while (index < size)
177 {
178 SyncState state = msg->state(index);
179 string strName = state.name();
180 string strLoc = state.locator();
181 cout << "Name: " << Name((const unsigned char *)strName.c_str(), strName.size()) << ", Loc: " << Name((const unsigned char *)strLoc.c_str(), strLoc.size()) << ", seq: " << state.seq() << endl;
182 if (state.type() == SyncState::UPDATE)
183 {
184 cout << "Action: update" << endl;
185 }
186 else
187 {
188 cout << "Action: delete" << endl;
189 }
190 index++;
191 }
Zhenkai Zhu6e7d4d22013-01-15 18:18:18 -0800192 */
Zhenkai Zhue573ae82013-01-15 13:15:52 -0800193 // END DEBUG
Zhenkai Zhue851b952013-01-13 22:29:57 -0800194 Bytes syncData;
195 msgToBytes(msg, syncData);
196 m_handle->publishData(name, syncData, FRESHNESS);
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800197 cerr << m_log->GetLocalName () << " publishes " << hash << endl;
Zhenkai Zhu4e1c1d92013-01-17 14:12:46 -0800198 printMsg(msg);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800199 }
200 else
201 {
202 // we don't recognize this hash, can not help
203 }
204}
205
206void
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800207SyncCore::handleSyncInterest(const Name &name)
208{
Zhenkai Zhue851b952013-01-13 22:29:57 -0800209 Bytes hashBytes = name.getComp(name.size() - 1);
210 HashPtr hash(new Hash(head(hashBytes), hashBytes.size()));
211 if (*hash == *m_rootHash)
212 {
213 // we have the same hash; nothing needs to be done
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800214 cerr << "same as root hash: " << *hash << endl;
Zhenkai Zhue851b952013-01-13 22:29:57 -0800215 return;
216 }
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800217 else if (m_log->LookupSyncLog(*hash) > 0)
Zhenkai Zhue851b952013-01-13 22:29:57 -0800218 {
219 // we know something more
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800220 cerr << "found hash in sync log" << endl;
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800221 SyncStateMsgPtr msg = m_log->FindStateDifferences(*hash, *m_rootHash);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800222
223 Bytes syncData;
224 msgToBytes(msg, syncData);
225 m_handle->publishData(name, syncData, FRESHNESS);
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800226 cerr << m_log->GetLocalName () << " publishes: " << *hash << endl;
Zhenkai Zhu4e1c1d92013-01-17 14:12:46 -0800227 printMsg(msg);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800228 }
229 else
230 {
231 // we don't recognize the hash, send recover Interest if still don't know the hash after a randomized wait period
232 ostringstream ss;
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800233 ss << "r-" << *hash;
Zhenkai Zhue573ae82013-01-15 13:15:52 -0800234 double wait = m_recoverWaitGenerator->nextInterval();
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800235 cerr << m_log->GetLocalName () << ", rootHash: " << *m_rootHash << ", hash: " << *hash << endl;
236 cerr << "recover task scheduled after wait: " << wait << endl;
Zhenkai Zhue573ae82013-01-15 13:15:52 -0800237 TaskPtr task(new OneTimeTask(boost::bind(&SyncCore::recover, this, hash), ss.str(), m_scheduler, wait));
Zhenkai Zhue851b952013-01-13 22:29:57 -0800238 m_scheduler->addTask(task);
Zhenkai Zhue573ae82013-01-15 13:15:52 -0800239
Zhenkai Zhue851b952013-01-13 22:29:57 -0800240 }
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800241}
242
243Closure::TimeoutCallbackReturnValue
244SyncCore::handleSyncInterestTimeout(const Name &name)
245{
246 // sendInterestInterest with the current root hash;
247 sendSyncInterest();
Zhenkai Zhue851b952013-01-13 22:29:57 -0800248 return Closure::RESULT_OK;
249}
250
251Closure::TimeoutCallbackReturnValue
252SyncCore::handleRecoverInterestTimeout(const Name &name)
253{
254 // We do not re-express recovery interest for now
255 // if difference is not resolved, the sync interest will trigger
256 // recovery anyway; so it's not so important to have recovery interest
257 // re-expressed
258 return Closure::RESULT_OK;
259}
260
261void
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800262SyncCore::handleRecoverData(const Name &name, PcoPtr content)
Zhenkai Zhue851b952013-01-13 22:29:57 -0800263{
Zhenkai Zhu6e7d4d22013-01-15 18:18:18 -0800264 //cout << "handle recover data" << endl;
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800265 handleStateData(*content->contentPtr ());
Zhenkai Zhu6e7d4d22013-01-15 18:18:18 -0800266 sendSyncInterest();
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800267}
268
269void
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800270SyncCore::handleSyncData(const Name &name, PcoPtr content)
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800271{
Zhenkai Zhue851b952013-01-13 22:29:57 -0800272 // suppress recover in interest - data out of order case
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800273 handleStateData(*content->contentPtr ());
Zhenkai Zhue851b952013-01-13 22:29:57 -0800274
275 // resume outstanding sync interest
276 sendSyncInterest();
277}
278
279void
280SyncCore::handleStateData(const Bytes &content)
281{
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800282 SyncStateMsgPtr msg(new SyncStateMsg);
283 bool success = msg->ParseFromArray(head(content), content.size());
284 if(!success)
285 {
286 // ignore misformed SyncData
Zhenkai Zhue851b952013-01-13 22:29:57 -0800287 cerr << "Misformed SyncData"<< endl;
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800288 return;
289 }
290
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800291 cerr << m_log->GetLocalName () << " receives Msg " << endl;
Zhenkai Zhu4e1c1d92013-01-17 14:12:46 -0800292 printMsg (msg);
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800293 int size = msg->state_size();
294 int index = 0;
295 while (index < size)
296 {
297 SyncState state = msg->state(index);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800298 string devStr = state.name();
299 Name deviceName((const unsigned char *)devStr.c_str(), devStr.size());
Zhenkai Zhu6e7d4d22013-01-15 18:18:18 -0800300 // cout << "Got Name: " << deviceName;
Zhenkai Zhue851b952013-01-13 22:29:57 -0800301 if (state.type() == SyncState::UPDATE)
302 {
303 sqlite3_int64 seqno = state.seq();
Zhenkai Zhu6e7d4d22013-01-15 18:18:18 -0800304 // cout << ", Got seq: " << seqno << endl;
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800305 m_log->UpdateDeviceSeqNo(deviceName, seqno);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800306 if (state.has_locator())
307 {
308 string locStr = state.locator();
309 Name locatorName((const unsigned char *)locStr.c_str(), locStr.size());
Zhenkai Zhu6e7d4d22013-01-15 18:18:18 -0800310 // cout << ", Got loc: " << locatorName << endl;
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800311 m_log->UpdateLocator(deviceName, locatorName);
Alexander Afanasyevdac84922013-01-20 23:32:17 -0800312 // WriteLock lock(m_ypMutex);
313 // m_yp[deviceName] = locatorName;
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800314 cerr << "self: " << m_log->GetLocalName () << ", device: " << deviceName << " < == > " << locatorName << endl;
Zhenkai Zhue851b952013-01-13 22:29:57 -0800315 }
316 }
317 else
318 {
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800319 cerr << "nani" << endl;
Zhenkai Zhue851b952013-01-13 22:29:57 -0800320 deregister(deviceName);
321 }
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800322 index++;
323 }
324
Zhenkai Zhue851b952013-01-13 22:29:57 -0800325 // find the actuall difference and invoke callback on the actual difference
326 HashPtr oldHash = m_rootHash;
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800327 m_rootHash = m_log->RememberStateInStateLog();
Zhenkai Zhu085aae72013-01-17 21:09:01 -0800328 // get diff with both new SeqNo and old SeqNo
329 SyncStateMsgPtr diff = m_log->FindStateDifferences(*oldHash, *m_rootHash, true);
Zhenkai Zhu6e7d4d22013-01-15 18:18:18 -0800330
Zhenkai Zhu9501b8b2013-01-17 12:37:00 -0800331 if (diff->state_size() > 0)
332 {
333 m_stateMsgCallback(diff);
334 }
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800335}
336
337void
338SyncCore::sendSyncInterest()
339{
340 Name syncInterest = constructSyncName(m_rootHash);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800341 m_handle->sendInterest(syncInterest, m_syncClosure);
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800342 cerr << m_log->GetLocalName () << " send SYNC interest: " << *m_rootHash << endl;
Zhenkai Zhue851b952013-01-13 22:29:57 -0800343}
344
345void
346SyncCore::recover(const HashPtr &hash)
347{
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800348 if (!(*hash == *m_rootHash) && m_log->LookupSyncLog(*hash) <= 0)
Zhenkai Zhue851b952013-01-13 22:29:57 -0800349 {
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800350 cerr << m_log->GetLocalName () << ", Recover for: " << *hash << endl;
Zhenkai Zhue851b952013-01-13 22:29:57 -0800351 // unfortunately we still don't recognize this hash
352 Bytes bytes;
353 readRaw(bytes, (const unsigned char *)hash->GetHash(), hash->GetHashBytes());
354 Name recoverInterest = m_syncPrefix;
355 recoverInterest.appendComp(RECOVER);
356 // append the unknown hash
357 recoverInterest.appendComp(bytes);
358 m_handle->sendInterest(recoverInterest, m_recoverClosure);
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800359 cerr << m_log->GetLocalName () << " send RECOVER Interest: " << *hash << endl;
Zhenkai Zhue851b952013-01-13 22:29:57 -0800360 }
361 else
362 {
363 // we already learned the hash; cheers!
364 }
365}
366
367void
368SyncCore::deregister(const Name &name)
369{
370 // Do nothing for now
371 // TODO: handle deregistering
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800372}
373
374Name
375SyncCore::constructSyncName(const HashPtr &hash)
376{
377 Bytes bytes;
Zhenkai Zhue851b952013-01-13 22:29:57 -0800378 readRaw(bytes, (const unsigned char*)hash->GetHash(), hash->GetHashBytes());
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800379 Name syncName = m_syncPrefix;
Zhenkai Zhue851b952013-01-13 22:29:57 -0800380 syncName.appendComp(bytes);
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800381 return syncName;
382}
383
384void
385SyncCore::msgToBytes(const SyncStateMsgPtr &msg, Bytes &bytes)
386{
Zhenkai Zhue851b952013-01-13 22:29:57 -0800387 int size = msg->ByteSize();
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800388 bytes.resize(size);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800389 msg->SerializeToArray(head(bytes), size);
Zhenkai Zhu8224bb62013-01-06 15:58:02 -0800390}
Zhenkai Zhu9501b8b2013-01-17 12:37:00 -0800391
392sqlite3_int64
393SyncCore::seq(const Name &name)
394{
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800395 return m_log->SeqNo(name);
Zhenkai Zhu9501b8b2013-01-17 12:37:00 -0800396}