IBP Client APIs Storage Management IBPallocate IBPmanage Data
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/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 Client. Timeout; int Server. Sync; } *IBP_timer;
Data Structure • IBP_Cap. Status typedef struct { int read. Ref. Count; int write. Ref. Count; unsigned long int current. Size; unsigned long int max. Size; struct ibp_attributes attrib ; } *IBP_Cap. Status;
IBP_allocate • IBP_set_of_caps IBP_allocate( IBP_depot, IBP_timer, unsigned long int size, IBP_attributes attribute ) • Allocate a size bytes remote storage area on the depot with 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 , 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 , 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 src. Cap , IBP_cap dst. Cap, IBP_timer src. Timeout, IBP_timer dst. Timeout, unsigned long int size, unsigned long int offset ); • Move size bytes of data , starting at offset, from src. Cap to dst. Cap. • 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 src. Cap , IBP_cap dst. Caps[], unsigned int n. Dst. Caps; IBP_timer src. Timeout, IBP_timer dst. Timeout, 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 src. Cap to an array of dst. Caps. • 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 , IBP_timer timeout, int cmd, int cap. Type, IBP_Cap. Status 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_dpt. Info IBP_status ( IBP_depot, int cmd, IBP_timer timeout, char *passwd, unsigned long int hard. Size, unsigned long int soft. Size, long duration ); • 2 Commands: IBP_ST_INQ IBP_ST_CHANGE • On success, IBP_manage returns a pointer to IBP_dpt. Info structure, otherwise NULL is returned with IBP_errno indicating error number.
IBP_nfu_op • int IBP_nfu_op ( IBP_depot , int opcode, int n. Parameters, 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 void int io. Type; *data; offset; 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.
- Slides: 17