cd_prot.x

来自「chord 源码 http://pdos.csail.mit.edu/chor」· X 代码 · 共 132 行

X
132
字号
%#include <chord_types.h>%#if 0%from chord_types import *%#endiftypedef chordID cd_vnode;// This seems silly.struct chord_node_wire_plus_id {  chord_node_wire wire;  chordID id;};/* NEWCHORD *******************************************************/enum cd_routing_mode {  MODE_SUCC,  MODE_CHORD,  MODE_DEBRUIJN,  MODE_PROX,  MODE_PROXREC,  MODE_PNS,  MODE_PNSREC,  MODE_CHORDREC,  MODE_TCPPNSREC};struct cd_newchord_arg {  /* wellknownhost can be zero-length, indicating that cd should figure   * out the local machine's address */  chord_hostname wellknownhost;  int wellknownport;  /* myname can be zero-length, and the meaning is the same as for   * wellknownhost */  chord_hostname myname;  int myport;  int maxcache;  int nvnodes;  cd_routing_mode routing_mode;};struct cd_newchord_res_ok {  int nvnodes;  cd_vnode vnodes<>;};union cd_newchord_res switch (chordstat stat) { case CHORD_OK:   cd_newchord_res_ok resok; default:   void;};/* UNNEWCHORD *****************************************************/struct cd_unnewchord_res {  chordstat stat;};/* LOOKUP *********************************************************/struct cd_lookup_arg {  cd_vnode vnode;  chordID key;};struct cd_lookup_res_ok {  chord_node_wire_plus_id successors<>;  chord_node_wire_plus_id route<>;};union cd_lookup_res switch (chordstat stat) {  case CHORD_OK:    cd_lookup_res_ok resok;  default:    /* CHORD_NOTINRANGE if the vnode id is invalid */    void;};/* GETSUCCLIST or GETPREDLIST *************************************/struct cd_getsucclist_arg {  cd_vnode vnode;};struct cd_getsucclist_res_ok {  chord_node_wire_plus_id nodes<>;};union cd_getsucclist_res switch (chordstat stat) {  case CHORD_OK:    cd_getsucclist_res_ok resok;  default:    /* CHORD_NOTINRANGE if the vnode id is invalid */    void;};/* program ********************************************************/program CD_PROGRAM {	version CD_VERSION {		void		CD_NULL (void) = 0;		void		CD_EXIT (void) = 1;		/** Cleanly shut down cd process. */		cd_newchord_res		CD_NEWCHORD(cd_newchord_arg) = 2;		/** Instantiate the chord object (returns CHORD_NOINRANGE		    if the Chord object already exists) */		cd_unnewchord_res		CD_UNNEWCHORD(void) = 3;		/** Delete the chord object (returns CHORD_NOINRANGE if the		    Chord object doesn't exist) */		cd_lookup_res		CD_LOOKUP(cd_lookup_arg) = 4;		/** Find successor node of chord ID */                cd_getsucclist_res                CD_GETSUCCLIST(cd_getsucclist_arg) = 5;                /** Get list of successors of one of our vnodes */                cd_getsucclist_res                CD_GETPREDLIST(cd_getsucclist_arg) = 6;                /** Get list of predecessors of one of our vnodes */	} = 1;} = 344600;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?