170 likes | 294 Views
IBP Client APIs. Storage Management IBP_allocate , IBP_manage Data Transfer IBP_store, IBP_load, IBP_copy, IBP_mcopy Depot Management IBP_status NFU IBP_nfu_op. IBP Capability. Format ibp://hostname:port/<resourceid>#key/WRMkey/WRM Example
E N D
IBP Client APIs • Storage Management • IBP_allocate , IBP_manage • Data Transfer • IBP_store, IBP_load, IBP_copy, IBP_mcopy • Depot Management • IBP_status • NFU • IBP_nfu_op
IBP Capability • Format ibp://hostname:port/<resourceid>#key/WRMkey/WRM • Example Read Cap: ibp://rod.cs.utk.edu:6714/0#abcd….6789/0123456789/READ Write Cap: ibp://rod.cs.utk.edu:6714/0#abcd….6789/9876543210/WRITE Manage Cap: ibp://rod.cs.utk.edu:6714/0#abcd….6789/2345678901/MANAGE
Data Structure • IBP_depot typedef struct { char host[MAX_LENGTH]; // hostname int port; // port number int rid; // resource id } *IBP_depot;
Data Structure • IBP_attributes typedef struct { time_t duration; // expiration time ( -1 for permanent ) int reliability; // IBP_HARD or IBP_SOFT int type; // access mode } *IBP_attributes ; Four Access Modes: IBP_BYTEARRAY, IBP_BUFFER, IBP_FIFO, IBP_CIRQ
Data Structure • IBP_timer typedef struct ibp_timer { int ClientTimeout; int ServerSync; } *IBP_timer;
Data Structure • IBP_CapStatus typedef struct { int readRefCount; int writeRefCount; unsigned long int currentSize; unsigned long int maxSize; struct ibp_attributes attrib ; } *IBP_CapStatus;
IBP_allocate • IBP_set_of_caps IBP_allocate( IBP_depot depot, IBP_timer timer, unsigned long int size, IBP_attributes attribute ) • Allocate a sizebytes remote storage area on the depotwith specific attribute. • On success, IBP_allocate returns a set of capabilities. Otherwise a NULL is returned with IBP_errno indicating error number.
IBP_Store • unsigned long int IBP_store ( IBP_cap cap , IBP_timer timeout, char *data, unsigned long int size); • Upload size bytes of data to the depot. • On success, IBP_store returns number of bytes written. Otherwise 0 is returned with IBP_errno indicating error number.
IBP_load • unsigned long int IBP_load ( IBP_cap cap , IBP_timer timeout, char *data, unsigned long int size, unsigned long int offset ); • Download size bytes of data,starting at offset, from the depot. • On success, IBP_load returns number of bytes read. Otherwise 0 is returned with IBP_errno indicating error number.
IBP_copy • unsigned long int IBP_copy ( IBP_cap srcCap , IBP_cap dstCap, IBP_timer srcTimeout, IBP_timer dstTimeout, unsigned long int size, unsigned long int offset ); • Move size bytes of data , starting at offset, from srcCap to dstCap . • On success, IBP_copy returns number of bytes written. Otherwise 0 is returned with IBP_errno indicating error number.
IBP_mcopy • unsigned long int IBP_mcopy ( IBP_cap srcCap , IBP_cap dstCaps[], unsigned int nDstCaps; IBP_timer srcTimeout, IBP_timer dstTimeout, unsigned long int size, unsigned long int offset int type[], int port[], int service);
IBP_mcopy • Move size bytes of data , starting at offset, from srcCap to an array of dstCaps . • On success, IBP_mcopy returns number of bytes written. Otherwise 0 is returned with IBP_errno indicating error number.
IBP_manage • unsigned long int IBP_manage ( IBP_cap cap , IBP_timer timeout, int cmd, int capType, IBP_CapStatus status ); • 4 Commands: IBP_INCR IBP_DECR IBP_CHNG IBP_PROBE • On success, IBP_manage returns 0, otherwise -1 is returned with IBP_errno indicating error number.
IBP_status • IBP_dptInfo IBP_status ( IBP_depot depot, int cmd, IBP_timer timeout, char *passwd, unsigned long int hardSize, unsigned long int softSize, long duration ); • 2 Commands: IBP_ST_INQ IBP_ST_CHANGE • On success, IBP_manage returns a pointer to IBP_dptInfo structure, otherwise NULL is returned with IBP_errno indicating error number.
IBP_nfu_op • int IBP_nfu_op ( IBP_depot depot , int opcode, int nParameters, PARAMETER *paras, IBP_timer timeout); • Invoke a NFU(opcode) on the depot. • On success, IBP_nfu_ops returns IBP_OK. Otherwise error number is returned and also IBP_errno is set.
PARAMETER structure • typedef struct { IOTYPE ioType; void *data; int offset; int length; }PARAMETER; • typedef enum { IBP_REF_RD, IBP_REF_WR, IBP_REF_RDWR, IBP_VAL_IN, IBP_VAL_OUT,IBP_VAL_INOUT } IOTYPE;
Parameter Type • Call-by-reference • Use IBP capabilities as parameters. At IBP depot side, NFU reads/writes data from/to allocations. • Call-by-value • User data are sent to IBP depot for input parameters and results are sent back from depot for output parameters.