SyncTreeWorker.h File Reference

Part of CCNx Sync. More...

Go to the source code of this file.

Data Structures

struct  SyncTreeWorkerHead
struct  SyncTreeWorkerEntry

Enumerations

enum  SyncTreeWorkerState { SyncTreeWorkerState_init, SyncTreeWorkerState_needFetch, SyncTreeWorkerState_fetching, SyncTreeWorkerState_error }
 SyncTreeWorker maintains the state for walking a local sync tree root, This is important becase the state cannot be simply kept in a call stack. More...

Functions

struct SyncTreeWorkerHeadSyncTreeWorkerCreate (struct SyncHashCacheHead *cache, struct SyncHashCacheEntry *ent, int remote)
 create a new tree worker, based on the given cache ent != NULL: initialize from the given node ent == NULL: create an empty worker, to be externally initialized
void SyncTreeWorkerInit (struct SyncTreeWorkerHead *head, struct SyncHashCacheEntry *ent, int remote)
 initialize an existing worker from the cache entry resulting level will be 1
struct SyncNodeElemSyncTreeWorkerGetElem (struct SyncTreeWorkerHead *head)
 requires that the node be present
struct SyncTreeWorkerEntrySyncTreeWorkerTop (struct SyncTreeWorkerHead *head)
struct SyncTreeWorkerEntrySyncTreeWorkerPush (struct SyncTreeWorkerHead *head)
 pushes into the node at the current position
struct SyncTreeWorkerEntrySyncTreeWorkerPop (struct SyncTreeWorkerHead *head)
 pops the stack and returns the top entry popping an empty stack has no effect and returns NULL
void SyncTreeWorkerReset (struct SyncTreeWorkerHead *head, int level)
 Reset the worker to the given level (or the current level if that is less).
struct SyncTreeWorkerHeadSyncTreeWorkerFree (struct SyncTreeWorkerHead *head)
 Free the storage for the worker.
enum SyncCompareResult SyncTreeLookupName (struct SyncTreeWorkerHead *head, struct ccn_charbuf *name, int minLevel)
 Lookup the name in the tree, starting at the current point, with backtrack while the level is greater than the given minimum.
enum SyncCompareResult SyncTreeGenerateNames (struct SyncTreeWorkerHead *head, struct SyncNameAccum *accum, int minLevel)
 Generate the names in the tree, starting at the current point, with backtrack while the level is greater than the given minimum.
int SyncTreeMarkReachable (struct SyncTreeWorkerHead *head, int minLevel)
 Mark all reachable cache entries using the current tree worker head, with backtrack while the level is greater than the given minimum.


Detailed Description

Part of CCNx Sync.

Copyright (C) 2011 Palo Alto Research Center, Inc.

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 SyncTreeWorker.h.


Enumeration Type Documentation

SyncTreeWorker maintains the state for walking a local sync tree root, This is important becase the state cannot be simply kept in a call stack.

Enumerator:
SyncTreeWorkerState_init 
SyncTreeWorkerState_needFetch 
SyncTreeWorkerState_fetching 
SyncTreeWorkerState_error 

Definition at line 32 of file SyncTreeWorker.h.


Function Documentation

enum SyncCompareResult SyncTreeGenerateNames ( struct SyncTreeWorkerHead head,
struct SyncNameAccum accum,
int  minLevel 
)

Generate the names in the tree, starting at the current point, with backtrack while the level is greater than the given minimum.

When SCR_missing is returned, SyncTreeWorkerTop(head) is missing.

Definition at line 218 of file SyncTreeWorker.c.

enum SyncCompareResult SyncTreeLookupName ( struct SyncTreeWorkerHead head,
struct ccn_charbuf name,
int  minLevel 
)

Lookup the name in the tree, starting at the current point, with backtrack while the level is greater than the given minimum.

The lookup can be restarted when a missing node is encountered. When SCR_missing is returned, SyncTreeWorkerTop(head) is missing.

Definition at line 163 of file SyncTreeWorker.c.

int SyncTreeMarkReachable ( struct SyncTreeWorkerHead head,
int  minLevel 
)

Mark all reachable cache entries using the current tree worker head, with backtrack while the level is greater than the given minimum.

When SCR_missing is returned, SyncTreeWorkerTop(head) is missing.

Returns:
the number of marked nodes.

Definition at line 271 of file SyncTreeWorker.c.

Referenced by purgeOldEntries().

struct SyncTreeWorkerHead* SyncTreeWorkerCreate ( struct SyncHashCacheHead cache,
struct SyncHashCacheEntry ent,
int  remote 
) [read]

create a new tree worker, based on the given cache ent != NULL: initialize from the given node ent == NULL: create an empty worker, to be externally initialized

Returns:
the new worker

Definition at line 43 of file SyncTreeWorker.c.

Referenced by purgeOldEntries(), SyncStartCompareAction(), testReadBuilder(), and UpdateAction().

struct SyncTreeWorkerHead* SyncTreeWorkerFree ( struct SyncTreeWorkerHead head  )  [read]

Free the storage for the worker.

Returns:
NULL.

Definition at line 153 of file SyncTreeWorker.c.

Referenced by destroyCompareData(), purgeOldEntries(), testReadBuilder(), and UpdateAction().

struct SyncNodeElem* SyncTreeWorkerGetElem ( struct SyncTreeWorkerHead head  )  [read]

requires that the node be present

Returns:
the SyncNodeElem from the current position

NULL if not valid

Definition at line 65 of file SyncTreeWorker.c.

Referenced by doComparison(), and SyncTreeWorkerPush().

void SyncTreeWorkerInit ( struct SyncTreeWorkerHead head,
struct SyncHashCacheEntry ent,
int  remote 
)

initialize an existing worker from the cache entry resulting level will be 1

Definition at line 28 of file SyncTreeWorker.c.

Referenced by CompareAction(), SyncTreeWorkerCreate(), and testReadBuilder().

struct SyncTreeWorkerEntry* SyncTreeWorkerPop ( struct SyncTreeWorkerHead head  )  [read]

pops the stack and returns the top entry popping an empty stack has no effect and returns NULL

Definition at line 127 of file SyncTreeWorker.c.

Referenced by doComparison(), doPreload(), printTreeInner(), SyncTreeGenerateNames(), SyncTreeLookupName(), SyncTreeMarkReachable(), SyncTreeMergeNames(), and SyncTreeWorkerReset().

struct SyncTreeWorkerEntry* SyncTreeWorkerPush ( struct SyncTreeWorkerHead head  )  [read]

pushes into the node at the current position

Returns:
the cache entry for the child (if any) pushing where there is no node has no effect and returns NULL

Definition at line 79 of file SyncTreeWorker.c.

Referenced by doComparison(), doPreload(), printTreeInner(), SyncTreeGenerateNames(), SyncTreeLookupName(), SyncTreeMarkReachable(), and SyncTreeMergeNames().

void SyncTreeWorkerReset ( struct SyncTreeWorkerHead head,
int  level 
)

Reset the worker to the given level (or the current level if that is less).

Resets the position at the new level to 0.

Definition at line 141 of file SyncTreeWorker.c.

Referenced by SyncTreeWorkerFree(), and SyncTreeWorkerInit().

struct SyncTreeWorkerEntry* SyncTreeWorkerTop ( struct SyncTreeWorkerHead head  )  [read]

Returns:
the entry at the top of the stack

NULL if no valid current entry

Definition at line 57 of file SyncTreeWorker.c.

Referenced by addNameFromCompare(), doComparison(), doPreload(), printTreeInner(), SyncTreeGenerateNames(), SyncTreeLookupName(), SyncTreeMarkReachable(), SyncTreeMergeNames(), SyncTreeWorkerGetElem(), and SyncTreeWorkerPush().


Generated on Thu Feb 16 00:44:29 2012 for Content-Centric Networking in C by  doxygen 1.5.6