IDZEBRA  2.1.2
Data Structures | Typedefs | Functions
api.h File Reference

Zebra API. More...

#include <yaz/odr.h>
#include <yaz/proto.h>
#include <idzebra/res.h>
#include <idzebra/version.h>
#include <idzebra/recctrl.h>

Go to the source code of this file.

Data Structures

struct  ZebraTransactionStatus
 
struct  ZebraRetrievalRecord
 
struct  ZebraScanEntry
 
struct  ZebraMetaRecord
 

Typedefs

typedef struct zebra_sessionZebraHandle
 a Zebra Handle - (session) More...
 
typedef struct zebra_serviceZebraService
 a Zebra Service handle More...
 

Functions

ZebraService zebra_start (const char *configName) ZEBRA_GCC_ATTR((warn_unused_result))
 Creates a Zebra Service. More...
 
ZebraService zebra_start_res (const char *configName, Res def_res, Res over_res) ZEBRA_GCC_ATTR((warn_unused_result))
 Creates a Zebra service with resources. More...
 
ZEBRA_RES zebra_stop (ZebraService zs)
 stops a Zebra service. More...
 
void zebra_filter_info (ZebraService zs, void *cd, void(*cb)(void *cd, const char *name))
 Lists enabled Zebra filters. More...
 
ZebraHandle zebra_open (ZebraService zs, Res res) ZEBRA_GCC_ATTR((warn_unused_result))
 Creates a Zebra session handle within service. More...
 
ZEBRA_RES zebra_close (ZebraHandle zh)
 Destroys Zebra session handle. More...
 
int zebra_errCode (ZebraHandle zh)
 Returns error code for last error. More...
 
const char * zebra_errString (ZebraHandle zh)
 Returns error string for last error. More...
 
char * zebra_errAdd (ZebraHandle zh)
 Returns additional info for last error. More...
 
void zebra_result (ZebraHandle zh, int *code, char **addinfo)
 Returns error code and additional info for last error. More...
 
const char * zebra_get_encoding (ZebraHandle zh)
 Returns character set encoding for session. More...
 
ZEBRA_RES zebra_set_approx_limit (ZebraHandle zh, zint approx_limit)
 Set limit before Zebra does approx hit count. More...
 
ZEBRA_RES zebra_search_PQF (ZebraHandle zh, const char *pqf_query, const char *setname, zint *hits)
 Search using PQF Query String. More...
 
ZEBRA_RES zebra_search_RPN_x (ZebraHandle zh, ODR o, Z_RPNQuery *query, const char *setname, zint *hits, int *estimated_hit_count, int *partial_resultset)
 Search using RPN Query structure (from ASN.1) More...
 
ZEBRA_RES zebra_search_RPN (ZebraHandle zh, ODR o, Z_RPNQuery *query, const char *setname, zint *hits)
 Search using RPN Query structure (from ASN.1) More...
 
ZEBRA_RES zebra_records_retrieve (ZebraHandle zh, ODR stream, const char *setname, Z_RecordComposition *comp, const Odr_oid *input_format, int num_recs, ZebraRetrievalRecord *recs)
 Retrieve records from result set (after search) More...
 
int zebra_deleteResultSet (ZebraHandle zh, int function, int num_setnames, char **setnames, int *statuses)
 Deletes one or more resultsets. More...
 
ZEBRA_RES zebra_result_set_term_no (ZebraHandle zh, const char *setname, int *num_terms)
 returns number of term info terms assocaited with result set More...
 
ZEBRA_RES zebra_result_set_term_info (ZebraHandle zh, const char *setname, int no, zint *count, int *approx, char *termbuf, size_t *termlen, const char **term_ref_id)
 returns information about a term assocated with a result set More...
 
ZEBRA_RES zebra_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, const Odr_oid *attributeset, int *position, int *num_entries, ZebraScanEntry **entries, int *is_partial, const char *setname)
 performs Scan (Z39.50 style) More...
 
ZEBRA_RES zebra_scan_PQF (ZebraHandle zh, ODR stream, const char *query, int *position, int *num_entries, ZebraScanEntry **entries, int *is_partial, const char *setname)
 performs Scan (taking PQF string) More...
 
ZEBRA_RES zebra_auth (ZebraHandle zh, const char *user, const char *pass)
 authenticate user. Returns 0 if OK, != 0 on failure More...
 
