lib/corosync/cmap.rb
# Get a list of keys.
#
# @param prefix [String] Filter the list of keys to those starting with the specified prefix
#
# @return [Array<String>] List of matching key names
Get a list of keys.
Get a list of keys .
def keys(prefix = nil)
		cmap_iteration_handle_ptr = FFI::MemoryPointer.new(Corosync.find_type(:cmap_iter_handle_t))
		Corosync.cs_send(:cmap_iter_init, @handle, prefix, cmap_iteration_handle_ptr)
		cmap_iteration_handle = cmap_iteration_handle_ptr.read_type(Corosync.find_type(:cmap_iter_handle_t))
		keys = []
		key_name_ptr = FFI::MemoryPointer.new(Corosync::CMAP_KEYNAME_MAXLEN)
		begin
			begin
				loop do
					Corosync.cs_send(:cmap_iter_next, @handle, cmap_iteration_handle, key_name_ptr, nil, nil)
					keys << key_name_ptr.read_string
				end
			rescue Corosync::NoSectionsError
			end
		ensure
			Corosync.cs_send(:cmap_iter_finalize, @handle, cmap_iteration_handle)
		end
		keys
	end
def keys ( prefix = nil ) cmap_iteration_handle_ptr = FFI :: MemoryPointer . new ( Corosync . find_type ( :cmap_iter_handle_t ) ) Corosync . cs_send ( :cmap_iter_init , @handle , prefix , cmap_iteration_handle_ptr ) cmap_iteration_handle = cmap_iteration_handle_ptr . read_type ( Corosync . find_type ( :cmap_iter_handle_t ) ) keys = [ ] key_name_ptr = FFI :: MemoryPointer . new ( Corosync :: CMAP_KEYNAME_MAXLEN ) begin begin loop do Corosync . cs_send ( :cmap_iter_next , @handle , cmap_iteration_handle , key_name_ptr , nil , nil ) keys << key_name_ptr . read_string end rescue Corosync :: NoSectionsError end ensure Corosync . cs_send ( :cmap_iter_finalize , @handle , cmap_iteration_handle ) end keys end
Get a list of keys.
Get a list of keys .
# we really don't need to get info on the value. it doesn't help us any #value_size = value_len_ptr.read_type(:size_t) #value_type = value_type_ptr.read_type(Corosync.find_type(:cmap_value_types_t)) #value_type = Corosync.enum_type(:cmap_value_types_t)[value_type] #keys[key_name_ptr.read_string] = Corosync::CMAP::ValueInfo.new(value_size, value_type) # signals end of iteration
List of matching key names
List of matching key names
Array<String>
prefix
Filter the list of keys to those starting with the specified prefix
Filter the list of keys to those starting with the specified prefix