00001 /** 00002 * @file sync/SyncPrivate.h 00003 * 00004 * Part of CCNx Sync. 00005 */ 00006 /* 00007 * Copyright (C) 2011-2012 Palo Alto Research Center, Inc. 00008 * 00009 * This library is free software; you can redistribute it and/or modify it 00010 * under the terms of the GNU Lesser General Public License version 2.1 00011 * as published by the Free Software Foundation. 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. You should have received 00016 * a copy of the GNU Lesser General Public License along with this library; 00017 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, 00018 * Fifth Floor, Boston, MA 02110-1301 USA. 00019 */ 00020 00021 #ifndef CCN_SyncPrivate 00022 #define CCN_SyncPrivate 00023 00024 #include "SyncBase.h" 00025 #include "SyncRoot.h" 00026 #include "SyncUtil.h" 00027 00028 struct SyncHashCacheEntry; // from SyncHashCache.h 00029 00030 struct SyncNameAccumList { 00031 struct SyncNameAccumList *next; 00032 struct SyncNameAccum *accum; 00033 }; 00034 00035 struct SyncPrivate { 00036 struct SyncRootStruct *rootHead; 00037 int nRoots; 00038 int useRepoStore; 00039 int stableEnabled; 00040 struct SyncNameAccum *topoAccum; 00041 struct SyncNameAccum *prefixAccum; 00042 struct SyncNameAccumList *filters; 00043 struct ccn_charbuf *localHostPrefix; 00044 struct ccn_charbuf *sliceCmdPrefix; 00045 struct SyncHashCacheEntry *storingHead; 00046 struct SyncHashCacheEntry *storingTail; 00047 struct ccn_indexbuf *comps; /*< used by SyncNotifyContent */ 00048 int nStoring; 00049 ccnr_hwm stableTarget; 00050 ccnr_hwm stableStored; 00051 int64_t lastStable; 00052 int64_t lastCacheClean; 00053 int sliceEnum; 00054 int sliceBusy; 00055 int fauxErrorTrigger; 00056 int syncActionsPrivate; 00057 int heartbeatMicros; /*< microseconds between action heartbeats */ 00058 int rootAdviseFresh; /*< seconds for root advise response freshness */ 00059 int rootAdviseLifetime; /*< seconds for root advise interest lifetime */ 00060 int fetchLifetime; /*< seconds for node fetch interest lifetime */ 00061 int maxFetchBusy; /*< max # of fetches per root busy */ 00062 int comparesBusy; /*< # of roots doing compares */ 00063 int maxComparesBusy; /*< max # of roots doing compares */ 00064 int deltasLimit; /*< # of bytes permitted for RootAdvise delta mode */ 00065 int syncScope; /*< default sync scope */ 00066 }; 00067 00068 struct SyncHashInfoList { 00069 struct SyncHashInfoList *next; 00070 struct SyncHashCacheEntry *ce; 00071 int64_t lastSeen; 00072 int64_t lastReplied; 00073 }; 00074 00075 struct SyncRootStats { 00076 uint64_t updatesDone; /*< number of sync tree root updates done */ 00077 uint64_t lastUpdateMicros; /*< last elapsed update time (microsecs) */ 00078 uint64_t comparesDone; /*< number of sync tree compares completed */ 00079 uint64_t lastCompareMicros; /*< last elapsed compare time (microsecs) */ 00080 uint64_t nodesCreated; /*< number of new nodes created */ 00081 uint64_t nodesShared; /*< number of nodes shared */ 00082 00083 uint64_t rootAdviseSent; /*< number of RootAdvise interests sent */ 00084 uint64_t nodeFetchSent; /*< number of NodeFetch interests sent */ 00085 uint64_t contentFetchSent; /*< number of content fetch interests sent */ 00086 00087 uint64_t rootAdviseSeen; /*< number of RootAdvise interests received */ 00088 uint64_t nodeFetchSeen; /*< number of NodeFetch interests received */ 00089 00090 uint64_t rootAdviseReceived; /*< number of RootAdvise responses received */ 00091 uint64_t nodeFetchReceived; /*< number of NodeFetch responses received */ 00092 uint64_t contentFetchReceived; /*< number of content objects received */ 00093 00094 uint64_t rootAdviseBytes; /*< number of bytes for RootAdvise responses */ 00095 uint64_t nodeFetchBytes; /*< number of bytes for NodeFetch responses */ 00096 uint64_t contentFetchBytes; /*< number of bytes for content objects */ 00097 00098 uint64_t rootAdviseTimeout; /*< number of RootAdvise response timeouts */ 00099 uint64_t nodeFetchTimeout; /*< number of NodeFetch response timeouts */ 00100 uint64_t contentFetchTimeout; /*< number of content object response timeouts */ 00101 00102 uint64_t rootAdviseFailed; /*< number of RootAdvise response failures */ 00103 uint64_t nodeFetchFailed; /*< number of NodeFetch response failures */ 00104 uint64_t contentFetchFailed; /*< number of content object response failures */ 00105 00106 }; 00107 00108 struct SyncRootDeltas { 00109 struct SyncRootDeltas *next; /*< link to next update */ 00110 struct SyncHashCacheEntry *ceStart; /*< entry for start hash (may be NULL) */ 00111 struct SyncHashCacheEntry *ceStop; /*< entry for end hash */ 00112 int64_t whenMade; /*< when created */ 00113 int64_t whenSent; /*< when last sent */ 00114 int deltasCount; /*< number of names in coding */ 00115 int closed; /*< 1 if coding is complete */ 00116 struct ccn_charbuf *coding; /*< coding for updates */ 00117 struct ccn_charbuf *name; /*< name used for reply */ 00118 struct ccn_charbuf *cob; /*< signed response buffer */ 00119 }; 00120 00121 struct SyncRootPrivate { 00122 struct SyncRootStats *stats; 00123 struct SyncHashCacheEntry *ceCurrent; /*< entry for current root hash (may be NULL) */ 00124 struct SyncHashInfoList *remoteSeen; 00125 struct SyncHashInfoList *localMade; 00126 struct SyncRootDeltas *deltasHead; /*< pointer to eldest update */ 00127 struct SyncRootDeltas *deltasTail; /*< pointer to youngest update */ 00128 int nDeltas; /*< number of deltas in the list */ 00129 struct SyncNameAccum *remoteDeltas; /*< delta names from remote sources */ 00130 int syncScope; /*< scope to be used for sync */ 00131 int sliceBusy; 00132 ccnr_hwm highWater; // high water via SyncNotifyContent 00133 ccnr_hwm stablePoint; // stable point for this root 00134 int64_t lastAdvise; 00135 int64_t lastUpdate; 00136 int64_t lastStable; 00137 int64_t lastHashChange; 00138 int adviseNeed; 00139 struct SyncHashCacheEntry *lastLocalSent; 00140 size_t currentSize; 00141 size_t prevAddLen; 00142 }; 00143 00144 #endif