int zebra_string_norm (ZebraHandle zh, const char *index_type, const char *input_str, int input_len, char *output_str, int output_len)
 Normalize zebra term for register (subject to change!) More...
 
ZEBRA_RES zebra_create_database (ZebraHandle zh, const char *db)
 Creates a database. More...
 
ZEBRA_RES zebra_drop_database (ZebraHandle zh, const char *db)
 Deletes a database (drop) More...
 
ZEBRA_RES zebra_admin_shutdown (ZebraHandle zh)
 
ZEBRA_RES zebra_admin_start (ZebraHandle zh)
 
ZEBRA_RES zebra_shutdown (ZebraService zs)
 
ZEBRA_RES zebra_admin_import_begin (ZebraHandle zh, const char *database, const char *record_type)
 
ZEBRA_RES zebra_admin_import_segment (ZebraHandle zh, Z_Segment *segment)
 
ZEBRA_RES zebra_admin_import_end (ZebraHandle zh)
 
ZEBRA_RES zebra_begin_trans (ZebraHandle zh, int rw) ZEBRA_GCC_ATTR((warn_unused_result))
 
ZEBRA_RES zebra_end_trans (ZebraHandle zh) ZEBRA_GCC_ATTR((warn_unused_result))
 
ZEBRA_RES zebra_end_transaction (ZebraHandle zh, ZebraTransactionStatus *stat)
 
ZEBRA_RES zebra_commit (ZebraHandle zh)
 
ZEBRA_RES zebra_clean (ZebraHandle zh)
 
ZEBRA_RES zebra_init (ZebraHandle zh)
 
ZEBRA_RES zebra_compact (ZebraHandle zh)
 
ZEBRA_RES zebra_repository_index (ZebraHandle zh, const char *path, enum zebra_recctrl_action_t action)
 
ZEBRA_RES zebra_repository_update (ZebraHandle zh, const char *path)
 
ZEBRA_RES zebra_repository_delete (ZebraHandle zh, const char *path)
 
ZEBRA_RES zebra_repository_show (ZebraHandle zh, const char *path)
 
ZEBRA_RES zebra_add_record (ZebraHandle zh, const char *buf, int buf_size)
 Simple update record. More...
 
ZEBRA_RES zebra_update_record (ZebraHandle zh, enum zebra_recctrl_action_t action, const char *recordType, zint *sysno, const char *match, const char *fname, const char *buf, int buf_size)
 Updates record. More...
 
ZEBRA_RES zebra_sort (ZebraHandle zh, ODR stream, int num_input_setnames, const char **input_setnames, const char *output_setname, Z_SortKeySpecList *sort_sequence, int *sort_status) ZEBRA_GCC_ATTR((warn_unused_result))
 
ZEBRA_RES zebra_select_databases (ZebraHandle zh, int num_bases, const char **basenames) ZEBRA_GCC_ATTR((warn_unused_result))
 
ZEBRA_RES zebra_select_database (ZebraHandle zh, const char *basename) ZEBRA_GCC_ATTR((warn_unused_result))
 
void zebra_shadow_enable (ZebraHandle zh, int value)
 
int zebra_register_statistics (ZebraHandle zh, int dumpdict)
 
ZEBRA_RES zebra_record_encoding (ZebraHandle zh, const char *encoding)
 
ZEBRA_RES zebra_octet_term_encoding (ZebraHandle zh, const char *encoding)
 
void zebra_set_resource (ZebraHandle zh, const char *name, const char *value)
 
const char * zebra_get_resource (ZebraHandle zh, const char *name, const char *defaultvalue)
 
void zebra_pidfname (ZebraService zs, char *path)
 
ZebraMetaRecordzebra_meta_records_create (ZebraHandle zh, const char *name, int num, zint *positions)
 
ZebraMetaRecordzebra_meta_records_create_range (ZebraHandle zh, const char *name, zint start, int num)
 
void zebra_meta_records_destroy (ZebraHandle zh, ZebraMetaRecord *records, int num)
 
struct BFiles_structzebra_get_bfs (ZebraHandle zh)
 
ZEBRA_RES zebra_set_limit (ZebraHandle zh, int complement_flag, zint *ids)
 
ZEBRA_RES zebra_set_break_handler (ZebraHandle zh, int(*f)(void *client_data), void *client_data)
 
