blob: e113b24db163399420d00243f3db593183e05500 [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"
Alexander Afanasyev49a30d02013-01-21 21:38:48 -080023#include "sync-state-helper.h"
Alexander Afanasyevc507ac22013-01-21 16:01:58 -080024#include "logging.h"
Alexander Afanasyevabe952a2013-01-17 17:06:32 -080025#include "random-interval-generator.h"
Zhenkai Zhu3b406592013-01-25 21:07:49 -080026#include "one-time-task.h"
Alexander Afanasyevabe952a2013-01-17 17:06:32 -080027
Alexander Afanasyevc507ac22013-01-21 16:01:58 -080028#include <boost/lexical_cast.hpp>
Zhenkai Zhu3b406592013-01-25 21:07:49 -080029#include <boost/make_shared.hpp>
Alexander Afanasyevc507ac22013-01-21 16:01:58 -080030
31INIT_LOGGER ("Sync.Core");
32
Zhenkai Zhue851b952013-01-13 22:29:57 -080033const string SyncCore::RECOVER = "RECOVER";
Zhenkai Zhue573ae82013-01-15 13:15:52 -080034const double SyncCore::WAIT = 0.05;
Zhenkai Zhue851b952013-01-13 22:29:57 -080035const double SyncCore::RANDOM_PERCENT = 0.5;
36
Alexander Afanasyevc507ac22013-01-21 16:01:58 -080037using namespace boost;
Alexander Afanasyev49a30d02013-01-21 21:38:48 -080038using namespace Ccnx;
Alexander Afanasyevc507ac22013-01-21 16:01:58 -080039
Alexander Afanasyev49a30d02013-01-21 21:38:48 -080040SyncCore::SyncCore(SyncLogPtr syncLog, const Name &userName, const Name &localPrefix, const Name &syncPrefix,
Zhenkai Zhu95160102013-01-25 21:54:57 -080041 const StateMsgCallback &callback, CcnxWrapperPtr ccnx, double syncInterestInterval/*= -1.0*/)
Alexander Afanasyev49a30d02013-01-21 21:38:48 -080042 : m_ccnx (ccnx)
43 , m_log(syncLog)
Alexander Afanasyevd94a8c62013-01-24 13:53:40 -080044 , m_scheduler(new Scheduler ())
45 , m_stateMsgCallback(callback)
46 , m_syncPrefix(syncPrefix)
47 , m_recoverWaitGenerator(new RandomIntervalGenerator(WAIT, RANDOM_PERCENT, RandomIntervalGenerator::UP))
Zhenkai Zhu95160102013-01-25 21:54:57 -080048 , m_syncInterestInterval(syncInterestInterval)
Zhenkai Zhu8224bb62013-01-06 15:58:02 -080049{
Zhenkai Zhub330aed2013-01-17 13:29:37 -080050 m_rootHash = m_log->RememberStateInStateLog();
Alexander Afanasyevd6c2a902013-01-19 21:24:30 -080051
Alexander Afanasyev49a30d02013-01-21 21:38:48 -080052 m_ccnx->setInterestFilter(m_syncPrefix, boost::bind(&SyncCore::handleInterest, this, _1));
Alexander Afanasyevdac84922013-01-20 23:32:17 -080053 // m_log->initYP(m_yp);
Alexander Afanasyev7326a252013-01-20 23:43:25 -080054 m_log->UpdateLocalLocator (localPrefix);
55
Zhenkai Zhue573ae82013-01-15 13:15:52 -080056 m_scheduler->start();
Zhenkai Zhu3b406592013-01-25 21:07:49 -080057 string tag = userName.toString() + "send-sync-interest";
Zhenkai Zhu95160102013-01-25 21:54:57 -080058 double interval = (m_syncInterestInterval > 0 && m_syncInterestInterval < 30.0) ? m_syncInterestInterval : 4.0;
59 m_sendSyncInterestTask = make_shared<OneTimeTask>(bind(&SyncCore::sendSyncInterest, this), tag, m_scheduler, interval);
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -080060 sendSyncInterest();
61}
62
63SyncCore::~SyncCore()
64{
Alexander Afanasyevfc720362013-01-24 21:49:48 -080065 // m_scheduler->shutdown ();
Alexander Afanasyevd6c2a902013-01-19 21:24:30 -080066 // need to "deregister" closures
Zhenkai Zhue851b952013-01-13 22:29:57 -080067}
68
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -080069void
Alexander Afanasyevcbda9922013-01-22 11:21:12 -080070SyncCore::updateLocalPrefix (const Name &localPrefix)
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -080071{
Alexander Afanasyevcbda9922013-01-22 11:21:12 -080072 m_log->UpdateLocalLocator (localPrefix);
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -080073}
74
75void
Zhenkai Zhue851b952013-01-13 22:29:57 -080076SyncCore::updateLocalState(sqlite3_int64 seqno)
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -080077{
Alexander Afanasyev7326a252013-01-20 23:43:25 -080078 m_log->UpdateLocalSeqNo (seqno);
Zhenkai Zhuc3fd51e2013-01-22 10:45:54 -080079 localStateChanged();
Zhenkai Zhuc3fd51e2013-01-22 10:45:54 -080080}
Alexander Afanasyev49a30d02013-01-21 21:38:48 -080081
Zhenkai Zhuc3fd51e2013-01-22 10:45:54 -080082void
83SyncCore::localStateChanged()
84{
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -080085 HashPtr oldHash = m_rootHash;
Zhenkai Zhub330aed2013-01-17 13:29:37 -080086 m_rootHash = m_log->RememberStateInStateLog();
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -080087
Zhenkai Zhub330aed2013-01-17 13:29:37 -080088 SyncStateMsgPtr msg = m_log->FindStateDifferences(*oldHash, *m_rootHash);
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -080089
90 // reply sync Interest with oldHash as last component
Alexander Afanasyev49a30d02013-01-21 21:38:48 -080091 Name syncName = Name (m_syncPrefix)(oldHash->GetHash(), oldHash->GetHashBytes());
Alexander Afanasyev08aa70a2013-01-22 22:16:25 -080092 BytesPtr syncData = serializeMsg (*msg);
Alexander Afanasyev49a30d02013-01-21 21:38:48 -080093
94 m_ccnx->publishData(syncName, *syncData, FRESHNESS);
Alexander Afanasyevfc720362013-01-24 21:49:48 -080095 _LOG_DEBUG ("[" << m_log->GetLocalName () << "] localStateChanged ");
Alexander Afanasyevfcf81dc2013-01-25 20:36:58 -080096 _LOG_TRACE ("[" << m_log->GetLocalName () << "] publishes: " << oldHash->shortHash ());
Alexander Afanasyevfc720362013-01-24 21:49:48 -080097 // _LOG_TRACE (msg);
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -080098
99 // 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;
100 // this is trying to avoid the situation that the order of SyncData and new Sync Interest gets reversed at receivers
Alexander Afanasyevcbda9922013-01-22 11:21:12 -0800101 Scheduler::scheduleOneTimeTask (m_scheduler, 0.05,
Alexander Afanasyevc507ac22013-01-21 16:01:58 -0800102 bind(&SyncCore::sendSyncInterest, this),
103 lexical_cast<string> (*m_rootHash));
104
Zhenkai Zhud276f1e2013-01-24 17:37:31 -0800105 //sendSyncInterest();
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800106}
107
108void
Zhenkai Zhue851b952013-01-13 22:29:57 -0800109SyncCore::handleInterest(const Name &name)
110{
111 int size = name.size();
112 int prefixSize = m_syncPrefix.size();
113 if (size == prefixSize + 1)
114 {
115 // this is normal sync interest
116 handleSyncInterest(name);
117 }
118 else if (size == prefixSize + 2 && name.getCompAsString(m_syncPrefix.size()) == RECOVER)
119 {
120 // this is recovery interest
121 handleRecoverInterest(name);
122 }
123}
124
125void
126SyncCore::handleRecoverInterest(const Name &name)
127{
Alexander Afanasyevfc720362013-01-24 21:49:48 -0800128 _LOG_DEBUG ("[" << m_log->GetLocalName () << "] <<<<< RECOVER Interest with name " << name);
129
Zhenkai Zhue851b952013-01-13 22:29:57 -0800130 Bytes hashBytes = name.getComp(name.size() - 1);
131 // this is the hash unkonwn to the sender of the interest
132 Hash hash(head(hashBytes), hashBytes.size());
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800133 if (m_log->LookupSyncLog(hash) > 0)
Zhenkai Zhue851b952013-01-13 22:29:57 -0800134 {
135 // we know the hash, should reply everything
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800136 SyncStateMsgPtr msg = m_log->FindStateDifferences(*(Hash::Origin), *m_rootHash);
Alexander Afanasyev49a30d02013-01-21 21:38:48 -0800137
Alexander Afanasyev08aa70a2013-01-22 22:16:25 -0800138 BytesPtr syncData = serializeMsg (*msg);
Alexander Afanasyev49a30d02013-01-21 21:38:48 -0800139 m_ccnx->publishData(name, *syncData, FRESHNESS);
Alexander Afanasyevfcf81dc2013-01-25 20:36:58 -0800140 _LOG_TRACE ("[" << m_log->GetLocalName () << "] publishes " << hash.shortHash ());
Alexander Afanasyevfc720362013-01-24 21:49:48 -0800141 // _LOG_TRACE (msg);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800142 }
Alexander Afanasyevfc720362013-01-24 21:49:48 -0800143 else
144 {
145 // we don't recognize this hash, can not help
146 }
Zhenkai Zhue851b952013-01-13 22:29:57 -0800147}
148
149void
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800150SyncCore::handleSyncInterest(const Name &name)
151{
Alexander Afanasyevfc720362013-01-24 21:49:48 -0800152 _LOG_DEBUG ("[" << m_log->GetLocalName () << "] <<<<< SYNC Interest with name " << name);
153
Zhenkai Zhue851b952013-01-13 22:29:57 -0800154 Bytes hashBytes = name.getComp(name.size() - 1);
155 HashPtr hash(new Hash(head(hashBytes), hashBytes.size()));
156 if (*hash == *m_rootHash)
157 {
158 // we have the same hash; nothing needs to be done
Alexander Afanasyevfcf81dc2013-01-25 20:36:58 -0800159 _LOG_TRACE ("same as root hash: " << hash->shortHash ());
Zhenkai Zhue851b952013-01-13 22:29:57 -0800160 return;
161 }
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800162 else if (m_log->LookupSyncLog(*hash) > 0)
Zhenkai Zhue851b952013-01-13 22:29:57 -0800163 {
164 // we know something more
Alexander Afanasyev49a30d02013-01-21 21:38:48 -0800165 _LOG_TRACE ("found hash in sync log");
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800166 SyncStateMsgPtr msg = m_log->FindStateDifferences(*hash, *m_rootHash);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800167
Alexander Afanasyev08aa70a2013-01-22 22:16:25 -0800168 BytesPtr syncData = serializeMsg (*msg);
Alexander Afanasyev49a30d02013-01-21 21:38:48 -0800169 m_ccnx->publishData(name, *syncData, FRESHNESS);
Alexander Afanasyevfcf81dc2013-01-25 20:36:58 -0800170 _LOG_TRACE (m_log->GetLocalName () << " publishes: " << hash->shortHash ());
Alexander Afanasyev49a30d02013-01-21 21:38:48 -0800171 _LOG_TRACE (msg);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800172 }
173 else
174 {
175 // we don't recognize the hash, send recover Interest if still don't know the hash after a randomized wait period
Zhenkai Zhue573ae82013-01-15 13:15:52 -0800176 double wait = m_recoverWaitGenerator->nextInterval();
Alexander Afanasyevfcf81dc2013-01-25 20:36:58 -0800177 _LOG_TRACE (m_log->GetLocalName () << ", rootHash: " << *m_rootHash << ", hash: " << hash->shortHash ());
Alexander Afanasyev49a30d02013-01-21 21:38:48 -0800178 _LOG_TRACE ("recover task scheduled after wait: " << wait);
Zhenkai Zhue573ae82013-01-15 13:15:52 -0800179
Alexander Afanasyevc507ac22013-01-21 16:01:58 -0800180 Scheduler::scheduleOneTimeTask (m_scheduler,
181 wait, boost::bind(&SyncCore::recover, this, hash),
182 "r-"+lexical_cast<string> (*hash));
Zhenkai Zhue851b952013-01-13 22:29:57 -0800183 }
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800184}
185
186Closure::TimeoutCallbackReturnValue
187SyncCore::handleSyncInterestTimeout(const Name &name)
188{
Zhenkai Zhu3b406592013-01-25 21:07:49 -0800189 // sync interest will be resent by scheduler
Zhenkai Zhue851b952013-01-13 22:29:57 -0800190 return Closure::RESULT_OK;
191}
192
193Closure::TimeoutCallbackReturnValue
194SyncCore::handleRecoverInterestTimeout(const Name &name)
195{
196 // We do not re-express recovery interest for now
197 // if difference is not resolved, the sync interest will trigger
198 // recovery anyway; so it's not so important to have recovery interest
199 // re-expressed
200 return Closure::RESULT_OK;
201}
202
203void
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800204SyncCore::handleRecoverData(const Name &name, PcoPtr content)
Zhenkai Zhue851b952013-01-13 22:29:57 -0800205{
Alexander Afanasyevfc720362013-01-24 21:49:48 -0800206 _LOG_DEBUG ("[" << m_log->GetLocalName () << "] <<<<< RECOVER DATA with name: " << name);
Alexander Afanasyevc507ac22013-01-21 16:01:58 -0800207 //cout << "handle recover data" << end;
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800208 handleStateData(*content->contentPtr ());
Zhenkai Zhu6e7d4d22013-01-15 18:18:18 -0800209 sendSyncInterest();
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800210}
211
212void
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800213SyncCore::handleSyncData(const Name &name, PcoPtr content)
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800214{
Alexander Afanasyevfc720362013-01-24 21:49:48 -0800215 _LOG_DEBUG ("[" << m_log->GetLocalName () << "] <<<<< SYNC DATA with name: " << name);
216
Zhenkai Zhue851b952013-01-13 22:29:57 -0800217 // suppress recover in interest - data out of order case
Alexander Afanasyevf278db32013-01-21 14:41:01 -0800218 handleStateData(*content->contentPtr ());
Zhenkai Zhue851b952013-01-13 22:29:57 -0800219
220 // resume outstanding sync interest
221 sendSyncInterest();
222}
223
224void
225SyncCore::handleStateData(const Bytes &content)
226{
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800227 SyncStateMsgPtr msg(new SyncStateMsg);
228 bool success = msg->ParseFromArray(head(content), content.size());
229 if(!success)
230 {
231 // ignore misformed SyncData
Alexander Afanasyevc507ac22013-01-21 16:01:58 -0800232 _LOG_ERROR ("Misformed SyncData");
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800233 return;
234 }
235
Alexander Afanasyev49a30d02013-01-21 21:38:48 -0800236 _LOG_TRACE (m_log->GetLocalName () << " receives Msg ");
237 _LOG_TRACE (msg);
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800238 int size = msg->state_size();
239 int index = 0;
240 while (index < size)
241 {
242 SyncState state = msg->state(index);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800243 string devStr = state.name();
244 Name deviceName((const unsigned char *)devStr.c_str(), devStr.size());
Zhenkai Zhu6e7d4d22013-01-15 18:18:18 -0800245 // cout << "Got Name: " << deviceName;
Zhenkai Zhue851b952013-01-13 22:29:57 -0800246 if (state.type() == SyncState::UPDATE)
247 {
248 sqlite3_int64 seqno = state.seq();
Zhenkai Zhu6e7d4d22013-01-15 18:18:18 -0800249 // cout << ", Got seq: " << seqno << endl;
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800250 m_log->UpdateDeviceSeqNo(deviceName, seqno);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800251 if (state.has_locator())
252 {
253 string locStr = state.locator();
254 Name locatorName((const unsigned char *)locStr.c_str(), locStr.size());
Zhenkai Zhu6e7d4d22013-01-15 18:18:18 -0800255 // cout << ", Got loc: " << locatorName << endl;
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800256 m_log->UpdateLocator(deviceName, locatorName);
Alexander Afanasyev49a30d02013-01-21 21:38:48 -0800257
258 _LOG_TRACE ("self: " << m_log->GetLocalName () << ", device: " << deviceName << " < == > " << locatorName);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800259 }
260 }
261 else
262 {
Alexander Afanasyev49a30d02013-01-21 21:38:48 -0800263 _LOG_ERROR ("Receive SYNC DELETE, but we don't support it yet");
Zhenkai Zhue851b952013-01-13 22:29:57 -0800264 deregister(deviceName);
265 }
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800266 index++;
267 }
268
Zhenkai Zhue851b952013-01-13 22:29:57 -0800269 // find the actuall difference and invoke callback on the actual difference
270 HashPtr oldHash = m_rootHash;
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800271 m_rootHash = m_log->RememberStateInStateLog();
Zhenkai Zhu085aae72013-01-17 21:09:01 -0800272 // get diff with both new SeqNo and old SeqNo
273 SyncStateMsgPtr diff = m_log->FindStateDifferences(*oldHash, *m_rootHash, true);
Zhenkai Zhu6e7d4d22013-01-15 18:18:18 -0800274
Zhenkai Zhu9501b8b2013-01-17 12:37:00 -0800275 if (diff->state_size() > 0)
276 {
Alexander Afanasyevfc720362013-01-24 21:49:48 -0800277 m_stateMsgCallback (diff);
Zhenkai Zhu9501b8b2013-01-17 12:37:00 -0800278 }
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800279}
280
281void
282SyncCore::sendSyncInterest()
283{
Alexander Afanasyev49a30d02013-01-21 21:38:48 -0800284 Name syncInterest = Name (m_syncPrefix)(m_rootHash->GetHash(), m_rootHash->GetHashBytes());
285
Alexander Afanasyevfcf81dc2013-01-25 20:36:58 -0800286 _LOG_DEBUG ("[" << m_log->GetLocalName () << "] >>> SYNC Interest for " << m_rootHash->shortHash () << ": " << syncInterest);
Alexander Afanasyevfc720362013-01-24 21:49:48 -0800287
Zhenkai Zhu95160102013-01-25 21:54:57 -0800288 Selectors selectors;
289 if (m_syncInterestInterval > 0 && m_syncInterestInterval < 30.0)
290 {
291 selectors.interestLifetime(m_syncInterestInterval);
292 }
Alexander Afanasyev49a30d02013-01-21 21:38:48 -0800293 m_ccnx->sendInterest(syncInterest,
294 Closure (boost::bind(&SyncCore::handleSyncData, this, _1, _2),
Zhenkai Zhu95160102013-01-25 21:54:57 -0800295 boost::bind(&SyncCore::handleSyncInterestTimeout, this, _1)),
296 selectors);
Zhenkai Zhu3b406592013-01-25 21:07:49 -0800297
Zhenkai Zhu95160102013-01-25 21:54:57 -0800298 // if there is a pending syncSyncInterest task, reschedule it to be m_syncInterestInterval seconds from now
Zhenkai Zhu3b406592013-01-25 21:07:49 -0800299 // if no such task exists, it will be added
Zhenkai Zhu3b406592013-01-25 21:07:49 -0800300 m_scheduler->rescheduleTask(m_sendSyncInterestTask);
Zhenkai Zhue851b952013-01-13 22:29:57 -0800301}
302
303void
304SyncCore::recover(const HashPtr &hash)
305{
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800306 if (!(*hash == *m_rootHash) && m_log->LookupSyncLog(*hash) <= 0)
Zhenkai Zhue851b952013-01-13 22:29:57 -0800307 {
Alexander Afanasyevfcf81dc2013-01-25 20:36:58 -0800308 _LOG_TRACE (m_log->GetLocalName () << ", Recover for: " << hash->shortHash ());
Zhenkai Zhue851b952013-01-13 22:29:57 -0800309 // unfortunately we still don't recognize this hash
310 Bytes bytes;
311 readRaw(bytes, (const unsigned char *)hash->GetHash(), hash->GetHashBytes());
Alexander Afanasyev49a30d02013-01-21 21:38:48 -0800312
Zhenkai Zhue851b952013-01-13 22:29:57 -0800313 // append the unknown hash
Alexander Afanasyev49a30d02013-01-21 21:38:48 -0800314 Name recoverInterest = Name (m_syncPrefix)(RECOVER)(bytes);
315
Alexander Afanasyevfcf81dc2013-01-25 20:36:58 -0800316 _LOG_DEBUG ("[" << m_log->GetLocalName () << "] >>> RECOVER Interests for " << hash->shortHash ());
Alexander Afanasyevfc720362013-01-24 21:49:48 -0800317
Alexander Afanasyev49a30d02013-01-21 21:38:48 -0800318 m_ccnx->sendInterest(recoverInterest,
319 Closure (boost::bind(&SyncCore::handleRecoverData, this, _1, _2),
320 boost::bind(&SyncCore::handleRecoverInterestTimeout, this, _1)));
321
Zhenkai Zhue851b952013-01-13 22:29:57 -0800322 }
323 else
324 {
325 // we already learned the hash; cheers!
326 }
327}
328
329void
330SyncCore::deregister(const Name &name)
331{
332 // Do nothing for now
333 // TODO: handle deregistering
Zhenkai Zhu74dd53c2013-01-10 23:39:57 -0800334}
335
Zhenkai Zhu9501b8b2013-01-17 12:37:00 -0800336sqlite3_int64
337SyncCore::seq(const Name &name)
338{
Zhenkai Zhub330aed2013-01-17 13:29:37 -0800339 return m_log->SeqNo(name);
Zhenkai Zhu9501b8b2013-01-17 12:37:00 -0800340}