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

/**
* Copyright (c) 2015 by Contributors
*/
#ifndef PS_BASE_H_
#define PS_BASE_H_
#include <limits>
#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<Key>::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_

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。