Sun Microsystems 5800 инструкция обслуживания

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136

Идти на страницу of

Хорошее руководство по эксплуатации

Законодательство обязывает продавца передать покупателю, вместе с товаром, руководство по эксплуатации Sun Microsystems 5800. Отсутствие инструкции либо неправильная информация, переданная потребителю, составляют основание для рекламации в связи с несоответствием устройства с договором. В законодательстве допускается предоставлении руководства в другой, чем бумажная форме, что, в последнее время, часто используется, предоставляя графическую или электронную форму инструкции Sun Microsystems 5800 или обучающее видео для пользователей. Условием остается четкая и понятная форма.

Что такое руководство?

Слово происходит от латинского "instructio", тоесть привести в порядок. Следовательно в инструкции Sun Microsystems 5800 можно найти описание этапов поведения. Цель инструкции заключается в облегчении запуска, использования оборудования либо выполнения определенной деятельности. Инструкция является набором информации о предмете/услуге, подсказкой.

К сожалению немного пользователей находит время для чтения инструкций Sun Microsystems 5800, и хорошая инструкция позволяет не только узнать ряд дополнительных функций приобретенного устройства, но и позволяет избежать возникновения большинства поломок.

Из чего должно состоять идеальное руководство по эксплуатации?

Прежде всего в инструкции Sun Microsystems 5800 должна находится:
- информация относительно технических данных устройства Sun Microsystems 5800
- название производителя и год производства оборудования Sun Microsystems 5800
- правила обслуживания, настройки и ухода за оборудованием Sun Microsystems 5800
- знаки безопасности и сертификаты, подтверждающие соответствие стандартам

Почему мы не читаем инструкций?

Как правило из-за нехватки времени и уверенности в отдельных функциональностях приобретенных устройств. К сожалению само подсоединение и запуск Sun Microsystems 5800 это слишком мало. Инструкция заключает ряд отдельных указаний, касающихся функциональности, принципов безопасности, способов ухода (даже то, какие средства стоит использовать), возможных поломок Sun Microsystems 5800 и способов решения проблем, возникающих во время использования. И наконец то, в инструкции можно найти адресные данные сайта Sun Microsystems, в случае отсутствия эффективности предлагаемых решений. Сейчас очень большой популярностью пользуются инструкции в форме интересных анимаций или видео материалов, которое лучше, чем брошюра воспринимаются пользователем. Такой вид инструкции позволяет пользователю просмотреть весь фильм, не пропуская спецификацию и сложные технические описания Sun Microsystems 5800, как это часто бывает в случае бумажной версии.

Почему стоит читать инструкции?

Прежде всего здесь мы найдем ответы касательно конструкции, возможностей устройства Sun Microsystems 5800, использования отдельных аксессуаров и ряд информации, позволяющей вполне использовать все функции и упрощения.

После удачной покупки оборудования/устройства стоит посвятить несколько минут для ознакомления с каждой частью инструкции Sun Microsystems 5800. Сейчас их старательно готовят или переводят, чтобы они были не только понятными для пользователя, но и чтобы выполняли свою основную информационно-поддерживающую функцию.

