Part of CCNx Sync. More...
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <sys/resource.h>
#include <sys/time.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>
#include "SyncActions.h"
#include <sys/types.h>
#include <stdint.h>
#include "IndexSorter.h"
#include "SyncBase.h"
#include "SyncRoot.h"
#include "SyncUtil.h"
Classes | |
struct | SyncCompareData |
struct | SyncUpdateData |
Defines | |
#define | M 1000000 |
#define | SYNC_UPDATE_VERSION (20120307) |
#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 int | HeartbeatAction (struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags) |
static int | UpdateAction (struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags) |
static int | CompareAction (struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags) |
static int | showCacheEntry (struct SyncRootStruct *root, char *dst, int lim, char *prefix, struct SyncHashCacheEntry *ce) |
static void | showCacheEntry1 (struct SyncRootStruct *root, char *here, char *msg, struct SyncHashCacheEntry *ce) |
static void | showCacheEntry2 (struct SyncRootStruct *root, char *here, char *msg, struct SyncHashCacheEntry *ce1, struct SyncHashCacheEntry *ce2) |
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) |
static 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 SyncNameAccum *acc, struct SyncHashInfoList *list) |
static struct ccn_charbuf * | constructCommandPrefix (struct SyncRootStruct *root, enum SyncRegisterActionKind kind) |
static int | extractDeltas (struct SyncRootStruct *root, struct ccn_upcall_info *info) |
static struct SyncNodeComposite * | extractNode (struct SyncRootStruct *root, struct ccn_upcall_info *info) |
static int | noteHash (struct SyncRootStruct *root, struct SyncHashCacheEntry *ce, int add, int remote) |
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 void | kickCompare (struct SyncCompareData *scd, struct SyncActionData *action) |
static void | kickHeartBeat (struct SyncRootStruct *root, int micros) |
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) |
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) |
static struct SyncRootDeltas * | NewDeltas (struct SyncRootStruct *root) |
static struct SyncRootDeltas * | FreeDeltas (struct SyncRootDeltas *deltas) |
static int | RemRootDeltas (struct SyncRootStruct *root, struct SyncRootDeltas *deltas) |
static int | SendDeltasReply (struct SyncRootStruct *root, struct SyncRootDeltas *deltas) |
static struct SyncHashInfoList * | scanRemoteSeen (struct SyncRootStruct *root, struct SyncHashCacheEntry *ceR) |
static struct SyncRootDeltas * | CloseUpdateCoding (struct SyncUpdateData *ud) |
static struct SyncRootDeltas * | scanDeltas (struct SyncRootStruct *root, struct SyncHashCacheEntry *ceR) |
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, int isNew) |
static int | SyncTreeMergeNames (struct SyncTreeWorkerHead *head, struct SyncUpdateData *ud) |
static struct SyncUpdateData * | FreeUpdateData (struct SyncUpdateData *ud) |
int | SyncUpdateRoot (struct SyncRootStruct *root) |
int | SyncStartCompareAction (struct SyncRootStruct *root, struct ccn_charbuf *hashR) |
Variables | |
static int | useCompExcl = 1 |
static int | showHighLevel = 1 |
static int | nDeltasLimit = 4 |
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 = 600 |
static int | exclusionTrig = 5 |
static int | stableTimeTrig = 10 |
static int | hashSplitTrigger = 17 |
static int | namesYieldInc = 100 |
static int | namesYieldMicros = 20*1000 |
static char * | syncStableSuffix = "SyncStable" |
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 StatsLine | ( | XXX | ) |
if (stats->XXX) \ pos += snprintf(s+pos, lim-pos, ", %s %ju", #XXX, (uintmax_t) stats->XXX);