ps-lite源码分析: include/ps/base.h

/**
* Copyright (c) 2015 by Contributors
*/
#ifndef PS_BASE_H_
#define PS_BASE_H_
#include
#include "ps/internal/utils.h"

namespace ps {

/** 如果定义了环境变量USE_KEY32,则将Key类型指定为无符号32位整型,否则使用无符号64位整型 */
#if USE_KEY32
/* Use unsigned 32-bit int as the key type */
using Key = uint32_t;
#else
/* Use unsigned 64-bit int as the key type */
using Key = uint64_t;
#endif

/** 设置Key最大取值范围 */
/* The maximal allowed key value */
static const Key kMaxKey = std::numeric_limits::max();

/**
* 设置节点、组的ID,组ID是可以按位组合的:
* 调度器节点ID为1;
* 服务节点组ID为2即(10);
* 工作节点组ID为4即(100);
* 服务节点组和调度节点组ID为3即(11);
* 服务节点组和工作节点组ID为6即(110);
*/
/* node ID for the scheduler */
static const int kScheduler = 1;
/**
* the server node group ID
*
* group id can be combined:
* - kServerGroup + kScheduler means all server nodes and the scheuduler
* - kServerGroup + kWorkerGroup means all server and worker nodes
*/
static const int kServerGroup = 2;
/** the worker node group ID */
static const int kWorkerGroup = 4;

} // namespace ps
#endif // PS_BASE_H_

你可能感兴趣的:(ps-lite源码分析: include/ps/base.h)