ZEBRA_RES zebra_register_check (ZebraHandle zh, const char *spec)
 

Detailed Description

Zebra API.

Return codes: Most functions has return type ZEBRA_RES, where ZEBRA_FAIL indicates failure; ZEBRA_OK indicates success.

Definition in file api.h.

Typedef Documentation

a Zebra Handle - (session)

Definition at line 71 of file api.h.

a Zebra Service handle

Definition at line 76 of file api.h.

Function Documentation

ZEBRA_RES zebra_add_record ( ZebraHandle  zh,
const char *  buf,
int  buf_size 
)

Simple update record.

Parameters
zhsession handle
bufrecord buffer
buf_sizerecord buffer size

This function is a simple wrapper or zebra_update_record with action=action_update (insert or replace) .

Definition at line 2599 of file zebraapi.c.

References action_update, and zebra_update_record().

ZEBRA_RES zebra_admin_import_begin ( ZebraHandle  zh,
const char *  database,
const char *  record_type 
)

Definition at line 1403 of file zebraapi.c.

References log_level, zebra_begin_trans(), ZEBRA_FAIL, and zebra_select_database().

Referenced by es_admin_request().

ZEBRA_RES zebra_admin_import_end ( ZebraHandle  zh)

Definition at line 1413 of file zebraapi.c.

References log_level, ZEBRA_CHECK_HANDLE, and zebra_end_trans().

Referenced by bend_segment().

ZEBRA_RES zebra_admin_import_segment ( ZebraHandle  zh,
Z_Segment *  segment 
)

Definition at line 1420 of file zebraapi.c.

References action_update, log_level, ZEBRA_CHECK_HANDLE, ZEBRA_FAIL, ZEBRA_OK, and zebra_update_record().

Referenced by bend_segment().

ZEBRA_RES zebra_admin_shutdown ( ZebraHandle  zh)
ZEBRA_RES zebra_admin_start ( ZebraHandle  zh)
ZEBRA_RES zebra_auth ( ZebraHandle  zh,
const char *  user,
const char *  pass 
)

authenticate user. Returns 0 if OK, != 0 on failure

Parameters
zhsession handle
useruser name
passpassword

Definition at line 1371 of file zebraapi.c.

References zebra_service::dbaccess, zebra_session::dbaccesslist, zebra_service::global_res, zebra_service::passwd_db, passwd_db_auth(), res_get(), zebra_session::service, zebra_session::user_perm, ZEBRA_CHECK_HANDLE, ZEBRA_FAIL, ZEBRA_OK, and zs.

Referenced by bend_init().

ZEBRA_RES zebra_begin_trans ( ZebraHandle  zh,
int  rw 
)
ZEBRA_RES zebra_clean ( ZebraHandle  zh)

Definition at line 2138 of file zebraapi.c.

References log_level, ZEBRA_CHECK_HANDLE, and zebra_commit_ex().

Referenced by main().

ZEBRA_RES zebra_close ( ZebraHandle  zh)
ZEBRA_RES zebra_commit ( ZebraHandle  zh)

Definition at line 2145 of file zebraapi.c.

References log_level, ZEBRA_CHECK_HANDLE, and zebra_commit_ex().

Referenced by es_admin_request(), main(), and zebra_begin_trans().

ZEBRA_RES zebra_compact ( ZebraHandle  zh)
ZEBRA_RES zebra_create_database ( ZebraHandle  zh,
const char *  db 
)

Creates a database.

Parameters
zhsession handle
dbdatabase to be created

Definition at line 1561 of file zebraapi.c.

References log_level, zebra_session::reg, zebra_begin_trans(), ZEBRA_CHECK_HANDLE, zebra_end_trans(), ZEBRA_FAIL, ZEBRA_OK, zebra_select_database(), zebra_setError(), zebraExplain_newDatabase(), and zebra_register::zei.

Referenced by cmd_create_database(), es_admin_request(), and main().

int zebra_deleteResultSet ( ZebraHandle  zh,
int  function,
int  num_setnames,
char **  setnames,
int *  statuses 
)

Deletes one or more resultsets.

Parameters
zhsession handle
functionZ_DeleteResultSetRequest_{list,all}
num_setnamesnumber of result sets
setnamesresult set names
statusesstatus result

Definition at line 1313 of file zebraapi.c.

References ASSERTZH, log_level, resultSetDestroy(), zebra_begin_read(), and zebra_end_read().

