package com.bocloud.ims.entity.middleware;

import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreAll;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.Generic;
import com.bocloud.entity.meta.PKStrategy;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * 缓存节点
 * 
 * @author weiwei
 *
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Table("kvs_node")
public class KvsNode extends Generic {

	@PK(PKStrategy.AUTO)
	private Long id;// ID
	@Column("address")
	private String address;// 节点地址
	@Column("port")
	private Integer port;// 节点端口
	@Column("role")
	private String role;// 节点角色
	@Column("status")
	private String status;// 节点状态
	@Column("instance_id")
	private String instanceId;// 关联的云主机实例ID
	@Column("server_id")
	private Long serverId;// 关联的云主机ID
	@Column("kvs_id")
	private Long kvsId;// 缓存服务ID
	@Column("group_id")
	private String groupId;
	@Column("manage_ip")
	private String manageIp;
	@IgnoreAll
	private String account;
	@IgnoreAll
	private String password;

	/**
	 * 
	 * @param address
	 * @param port
	 * @param role
	 * @param status
	 * @param instanceId
	 * @param kvsId
	 */
	public KvsNode(String address, Integer port, String role, String status, String instanceId, Long kvsId) {
		super();
		this.address = address;
		this.port = port;
		this.role = role;
		this.status = status;
		this.instanceId = instanceId;
		this.kvsId = kvsId;
	}
}
