SyncHashCache.h File Reference

Part of CCNx Sync. More...

Go to the source code of this file.

Data Structures

struct  SyncHashCacheHead
struct  SyncHashCacheEntry

Enumerations

enum  SyncHashState {
  SyncHashState_local = 1, SyncHashState_remote = 2, SyncHashState_fetching = 4, SyncHashState_covered = 8,
  SyncHashState_storing = 16, SyncHashState_stored = 32, SyncHashState_marked = 64
}

Functions

struct SyncHashCacheEntrySyncHashLookup (struct SyncHashCacheHead *head, const unsigned char *xp, ssize_t xs)
 lookup a full hash in a hash table (raw contents, no tag)
struct SyncHashCacheEntrySyncHashEnter (struct SyncHashCacheHead *head, const unsigned char *xp, ssize_t xs, enum SyncHashState set)
 based on the raw hash, ensure that a remote cache entry exists ent->state |= set
void SyncHashRemoveEntry (struct SyncHashCacheHead *head, struct SyncHashCacheEntry *ce)
 remove the entry (if present)
void SyncHashClearMarks (struct SyncHashCacheHead *head)
 clear all marks
struct SyncHashCacheHeadSyncHashCacheCreate (struct SyncRootStruct *root, uint32_t mod)
 create a new hash table with the given modulus (mod == 0 uses a default)
struct SyncHashCacheHeadSyncHashCacheFree (struct SyncHashCacheHead *head)
 frees the cache resources caller must ensure no further use of the cache
int SyncCacheEntryFetch (struct SyncHashCacheEntry *ce)
 fetches the cache entry to be eligible, ce != NULL && ce->ncL != NULL && (ce->state & SyncHashState_stored) == 1
int SyncCacheEntryStore (struct SyncHashCacheEntry *ce)
 stores the cahe entry to the repo to be eligible, ce != NULL && ce->ncL == NULL && (ce->state & SyncHashState_stored) == 0

Detailed Description

Part of CCNx Sync.

Definition in file SyncHashCache.h.


Enumeration Type Documentation

Enumerator:
SyncHashState_local 

a local node exists

SyncHashState_remote 

a remote hash has been seen

SyncHashState_fetching 

remote node is being fetched

SyncHashState_covered 

remote hash known covered by the local root

SyncHashState_storing 

local node is queued to be stored

SyncHashState_stored 

local node has been stored

SyncHashState_marked 

cache entry has been marked

Definition at line 28 of file SyncHashCache.h.


Function Documentation

int SyncCacheEntryFetch ( struct SyncHashCacheEntry ce  ) 

fetches the cache entry to be eligible, ce != NULL && ce->ncL != NULL && (ce->state & SyncHashState_stored) == 1

Returns:
< 0 for failure, 0 if not eligible, and > 0 for success

Definition at line 209 of file SyncHashCache.c.

Referenced by cacheEntryForElem(), doComparison(), formatStats(), newNodeCommon(), SyncInterestArrived(), SyncTreeMergeNames(), and UpdateAction().

int SyncCacheEntryStore ( struct SyncHashCacheEntry ce  ) 

stores the cahe entry to the repo to be eligible, ce != NULL && ce->ncL == NULL && (ce->state & SyncHashState_stored) == 0

Returns:
< 0 for failure, 0 if not eligible, and > 0 for success

Definition at line 176 of file SyncHashCache.c.

Referenced by HeartbeatAction().

struct SyncHashCacheHead* SyncHashCacheCreate ( struct SyncRootStruct root,
uint32_t  mod 
) [read]

create a new hash table with the given modulus (mod == 0 uses a default)

Definition at line 144 of file SyncHashCache.c.

Referenced by SyncAddRoot().

struct SyncHashCacheHead* SyncHashCacheFree ( struct SyncHashCacheHead head  )  [read]

frees the cache resources caller must ensure no further use of the cache

Returns:
NULL

Definition at line 154 of file SyncHashCache.c.

Referenced by SyncRemRoot().

void SyncHashClearMarks ( struct SyncHashCacheHead head  ) 

clear all marks

Definition at line 130 of file SyncHashCache.c.

Referenced by purgeOldEntries().

struct SyncHashCacheEntry* SyncHashEnter ( struct SyncHashCacheHead head,
const unsigned char *  xp,
ssize_t  xs,
enum SyncHashState  set 
) [read]

based on the raw hash, ensure that a remote cache entry exists ent->state |= set

Definition at line 63 of file SyncHashCache.c.

Referenced by ccns_open(), ccns_root_advise_response(), ensureRemoteEntry(), newNodeCommon(), SyncInterestArrived(), SyncRemoteFetchResponse(), SyncRootAdviseResponse(), SyncStartCompareAction(), and UpdateAction().

struct SyncHashCacheEntry* SyncHashLookup ( struct SyncHashCacheHead head,
const unsigned char *  xp,
ssize_t  xs 
) [read]

lookup a full hash in a hash table (raw contents, no tag)

Returns:
entry if it exists

Definition at line 43 of file SyncHashCache.c.

Referenced by cacheEntryForElem(), ccns_send_root_advise_interest(), CompareAction(), doPreload(), MakeNodeFromNames(), newNodeCommon(), nodeFromNodes(), SyncRemoteFetchResponse(), SyncRootTopEntry(), SyncStartCompareAction(), and SyncTreeWorkerPush().

void SyncHashRemoveEntry ( struct SyncHashCacheHead head,
struct SyncHashCacheEntry ce 
)

remove the entry (if present)

Definition at line 106 of file SyncHashCache.c.

Generated on Tue Aug 21 14:54:55 2012 for Content-Centric Networking in C by  doxygen 1.6.3