Referenced by bend_delete().

ZEBRA_RES zebra_drop_database ( ZebraHandle  zh,
const char *  db 
)
ZEBRA_RES zebra_end_trans ( ZebraHandle  zh)
ZEBRA_RES zebra_end_transaction ( ZebraHandle  zh,
ZebraTransactionStatus stat 
)
char* zebra_errAdd ( ZebraHandle  zh)

Returns additional info for last error.

Parameters
zhzebra session handle.

Definition at line 1362 of file zebraapi.c.

References zebra_session::errString, and log_level.

Referenced by cmd_err(), cmd_erradd(), main(), and Zerrors().

int zebra_errCode ( ZebraHandle  zh)

Returns error code for last error.

Parameters
zhzebra session handle.

Definition at line 1342 of file zebraapi.c.

References zebra_session::errCode, and log_level.

Referenced by cmd_err(), cmd_errcode(), main(), and Zerrors().

const char* zebra_errString ( ZebraHandle  zh)

Returns error string for last error.

Parameters
zhzebra session handle.

Definition at line 1353 of file zebraapi.c.

References zebra_session::errCode, and log_level.

Referenced by cmd_err(), cmd_errstr(), main(), and Zerrors().

void zebra_filter_info ( ZebraService  zs,
void *  cd,
void(*)(void *cd, const char *name)  cb 
)

Lists enabled Zebra filters.

Parameters
zsservice handle
cdcallback parameter (opaque)
cbcallback function

Definition at line 305 of file zebraapi.c.

References ASSERTZS, zebra_service::record_classes, and recTypeClass_info().

Referenced by show_filters().

struct BFiles_struct* zebra_get_bfs ( ZebraHandle  zh)

Definition at line 2732 of file zebraapi.c.

References zebra_register::bfs, and zebra_session::reg.

Referenced by zebra_register_statistics().

const char* zebra_get_encoding ( ZebraHandle  zh)

Returns character set encoding for session.

Parameters
zhzebra session handle.
Returns
encoding name (e.g. "iso-8859-1")

Definition at line 106 of file zebraapi.c.

References res_get_def(), and zebra_session::session_res.

Referenced by bend_init(), and zebra_open().

const char* zebra_get_resource ( ZebraHandle  zh,
const char *  name,
const char *  defaultvalue 
)

Definition at line 2564 of file zebraapi.c.

References ASSERTZH, log_level, zebra_session::res, and res_get_def().

Referenced by resultSetAdd().

ZEBRA_RES zebra_init ( ZebraHandle  zh)
ZebraMetaRecord* zebra_meta_records_create ( ZebraHandle  zh,
const char *  name,
int  num,
zint positions 
)
ZebraMetaRecord* zebra_meta_records_create_range ( ZebraHandle  zh,
const char *  name,
zint  start,
int  num 
)

Definition at line 393 of file zsets.c.

References zebra_meta_records_create().

void zebra_meta_records_destroy ( ZebraHandle  zh,
ZebraMetaRecord records,
int  num 
)

Definition at line 547 of file zsets.c.

Referenced by facet_fetch(), and zebra_records_retrieve().

ZEBRA_RES zebra_octet_term_encoding ( ZebraHandle  zh,
const char *  encoding 
)
ZebraHandle zebra_open ( ZebraService  zs,
Res  res 
)
void zebra_pidfname ( ZebraService  zs,
char *  path 
)

Definition at line 313 of file zebraapi.c.

References ASSERTZS, zebra_service::global_res, and zebra_lock_prefix().

Referenced by bend_start(), and bend_stop().

ZEBRA_RES zebra_record_encoding ( ZebraHandle  zh,
const char *  encoding 
)

Definition at line 2544 of file zebraapi.c.

References log_level, zebra_session::record_encoding, ZEBRA_CHECK_HANDLE, and ZEBRA_OK.

Referenced by bend_init().

ZEBRA_RES zebra_records_retrieve ( ZebraHandle  zh,
ODR  stream,
const char *  setname,
Z_RecordComposition *  comp,
const Odr_oid *  input_format,
int  num_recs,
ZebraRetrievalRecord recs 
)

Retrieve records from result set (after search)

Parameters
zhsession handle
streamallocate records returned using this ODR
setnamename of result set to retrieve records from
compZ39.50 record composition
input_formattransfer syntax (OID)
num_recsnumber of records to retrieve
recsstore records in this structure (size is num_recs)

