Go to the source code of this file.
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) |
starts a slice enumeration for the root | |
static int | HeartbeatAction (struct ccn_schedule *sched, void *clienth, struct ccn_scheduled_event *ev, int flags) |
int | SyncStartHeartbeat (struct SyncBaseStruct *base) |
starts a periodic wakeup that maintains state across all roots | |
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) |
starts a remote fetch of the given node, based on the hash comp may be NULL if this is not for a compare | |
int | SyncStartContentFetch (struct SyncRootStruct *root, struct ccn_charbuf *name, struct SyncCompareData *comp) |
starts a remote fetch of the given name comp may be NULL if this is not for a compare | |
static struct SyncActionData * | SyncFindAction (struct SyncRootStruct *root, enum SyncRegisterActionKind kind) |
int | SyncAddName (struct SyncBaseStruct *base, struct ccn_charbuf *name, ccnr_accession item) |
Adds the given name to any applicable roots. | |
static int | findAndDeleteRoot (struct SyncBaseStruct *base, char *here, const unsigned char *hp, ssize_t hs) |
int | SyncHandleSlice (struct SyncBaseStruct *base, struct ccn_charbuf *name) |
Creates a new slice from a full 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) |
registers interests associated with the given root these include C1.S.RA (Root Advise) and C1.S.NF (Node Fetch) interests additional interests may be registered as the protocol evolves | |
enum ccn_upcall_res | SyncRootAdviseResponse (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info) |
int | SyncSendRootAdviseInterest (struct SyncRootStruct *root) |
send a root advise request for the given root only one at a time may be outstanding | |
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) |
updates the root with the current root->namesToAdd | |
int | SyncStartCompareAction (struct SyncRootStruct *root, struct ccn_charbuf *hashR) |
initiates a compare action with the given remote hash | |
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 |
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.
Definition in file SyncActions.c.
#define M 1000000 |
Definition at line 41 of file SyncActions.c.
Referenced by chooseRemoteHash(), formatStats(), GetCurrentTime(), GetCurrentTimeUSecs(), HeartbeatAction(), MilliSleep(), purgeOldEntries(), and SyncCurrentTime().
#define StatsLine | ( | XXX | ) |
Value:
if (stats->XXX) \ pos += snprintf(s+pos, lim-pos, ", %s %ju", #XXX, (uintmax_t) stats->XXX);
Definition at line 378 of file SyncActions.c.
Referenced by formatStats().
enum SyncCompareState |
SyncCompare_init | |
SyncCompare_preload | |
SyncCompare_busy | |
SyncCompare_waiting | |
SyncCompare_done |
Definition at line 62 of file SyncActions.c.
enum SyncUpdateState |
Definition at line 97 of file SyncActions.c.
static void abortCompare | ( | struct SyncCompareData * | data, | |
char * | why | |||
) | [static] |
static int addNameFromCompare | ( | struct SyncCompareData * | data | ) | [static] |
static int AddUpdateName | ( | struct SyncUpdateData * | ud, | |
struct ccn_charbuf * | name | |||
) | [static] |
static struct SyncHashCacheEntry* cacheEntryForElem | ( | struct SyncCompareData * | data, | |
struct SyncNodeComposite * | nc, | |||
struct SyncNodeElem * | ne, | |||
int | remote | |||
) | [static, read] |
static struct SyncHashInfoList* chooseRemoteHash | ( | struct SyncRootStruct * | root | ) | [static, read] |
static int CompareAction | ( | struct ccn_schedule * | sched, | |
void * | clienth, | |||
struct ccn_scheduled_event * | ev, | |||
int | flags | |||
) | [static] |
static int compareHash | ( | struct ccn_charbuf * | hashX, | |
struct ccn_charbuf * | hashY | |||
) | [static] |
Definition at line 299 of file SyncActions.c.
Referenced by abortCompare(), SyncStartNodeFetch(), and UpdateAction().
static int comparisonFailed | ( | struct SyncCompareData * | data, | |
char * | why, | |||
int | line | |||
) | [static] |
static struct ccn_charbuf* constructCommandPrefix | ( | struct SyncRootStruct * | root, | |
enum SyncRegisterActionKind | kind | |||
) | [static, read] |
Definition at line 547 of file SyncActions.c.
Referenced by SyncRegisterInterest(), SyncSendRootAdviseInterest(), and SyncStartNodeFetch().
static void delinkActionData | ( | struct SyncActionData * | data | ) | [static] |
Definition at line 148 of file SyncActions.c.
Referenced by destroyActionData(), and moveActionData().
static struct SyncActionData* destroyActionData | ( | struct SyncActionData * | data | ) | [static, read] |
Definition at line 219 of file SyncActions.c.
Referenced by CompareAction(), destroyCompareData(), doPreload(), SyncInterestArrived(), SyncRegisterInterest(), SyncRemoteFetchResponse(), SyncRootAdviseResponse(), SyncSendRootAdviseInterest(), SyncStartContentFetch(), and SyncStartNodeFetch().
static void destroyCompareData | ( | struct SyncCompareData * | data | ) | [static] |
static int doComparison | ( | struct SyncCompareData * | data | ) | [static] |
static int doPreload | ( | struct SyncCompareData * | data | ) | [static] |
static struct SyncHashCacheEntry* ensureRemoteEntry | ( | struct SyncCompareData * | data, | |
const unsigned char * | xp, | |||
ssize_t | xs | |||
) | [static, read] |
static struct SyncNameAccum* exclusionsFromHashList | ( | struct SyncRootStruct * | root, | |
struct SyncHashInfoList * | list | |||
) | [static, read] |
static int extractBuf | ( | struct ccn_charbuf * | cb, | |
struct SyncNodeComposite * | nc, | |||
struct SyncNodeElem * | ne | |||
) | [static] |
Definition at line 770 of file SyncActions.c.
Referenced by doComparison(), and SyncTreeMergeNames().
static struct SyncNodeComposite* extractNode | ( | struct SyncRootStruct * | root, | |
struct ccn_upcall_info * | info | |||
) | [static, read] |
Definition at line 567 of file SyncActions.c.
Referenced by SyncRemoteFetchResponse(), and SyncRootAdviseResponse().
static int fauxError | ( | struct SyncBaseStruct * | base | ) | [static] |
Definition at line 675 of file SyncActions.c.
Referenced by SyncRemoteFetchResponse(), and SyncRootAdviseResponse().
static int fetchStablePoint | ( | struct SyncBaseStruct * | base, | |
ccnr_hwm * | ptr | |||
) | [static] |
static int findAndDeleteRoot | ( | struct SyncBaseStruct * | base, | |
char * | here, | |||
const unsigned char * | hp, | |||
ssize_t | hs | |||
) | [static] |
static struct ccn_charbuf* formatStats | ( | struct SyncRootStruct * | root, | |
struct ccn_charbuf * | cb | |||
) | [static, read] |
Definition at line 383 of file SyncActions.c.
Referenced by CompareAction(), getFile(), putFile(), SyncInterestArrived(), and UpdateAction().
static char* getCmdStr | ( | enum SyncRegisterActionKind | kind | ) | [static] |
static char* getKindStr | ( | enum SyncRegisterActionKind | kind | ) | [static] |
Definition at line 252 of file SyncActions.c.
Referenced by SyncInterestArrived(), and SyncRegisterInterest().
static int HeartbeatAction | ( | struct ccn_schedule * | sched, | |
void * | clienth, | |||
struct ccn_scheduled_event * | ev, | |||
int | flags | |||
) | [static] |
static int isCovered | ( | struct SyncHashCacheEntry * | ce | ) | [static] |
Definition at line 289 of file SyncActions.c.
Referenced by doComparison(), SyncRemoteFetchResponse(), and SyncRootAdviseResponse().
static int isRootStableEnough | ( | struct SyncRootStruct * | root, | |
ccnr_hwm | target | |||
) | [static] |
static void kickCompare | ( | struct SyncCompareData * | scd, | |
struct SyncActionData * | action | |||
) | [static] |
Definition at line 1431 of file SyncActions.c.
Referenced by SyncRemoteFetchResponse(), and SyncStartCompareAction().
static void linkActionData | ( | struct SyncRootStruct * | root, | |
struct SyncActionData * | data | |||
) | [static] |
Definition at line 139 of file SyncActions.c.
Referenced by SyncRegisterInterest(), SyncSendRootAdviseInterest(), SyncStartContentFetch(), and SyncStartNodeFetch().
static int MakeNodeFromNames | ( | struct SyncUpdateData * | ud, | |
int | split | |||
) | [static] |
static int moveActionData | ( | struct SyncActionData * | data, | |
enum SyncActionState | dstState | |||
) | [static] |
static struct SyncActionData* newActionData | ( | enum SyncRegisterActionKind | kind | ) | [static, read] |
Definition at line 130 of file SyncActions.c.
Referenced by SyncRegisterInterest(), SyncSendRootAdviseInterest(), SyncStartContentFetch(), and SyncStartNodeFetch().
static struct SyncHashCacheEntry* newNodeCommon | ( | struct SyncRootStruct * | root, | |
struct SyncNodeAccum * | nodes, | |||
struct SyncNodeComposite * | nc | |||
) | [static, read] |
Definition at line 1449 of file SyncActions.c.
Referenced by MakeNodeFromNames(), and nodeFromNodes().
static struct SyncHashCacheEntry* nodeFromNodes | ( | struct SyncRootStruct * | root, | |
struct SyncNodeAccum * | na | |||
) | [static, read] |
static int noteRemoteHash | ( | struct SyncRootStruct * | root, | |
struct SyncHashCacheEntry * | ce, | |||
int | add | |||
) | [static] |
Definition at line 596 of file SyncActions.c.
Referenced by SyncInterestArrived(), and SyncRootAdviseResponse().
static void purgeOldEntries | ( | struct SyncRootStruct * | root | ) | [static] |
int reportExclude | ( | struct SyncRootStruct * | root, | |
struct ccn_buf_decoder * | d | |||
) |
static void setCovered | ( | struct SyncHashCacheEntry * | ce | ) | [static] |
Definition at line 272 of file SyncActions.c.
Referenced by doComparison(), ensureRemoteEntry(), isCovered(), newNodeCommon(), and noteRemoteHash().
static struct SyncNameAccum* sortNames | ( | struct SyncRootStruct * | root, | |
struct SyncNameAccum * | src | |||
) | [static, read] |
static int storeStablePoint | ( | struct SyncBaseStruct * | base, | |
ccnr_hwm | point | |||
) | [static] |
int SyncAddName | ( | struct SyncBaseStruct * | base, | |
struct ccn_charbuf * | name, | |||
ccnr_accession | item | |||
) |
Adds the given name to any applicable roots.
Use item == 0 to ignore accession number.
Definition at line 2163 of file SyncActions.c.
Referenced by SyncNotifyContent(), and SyncStartContentFetch().
static struct SyncActionData* SyncFindAction | ( | struct SyncRootStruct * | root, | |
enum SyncRegisterActionKind | kind | |||
) | [static, read] |
Definition at line 2153 of file SyncActions.c.
Referenced by SyncInterestArrived(), and SyncSendRootAdviseInterest().
int SyncHandleSlice | ( | struct SyncBaseStruct * | base, | |
struct ccn_charbuf * | name | |||
) |
Creates a new slice from a full name.
The name must start with base->priv->sliceCmdPrefix.
Definition at line 2258 of file SyncActions.c.
Referenced by SyncNotifyContent().
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 | |||
) | [static] |
int SyncRegisterInterests | ( | struct SyncRootStruct * | root | ) |
registers interests associated with the given root these include C1.S.RA (Root Advise) and C1.S.NF (Node Fetch) interests additional interests may be registered as the protocol evolves
Definition at line 2662 of file SyncActions.c.
Referenced by SyncAddRoot().
enum ccn_upcall_res SyncRemoteFetchResponse | ( | struct ccn_closure * | selfp, | |
enum ccn_upcall_kind | kind, | |||
struct ccn_upcall_info * | info | |||
) |
Definition at line 1843 of file SyncActions.c.
Referenced by SyncStartContentFetch(), and SyncStartNodeFetch().
enum ccn_upcall_res SyncRootAdviseResponse | ( | struct ccn_closure * | selfp, | |
enum ccn_upcall_kind | kind, | |||
struct ccn_upcall_info * | info | |||
) |
int SyncSendRootAdviseInterest | ( | struct SyncRootStruct * | root | ) |
send a root advise request for the given root only one at a time may be outstanding
Definition at line 2848 of file SyncActions.c.
Referenced by HeartbeatAction(), and UpdateAction().
int SyncStartCompareAction | ( | struct SyncRootStruct * | root, | |
struct ccn_charbuf * | hashR | |||
) |
initiates a compare action with the given remote hash
Definition at line 3455 of file SyncActions.c.
Referenced by HeartbeatAction().
int SyncStartContentFetch | ( | struct SyncRootStruct * | root, | |
struct ccn_charbuf * | name, | |||
struct SyncCompareData * | comp | |||
) |
starts a remote fetch of the given name comp may be NULL if this is not for a compare
Definition at line 2095 of file SyncActions.c.
Referenced by CompareAction().
int SyncStartHeartbeat | ( | struct SyncBaseStruct * | base | ) |
starts a periodic wakeup that maintains state across all roots
Definition at line 1788 of file SyncActions.c.
Referenced by SyncInit().
int SyncStartNodeFetch | ( | struct SyncRootStruct * | root, | |
struct SyncHashCacheEntry * | ce, | |||
struct SyncCompareData * | comp | |||
) |
starts a remote fetch of the given node, based on the hash comp may be NULL if this is not for a compare
Definition at line 2018 of file SyncActions.c.
Referenced by doComparison(), and doPreload().
int SyncStartSliceEnum | ( | struct SyncRootStruct * | root | ) |
starts a slice enumeration for the root
Definition at line 1578 of file SyncActions.c.
Referenced by HeartbeatAction(), and SyncNotifyContent().
static int SyncTreeMergeNames | ( | struct SyncTreeWorkerHead * | head, | |
struct SyncUpdateData * | ud | |||
) | [static] |
int SyncUpdateRoot | ( | struct SyncRootStruct * | root | ) |
updates the root with the current root->namesToAdd
Definition at line 3411 of file SyncActions.c.
Referenced by HeartbeatAction(), and testReadBuilder().
static int TryNodeSplit | ( | struct SyncUpdateData * | ud | ) | [static] |
static int UpdateAction | ( | struct ccn_schedule * | sched, | |
void * | clienth, | |||
struct ccn_scheduled_event * | ev, | |||
int | flags | |||
) | [static] |
int adviseNeedReset = 1 [static] |
Definition at line 47 of file SyncActions.c.
Referenced by HeartbeatAction(), SyncInterestArrived(), SyncRegisterInterests(), and UpdateAction().
int cacheCleanBatch = 16 [static] |
int cacheCleanDelta = 8 [static] |
int cachePurgeTrigger = 60 [static] |
int compareAssumeBad = 20 [static] |
int exclusionLimit = 1000 [static] |
int hashSplitTrigger = 17 [static] |
int namesYieldInc = 100 [static] |
Definition at line 56 of file SyncActions.c.
Referenced by SyncTreeMergeNames(), and UpdateAction().
int namesYieldMicros = 20*1000 [static] |
Definition at line 57 of file SyncActions.c.
Referenced by SyncTreeMergeNames(), and UpdateAction().
int nodeSplitTrigger = 4000 [static] |
Definition at line 52 of file SyncActions.c.
Referenced by AddUpdateName(), newNodeCommon(), nodeFromNodes(), and TryNodeSplit().
int shortDelayMicros = 1000 [static] |
Definition at line 50 of file SyncActions.c.
Referenced by CompareAction(), HeartbeatAction(), kickCompare(), and UpdateAction().
int stableTimeTrig = 10 [static] |
int syncScope = 2 [static] |
Definition at line 60 of file SyncActions.c.
Referenced by SyncSendRootAdviseInterest(), SyncStartContentFetch(), and SyncStartNodeFetch().
char* syncStableSuffix = "SyncStable" [static] |
Definition at line 58 of file SyncActions.c.
Referenced by fetchStablePoint(), and storeStablePoint().
int updateNeedDelta = 6 [static] |
int updateStallDelta = 15 [static] |