ibp client apis
DESCRIPTION
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/#key/WRMkey/WRM Example - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/1.jpg)
IBP Client APIsIBP Client APIs
• Storage ManagementStorage Management– IBP_allocate , IBP_manageIBP_allocate , IBP_manage
• Data TransferData Transfer– IBP_store, IBP_load, IBP_copy, IBP_mcopyIBP_store, IBP_load, IBP_copy, IBP_mcopy
• Depot ManagementDepot Management– IBP_statusIBP_status
• NFUNFU– IBP_nfu_opIBP_nfu_op
![Page 2: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/2.jpg)
IBP Capability
• Format
ibp://hostname:port/<resourceid>#key/WRMkey/WRM
• ExampleRead 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
![Page 3: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/3.jpg)
Data Structure
• IBP_depot
typedef struct {
char host[MAX_LENGTH]; // hostname
int port; // port number
int rid; // resource id
} *IBP_depot;
![Page 4: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/4.jpg)
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
![Page 5: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/5.jpg)
Data Structure
• IBP_timer
typedef struct ibp_timer {
int ClientTimeout;
int ServerSync;
} *IBP_timer;
![Page 6: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/6.jpg)
Data Structure
• IBP_CapStatus
typedef struct {
int readRefCount;
int writeRefCount;
unsigned long int currentSize;
unsigned long int maxSize;
struct ibp_attributes attrib ;
} *IBP_CapStatus;
![Page 7: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/7.jpg)
IBP_allocateIBP_allocate• IBP_set_of_caps IBP_allocate( IBP_depot depot, IBP_set_of_caps IBP_allocate( IBP_depot depot,
IBP_timer timer, IBP_timer timer,
unsigned long int size, unsigned long int size,
IBP_attributes attribute )IBP_attributes attribute )
• Allocate a Allocate a sizesize bytes remote storage area on the bytes remote storage area on the depotdepot with with specific specific attributeattribute..
• On success, IBP_allocate returns a set of capabilities. Otherwise On success, IBP_allocate returns a set of capabilities. Otherwise a NULL is returned with IBP_errno indicating error number. a NULL is returned with IBP_errno indicating error number.
![Page 8: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/8.jpg)
IBP_StoreIBP_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. On success, IBP_store returns number of bytes written. Otherwise 0 is returned with IBP_errno indicating error number. Otherwise 0 is returned with IBP_errno indicating error number.
![Page 9: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/9.jpg)
IBP_loadIBP_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 On success, IBP_load returns number of bytes read. Otherwise 0 is
returned with IBP_errno indicating error number. returned with IBP_errno indicating error number.
![Page 10: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/10.jpg)
IBP_copyIBP_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 On success, IBP_copy returns number of bytes written. Otherwise 0 is returned with IBP_errno indicating error number. returned with IBP_errno indicating error number.
![Page 11: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/11.jpg)
IBP_mcopyIBP_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);
![Page 12: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/12.jpg)
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 On success, IBP_mcopy returns number of bytes written. Otherwise 0 is returned with IBP_errno written. Otherwise 0 is returned with IBP_errno indicating error number. indicating error number.
![Page 13: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/13.jpg)
IBP_manageIBP_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 On success, IBP_manage returns 0, otherwise -1 is returned with IBP_errno indicating error number. IBP_errno indicating error number.
![Page 14: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/14.jpg)
IBP_statusIBP_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 On success, IBP_manage returns a pointer to IBP_dptInfo structure, otherwise NULL is
returned with IBP_errno indicating error number. returned with IBP_errno indicating error number.
![Page 15: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/15.jpg)
IBP_nfu_opIBP_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 On success, IBP_nfu_ops returns IBP_OK. Otherwise error number is returned and also IBP_errno is set. number is returned and also IBP_errno is set.
![Page 16: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/16.jpg)
PARAMETER structurePARAMETER 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;
![Page 17: IBP Client APIs](https://reader036.vdocuments.mx/reader036/viewer/2022083006/56813b48550346895da42db4/html5/thumbnails/17.jpg)
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.