Definition at line 1117 of file zebraapi.c.

References zebra_session::approx_limit, ZebraRetrievalRecord::base, ZebraRetrievalRecord::buf, ZebraMetaRecord::db, ZebraRetrievalRecord::errCode, ZebraRetrievalRecord::errString, ZebraRetrievalRecord::format, ZebraRetrievalRecord::len, log_level, zebra_session::res, ZebraRetrievalRecord::score, ZebraMetaRecord::score, ZebraRetrievalRecord::sysno, ZebraMetaRecord::sysno, ZebraMetaRecord::term, zebra_begin_read(), ZEBRA_CHECK_HANDLE, zebra_end_read(), ZEBRA_FAIL, zebra_meta_records_create(), zebra_meta_records_destroy(), ZEBRA_OK, zebra_record_fetch(), zebra_setError(), zebra_setError_zint(), zebra_snippets_create(), zebra_snippets_destroy(), and zebra_snippets_hit_vector().

Referenced by bend_fetch(), and cmd_show().

ZEBRA_RES zebra_register_check ( ZebraHandle  zh,
const char *  spec 
)
int zebra_register_statistics ( ZebraHandle  zh,
int  dumpdict 
)
ZEBRA_RES zebra_repository_delete ( ZebraHandle  zh,
const char *  path 
)

Definition at line 2011 of file zebraapi.c.

References action_delete, and zebra_repository_index().

ZEBRA_RES zebra_repository_index ( ZebraHandle  zh,
const char *  path,
enum zebra_recctrl_action_t  action 
)
ZEBRA_RES zebra_repository_show ( ZebraHandle  zh,
const char *  path 
)

Definition at line 2037 of file zebraapi.c.

References ASSERTZH, log_level, repositoryShow(), and ZEBRA_OK.

Referenced by main().

ZEBRA_RES zebra_repository_update ( ZebraHandle  zh,
const char *  path 
)

Definition at line 2006 of file zebraapi.c.

References action_update, and zebra_repository_index().

void zebra_result ( ZebraHandle  zh,
int *  code,
char **  addinfo 
)

Returns error code and additional info for last error.

Parameters
zhzebra session handle.
codepointer to returned error code
addinfopointer to returned additional info

Definition at line 2499 of file zebraapi.c.

References zebra_session::errCode, zebra_session::errString, and log_level.

Referenced by bend_esrequest(), bend_fetch(), bend_scan(), bend_search(), bend_sort(), and es_admin_request().

ZEBRA_RES zebra_result_set_term_info ( ZebraHandle  zh,
const char *  setname,
int  no,
zint count,
int *  approx,
char *  termbuf,
size_t *  termlen,
const char **  term_ref_id 
)

returns information about a term assocated with a result set

Parameters
zhsession handle
setnameresult set name
nothe term we want to know about (0=first, 1=second,..)
countthe number of occurrences of this term, aka hits (output)
approxabout hits: 0=exact,1=approx (output)
termbufbuffer for term string (intput, output)
termlensize of termbuf (input=max, output=actual length)
term_ref_idif non-NULL *term_ref_id holds term reference

Returns information about one search term associated with result set. Use zebra_result_set_term_no to read total number of terms associated with result set. If this function can not return information, due to no out of range or bad result set name, ZEBRA_FAIL is returned. The passed termbuf must be able to hold at least *termlen characters. Upon completion, *termlen holds actual length of search term.

Definition at line 1275 of file zsets.c.

References zebra_session::iconv_from_utf8, rset_term::name, rset_term::ref_id, resultSetGet(), zebra_set::rset, trav_rset_for_termids(), ZEBRA_FAIL, and ZEBRA_OK.

Referenced by search_terms().

ZEBRA_RES zebra_result_set_term_no ( ZebraHandle  zh,
const char *  setname,
int *  num_terms 
)

returns number of term info terms assocaited with result set

Parameters
zhsession handle
setnameresult set name
num_termsnumber of terms returned in this integer

This function is used in conjunction with zebra_result_set_term_info. If operation was successful, ZEBRA_OK is returned; otherwise ZEBRA_FAIL is returned (typically non-existing setname)

Definition at line 1262 of file zsets.c.

