SyncTest.c File Reference

Part of CCNX Sync. More...

Go to the source code of this file.

Functions

PUBLIC void ccnr_msg (struct ccnr_handle *h, const char *fmt,...)
 Produce ccnr debug output.
PUBLIC int ccnr_msg_level_from_string (char *s)
PUBLIC void r_sync_notify_after (struct ccnr_handle *ccnr, ccnr_hwm item)
 Notify repo of starting point for new names to be passed to sync.
PUBLIC int r_sync_enumerate (struct ccnr_handle *ccnr, struct ccn_charbuf *interest)
 Request that a SyncNotifyContent call is made for each content object matching the interest.
PUBLIC int r_sync_lookup (struct ccnr_handle *ccnr, struct ccn_charbuf *interest, struct ccn_charbuf *content_ccnb)
 Look up a content object that is stored locally in the repository based on the supplied interest.
PUBLIC enum ccn_upcall_res r_sync_upcall_store (struct ccnr_handle *ccnr, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
 Called when a content object is received by sync and needs to be committed to stable storage by the repo.
PUBLIC int r_sync_local_store (struct ccnr_handle *ccnr, struct ccn_charbuf *content)
 Called when a content object has been constructed locally by sync and needs to be committed to stable storage by the repo.
PUBLIC uintmax_t ccnr_accession_encode (struct ccnr_handle *ccnr, ccnr_accession a)
PUBLIC ccnr_accession ccnr_accession_decode (struct ccnr_handle *ccnr, uintmax_t encoded)
PUBLIC int ccnr_accession_compare (struct ccnr_handle *ccnr, ccnr_accession x, ccnr_accession y)
PUBLIC uintmax_t ccnr_hwm_encode (struct ccnr_handle *ccnr, ccnr_hwm hwm)
PUBLIC ccnr_hwm ccnr_hwm_decode (struct ccnr_handle *ccnr, uintmax_t encoded)
PUBLIC int ccnr_acc_in_hwm (struct ccnr_handle *ccnr, ccnr_accession a, ccnr_hwm hwm)
PUBLIC ccnr_hwm ccnr_hwm_update (struct ccnr_handle *ccnr, ccnr_hwm hwm, ccnr_accession a)
PUBLIC ccnr_hwm ccnr_hwm_merge (struct ccnr_handle *ccnr, ccnr_hwm x, ccnr_hwm y)
PUBLIC int ccnr_hwm_compare (struct ccnr_handle *ccnr, ccnr_hwm x, ccnr_hwm y)
static int noteErr (const char *fmt,...)
static int parseAndAccumName (char *s, struct SyncNameAccum *na)
static struct SyncNameAccumreadAndAccumNames (FILE *input, int rem)
static void printTreeInner (struct SyncTreeWorkerHead *head, struct ccn_charbuf *tmpB, struct ccn_charbuf *tmpD, FILE *f)
static void printTree (struct SyncTreeWorkerHead *head, FILE *f)
static void putMark (FILE *f)
static struct SyncNodeCompositetestGenComposite (struct SyncBaseStruct *base, int nRefs)
static int testEncodeDecode (struct SyncTestParms *parms)
static int testReader (struct SyncTestParms *parms)
static struct SyncRootStructnewDefaultRoot (struct SyncTestParms *parms, struct SyncNameAccum *filter)
static int testReadBuilder (struct SyncTestParms *parms)
static struct SyncRootStructtestRootCoding (struct SyncTestParms *parms, struct SyncRootStruct *root)
static int testRootLookup (struct SyncTestParms *parms, struct SyncRootStruct *root, char *goodName, char *badName)
static int testRootBasic (struct SyncTestParms *parms)
static int localStore (struct ccn *ccn, struct ccn_charbuf *nm, struct ccn_charbuf *cb)
static int sendSlice (struct SyncTestParms *parms, char *topo, char *prefix, int count, char **clauses)
static int64_t segFromInfo (struct ccn_upcall_info *info)
static enum ccn_upcall_res storeHandler (struct ccn_closure *selfp, enum ccn_upcall_kind kind, struct ccn_upcall_info *info)
static void formatStats (struct SyncTestParms *parms)
static int getFile (struct SyncTestParms *parms, char *src, char *dst)
static int putFile (struct SyncTestParms *parms, char *src, char *dst)
static int existingRootOp (struct SyncTestParms *parms, char *topo, char *prefix, int delete)
int main (int argc, char **argv)


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 SyncTest.c.


Function Documentation

PUBLIC int ccnr_acc_in_hwm ( struct ccnr_handle ccnr,
ccnr_accession  a,
ccnr_hwm  hwm 
)

Definition at line 209 of file SyncTest.c.

PUBLIC int ccnr_accession_compare ( struct ccnr_handle ccnr,
ccnr_accession  x,
ccnr_accession  y 
)

Definition at line 188 of file SyncTest.c.

PUBLIC ccnr_accession ccnr_accession_decode ( struct ccnr_handle ccnr,
uintmax_t  encoded 
)

Definition at line 182 of file SyncTest.c.

Referenced by r_store_content_btree_insert(), and r_store_look().

PUBLIC uintmax_t ccnr_accession_encode ( struct ccnr_handle ccnr,
ccnr_accession  a 
)

PUBLIC int ccnr_hwm_compare ( struct ccnr_handle ccnr,
ccnr_hwm  x,
ccnr_hwm  y 
)

Definition at line 227 of file SyncTest.c.

Referenced by HeartbeatAction().

PUBLIC ccnr_hwm ccnr_hwm_decode ( struct ccnr_handle ccnr,
uintmax_t  encoded 
)

Definition at line 203 of file SyncTest.c.

Referenced by fetchStablePoint().

PUBLIC uintmax_t ccnr_hwm_encode ( struct ccnr_handle ccnr,
ccnr_hwm  hwm 
)

Definition at line 197 of file SyncTest.c.

Referenced by HeartbeatAction(), storeStablePoint(), and UpdateAction().

PUBLIC ccnr_hwm ccnr_hwm_merge ( struct ccnr_handle ccnr,
ccnr_hwm  x,
ccnr_hwm  y 
)

Definition at line 221 of file SyncTest.c.

PUBLIC ccnr_hwm ccnr_hwm_update ( struct ccnr_handle ccnr,
ccnr_hwm  hwm,
ccnr_accession  a 
)

Definition at line 215 of file SyncTest.c.

Referenced by SyncAddName(), and SyncNotifyContent().

PUBLIC void ccnr_msg ( struct ccnr_handle h,
const char *  fmt,
  ... 
)

Produce ccnr debug output.

Output is produced via h->logger under the control of h->debug; prepends decimal timestamp and process identification. Caller should not supply newlines.

Parameters:
h the ccnr handle
fmt printf-like format string

Definition at line 83 of file SyncTest.c.

PUBLIC int ccnr_msg_level_from_string ( char *  s  ) 

Definition at line 100 of file SyncTest.c.

static int existingRootOp ( struct SyncTestParms *  parms,
char *  topo,
char *  prefix,
int  delete 
) [static]

Definition at line 1359 of file SyncTest.c.

Referenced by main().

static void formatStats ( struct SyncTestParms *  parms  )  [static]

Definition at line 1053 of file SyncTest.c.

static int getFile ( struct SyncTestParms *  parms,
char *  src,
char *  dst 
) [static]

Definition at line 1108 of file SyncTest.c.

Referenced by main().

static int localStore ( struct ccn *  ccn,
struct ccn_charbuf nm,
struct ccn_charbuf cb 
) [static]

Definition at line 786 of file SyncTest.c.

Referenced by existingRootOp(), and sendSlice().

int main ( int  argc,
char **  argv 
)

Definition at line 1432 of file SyncTest.c.

static struct SyncRootStruct* newDefaultRoot ( struct SyncTestParms *  parms,
struct SyncNameAccum filter 
) [static, read]

Definition at line 538 of file SyncTest.c.

Referenced by testReadBuilder(), and testRootBasic().

static int noteErr ( const char *  fmt,
  ... 
) [static]

static int parseAndAccumName ( char *  s,
struct SyncNameAccum na 
) [static]

Definition at line 262 of file SyncTest.c.

Referenced by readAndAccumNames().

static void printTree ( struct SyncTreeWorkerHead head,
FILE *  f 
) [static]

Definition at line 399 of file SyncTest.c.

Referenced by testReadBuilder().

static void printTreeInner ( struct SyncTreeWorkerHead head,
struct ccn_charbuf tmpB,
struct ccn_charbuf tmpD,
FILE *  f 
) [static]

Definition at line 352 of file SyncTest.c.

Referenced by printTree().

static int putFile ( struct SyncTestParms *  parms,
char *  src,
char *  dst 
) [static]

Definition at line 1254 of file SyncTest.c.

Referenced by main().

static void putMark ( FILE *  f  )  [static]

Definition at line 407 of file SyncTest.c.

Referenced by existingRootOp(), formatStats(), putFile(), sendSlice(), and storeHandler().

PUBLIC int r_sync_enumerate ( struct ccnr_handle ccnr,
struct ccn_charbuf interest 
)

Request that a SyncNotifyContent call is made for each content object matching the interest.

returns -1 for error, or an enumeration number which will also be passed in the SyncNotifyContent

Request that a SyncNotifyContent call is made for each content object matching the interest.

If SyncNotifyContent returns -1 the active enumeration will be cancelled.

When there are no more matching objects, SyncNotifyContent will be called passing NULL for name.

Content objects that arrive during an enumeration may or may not be included in that enumeration.

Returns:
-1 for error, or an enumeration number which will also be passed in the SyncNotifyContent

Definition at line 131 of file SyncTest.c.

PUBLIC int r_sync_local_store ( struct ccnr_handle ccnr,
struct ccn_charbuf content 
)

Called when a content object has been constructed locally by sync and needs to be committed to stable storage by the repo.

returns 0 for success, -1 for error.

Definition at line 168 of file SyncTest.c.

PUBLIC int r_sync_lookup ( struct ccnr_handle ccnr,
struct ccn_charbuf interest,
struct ccn_charbuf content_ccnb 
)

Look up a content object that is stored locally in the repository based on the supplied interest.

appends the content object to the content_ccnb. returns 0 for success, -1 for error.

Definition at line 140 of file SyncTest.c.

PUBLIC void r_sync_notify_after ( struct ccnr_handle ccnr,
ccnr_hwm  item 
)

Notify repo of starting point for new names to be passed to sync.

Use item = 0 as the initial value. Following a call to r_sync_notify_after, the repository will call SyncNotifyContent(struct SyncBaseStruct *, int enumeration, ccnr_accession item, struct ccn_charbuf *name); periodically while there are no un-notified objects. enumeration is 0 for "time-based" notifications, or the value passed in when the enumeration was started. This may not end up an int. if the call is for an explicit enumeration, and there are no more objects, name and content_comps will be NULL. If SyncNotifyContent returns -1 then the active enumeration, or the r_sync_notify_after() will be cancelled.

Definition at line 124 of file SyncTest.c.

PUBLIC enum ccn_upcall_res r_sync_upcall_store ( struct ccnr_handle ccnr,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info 
)

Called when a content object is received by sync and needs to be committed to stable storage by the repo.

Definition at line 153 of file SyncTest.c.

static struct SyncNameAccum* readAndAccumNames ( FILE *  input,
int  rem 
) [static, read]

Definition at line 301 of file SyncTest.c.

Referenced by testReadBuilder(), and testReader().

static int64_t segFromInfo ( struct ccn_upcall_info info  )  [static]

Definition at line 919 of file SyncTest.c.

Referenced by storeHandler().

static int sendSlice ( struct SyncTestParms *  parms,
char *  topo,
char *  prefix,
int  count,
char **  clauses 
) [static]

Definition at line 822 of file SyncTest.c.

Referenced by main().

static enum ccn_upcall_res storeHandler ( struct ccn_closure selfp,
enum ccn_upcall_kind  kind,
struct ccn_upcall_info info 
) [static]

Definition at line 957 of file SyncTest.c.

Referenced by putFile().

static int testEncodeDecode ( struct SyncTestParms *  parms  )  [static]

Definition at line 442 of file SyncTest.c.

Referenced by main().

static struct SyncNodeComposite* testGenComposite ( struct SyncBaseStruct base,
int  nRefs 
) [static, read]

Definition at line 421 of file SyncTest.c.

Referenced by testEncodeDecode().

static int testReadBuilder ( struct SyncTestParms *  parms  )  [static]

Definition at line 559 of file SyncTest.c.

Referenced by main().

static int testReader ( struct SyncTestParms *  parms  )  [static]

Definition at line 474 of file SyncTest.c.

Referenced by main().

static int testRootBasic ( struct SyncTestParms *  parms  )  [static]

Definition at line 730 of file SyncTest.c.

Referenced by main().

static struct SyncRootStruct* testRootCoding ( struct SyncTestParms *  parms,
struct SyncRootStruct root 
) [static, read]

Definition at line 661 of file SyncTest.c.

Referenced by testRootBasic().

static int testRootLookup ( struct SyncTestParms *  parms,
struct SyncRootStruct root,
char *  goodName,
char *  badName 
) [static]

Definition at line 708 of file SyncTest.c.

Referenced by testRootBasic().


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