quasardb C API: Iteration-related operations

quasardb C API

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Functions
Iteration-related operations

## Data Structures
struct | qdb_const_iterator_t
| A read-only iterator on quasardb entries. More...

## Functions
QDB_API_LINKAGE qdb_error_t | qdb_iterator_begin (qdb_handle_t handle, qdb_const_iterator_t *iterator)
| Creates an iterator that points to the "first" entry of the cluster. More...
QDB_API_LINKAGE qdb_error_t | qdb_iterator_rbegin (qdb_handle_t handle, qdb_const_iterator_t *iterator)
| Creates an iterator that points to the "last" entry of the cluster. More...
QDB_API_LINKAGE qdb_error_t | qdb_iterator_next (qdb_const_iterator_t *iterator)
| Advances an iterator to the next entry, if any. More...
QDB_API_LINKAGE qdb_error_t | qdb_iterator_previous (qdb_const_iterator_t *iterator)
| Advances an iterator to the previous entry, if any. More...
QDB_API_LINKAGE qdb_error_t | qdb_iterator_close (qdb_const_iterator_t *iterator)
| Closes a previously initialized iterator and releases all associated resources. More...
QDB_API_LINKAGE qdb_error_t | qdb_iterator_copy (const qdb_const_iterator_t *original, qdb_const_iterator_t *copy)
| Clones a previously initialized iterator. More...

## Detailed Description

## Function Documentation

QDB_API_LINKAGE qdb_error_t qdb_iterator_begin | ( | qdb_handle_t | handle,
|  | qdb_const_iterator_t * | iterator
| ) |  |

Creates an iterator that points to the "first" entry of the cluster.

This function enables you to iterate on all the entries of a cluster. Keep in mind that there is no guarantee regarding the order of entries.

The iteration occurs at a fixed point in time, operations occurring after the iterator has been created will not be visible.

Call qdb_iterator_next to go to the next available entry, if any.

When iteration completes the function will return qdb_e_iterator_end and the user must call qdb_iterator_close to release client-allocated resources for the iteration.

Iteration does not allocate any resource on the server.

Whole cluster iteration is intended for some very specific use case. It is greatly advised to use tags to work on subgroup of entries.

Parameters

  handle | A valid handle previously initialized by qdb_open or qdb_open_tcp.
  iterator | A pointer to an uninitialized iterator structure that will be set to the first entry if successful

Returns
  A qdb_error_t code indicating success or failure.

See Also
  qdb_iterator_next, qdb_iterator_previous, qdb_iterator_close

QDB_API_LINKAGE qdb_error_t qdb_iterator_close | ( | qdb_const_iterator_t * | iterator | ) |

Closes a previously initialized iterator and releases all associated resources.

Parameters

  iterator | A pointer to a previously initialized iterator.

See Also
  qdb_iterator_rbegin, qdb_iterator_begin

QDB_API_LINKAGE qdb_error_t qdb_iterator_copy | ( | const qdb_const_iterator_t * | original,
|  | qdb_const_iterator_t * | copy
| ) |  |

Clones a previously initialized iterator.

Copies the state of the original iterator to a new iterator. Both iterators can afterward be independently operated. The cloned iterator will have to be closed with qdb_iterator_close.

See Also
  qdb_iterator_rbegin, qdb_iterator_begin, qdb_iterator_close

QDB_API_LINKAGE qdb_error_t qdb_iterator_next | ( | qdb_const_iterator_t * | iterator | ) |

Advances an iterator to the next entry, if any.

Updates the iterator to point to the next available entry in the cluster. Although each entry is returned only once, the order in which entries are returned is undefined. If there is no following entry or it is otherwise unavailable, the function will return qdb_e_iterator_end.

Parameters

  iterator | A pointer to a previously initialized iterator.

See Also
  qdb_iterator_begin

QDB_API_LINKAGE qdb_error_t qdb_iterator_previous | ( | qdb_const_iterator_t * | iterator | ) |

Advances an iterator to the previous entry, if any.

Updates the iterator to point to the previous available entry in the cluster. Although each entry is returned only once, the order in which entries are returned is undefined. If there is no previous entry or it is otherwise unavailable, the function will return qdb_e_iterator_end.

Parameters

  iterator | A pointer to a previously initialized iterator.

See Also
  qdb_iterator_begin

QDB_API_LINKAGE qdb_error_t qdb_iterator_rbegin | ( | qdb_handle_t | handle,
|  | qdb_const_iterator_t * | iterator
| ) |  |

Creates an iterator that points to the "last" entry of the cluster.

This function enables you to iterate on all the entries of a cluster. Keep in mind that there is no guarantee regarding the order of entries.

This works exactly like qdb_iterator_begin, excepts it starts at the "end" of the cluster.

Call qdb_iterator_previous to go to the previous available entry, if any.

See qdb_iterator_begin for more information.

Parameters

  handle | A valid handle previously initialized by qdb_open or qdb_open_tcp.
  iterator | A pointer to an uninitialized iterator structure that will be set to the last entry if successful

Returns
  A qdb_error_t code indicating success or failure.

See Also
  qdb_iterator_begin, qdb_iterator_next, qdb_iterator_previous, qdb_iterator_close