References resultSetGet(), zebra_set::rset, trav_rset_for_termids(), ZEBRA_FAIL, and ZEBRA_OK.

Referenced by search_terms().

ZEBRA_RES zebra_scan ( ZebraHandle  zh,
ODR  stream,
Z_AttributesPlusTerm *  zapt,
const Odr_oid *  attributeset,
int *  position,
int *  num_entries,
ZebraScanEntry **  entries,
int *  is_partial,
const char *  setname 
)

performs Scan (Z39.50 style)

Parameters
zhsession handle
streamODR handle for result
zaptAttribute plus Term (start term)
attributesetAttributeset for Attribute plus Term
positioninput/output position
num_entriesnumber of terms requested / returned
entrieslist of resulting terms (ODR allocated)
is_partialupon return 1=partial, 0=complete
setnamelimit scan by this set (NULL means no limit)

Definition at line 1257 of file zebraapi.c.

References zebra_session::basenames, log_level, zebra_session::num_basenames, rpn_scan(), zebra_begin_read(), ZEBRA_CHECK_HANDLE, zebra_end_read(), and ZEBRA_FAIL.

Referenced by bend_scan(), and zebra_scan_PQF().

ZEBRA_RES zebra_scan_PQF ( ZebraHandle  zh,
ODR  stream,
const char *  query,
int *  position,
int *  num_entries,
ZebraScanEntry **  entries,
int *  is_partial,
const char *  setname 
)

performs Scan (taking PQF string)

Parameters
zhsession handle
streamODR handle for result
queryPQF scan query
positioninput/output position
num_entriesnumber of terms requested / returned
entrieslist of resulting terms (ODR allocated)
is_partialupon return 1=partial, 0=complete
setnamelimit scan by this set (NULL means no limit)

Definition at line 1231 of file zebraapi.c.

References zebra_session::errCode, ZEBRA_FAIL, and zebra_scan().

ZEBRA_RES zebra_search_PQF ( ZebraHandle  zh,
const char *  pqf_query,
const char *  setname,
zint hits 
)

Search using PQF Query String.

Parameters
zhsession handle
pqf_queryquery
setnamename of resultset
hitsof hits is returned

Definition at line 2650 of file zebraapi.c.

References zebra_session::errCode, log_level, ZEBRA_CHECK_HANDLE, ZEBRA_FAIL, ZEBRA_OK, zebra_search_RPN(), and ZINT_FORMAT.

Referenced by cmd_find(), and cmd_search_pqf().

ZEBRA_RES zebra_search_RPN ( ZebraHandle  zh,
ODR  o,
Z_RPNQuery *  query,
const char *  setname,
zint hits 
)

Search using RPN Query structure (from ASN.1)

Parameters
zhsession handle
oODR handle
queryRPN query using YAZ structure
setnamename of resultset
hitsnumber of hits is returned

Definition at line 1107 of file zebraapi.c.

References zebra_search_RPN_x().

Referenced by zebra_search_PQF().

ZEBRA_RES zebra_search_RPN_x ( ZebraHandle  zh,
ODR  o,
Z_RPNQuery *  query,
const char *  setname,
zint hits,
int *  estimated_hit_count,
int *  partial_resultset 
)

Search using RPN Query structure (from ASN.1)

Parameters
zhsession handle
oODR handle
queryRPN query using YAZ structure
setnamename of resultset
hitsnumber of hits is returned
estimated_hit_countwhether hit count is an estimate
partial_resultsetwhether result is only partially evaluated

Definition at line 1078 of file zebraapi.c.

References zebra_session::basenames, log_level, zebra_session::num_basenames, zebra_session::partial_result, resultSetAddRPN(), zebra_begin_read(), ZEBRA_CHECK_HANDLE, zebra_end_read(), and ZEBRA_FAIL.

Referenced by bend_search(), and zebra_search_RPN().

ZEBRA_RES zebra_select_database ( ZebraHandle  zh,
const char *  basename 
)
ZEBRA_RES zebra_select_databases ( ZebraHandle  zh,
int  num_bases,
const char **  basenames 
)
ZEBRA_RES zebra_set_approx_limit ( ZebraHandle  zh,
zint  approx_limit 
)

Set limit before Zebra does approx hit count.

Parameters
zhsession handle
approx_limitthe limit

Results will be approximiate if hit count is greater than the limit specified. By default there is a high-limit (no limit).

Definition at line 1055 of file zebraapi.c.

