MCPcopy Create free account
hub / github.com/corosync/corosync / initialize

Function initialize

bindings/rust/src/cmap.rs:111–131  ·  view source on GitHub ↗

Initialize a connection to the cmap subsystem. map specifies which cmap "map" to use. Returns a [Handle] into the cmap library

(map: Map)

Source from the content-addressed store, hash-verified

109/// map specifies which cmap "map" to use.
110/// Returns a [Handle] into the cmap library
111pub fn initialize(map: Map) -> Result<Handle> {
112 let mut handle: ffi::cmap_handle_t = 0;
113 let c_map = match map {
114 Map::Icmap => ffi::CMAP_MAP_ICMAP,
115 Map::Stats => ffi::CMAP_MAP_STATS,
116 };
117
118 unsafe {
119 let res = ffi::cmap_initialize_map(&mut handle, c_map);
120 if res == ffi::CS_OK {
121 let rhandle = Handle {
122 cmap_handle: handle,
123 clone: false,
124 };
125 HANDLE_HASH.lock().unwrap().insert(handle, rhandle.clone());
126 Ok(rhandle)
127 } else {
128 Err(CsError::from_c(res))
129 }
130 }
131}
132
133/// Finish with a connection to corosync.
134/// Takes a [Handle] as returned from [initialize]

Callers

nothing calls this directly

Calls 2

cmap_initialize_mapFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected