Data Structures | Defines | Typedefs | Functions | Variables

ClusterAPI.cc File Reference

A brief file description. More...

#include "P_Cluster.h"
#include "InkAPIInternal.h"
Include dependency graph for ClusterAPI.cc:

Go to the source code of this file.

Data Structures

struct  node_callout_entry
struct  RPCHandle
class  MachineStatusSM
class  ClusterAPIPeriodicSM

Defines

#define NE_STATE_FREE   0
#define NE_STATE_INITIALIZED   1
#define MAX_CLUSTERSTATUS_CALLOUTS   32
#define INDEX_TO_CLUSTER_STATUS_HANDLE(i)   ((TSClusterStatusHandle_t)((i)))
#define CLUSTER_STATUS_HANDLE_TO_INDEX(h)   ((int) ((h)))
#define NODE_HANDLE_TO_IP(h)   (*((struct in_addr *) &((h))))
#define RPC_FUNCTION_KEY_TO_CLUSTER_NUMBER(k)   ((int)((k)))
#define IP_TO_NODE_HANDLE(ip)   ((TSNodeHandle_t)((ip)))
#define SIZEOF_RPC_MSG_LESS_DATA
#define RPC_HANDLE_MAGIC   0x12345678

Typedefs

typedef struct node_callout_entry node_callout_entry_t
typedef struct RPCHandle RPCHandle_t
typedef int(MachineStatusSM::* MachineStatusSMHandler )(int, void *)
typedef int(ClusterAPIPeriodicSM::* ClusterAPIPeriodicSMHandler )(int, void *)

Functions

static void send_machine_online_list (TSClusterStatusHandle_t *)
void clusterAPI_init ()
int TSAddClusterStatusFunction (TSClusterStatusFunction Status_Function, TSMutex m, TSClusterStatusHandle_t *h)
int TSDeleteClusterStatusFunction (TSClusterStatusHandle_t *h)
int TSNodeHandleToIPAddr (TSNodeHandle_t *h, struct in_addr *in)
void TSGetMyNodeHandle (TSNodeHandle_t *h)
void TSEnableClusterStatusCallout (TSClusterStatusHandle_t *h)
void machine_online_APIcallout (int Ipaddr)
void machine_offline_APIcallout (int Ipaddr)
int TSAddClusterRPCFunction (TSClusterRPCKey_t k, TSClusterRPCFunction func, TSClusterRPCHandle_t *h)
int TSDeleteClusterRPCFunction (TSClusterRPCHandle_t *rpch)
void default_api_ClusterFunction (ClusterHandler *ch, void *data, int len)
void TSFreeRPCMsg (TSClusterRPCMsg_t *msg, int msg_data_len)
TSClusterRPCMsg_tTSAllocClusterRPCMsg (TSClusterRPCHandle_t *h, int data_size)
int TSSendClusterRPC (TSNodeHandle_t *nh, TSClusterRPCMsg_t *msg)

Variables

static ProxyMutexClusterAPI_mutex
static ClusterAPIPeriodicSMperiodicSM
static node_callout_entry_t status_callouts [MAX_CLUSTERSTATUS_CALLOUTS]
static TSClusterRPCFunction RPC_Functions [API_END_CLUSTER_FUNCTION]
static InkAtomicList status_callout_atomic_q
static Queue< MachineStatusSMstatus_callout_q

Detailed Description

A brief file description.

License

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file ClusterAPI.cc.


Define Documentation

#define CLUSTER_STATUS_HANDLE_TO_INDEX (   h  )     ((int) ((h)))
#define INDEX_TO_CLUSTER_STATUS_HANDLE (   i  )     ((TSClusterStatusHandle_t)((i)))

Definition at line 56 of file ClusterAPI.cc.

Referenced by TSAddClusterStatusFunction().

#define IP_TO_NODE_HANDLE (   ip  )     ((TSNodeHandle_t)((ip)))
#define MAX_CLUSTERSTATUS_CALLOUTS   32

Definition at line 48 of file ClusterAPI.cc.

Referenced by TSDeleteClusterStatusFunction(), and TSEnableClusterStatusCallout().

#define NE_STATE_FREE   0

Definition at line 45 of file ClusterAPI.cc.

#define NE_STATE_INITIALIZED   1
#define NODE_HANDLE_TO_IP (   h  )     (*((struct in_addr *) &((h))))

Definition at line 58 of file ClusterAPI.cc.

Referenced by TSNodeHandleToIPAddr(), and TSSendClusterRPC().

#define RPC_FUNCTION_KEY_TO_CLUSTER_NUMBER (   k  )     ((int)((k)))

Definition at line 59 of file ClusterAPI.cc.

Referenced by TSAddClusterRPCFunction().

#define RPC_HANDLE_MAGIC   0x12345678

Definition at line 78 of file ClusterAPI.cc.

Referenced by TSFreeRPCMsg(), and TSSendClusterRPC().

#define SIZEOF_RPC_MSG_LESS_DATA
Value:
(sizeof(TSClusterRPCMsg_t) - \
         (sizeof(TSClusterRPCMsg_t) - sizeof(TSClusterRPCHandle_t)))

Definition at line 61 of file ClusterAPI.cc.

Referenced by TSAllocClusterRPCMsg(), and TSFreeRPCMsg().


Typedef Documentation

typedef int(ClusterAPIPeriodicSM::* ClusterAPIPeriodicSMHandler)(int, void *)

Definition at line 204 of file ClusterAPI.cc.

typedef int(MachineStatusSM::* MachineStatusSMHandler)(int, void *)

Definition at line 81 of file ClusterAPI.cc.

typedef struct RPCHandle RPCHandle_t

Function Documentation

void clusterAPI_init (  ) 
void default_api_ClusterFunction ( ClusterHandler ch,
void *  data,
int  len 
)
void machine_offline_APIcallout ( int  Ipaddr  ) 

Definition at line 419 of file ClusterAPI.cc.

References ink_atomiclist_push(), IP_TO_NODE_HANDLE, and NODE_OFFLINE.

Referenced by ClusterHandler::machine_down().

void machine_online_APIcallout ( int  Ipaddr  ) 

Definition at line 408 of file ClusterAPI.cc.

References ink_atomiclist_push(), IP_TO_NODE_HANDLE, and NODE_ONLINE.

Referenced by ClusterHandler::startClusterEvent().

static void send_machine_online_list ( TSClusterStatusHandle_t h  )  [static]

Definition at line 383 of file ClusterAPI.cc.

References ink_atomiclist_push().

Referenced by TSEnableClusterStatusCallout().

int TSAddClusterRPCFunction ( TSClusterRPCKey_t  k,
TSClusterRPCFunction  func,
TSClusterRPCHandle_t h 
)
int TSAddClusterStatusFunction ( TSClusterStatusFunction  Status_Function,
TSMutex  m,
TSClusterStatusHandle_t h 
)
TSClusterRPCMsg_t* TSAllocClusterRPCMsg ( TSClusterRPCHandle_t h,
int  data_size 
)
int TSDeleteClusterRPCFunction ( TSClusterRPCHandle_t rpch  ) 
int TSDeleteClusterStatusFunction ( TSClusterStatusHandle_t h  ) 
void TSEnableClusterStatusCallout ( TSClusterStatusHandle_t h  ) 
void TSFreeRPCMsg ( TSClusterRPCMsg_t msg,
int  msg_data_len 
)
void TSGetMyNodeHandle ( TSNodeHandle_t h  ) 

Definition at line 355 of file ClusterAPI.cc.

References IP_TO_NODE_HANDLE, and this_cluster_machine().

int TSNodeHandleToIPAddr ( TSNodeHandle_t h,
struct in_addr *  in 
)

Definition at line 348 of file ClusterAPI.cc.

References NODE_HANDLE_TO_IP.

int TSSendClusterRPC ( TSNodeHandle_t nh,
TSClusterRPCMsg_t msg 
)

Variable Documentation

Definition at line 50 of file ClusterAPI.cc.

Definition at line 51 of file ClusterAPI.cc.

TSClusterRPCFunction RPC_Functions[API_END_CLUSTER_FUNCTION] [static]

Definition at line 223 of file ClusterAPI.cc.

Definition at line 224 of file ClusterAPI.cc.

node_callout_entry_t status_callouts[MAX_CLUSTERSTATUS_CALLOUTS] [static]

Definition at line 53 of file ClusterAPI.cc.