References zebra_session::approx_limit, DEFAULT_APPROX_LIMIT, and ZEBRA_OK.

Referenced by zebra_select_register().

ZEBRA_RES zebra_set_break_handler ( ZebraHandle  zh,
int(*)(void *client_data)  f,
void *  client_data 
)

Definition at line 1069 of file zebraapi.c.

References zebra_session::break_handler_data, zebra_session::break_handler_func, and ZEBRA_OK.

Referenced by bend_search().

ZEBRA_RES zebra_set_limit ( ZebraHandle  zh,
int  complement_flag,
zint ids 
)
void zebra_set_resource ( ZebraHandle  zh,
const char *  name,
const char *  value 
)

Definition at line 2555 of file zebraapi.c.

References ASSERTZH, log_level, zebra_session::res, and res_set().

void zebra_shadow_enable ( ZebraHandle  zh,
int  value 
)

Definition at line 2514 of file zebraapi.c.

References ASSERTZH, log_level, and zebra_session::shadow_enable.

Referenced by main().

ZEBRA_RES zebra_shutdown ( ZebraService  zs)
ZEBRA_RES zebra_sort ( ZebraHandle  zh,
ODR  stream,
int  num_input_setnames,
const char **  input_setnames,
const char *  output_setname,
Z_SortKeySpecList *  sort_sequence,
int *  sort_status 
)
ZebraService zebra_start ( const char *  configName)

Creates a Zebra Service.

Parameters
configNamename of configuration file

This function is a simplified version of zebra_start_res.

Definition at line 191 of file zebraapi.c.

References zebra_start_res().

Referenced by cmd_zebra_start().

ZebraService zebra_start_res ( const char *  configName,
Res  def_res,
Res  over_res 
)

Creates a Zebra service with resources.

Parameters
configNamename of configuration file
def_resdefault resources
over_resoverriding resources

This function typically called once in a program. A Zebra Service acts as a factory for Zebra session handles.

Definition at line 196 of file zebraapi.c.

References zebra_service::dbaccess, zebra_service::global_res, log_level, log_level_initialized, zebra_service::nmem, zebra_service::passwd_db, passwd_db_file_crypt(), passwd_db_file_plain(), passwd_db_open(), zebra_service::path_root, zebra_service::record_classes, recTypeClass_create(), recTypeClass_load_modules(), res_close(), res_get(), res_open(), res_read_file(), zebra_service::session_lock, zebra_service::sessions, zebra_service::timing, zebra_chdir(), zebra_check_res(), zebra_flock_init(), zebra_get_version(), zebra_mutex_cond_init(), ZEBRA_OK, and zh.

Referenced by bend_start(), main(), and zebra_start().

ZEBRA_RES zebra_stop ( ZebraService  zs)
int zebra_string_norm ( ZebraHandle  zh,
const char *  index_type,
const char *  input_str,
int  input_len,
char *  output_str,
int  output_len 
)

Normalize zebra term for register (subject to change!)

Parameters
zhsession handle
index_type"w", "p",..
input_strinput string buffer
input_leninput string length
output_stroutput string buffer
output_lenoutput string length

Definition at line 1586 of file zebraapi.c.

References ASSERTZH, log_level, zebra_session::reg, zebra_map_get(), zebra_register::zebra_maps, and zebra_replace().

ZEBRA_RES zebra_update_record ( ZebraHandle  zh,
enum zebra_recctrl_action_t  action,
const char *  recordType,
zint sysno,
const char *  match,
const char *  fname,
const char *  buf,
int  buf_size 
)

Updates record.

Parameters
zhsession handle
action(insert,replace,delete or update (replace/insert)
recordTypefilter type (0 indicates default)
sysnosystem id (0 may be passed for no known id)
matchmatch criteria (0 may be passed for no known criteria)
fnamefilename to be printed for logging (0 may be passed)
bufrecord buffer
buf_sizerecord buffer size

Definition at line 2610 of file zebraapi.c.

References log_level, zebra_begin_trans(), zebra_buffer_extract_record(), ZEBRA_CHECK_HANDLE, zebra_end_trans(), ZEBRA_FAIL, ZEBRA_OK, and ZINT_FORMAT.

Referenced by bend_esrequest(), cmd_exchange_record(), cmd_record_insert(), zebra_add_record(), and zebra_admin_import_segment().