CCNx-Android-Services/jni/csrc/sync/SyncActions.c File Reference

Part of CCNx Sync. More...

#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <sys/resource.h>
#include <sys/time.h>
#include "SyncActions.h"
#include "SyncNode.h"
#include "SyncPrivate.h"
#include "SyncRoot.h"
#include "SyncTreeWorker.h"
#include "SyncUtil.h"
#include <ccn/ccn.h>
#include <ccn/charbuf.h>
#include <ccn/coding.h>
#include <ccn/indexbuf.h>
#include <ccn/schedule.h>
#include <ccnr/ccnr_msg.h>
#include <ccnr/ccnr_sync.h>
#include <ccnr/ccnr_private.h>

Classes

struct  SyncCompareData
struct  SyncUpdateData

Defines

#define M   1000000
#define StatsLine(XXX)

Enumerations

enum  SyncCompareState {
  SyncCompare_init, SyncCompare_preload, SyncCompare_busy, SyncCompare_waiting,
  SyncCompare_done
}
enum  SyncUpdateState {
  SyncUpdate_init, SyncUpdate_inserted, SyncUpdate_busy, SyncUpdate_error,
  SyncUpdate_done
}

Functions

static struct SyncActionData * newActionData (enum SyncRegisterActionKind kind)
static void linkActionData (struct SyncRootStruct *root, struct SyncActionData *data)
static void delinkActionData (struct SyncActionData *data)
static int moveActionData (struct SyncActionData *data, enum SyncActionState dstState)
static struct SyncActionData * destroyActionData (struct SyncActionData *data)
static char * getCmdStr (enum SyncRegisterActionKind kind)
static char * getKindStr (enum SyncRegisterActionKind kind)
static void setCovered (struct SyncHashCacheEntry *ce)
static int isCovered (struct SyncHashCacheEntry *ce)
static int compareHash (struct ccn_charbuf *hashX, struct ccn_charbuf *hashY)
static struct SyncNameAccum * sortNames (struct SyncRootStruct *root, struct SyncNameAccum *src)
int reportExclude (struct SyncRootStruct *root, struct ccn_buf_decoder *d)
static struct ccn_charbuf * formatStats (struct SyncRootStruct *root, struct ccn_charbuf *cb)
static struct SyncNameAccum * exclusionsFromHashList (struct SyncRootStruct *root, struct SyncHashInfoList *list)
static struct ccn_charbuf * constructCommandPrefix (struct SyncRootStruct *root, enum SyncRegisterActionKind kind)
static struct SyncNodeComposite * extractNode (struct SyncRootStruct *root, struct ccn_upcall_info *info)
static int noteRemoteHash (struct SyncRootStruct *root, struct SyncHashCacheEntry *ce, int add)
static struct SyncHashInfoList * chooseRemoteHash (struct SyncRootStruct *root)
static int fauxError (struct SyncBaseStruct *base)
static void destroyCompareData (struct SyncCompareData *data)
static void abortCompare (struct SyncCompareData *data, char *why)
static int extractBuf (struct ccn_charbuf *cb, struct SyncNodeComposite *nc, struct SyncNodeElem *ne)
static struct SyncHashCacheEntry * ensureRemoteEntry (struct SyncCompareData *data, const unsigned char *xp, ssize_t xs)
static struct SyncHashCacheEntry * cacheEntryForElem (struct SyncCompareData *data, struct SyncNodeComposite *nc, struct SyncNodeElem *ne, int remote)
static int comparisonFailed (struct SyncCompareData *data, char *why, int line)
static int addNameFromCompare (struct SyncCompareData *data)
static int doPreload (struct SyncCompareData *data)
static int doComparison (struct SyncCompareData *data)
static int fetchStablePoint (struct SyncBaseStruct *base, ccnr_hwm *ptr)
static int storeStablePoint (struct SyncBaseStruct *base, ccnr_hwm point)
static int isRootStableEnough (struct SyncRootStruct *root, ccnr_hwm target)
static void purgeOldEntries (struct SyncRootStruct *root)
static int CompareAction (struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
static void kickCompare (struct SyncCompareData *scd, struct SyncActionData *action)
static struct SyncHashCacheEntry * newNodeCommon (struct SyncRootStruct *root, struct SyncNodeAccum *nodes, struct SyncNodeComposite *nc)
static struct SyncHashCacheEntry * nodeFromNodes (struct SyncRootStruct *root, struct SyncNodeAccum *na)
int SyncStartSliceEnum (struct SyncRootStruct *root)
static int HeartbeatAction (struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
int SyncStartHeartbeat (struct SyncBaseStruct *base)
enum ccn_upcall_res SyncRemoteFetchResponse (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
int SyncStartNodeFetch (struct SyncRootStruct *root, struct SyncHashCacheEntry *ce, struct SyncCompareData *comp)
int SyncStartContentFetch (struct SyncRootStruct *root, struct ccn_charbuf *name, struct SyncCompareData *comp)
static struct SyncActionData * SyncFindAction (struct SyncRootStruct *root, enum SyncRegisterActionKind kind)
int SyncAddName (struct SyncBaseStruct *base, struct ccn_charbuf *name, ccnr_accession item)
static int findAndDeleteRoot (struct SyncBaseStruct *base, char *here, const unsigned char *hp, ssize_t hs)
int SyncHandleSlice (struct SyncBaseStruct *base, struct ccn_charbuf *name)
enum ccn_upcall_res SyncInterestArrived (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
static int SyncRegisterInterest (struct SyncRootStruct *root, enum SyncRegisterActionKind kind)
int SyncRegisterInterests (struct SyncRootStruct *root)
enum ccn_upcall_res SyncRootAdviseResponse (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
int SyncSendRootAdviseInterest (struct SyncRootStruct *root)
static int MakeNodeFromNames (struct SyncUpdateData *ud, int split)
static int TryNodeSplit (struct SyncUpdateData *ud)
static int AddUpdateName (struct SyncUpdateData *ud, struct ccn_charbuf *name)
static int SyncTreeMergeNames (struct SyncTreeWorkerHead *head, struct SyncUpdateData *ud)
static int UpdateAction (struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags)
int SyncUpdateRoot (struct SyncRootStruct *root)
int SyncStartCompareAction (struct SyncRootStruct *root, struct ccn_charbuf *hashR)

Variables

static int cachePurgeTrigger = 60
static int cacheCleanBatch = 16
static int cacheCleanDelta = 8
static int adviseNeedReset = 1
static int updateStallDelta = 15
static int updateNeedDelta = 6
static int shortDelayMicros = 1000
static int compareAssumeBad = 20
static int nodeSplitTrigger = 4000
static int exclusionLimit = 1000
static int stableTimeTrig = 10
static int hashSplitTrigger = 17
static int namesYieldInc = 100
static int namesYieldMicros = 20*1000
static char * syncStableSuffix = "SyncStable"
static int syncScope = 2


Detailed Description

Part of CCNx Sync.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


Define Documentation

#define StatsLine ( XXX   ) 

Value:

if (stats->XXX) \
pos += snprintf(s+pos, lim-pos, ", %s %ju", #XXX, (uintmax_t) stats->XXX);


Generated on Thu Feb 16 00:45:13 2012 for CCNx for Android by  doxygen 1.5.6