---
name: "quorum_initialize"
section: "3"
platform: "linux"
package: "libquorum-dev"
version: "3.1.9-2+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/quorum_initialize"
---

# quorum\_initialize(3)

Create a new connection to the Quorum service

## NAME

quorum\_initialize - Create a new connection to the Quorum service

## SYNOPSIS

**#include \<corosync/quorum.h\>**

**int quorum\_initialize(quorum\_handle\_t \****handle***, quorum\_callbacks\_t \****callbacks***, uint32\_t \****quorum\_type***);**

## DESCRIPTION

The **quorum\_initialize** function is used to initialize a connection to the quorum API.

Each application may have several connections to the quorum API.  Each application uses the *handle* argument to uniquely identify the connection.  The *handle* argument is then used in other function calls to identify the connection to be used for communication with the quorum service.

Every time the voting configuration changes (eg a node joins or leave the cluster) or the quorum status change, the callback is called. The callback function is described by the following type definitions:

```
typedef void (*quorum_notification_fn_t) (
        quorum_handle_t handle,
        uint32_t quorate,
        uint64_t ring_seq,
        uint32_t view_list_entries,
        uint32_t *view_list
        );
```

The *callbacks* argument is of the type:

```
typedef struct {
        quorum_notification_fn_t quorum_notify_fn;
} quorum_callbacks_t;
```

The *quorum\_type* argument is set to:

```
#define QUORUM_FREE     0
#define QUORUM_SET      1
```

*QUORUM\_FREE* value means that no quorum algorithm is loaded and that no callbacks will take place.

*QUORUM\_SET* value means that one quorum algorithm is configured and that callbacks will take place.

When a configuration change occurs, the callback is called from the **quorum\_dispatch()** function.

## RETURN VALUE

This call returns the CS\_OK value if successful, otherwise an error is returned.

## ERRORS

**CS\_ERR\_TRY\_AGAIN** Resource temporarily unavailable

**CS\_ERR\_INVALID\_PARAM** Invalid argument

**CS\_ERR\_ACCESS** Permission denied

**CS\_ERR\_LIBRARY** The connection failed

**CS\_ERR\_INTERRUPT** System call interrupted by a signal

**CS\_ERR\_NOT\_SUPPORTED** The requested protocol/functionality not supported

**CS\_ERR\_MESSAGE\_ERROR** Incorrect auth message received

**CS\_ERR\_NO\_MEMORY** Not enough memory to complete the requested task

## SEE ALSO

[**quorum\_overview**(3)](/quorum_overview/3.md), [**quorum\_model\_initialize**(3)](/quorum_model_initialize/3.md), [**quorum\_finalize**(3)](/quorum_finalize/3.md), [**quorum\_getquorate**(3)](/quorum_getquorate/3.md), [**quorum\_trackstart**(3)](/quorum_trackstart/3.md), [**quorum\_trackstop**(3)](/quorum_trackstop/3.md), [**quorum\_fd\_get**(3)](/quorum_fd_get/3.md), [**quorum\_dispatch**(3)](/quorum_dispatch/3.md), [**quorum\_context\_set**(3)](/quorum_context_set/3.md), [**quorum\_context\_get**(3)](/quorum_context_get/3.md)
