Synchronous C API Functions

To Use the API for Storing Name-Value Records

1Call hc_init once per process.

2Call hc_session_create_ez”on page 53 to initialize the session and download the schema.

3Create the metadata record with hc_nvr_create”on page 65.

4Fill the new metadata piece by piece with hc_nvr_add_metadata_* functions (see “Building

Name-Value Records”on page 66) for each 5800 system type.

5Call either hc_store_metadata_ez”on page 88 or hc_store_both_ez”on page 87 to store the new metadata record.

6When you are done, free the metadata record by calling hc_nvr_free”on page 66.

7When the session is finished, call hc_session_free”on page 55 to free the session data structures.

8When all threads are completed, call hc_cleanup to release the global session.

Using Returned Name-Value Records

Name-value records are also returned as the result of queries that return metadata information,

such as “hc_retrieve_metadata_ez” on page 92.

To Use Returned Name-Value Records

1Run the query to create an hc_nvr_t”on page 48 record or a table of hc_nvr_t”on page 48 structures.

Use either name-based access (for example, hc_nvr_get_*) or index-based access (for example, “hc_nvr_get_count” on page 76 and “hc_nvr_get_value_at_index” on page 77).

2To free the hc_nvr_t”on page 48 structure, call hc_nvr_free”on page 66.

Note – Structures created by hc_nvr_create can also be freed by calling hc_nvr_free.

64

Sun StorageTek 5800 System Client API Reference Manual • June 2008

Page 64
Image 64
Sun Microsystems 5800 manual Using Returned Name-Value Records, To Use the API for Storing Name-Value Records