Sun StorageTek 5800 System Client API Reference Guide

Synchronous C Data Types

The following data types are defined for the C API:

hc_string_t

Type for holding Unicode (UTF-8) and Latin-1 null-terminated strings.

Synopsis

     typedef char *hc_string_t;

Description

This type is used interchangeably for holding Unicode (UTF-8) and Latin-1 null-terminated metadata strings. The context determines whether the contents are UTF-8 or Latin-1.

hc_long_t

Type for holding integer values.

Synopsis

     typedef int64_t hc_long_t;

Description

Type for holding integer values.

hc_double_t

Type for holding floating-point values.

Synopsis

     typedef double hc_double_t;

Description

Type for holding floating-point values.

hc_type_t

5800 system name-value metadata type specifier.

Synopsis

    typedef enum hc_types_{
        HC_UNKNOWN_TYPE = -1,
        HC_BOGUS_TYPE = 0,
        HC_STRING_TYPE = 1,
        HC_LONG_TYPE = 2,
        HC_DOUBLE_TYPE = 3,
        HC_BYTE_TYPE = 4,
        HC_CHAR_TYPE = 5,
        HC_BINARY_TYPE = 6,
        HC_DATE_TYPE = 7,
        HC_TIME_TYPE = 8,
        HC_TIMESTAMP_TYPE = 9,
        HC_OBJECTID_TYPE = 10,
    } hc_type_t;

Description

Specifies one of the 5800 system metadata types that can go in the archive.

hc_value_t

5800 system name-value metadata data value.

Synopsis

    typedef struct hc_value_ {
        hc_type_t hcv_type;
        union {
            hc_string_t hcv_string;
            hc_long_t hcv_long;
            hc_double_t hcv_double;
            hc_bytearray_t hcv_bytearray;
            struct tm hcv_tm;
            struct timespec hcv_timespec;
        } hcv;
    } hc_value_t;

Description

This tagged union type can be used to hold a reference to any of the 5800 system data types.

hc_schema_t

5800 system name-value metadata schema.

Synopsis

    typedef void hc_schema_t;

Description

An opaque structure that holds the names and data types of each element in the archive’s metadata schema.

hc_nvr_t

5800 system name-value record.

Synopsis

    typedef void hc_nvr_t;

Description

An opaque structure to represent one metadata record. There is a count of metadata tuples, and parallel sets of names and of typed values for the tuples in this metadata record.

hc_session_t

Structure describing the connection from one thread to one 5800 system server.

Synopsis

    typedef void hc_session_t;

Description

An opaque structure to represent the session from one thread to one 5800 system server. It contains the schema used to interpret metadata store and retrieve operations to this 5800 system server.

hc_pstmt_t

Structure for holding a prepared statement.

Synopsis

    typedef void hc_pstmt_t;

Description

An opaque structure representing a query, including the query text and bound fields.

hc_query_result_set_t

Structure used to hold the results of a query.

Synopsis

    typedef void hc_query_result_set_t;

Description

This opaque structure is used to hold the results of a query. For more information on the functions that use this structure, see Querying Metadata.

read_from_data_source

Data source template used to upload object data to the cluster.

Synopsis

    typedef long (*read_from_data_source) 
    (void *cookie, char *buf, long buf_size);

Description

Function pointers of read_from_data_source type are used to upload object data. The function pointer and opaque cookie reference are supplied as arguments to hc_store_both_ez and other functions that store object data. The data source reader function will be called repeatedly, with the supplied cookie as an argument, to gather the object data to upload into storage.

A read_from_data_source function should read up to buf_size bytes from the data source indicated by cookie into the buffer at location buff and return the actual number of bytes read as the return value from the function.

There are two special return codes:

Parameters

cookie

An opaque data structure to identify this data cookie. The cookie is likely to be an open file descriptor.

buf

Where to store the data.

buf_size

The number of available bytes of space in buf.

See Also

hc_store_both_ez

write_to_data_destination

Data destination template used to download object data to the cluster.

Synopsis

    typedef long (*write_to_data_destination) 
    (void *cookie, char *buff, long buff_len);

Description

Function pointers of write_to_data_destination type are used to download object data to a network or other destination from the 5800 system server using hc_retrieve_ez. The function pointer and opaque cookie reference are supplied as arguments to hc_retrieve_ez, and the function will be called with the supplied cookie argument to deliver the downloaded data to a local data storage function.

A write_to_data_destination function should write exactly buff_len bytes to the data destination indicated by cookie, reading the bytes from the buffer at location buff. It should return a long value indicating the number of bytes actually processed. A return code that differs from buff_len indicates that the transfer should be terminated.

Parameters

cookie

An opaque data structure to identify this data cookie. The cookie is likely to be an open file descriptor.

buff

Where to copy the data from.

buff_len

The number of bytes of space in buff.

See Also

hc_retrieve_ez

hcerr_t

5800 system C client API error codes.

To decode hcerr_t values into strings, see hc_decode_hcerr

Synopsis

    typedef enum hcerr {
        HCERR_OK = 0,
        HCERR_NOT_INITED,
        HCERR_ALREADY_INITED,
        HCERR_INIT_FAILED,
        HCERR_OOM,
        HCERR_NOT_YET_IMPLEMENTED,
        HCERR_SESSION_CREATE_FAILED,
        HCERR_ADD_HEADER_FAILED,HCERR_IO_ERR,
        HCERR_FAILOVER_OCCURRED,
        HCERR_CAN_CALL_AGAIN,
        HCERR_GET_RESPONSE_CODE_FAILED,
        HCERR_CONNECTION_FAILED,
        HCERR_BAD_REQUEST,
        HCERR_NO_SUCH_OBJECT,
        HCERR_INTERNAL_SERVER_ERROR,
        HCERR_FAILED_GETTING_FDSET,
        HCERR_FAILED_CHECKING_FDSET,
        HCERR_MISSING_SELECT_CLAUSE,
        HCERR_URL_TOO_LONG,
        HCERR_COULD_NOT_OPEN_FILE,
        HCERR_FAILED_TO_WRITE_TO_FILE,
        HCERR_NULL_SESSION,
        HCERR_INVALID_SESSION,
        HCERR_INVALID_OID,
        HCERR_NULL_HANDLE,
        HCERR_INVALID_HANDLE,
        HCERR_INVALID_SCHEMA,
        HCERR_INVALID_RESULT_SET,
        HCERR_INVALID_NVR,
        HCERR_WRONG_HANDLE_FOR_OPERATION,
        HCERR_HANDLE_IN_WRONG_STATE_FOR_OPERATION,
        HCERR_READ_PAST_LAST_RESULT,
        HCERR_XML_PARSE_ERROR,
        HCERR_XML_MALFORMED_XML,
        HCERR_XML_EXPECTED_LT,
        HCERR_XML_INVALID_ELEMENT_TAG,
        HCERR_XML_MALFORMED_START_ELEMENT,
        HCERR_XML_MALFORMED_END_ELEMENT,
        HCERR_XML_BAD_ATTRIBUTE_NAME,
        HCERR_XML_BUFFER_OVERFLOW,
        HCERR_BUFFER_OVERFLOW,
        HCERR_NO_SUCH_TYPE,
        HCERR_ILLEGAL_VALUE_FOR_METADATA,
        HCERR_NO_SUCH_ATTRIBUTE,
        HCERR_NO_MORE_ATTRIBUTES,
        HCERR_EOF,HCERR_FAILED_GETTING_SILO_DATA,
        HCERR_PLATFORM_NOT_INITED,
        HCERR_PLATFORM_ALREADY_INITED,
        HCERR_PLATFORM_INIT_FAILED,
        HCERR_PLATFORM_HEADER_TOO_LONG,
        HCERR_PLATFORM_TOO_LATE_FOR_HEADERS,
        HCERR_PLATFORM_NOT_ALLOWED_FOR_GET,
        HCERR_FAILED_TO_GET_SYSTEM_RECORD,
        HCERR_PARTIAL_FILE,
        HCERR_ABORTED_BY_CALLBACK,
        HCERR_PLATFORM_GENERAL_ERROR,
        HCERR_ILLEGAL_ARGUMENT
    } hcerr_t;

Description

This structure defines the 5800 system C client API error codes.