hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cl_shm.h File Reference
#include "citrusleaf.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <sys/shm.h>
Include dependency graph for cl_shm.h:

Go to the source code of this file.

Classes

struct  cl_shm_ninfo
struct  cl_shm
struct  cl_shm_info

Macros

#define NUM_NODES   128
#define NUM_NAMESPACES   10
#define CL_SHM_ERROR   -1
#define CL_SHM_OK   0
#define SZ_NODE_IP   32
#define SZ_NAMESPACE   32
#define SZ_PARTITION_ID   4
#define MAX_NEIGHBORS   (NUM_NODES-1)
#define NUM_PARTITIONS   4096
#define MAX_ADDRESSES_PER_NODE   4
#define SZ_FIELD_NEIGHBORS   (MAX_NEIGHBORS * SZ_NODE_IP + 1)
#define SZ_OVERHEAD   ((3 * 32) + 20)
#define SZ_BITMAP   ((NUM_PARTITIONS + 7) / 8)
#define SZ_ENCODED_BITMAP   (((SZ_BITMAP + 2) / 3) * 4)
#define SZ_NS_ENCODED_BITMAP   (64 + SZ_ENCODED_BITMAP + 1)
#define SZ_REPLICAS_TEXT   (SZ_OVERHEAD + (NUM_NAMESPACES * 2 * SZ_NS_ENCODED_BITMAP))
#define SHMMAX_SYS_FILE   "/proc/sys/kernel/shmmax"
#define DEFAULT_NUM_NODES_FOR_SHM   64
#define DEFAULT_SHM_KEY   229857887

Functions

int citrusleaf_use_shm (int num_nodes, key_t key)
int citrusleaf_shm_free ()
int cl_shm_get_partition_count ()
cl_shm_ninfocl_shm_find_node_from_name (const char *node_name)
cl_shm_ninfocl_shm_find_node_from_address (struct sockaddr_in *sa_in)
int cl_shm_node_lock (cl_shm_ninfo *shared_node)
void cl_shm_node_unlock (cl_shm_ninfo *shared_node)

Variables

bool g_shared_memory

Macro Definition Documentation

#define CL_SHM_ERROR   -1

Definition at line 12 of file cl_shm.h.

#define CL_SHM_OK   0

Definition at line 13 of file cl_shm.h.

#define DEFAULT_NUM_NODES_FOR_SHM   64

Definition at line 49 of file cl_shm.h.

#define DEFAULT_SHM_KEY   229857887

Definition at line 50 of file cl_shm.h.

#define MAX_ADDRESSES_PER_NODE   4

Definition at line 22 of file cl_shm.h.

#define MAX_NEIGHBORS   (NUM_NODES-1)

Definition at line 20 of file cl_shm.h.

#define NUM_NAMESPACES   10

Definition at line 9 of file cl_shm.h.

#define NUM_NODES   128

Definition at line 8 of file cl_shm.h.

#define NUM_PARTITIONS   4096

Definition at line 21 of file cl_shm.h.

#define SHMMAX_SYS_FILE   "/proc/sys/kernel/shmmax"

Definition at line 48 of file cl_shm.h.

#define SZ_BITMAP   ((NUM_PARTITIONS + 7) / 8)

Definition at line 35 of file cl_shm.h.

#define SZ_ENCODED_BITMAP   (((SZ_BITMAP + 2) / 3) * 4)

Definition at line 36 of file cl_shm.h.

#define SZ_FIELD_NEIGHBORS   (MAX_NEIGHBORS * SZ_NODE_IP + 1)

Definition at line 24 of file cl_shm.h.

#define SZ_NAMESPACE   32

Definition at line 18 of file cl_shm.h.

#define SZ_NODE_IP   32

Definition at line 17 of file cl_shm.h.

#define SZ_NS_ENCODED_BITMAP   (64 + SZ_ENCODED_BITMAP + 1)

Definition at line 38 of file cl_shm.h.

#define SZ_OVERHEAD   ((3 * 32) + 20)

Definition at line 33 of file cl_shm.h.

#define SZ_PARTITION_ID   4

Definition at line 19 of file cl_shm.h.

#define SZ_REPLICAS_TEXT   (SZ_OVERHEAD + (NUM_NAMESPACES * 2 * SZ_NS_ENCODED_BITMAP))

Definition at line 40 of file cl_shm.h.

Function Documentation

int citrusleaf_shm_free ( )
int citrusleaf_use_shm ( int  num_nodes,
key_t  key 
)
cl_shm_ninfo* cl_shm_find_node_from_address ( struct sockaddr_in *  sa_in)
cl_shm_ninfo* cl_shm_find_node_from_name ( const char *  node_name)
int cl_shm_get_partition_count ( )
int cl_shm_node_lock ( cl_shm_ninfo shared_node)
void cl_shm_node_unlock ( cl_shm_ninfo shared_node)

Variable Documentation

bool g_shared_memory