Содержание руководства

  • Страница 1

    Sun Stor age T ek 5800 S y stem Client API Refer ence Manual Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. Part N o: 820–4796 June 2008[...]

  • Страница 2

    Copyright 2008 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. All rights reserved. Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. I n particular, and without limitation, these intellectual property rights may include one or more U.S[...]

  • Страница 3

    Cont ents Preface ...................................................................................................................................................11 1 Sun Storage T ek 5800 Syst em Client API .......................................................................................... 15 Changes in Version 1.1 ......................[...]

  • Страница 4

    3 Sun Storage T ek 5800 Syst em C Client API ....................................................................................... 39 Overview of the 5800 System C Client API ...................................................................................... 39 Architecture ......................................................................[...]

  • Страница 5

    hc_session_get_platform_result ......................................................................................... 58 hc_session_get_archive .......................................................................................................... 59 Managing a Schema ...........................................................................[...]

  • Страница 6

    Storing Data and Metadata ......................................................................................................... 87 hc_store_both_ez ...................................................................................................................... 87 hc_store_metadata_ez .......................................................[...]

  • Страница 7

    Supported Data Types ....................................................................................................................... 116 Queries ................................................................................................................................................ 117 Translating a Query to the Underlying Database .[...]

  • Страница 8

    8[...]

  • Страница 9

    T ables T ABLE 4–1 Canonical String Representation of Data Types .................................................. 119 9[...]

  • Страница 10

    10[...]

  • Страница 11

    P refac e The Sun StorageTek 5800 System Client API Reference M anual is written for programmers and application developers who develop custom applications for the Sun StorageTek TM 5800 System. This document, along with the Sun StorageTek 5800 SystemSDK Reference M anual , provides the information that you need to develop custom applications for t[...]

  • Страница 12

    Relat ed Third-P ar ty W eb Site Refer ences Third-party URLs are referenced in this document and provide additional, related information. Note – Sun is not responsible for the availability of third-party web sites mentioned in this document. Sun does not endorse and is not responsible or liable for any content, advertising, products, or other ma[...]

  • Страница 13

    T ABLE P–1 Typographic Conventions (Continued) T ypeface Meaning Example A aBbCc123 Book titles, new terms, and terms to be emphasized Read Chapter 6 in the User's Guide . A cache is a copy that is stored locally. Do not save the le. Note: Some emphasized items appear bold online. Shell Pr ompts in Command Examples The following table sho[...]

  • Страница 14

    14[...]

  • Страница 15

    Sun Storage T ek 5800 System Client API The Sun TM StorageTek TM 5800 system client API provides programmatic access to a 5800 system server to store, retrieve, query, and delete object data and metadata. Synchronous versions are provided in C and J ava TM languages. A future release will implement a non-blocking C API for use with POSIX operations[...]

  • Страница 16

    In 5800 system version 1.1, an attempt to store a value that is longer than the associated eld generates an immediate error. 5800 Sy stem Over view This section provides an overviews of the 5800 system, the 5800 system history, and a summaries of the key points of the 5800 system usage model. The following topics are discussed: ■ “5800 Syste[...]

  • Страница 17

    This chapter provides a summary of key points of the 5800 system usage model that are useful for understanding either API. In the following sections, the terms from the J ava API are used as an aid to exposition. In all cases, a simple equivalent using the C API is available. ■ Chapter 4, “Sun StorageTek 5800 System Query Language, ” provides[...]

  • Страница 18

    Read-M ultiple (WORM) archive. Each object corresponds to a single stream of data and a single set of metadata; there are no “grouped objects” or “compound objects” other than by application convention. Each object corresponds to a single stream of data and a single set of metadata. There are no “grouped objects” or “compound objects?[...]

  • Страница 19

    The 5800 S ystem Metadata Model M etadata means “data about the data”; it describes the data and helps to determine how the data should be interpreted. In addition, metadata can be used to facilitate querying the 5800 system for objects that match a particular set of search criteria. For the 5800 system, the supported metadata option is in the [...]

  • Страница 20

    The metadata associated with an object is immutable. There is no operation to modify the metadata associated with an object after the object has been stored. Instead, the storeMetadata operation can be used to create a completely new object by associating new user metadata with the underlying data and system-metadata of an existing object. The stor[...]

  • Страница 21

    Query expressions can use much of the power of Structured Query Language (SQL). Each query expression combines SQL functions and operators, eld names from the metadata schema, and literal values. There are no query expressions that select objects based on the data stored in the object itself; all queries apply only to the metadata elds associ[...]

  • Страница 22

    Note – The format of records as stored in the reliable and scalable object archive is not suitable for fast query. To enable searching, the queryable elds from the metadata are indexed in a query engine that can provide fast and exible query services. The query engine is basically an SQL database. This is why the 5800 system's query la[...]

  • Страница 23

    match the original object metadata. There are no transactional guarantees regarding ordering of queries and delete operations that are occurring at the same time. If an object is being deleted at the same time that a query that matches that object is being performed, then that object may or may not show up in the query result set, with no guarantee[...]

  • Страница 24

    24[...]

  • Страница 25

    Sun Storage T ek 5800 System Ja va Client API This chapter provides information on the 5800 system J ava client API. The following topics are discussed: ■ “Overview of the 5800 System Java Client API” on page 25 ■ “J ava Client A pplication D eployment” on page 27 ■ “J ava API” on page 27 Note – You can nd detailed informatio[...]

  • Страница 26

    The 5800 system J ava client library provides a platform-independent mechanism to upload data and metadata to a 5800 system, and to retrieve and query the data and metadata. The J ava client library works with any implementation of J2SE TM platform 4.0 or later with HTTP connectivity to the 5800 system cluster. A ccess is designed to be high-level [...]

  • Страница 27

    Updating Client V iew of the Schema In the J ava client API, the schema is fetched when the NameValueObjectArchive class is instantiated. If the schema has changed, the client application needs to create a new NameValueArchive . A local copy of the schema is used for some metadata operations. Jav a Client Application Deployment J ava applications u[...]

  • Страница 28

    Basic C oncepts The root of the 5800 system J ava client API is the NameValueObjectArchive class, which represents a connection to a single 5800 system server. All operations are initiated by invoking methods on a NameValueObjectArchive instance after initializing it with the address of a cluster. The fact that a cluster of machines, rather than a [...]

  • Страница 29

    ■ “ ObjectIdentifier ” on page 29 ■ “ QueryResultSet ” on page 30 ■ “ SystemRecord ” on page 30 ■ “ NameValueRecord ” on page 30 For more information on using these classes, see “Basic Concepts” on page 28 . NameValueObjectArchive The NameValueObjectArchive class is the main entry point into the 5800 system. Each instanc[...]

  • Страница 30

    later for retrieving objects. External storage can be accomplished using an identier's string representation by invoking the toString method. An instance of ObjectIdentifier can be reconstituted using the constructor that takes String as an argument. QueryResultSet Instances of QueryResultSet provide access to the objects and metadata match[...]

  • Страница 31

    ■ “ query (with PreparedStatement )” on page 35 ■ “ query (with PreparedStatement and selectKeys )” on page 35 ■ “ PreparedStatement ” on page 36 ■ “ QueryResultSet ” on page 37 ■ “ getObjectIdentifier ” on page 37 ■ “ isQueryComplete ” on page 37 ■ “ getQueryIntegrityTime ” on page 38 ■ “ QueryIntegrit[...]

  • Страница 32

    Synopsis public SystemRecord storeObject(java.nio.channels.ReadableByteChannel dataChannel) public SystemRecord storeObject(ReadableByteChannel dataChannel,NameValueRecord record) throws ArchiveException,IOException Description Takes a ReadableByteChannel (and an optional NameValueRecord ) and returns a SystemRecord instance containing the system m[...]

  • Страница 33

    checkIndexed returns an int value that indicates if the metadata for this object has been inserted into the query engine. The value is -1 if the metadata was already inserted before this operation was called, 0 if the metadata has still not been inserted, or 1 if the metadata was just now inserted. retrieveObject Writes all of the data for the spec[...]

  • Страница 34

    Synopsis public NameValueSchema getSchema() throws ArchiveException, java.io.IOException Description Returns the runtime conguration of the name-value object archive as a NameValueSchema instance. query Returns a ResultSet of SystemRecord instances containing MetadataRecord OIDs. Synopsis public QueryResultSet query(java.lang.String query,int re[...]

  • Страница 35

    Description Takes a where clause and a select clause and returns a QueryResultSet of NameValueRecord instances containing the selected values. selectKeys identies the values to be returned, functioning as an SQL select clause. The query parameter is a where clause in the 5800 system query syntax, which is a subset of SQL. Returns a QueryResultSe[...]

  • Страница 36

    Synopsis public QueryResultSet query(PreparedStatement query, java.lang.String[] selectKeys, int resultsPerFetch) Description Takes a where clause and a select clause and returns a QueryResultSet of NameValueRecord instances containing the selected values. selectKeys identies the values to be returned, functioning as an SQL select clause. The Pr[...]

  • Страница 37

    stmt.bindParameter(date_value,1); QueryResultSet qrs = archive.query(stmt); QueryResultSet The QueryResultSet class is used to page through OIDs and associated metadata returned by NameValueObjectArchive.query . See the javadoc for the getXXX methods for getting typed metadata. next Sets the QueryResultSet to point at the next record. Synopsis bool[...]

  • Страница 38

    getQueryIntegrityTime Returns the most recent time at which all store index exceptions are known to have been resolved. Synopsis long getQueryIntegrityTime() Description The query integrity time is a time such that all store index exceptions from before that time have been resolved. There is an ideal query integrity time, which is the time of the o[...]

  • Страница 39

    Sun Storage T ek 5800 System C Client API This chapter provides detailed information on the 5800 system C client API. The following topics are discussed: ■ “Overview of the 5800 System C Client API” on page 39 ■ “C Client A pplication Deployment” on page 43 ■ “Nonblocking C API ” on page 43 ■ “Synchronous C API” on page 44 ?[...]

  • Страница 40

    Architecture The 5800 system C API client supports two dierent access patterns: a synchronous “EZ” access very similar to the current J ava implementation, and a more exible, nonblocking access based on the POSIX model. Note – For this release, the nonblocking C API client is not implemented. Inter faces The C client library interacts w[...]

  • Страница 41

    Memor y Usage The 5800 system C client library generally follows the model of populating externally allocated data structures such as handles, buers, and result arrays. Some internal data structures are generated during XML document construction. These data structures are allocated and freed using the function pointers supplied to hc_init when i[...]

  • Страница 42

    hcerr_t hc_init(allocator_t, deallocator_t, reallocator_t); This function must be called once per process to initialize the memory functions used in the 5800 system C API. I t also initializes global session properties. A global session is initialized once per process, regardless of how many threads in that process are using the C API. Note – hc_[...]

  • Страница 43

    ■ oid — The objectid for this object, equivalent to the system.object_id eld. ■ digest_algo — Always set to " sha1 " for this release. Equivalent to the system.object_hash_alg eld. ■ data_digest — An array of bytes that represent the content digest of this object's data. Equivalent to the system.object_hash eld. [...]

  • Страница 44

    Synchr onous C API A multiplatform synchronous C API in which operations are accomplished in a few simple function calls is provided for the 5800 system. The API calls include operations for storing, retrieving, deleting, and querying of data and metadata records. M ultiple threads are supported, and operations block until they complete. You must c[...]

  • Страница 45

    – “ hc_nvr_get_time ” on page 82 – “ hc_nvr_get_timestamp ” on page 83 – “ hc_pstmt_create ” on page 100 – “ hc_pstmt_free ” on page 101 – “ hc_pstmt_set_string ” on page 101 – “ hc_pstmt_set_char ” on page 102 – “ hc_pstmt_set_double ” on page 103 – “ hc_pstmt_set_long ” on page 104 – “ hc_pstmt_[...]

  • Страница 46

    Synchr onous C Data T ypes The following data types are dened for the C API: ■ “ hc_string_t ” on page 46 ■ “ hc_long_t ” on page 46 ■ “ hc_double_t ” on page 46 ■ “ hc_type_t ” on page 47 ■ “ hc_value_t ” on page 47 ■ “ hc_schema_t ” on page 48 ■ “ hc_nvr_t ” on page 48 ■ “ hc_session_t ” on page [...]

  • Страница 47

    Synopsis typedef double hc_double_t; Description Type for holding oating-point values. hc_type_t 5800 system name-value metadata type specier. 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 [...]

  • Страница 48

    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 da[...]

  • Страница 49

    Description An opaque structure to represent the session from one thread to one 5800 system server. I t 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[...]

  • Страница 50

    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 ”o n page 87 and other functions that store object data. The data source reader function will be called repeatedly, with the supplied cookie as an argument, [...]

  • Страница 51

    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 ” on page 91 . The function pointer and opaque cookie reference are supplied as arguments to “ hc_retrieve_ez ” on page 91 , and the function will be called wit[...]

  • Страница 52

    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[...]

  • Страница 53

    Description This structure denes the 5800 system C client API error codes. Synchr onous C API Functions The 5800 system synchronous C API functions are dened to perform the following tasks: ■ “Managing 5800 System Sessions” on page 53 ■ “Managing a Schema” on page 59 ■ “Manipulating N ame-Value Records” on page 63 ■ “Sto[...]

  • Страница 54

    Description This function initializes the 5800 system API and must be called before calling any of the other functions in this API. I t downloads a copy of the schema for a particular host or port. The schema is used to validate the name-value-type tuples that are added to metadata records. Both the synchronous and the nonsynchronous C APIs are ful[...]

  • Страница 55

    hc_session_free Releases the session object. Synopsis hcerr_t hc_session_free (hc_session_t *session); Description This function releases the session object and recovers handles and memory for one connection. Par ameters session IN: The session object to free. Return Codes HCERR_OK HCERR_BAD_REQUEST HCERR_OOM HCERR_NULL_SESSION HCERR_INVALID_SESSIO[...]

  • Страница 56

    response_codep OUT: Updated to be the HTTP response code. errstr IN: Updated to be the error returned in the response body if the response code is not 200 (OK). errstr should not be written to by the application (that is, it is read only), and will persist until the next request to the 5800 system server or until “ hc_session_free ” on page 55 [...]

  • Страница 57

    Return Codes HCERR_OK HCERR_BAD_REQUEST HCERR_OOM HCERR_NULL_SESSION HCERR_INVALID_SESSION hc_session_get_host Returns the host name and port number associated with the session. Synopsis hc_session_get_host(hc_session_t *session, char **hostp,int *portp); Description This function returns the host name and port number associated with the session. P[...]

  • Страница 58

    hc_session_get_platform_result Returns low-level error codes associated with the current session. Synopsis hcerr_t hc_session_get_platform_result(hc_session_t *session, int32_t *connect_errnop, int32_t *platform_resultp); Description This function returns low-level error codes associated with the current session. Note – The values returned by hc_[...]

  • Страница 59

    hc_session_get_archive Returns the current archive object associated with this session. Synopsis hcerr_t hc_session_get_archive(hc_session_t *session, hc_archive_t **archivep); Description This function returns the current archive object associated with this session. Note – The archive object is not needed for the synchronous C API, but is made a[...]

  • Страница 60

    ■ “ hc_schema_get_type_at_index ” on page 62 hc_schema_get_type Looks up type in schema. Synopsis hcerr_t hc_schema_get_type(hc_schema_t *schema, char *name, hc_type_t *typep); Description This function looks up the type associated with a given name in the current metadata schema, or returns an error if the name is not known. Par ameters sche[...]

  • Страница 61

    hc_schema_get_length Looks up length of char and string attribute elds. Synopsis hcerr_t hc_schema_get_length(hc_schema_t *schema, char *name, int *length); Description This function looks up the length of a char or string eld associated with a given attribute name in the current metadata schema, or returns an error if the name is not known. [...]

  • Страница 62

    Description This function returns the number of name-value pairs in the metadata schema. Par ameters hsp IN: The schema to interrogate. countp OUT: Updated with the number of name-value pairs in the schema. Return Codes HCERR_OK HCERR_BAD_REQUEST HCERR_OOM HCERR_INVALID_SCHEMA See Also “ hc_schema_get_type_at_index ” on page 62 hc_schema_get_ty[...]

  • Страница 63

    IN: Should range from 0 up to the count-1 returned in “ hc_schema_get_count ” on page 61 . namep OUT: Updated to point to a string that is an attribute name of one attribute in the schema. typep OUT: Updated to be the type associated with that name in the schema. I f the server schema references a type that the client library does not support, [...]

  • Страница 64

    ▼ T o Use the API f or Storing Name-V alue Records Call hc_init once per proc ess. Call “ hc_session_create_ez ” on page 53 to initialize the session and download the schema. Create the metada ta record with “ hc_nvr_create ” on page 65 . Fill the new metadata piec e by piece with hc_nvr_add_metadata_* functions (see “Building Name-V al[...]

  • Страница 65

    Creating and F reeing Name -V alue Records The following functions are dened to create and free name-value records: ■ “ hc_nvr_create ” on page 65 ■ “ hc_nvr_free ” on page 66 hc_nvr_create Creates a name-value record. Synopsis hcerr_t hc_nvr_create(hc_session_t *session, hc_long_t nslots, hc_nvr_t **nvrp); Description This function [...]

  • Страница 66

    See Also “ hc_nvr_free ” on page 66 hc_nvr_free Frees a name-value record. Synopsis hcerr_t hc_nvr_free(hc_nvr_t *nvr); Description This function frees a name-value record that was created by “ hc_nvr_create ” on page 65 . Par ameter nvr IN: P oints to the name-value-record to be freed. Return Codes HCERR_OK HCERR_BAD_REQUEST HCERR_OOM HCER[...]

  • Страница 67

    ■ “ hc_nvr_add_timestamp ” on page 74 ■ “ hc_nvr_add_from_string ” on page 75 hc_nvr_add_value A dds a new metadata value. Synopsis hcerr_t hc_nvr_add_value(hc_nvr_t *nvr, char *name, hc_value_t value); Description This function adds a new metadata name-value-type tuple to a designated name-value record. The name-value record will autom[...]

  • Страница 68

    hc_nvr_add_long A dds a new metadata value of type hc_long_t . Synopsis hcerr_t hc_nvr_add_long(hc_nvr_t *nvr, char *name, hc_long_t value) Description This function adds a new metadata name-value-type tuple to a designated name-value record, where type is known to be hc_long_t (see “ hc_type_t ” on page 47 ). The name-value record will automat[...]

  • Страница 69

    hc_nvr_add_double A dds a new metadata value of type hc_double_t . Synopsis hcerr_t hc_nvr_add_double(hc_nvr_t *nvr, char *name, hc_double_t value); Description This function adds a new metadata name-value-type tuple to a designated name-value record, where type is known to be hc_double_t (see “ hc_type_t ” on page 47 ). The name-value record w[...]

  • Страница 70

    hc_nvr_add_string A dds a new metadata value of type Unicode UTF-8 string. Synopsis hcerr_t hc_nvr_add_string(hc_nvr_t *nvr, char *name, hc_string_t value); Description This function adds a new metadata name-value-type tuple to a designated name-value record, where type is a Unicode UTF-8 string. The name-value record automatically expands as neede[...]

  • Страница 71

    hc_nvr_add_binary A dds new metadata value of type binary . Synopsis hcerr_t hc_nvr_add_binary(hc_nvr_t *nvr, hc_string_t name, int size, unsigned char *bytes); Description This function adds a new metadata name-value-type tuple to a designated name-value record, where type is binary data. The name-value record automatically expands as needed. The [...]

  • Страница 72

    hc_nvr_add_date A dds new metadata value of type date . Synopsis #include <time.h> hcerr_t hc_nvr_add_date(hc_nvr_t *nvr, hc_string_t name,struct tm *value); Description This function adds a new metadata name-value-type tuple to a designated name-value record. The struct tm elds are as dened in the POSIX standard and interpreted by mkti[...]

  • Страница 73

    hc_nvr_add_time A dds new metadata value of type time . Synopsis #include <time.h> hcerr_t hc_nvr_add_time(hc_nvr_t *nvr, hc_string_t name, time_t *value); Description This function adds a new metadata name-value-type tuple to a designated name-value record. The value represents seconds since midnight. The name-value record automatically expa[...]

  • Страница 74

    hc_nvr_add_timestamp A dds new metadata value of type timestamp . Synopsis #include <time.h> hcerr_t hc_nvr_add_timestamp(hc_nvr_t *nvr, hc_string_t name, struct timespec *value); Description This function adds a new metadata name-value-type tuple to a designated name-value record, where type is hc_timestamp_t . The struct timespec is dene[...]

  • Страница 75

    hc_nvr_add_from_string A dds a new metadata value where the value always starts out as a string. Synopsis hcerr_t hc_nvr_add_from_string(hc_nvr_t *nvr, char *name, char *value); Description This is a convenient function for adding a new metadata name-value-type tuple to a designated name-value, where the value always starts out as a string. The cor[...]

  • Страница 76

    Retrieving Name - V alue Records The following functions are dened to retrieve name-value records: ■ “ hc_nvr_get_count ” on page 76 ■ “ hc_nvr_get_value_at_index ” on page 77 ■ “ hc_nvr_get_long ” on page 78 ■ “ hc_nvr_get_double ” on page 79 ■ “ hc_nvr_get_string ” on page 80 ■ “ hc_nvr_get_binary ” on page [...]

  • Страница 77

    hc_nvr_get_value_at_index I terates through the names and values in a name-value record. Synopsis hc_nvr_get_value_at_index(hc_nvr_t *nvr, hc_long_t index, char **namep, hc_value_t *valuep); Description This function iterates through the names and values in a name-value record. The returned names are read-only. Unpredictable results will occur if e[...]

  • Страница 78

    hc_nvr_get_long Retrieves a value of type hc_long_t . Synopsis hcerr_t hc_nvr_get_long(hc_nvr_t *nvr, char *name, hc_long_t *retlong); Description This function retrieves the value of type hc_long_t (see “ hc_type_t ” on page 47 ) associated with an indicated attribute name in a name-value record. Par ameters nvr P oints to a name-value-record.[...]

  • Страница 79

    hc_nvr_get_double Retrieves a value of type hc_double_t . Synopsis hcerr_t hc_nvr_get_double(hc_nvr_t *nvr, char *name, hc_double_t *retdouble); Description This function retrieves the value of type hc_double_ t (see “ hc_type_t ” on page 47 ) associated with an indicated attribute name in a name-value record. Par ameters nvr P oints to a name-[...]

  • Страница 80

    hc_nvr_get_string Retrieves a value of a Unicode UTF-8 string. Synopsis hcerr_t hc_nvr_get_string(hc_nvr_t *nvr, char *name, hc_string_t *retstring); Description This function retrieves the value of a Unicode UTF-8 string associated with an indicated attribute name in a name-value record. N ote that the memory pointed to will be freed when the reco[...]

  • Страница 81

    hc_nvr_get_binary Retrieves a metadata value of type binary . Synopsis hcerr_t hc_nvr_get_binary(hc_nvr_t *nvr, hc_string_t name, int *size, unsigned char **bytes); This function retrieves the value of type binary associated with an indicated attribute name in a name-value record. The binary data is not copied and is freed when the name-value recor[...]

  • Страница 82

    hc_nvr_get_date Retrieves metadata value of type date . Synopsis #include <time.h> hcerr_t hc_nvr_get_date(hc_nvr_t *nvr, hc_string_t name, struct tm *value); Description This function retrieves the value of type struct tm associated with an indicated attribute name in a name-value record. Par ameters nvr P oints to a name-value-record. name [...]

  • Страница 83

    Synopsis #include <time.h> hcerr_t hc_nvr_get_time(hc_nvr_t *nvr, hc_string_t name, time_t *value); This function retrieves the value of type time_t (seconds since midnight) associated with an indicated attribute name in a name-value record. Par ameters nvr P oints to a name-value-record. name IN: N ame for the tuple. value OUT: Updated with [...]

  • Страница 84

    This function retrieves the value of type struct timespec associated with an indicated attribute name in a name-value record. Par ameters nvr P oints to a name-value-record. name IN: N ame for the tuple. value OUT: Updated with the struct timespec ( time.h ) value. Return Codes HCERR_OK HCERR_BAD_REQUEST HCERR_OOM HCERR_INVALID_NVR HCERR_ILLEGAL_AR[...]

  • Страница 85

    char **names, char **values, hc_long_t nitems); Description This function creates a name-value-record from parallel tables of string names and string values. The correct metadata type for each name must be looked up from the schema associated with this session. The name-value record will automatically expand as needed. The names and data values are[...]

  • Страница 86

    hc_nvr_convert_to_string_arrays Converts name-value-record to string names and string values. Synopsis hcerr_t hc_nvr_convert_to_string_arrays(hc_nvr_t *nvr, char ***namesp, char ***valuesp, int *nitemsp); Description This function converts a name-value-record into parallel tables of string names and string values. This destructively modies the [...]

  • Страница 87

    HCERR_OOM HCERR_INVALID_NVR HCERR_ILLEGAL_ARGUMENT Storing Data and Metada ta The following functions are dened to store data and metadata and to enforce indexing of metadata where necessary: ■ “ hc_store_both_ez ” on page 87 ■ “ hc_store_metadata_ez ” on page 88 ■ “ hc_check_indexed_ez ” on page 89 Note – The is_indexed valu[...]

  • Страница 88

    Par ameters session IN: The session for the host and port to talk to. data_source_reader IN: The source of data to be stored. See “ read_from_data_source ” on page 49 . cookie IN: An opaque data structure (cookie) to be provided to data_source_reader . For example, this could be a le descriptor. nvr IN: P ointer to a name-value record with t[...]

  • Страница 89

    Description This function adds a metadata record for the specied OID and returns a system_record descriptor. Par ameters session IN: The session for the host and port to talk to. oid IN: An identier of object data to which the metadata record is attached. nvr IN: P ointer to a name-value record with the metadata. system_record OUT: Returned d[...]

  • Страница 90

    Description checkIndexed is intended as way to resolve a store index exception under program control (see “The 5800 System Query Integrity M odel” on page 21 ). Once a store index exception occurs (as indicated by a non-zero value of the is_indexed eld in the hc_system_record_t returned from a store operation) then hc_check_indexed_ez can be[...]

  • Страница 91

    Retrieving Data and Metada ta The following functions are dened to retrieve data and metadata: ■ “ hc_retrieve_ez ” on page 91 ■ “ hc_retrieve_metadata_ez ” on page 92 ■ “ hc_range_retrieve_ez ” on page 93 hc_retrieve_ez Retrieves data for the specied OID . Synopsis hcerr_t hc_retrieve_ez(hc_session_t *session, *data_writer,[...]

  • Страница 92

    HCERR_OOM HCERR_NULL_SESSION HCERR_INVALID_SESSION HCERR_INVALID_OID hc_retrieve_metadata_ez Retrieves a metadata record for the specied OID . Synopsis hcerr_t hc_retrieve_metadata_ez (hc_session_t *session, hc_oid *oid, hv_nvr_t **nvrp); Description This function retrieves a metadata record for the specied OID . When it has nished, you sh[...]

  • Страница 93

    hc_range_retrieve_ez Retrieves a specied range of data for a specied OID . Synopsis hc_range_retrieve_ez(hc_session_t *session, write_to_data_destination data_writer, void *cookie, hc_oid *oid, hc_long_t; firstbyte, hc_long_t lastbyte); Description This function retrieves a specied range of data for a specied OID . Par ameters session I[...]

  • Страница 94

    HCERR_NULL_SESSION HCERR_INVALID_SESSION HCERR_INVALID_OID HCERR_ILLEGAL_ARGUMENT Quer ying Metadata The following functions are dened for simple queries: ■ “ hc_query_ez ” on page 94 ■ “ hc_qrs_next_ez ” on page 96 ■ “ hc_qrs_is_query_complete ” on page 97 ■ “ hc_qrs_get_query_integrity_time ” on page 98 ■ “ hc_qrs_f[...]

  • Страница 95

    int results_per_fetch, hc_query_result_set_t **rsetp); Description This function retrieves OIDs and optionally name-value records matching a query. I f the selects list is NULL , only OIDs are retrieved. I f selects is not NULL , name-value records are also retrieved and should each be freed using “ hc_nvr_free ” on page 66 . In both cases the [...]

  • Страница 96

    Return Codes HCERR_OK HCERR_OOM HCERR_BAD_REQUEST HCERR_NULL_SESSION HCERR_INVALID_SESSION HCERR_ILLEGAL_ARGUMENT See Also “ hc_qrs_free ” on page 99 hc_qrs_next_ez Fetches the next O ID and optionally name-value record from the QueryResultSet . Synopsis hcerr_t hc_qrs_next_ez(**rset, hc_oid *oid, hc_nvr_t **nvrp, int *finishedp); Description T[...]

  • Страница 97

    finishedp OUT: P oints to an int that is updated to 0 if query data has been returned and to 1 if the result set is empty. Return Codes HCERR_OK HCERR_OOM HCERR_BAD_REQUEST HCERR_INVALID_RESULT_SET HCERR_ILLEGAL_ARGUMENT hc_qrs_is_query_complete Indicates whether results of this query are complete in the sense that all objects that match the query,[...]

  • Страница 98

    Return Codes HCERR_OK HCERR_BAD_REQUEST HCERR_OOM HCERR_INVALID_RESULT_SET hc_qrs_get_query_integrity_time Returns a time that helps get more detail on which store index exceptions might still be unresolved. Synopsis hcerr_t hc_qrs_get_query_integrity_time(hc_query_result_set_t *rset, hc_long_t *query_timep); Description If the query integrity time[...]

  • Страница 99

    HCERR_OOM HCERR_INVALID_RESULT_SET hc_qrs_free Releases the resources associated with this QueryResultSet . Synopsis hcerr_t hc_qrs_free (**rsetp); Description This function releases the resources associated with this QueryResultSet . Note – When a query is incorrect and elicits an error from the server, the error is often reported after hc_qrs_f[...]

  • Страница 100

    hc_pstmt_create Creates an “ hc_pstmt_t ” on page 49 for use with the “ hc_pstmt_query_ez ” on page 109 function. Synopsis hcerr_t hc_pstmt_create(hc_session_t *session, hc_string_t query, hc_pstmt_t **ptr); Description This function creates a prepared statement for use with the “ hc_pstmt_query_ez ” on page 109 function. Par ameters se[...]

  • Страница 101

    hc_pstmt_free Frees a “ hc_pstmt_t ” on page 49 with all its bindings. Synopsis hcerr_t hc_pstmt_free(hc_pstmt_t *pstmt); Description This function frees a prepared statement. Par ameters pstmt Prepared statement to be freed. Return Codes HCERR_OK See Also “ hc_pstmt_create ” on page 100 hc_pstmt_set_string A dds a string binding to a “ h[...]

  • Страница 102

    Par ameters pstmt Prepared statement to add the binding to. which IN: Variable (” ? ’) in the prepared statement, numbered from 1 . value IN: String to bind. Return Codes HCERR_OK HCERR_OOM See Also “ hc_pstmt_create ” on page 100 hc_pstmt_set_char A dds a char binding to a “ hc_pstmt_t ” on page 49 . Synopsis hcerr_t hc_pstmt_set_char([...]

  • Страница 103

    IN: Variable (” ? ’) in the prepared statement, numbered from 1 . value IN: char * string to bind. Return Codes HCERR_OK HCERR_OOM See Also “ hc_pstmt_create ” on page 100 hc_pstmt_set_double A dds a double precision binding to a “ hc_pstmt_t ” on page 49 . Synopsis hcerr_t hc_pstmt_set_double(hc_pstmt_t *pstmt, int which, hc_double_t v[...]

  • Страница 104

    Return Codes HCERR_OK HCERR_OOM See Also “ hc_pstmt_create ” on page 100 hc_pstmt_set_long A dds a “ hc_long_t ” on page 46 binding to a “ hc_pstmt_t ” on page 49 . Synopsis hcerr_t hc_pstmt_set_long(hc_pstmt_t *pstmt, int which, hc_long_t value); Description This function binds an “ hc_long_t ” on page 46 to one of the variables in[...]

  • Страница 105

    See Also “ hc_pstmt_create ” on page 100 hc_pstmt_set_date A dds a date binding to a “ hc_pstmt_t ” on page 49 . Synopsis #include <time.h> hcerr_t hc_pstmt_set_date(hc_pstmt_t *pstmt, int which, struct tm *value); Description This function binds a date in the form of the POSIX struct to one of the variables in a prepared statement. T[...]

  • Страница 106

    See Also “ hc_pstmt_create ” on page 100 hc_pstmt_set_time A dds a time-of-day binding to a “ hc_pstmt_t ” on page 49 . Synopsis #include <time.h> hcerr_t hc_pstmt_set_time(hc_pstmt_t *pstmt, int which, time_t *value); Description This function binds a time of day in seconds to one of the variables in a prepared statement. The variabl[...]

  • Страница 107

    hc_pstmt_set_timestamp A dds a timestamp binding to a “ hc_pstmt_t ” on page 49 . Synopsis #include <time.h> hcerr_t hc_pstmt_set_timestamp(hc_pstmt_t *pstmt, int which, struct timespec *value); Description This function binds a timestamp in the form of the POSIX struct timespec to one of the variables in a prepared statement. The variabl[...]

  • Страница 108

    hc_pstmt_set_binary A dds a binary binding to a “ hc_pstmt_t ” on page 49 . Synopsis hcerr_t hc_pstmt_set_binary(hc_pstmt_t *pstmt, int which, unsigned char *data,int size); Description This function binds a binary array to one of the variables in a prepared statement. The variable must be of the appropriate type in the database. Errors in bind[...]

  • Страница 109

    hc_pstmt_query_ez Retrieves OIDs and optionally name-value records matching a prepared statement. Synopsis hcerr_t hc_pstmt_query_ez(*pstmt,hc_string_t selects[], int n_selects, int results_per_fetch, hc_query_result_set_t **rsetp); Description This function retrieves OIDs and optionally name-value records matching a prepared statement. “ hc_qrs_[...]

  • Страница 110

    Return Codes HCERR_OK HCERR_OOM HCERR_BAD_REQUEST HCERR_NULL_SESSION HCERR_INVALID_SESSION HCERR_ILLEGAL_ARGUMENT See Also “ hc_pstmt_create ” on page 100 Quer ying With a P repared Sta tement The following code is an example of querying with a prepared statement. Error handling is omitted. Two metadata elds are used with the denitions fr[...]

  • Страница 111

    // list all OIDs from yesterday with test_status t = 86400; // 86400 sec/day date = gmtime(&t); res = hc_pstmt_set_date(pstmt, 1, date); res = hc_pstmt_query_ez(pstmt, selects, 1, 2000, &rset); while (1) { hc_oid oid; hc_nvr_t *nvr int finished; hc_string_t test_status; res = hc_qrs_next_ez(rset, &oid, &nvr, &finished); if (fini[...]

  • Страница 112

    Par ameters session IN: P ointer to the session. oid IN: The specied OID . Return Codes HCERR_OK HCERR_BAD_REQUEST HCERR_OOM HCERR_NULL_SESSION HCERR_INVALID_SESSION HCERR_INVALID_OID T ranslating Err or and T ype Codes The following functions are dened for translating error codes and type codes into strings: ■ “ hc_decode_hcerr ” on pa[...]

  • Страница 113

    hc_decode_hc_type Translates a type code into a string. Synopsis char *hc_decode_hc_type(hc_type_t type); Description Translates a type code into a string. Par ameters type IN: The type code to translate. Querying With a P repared Stat ement Chapter 3 • Sun Storage T ek 5800 System C Client API 113[...]

  • Страница 114

    114[...]

  • Страница 115

    Sun Storage T ek 5800 System Quer y Language This chapter provides information on the 5800 system query language. Note – For details of the metadata system and how it is congured, see Chapter 8, “Conguring M etadata and Virtual File System Views” in Sun StorageTek 5800 Storage System A dministration Guide . The following topics are disc[...]

  • Страница 116

    Opera tion The query format is similar to the where clause of an SQL query. The two main dierences are that 5800 system queries do not contain embedded subqueries, and that the only “columns” that are available are the attributes dened in the 5800 system schema. Many features of the underlying metadata database’ s own query language can[...]

  • Страница 117

    Queries A query in the 5800 system query language is translated into an equivalent query for the underlying database that implements the query engine. The database used in a live 5800 system is Sun's High A vailability Database (H ADB). The database used by the 5800 system emulator is A pache TM Derby. Since the SQL query language used by HAD [...]

  • Страница 118

    SQL Syntax in 5800 S ystem Queries General Unicode characters outside of the ASCII range in queries are allowed in only two places to the 5800 system. Specically, both attribute names and literal values may contain general Unicode characters. All text that is not either an attribute name nor a literal value is passed unchanged to the underlying [...]

  • Страница 119

    Literals f or 5800 Syst em Data T ypes For each 5800 system data type, there is a syntax to include literals of that type in a query string. The syntax is {type_name ’ stringliteral ’ } . For example, consider the query: timestamp_field<{timestamp ’ 2006-10-26T12:00:00Z ’ } In particular, this syntax can be used to query for a particular[...]

  • Страница 120

    ■ When converting a typed value to a string as the result of the getAsString operation on a NameValueRecord or a QueryResultSet operation ■ When parsing a literal value as described in “Literals for 5800 System Data Types” on page 119 to create a typed query value from a string representation of that value. The C anonical String Decode Oper[...]

  • Страница 121

    ■ The following JDBC function escapes supported: TIMESTAMPDIFF, TIMESTAMPADD, CURRENT_TIMESTAMP, CURRENT_TIME, CURRENT_DATE, HOUR, MINUTE, SECOND . Reser ved W ords Some SQL reserved words (such as BETWEEN or LIKE ) are allowed in queries and are expected to occur. An SQL reserved word cannot be used as an attribute name unless it is enclosed in [...]

  • Страница 122

    ■ expr [NOT] IN (valueslist) . Note – The 5800 system emulator supports (but the cluster database does not) a JDBC “escape” clause that allows you to treat either % or _ as constant characters. There is currently no way to accomplish this in a LIKE clause in a query on a live cluster. ■ The following JDBC function escapes have been tested[...]

  • Страница 123

    Examples of Suppor ted Quer y Expressions ■ {fn LCASE(mp3.artist)} LIKE ’ %floyd% ’ AND system.object_size > 2000000 ■ (object_size < 200) OR " Collation " = ’ en-US ’ ■ {fn TIMESTAMPDIFF(SQL_TSI_YEAR, system.test.type_timestamp, ’ 2007-04-02 01:50:50.999 ’ ) }<3 ■ {fn TIMESTAMPADD(SQL_TSI_YEAR, 2, system.test[...]

  • Страница 124

    ■ SIN(float) ■ SQRT(float) ■ TAN(float) SQL W ords T hat Ar e Allow ed in Q ueries Some SQL reserved words (such as BETWEEN or LIKE ) are allowed in queries and are expected to occur. An SQL reserved word cannot be used as an attribute name unless it is enclosed in double quotes (for example, " FIRST " ) . The following reserved wor[...]

  • Страница 125

    DEALLOCATE, DECLARE, DEFAULT, DEFERRABLE, DEFERRED, DELETE, DESC, DESCRIBE, DESCRIPTOR, DETERMINISTIC, DIAGNOSTICS, DIRECTORY, DISCONNECT, DISTINCT, DO, DOMAIN, DOUBLEATTRIBUTE, DROP, EACH, EXCEPT, EXCEPTION, EXEC, EXECUTE, EXTERNAL, FETCH, FLOAT, FOREIGN, FOUND, FULL, FUNCTION, GET, GLOBAL, GO, GOTO, GRANT, GROUP, HANDLER, HAVING, IDENTITY, IMMEDI[...]

  • Страница 126

    126[...]

  • Страница 127

    P rogramming C onsiderations and Best P rac tices This chapter provides considerations and practices that can help you create ecient 5800 system applications. The following topics are discussed: ■ “Retries and Timeouts” on page 127 ■ “Query Size Limit” on page 127 ■ “Limit the Size of Schema Query Parameters and Literals” on pa[...]

  • Страница 128

    eld consumes the same number of bytes as the length of the value. A string value consumes twice as many bytes as the length of the value. These sizes are similar to what is described in the Sun StorageTek 5800 System A dministration Guide , Table 7-6, N umber of Bytes Used by Each Element Type in a Schema Table. For example, assume dynamic param[...]

  • Страница 129

    Index Numbers and Symbols 5800 system Honeycomb project, 17 summary, 16-17 B best practices max results per fetch, 128 retries and timeouts, 127 schema query size, 128 C C client API application deployment, 43 architecture, 40 failure and recovery, 43 hc_cleanup ,4 2 hc_init , 41-42 hc_system_record_t , 42-43 heap memory allocator, 41 deallocator, [...]

  • Страница 130

    data type, synchronous C API (Continued) hc_string_t ,4 6 hc_value_t , 47-48 hcerr_t , 51-53 read_from_data_source , 49-50 write_to_data_destination , 50-51 deleting, objects, overview, 22-23 E error codes list of, 51-53 translating into a string hc_decode_hcerr , 112 F fetches, limiting max results, 128 G getObjectIdentifier method, 37 getQueryInt[...]

  • Страница 131

    metadata (Continued) retrieving, 91 storing, 87 hc_store_both_ez , 87-88 metadata model, overview, 19-20 models data, 17-19 deleting objects, 22-23 metadata, 19-20 query, 20-21 query integrity, 21-22 multithreaded access, 40 N name-value records, 63 building, 66-67 hc_nvr_add_binary ,7 1 hc_nvr_add_date ,7 2 hc_nvr_add_double ,6 9 hc_nvr_add_from_s[...]

  • Страница 132

    OID (Continued) retrieve metadata for hc_retrieve_metadata_ez ,9 2 retrieve range of data for hc_range_retrieve_ez , 93-94 operations retrying, 26, 40 overview, 16-23 5800 system, 16-17 data model, 17-19 Honeycomb project, 17 metadata model, 19-20 query integrity model, 21-22 query model, 20-21 P prepared statement add binary binding to hc_pstmt_se[...]

  • Страница 133

    R retries, 127 retrieveMetadata method, 33 retrieveObject method, 33 retrying operations, 26, 40 S schema managing, 59-60 hc_schema_get_count , 61-62 hc_schema_get_length ,6 1 hc_schema_get_type ,6 0 hc_schema_get_type_at_index , 62-63 schema denitions, updating, 41 session management allocator_t ,4 1 deallocator_t ,4 1 failure and recovery, 43 [...]

  • Страница 134

    synchronous C API (Continued) error codes translating into a string, 112 fetch next OID hc_qrs_next_ez , 96-97 free prepared statement hc_pstmt_free , 101 functions, 53-110 hc_nvr_get_count ,7 6 hc_pstmt_create , 100 hc_pstmt_free , 101 hc_pstmt_query_ez , 109-110 hc_pstmt_set_binary , 108 hc_pstmt_set_char , 102-103 hc_pstmt_set_date , 105-106 hc_[...]

  • Страница 135

    T timeouts, 127 Index 135[...]

  • Страница 136

    136[...]