package utils

/// 系统中所使用的常量, 放在这里是为了避免各个子系统中重复的定义

import (
	"errors"
	"time"
)

const (
	// 一些参数
	DEF_INTERVAL_HEARTBEAT = 6 * time.Second // 心跳频率
	DEF_MAX_SEND_TIMEOUT   = 3 * time.Second // 网络发送超时
	DEF_MAX_RECV_TIMEOUT   = 3 * time.Second // 网络接受超时
	DEF_CHAN_NET_SIZE      = 10240           // 用于网络的 chan 的大小

	USER_INIT_VIP_LEVEL = 1 // 默认 VIP 等级

	// 网络断开或关闭原因 (update: 见 protos.enums)
)

var (
	ErrBufferOutOfBound = errors.New("buffer given is out of bound")
	ErrIndexOutOfRange  = errors.New("index out of range")
	ErrRecvedDataLength = errors.New("recved lenght of data error")
	ErrKeyNotExists     = errors.New("can not find by key")
	ErrEmptyString      = errors.New("String is empty")
	ErrEmptySlice       = errors.New("slice is empty")
	ErrEmptyMap         = errors.New("map is empty")
	ErrInvalidParams    = errors.New("invalid parameters")
	ErrIllegalOper      = errors.New("operation is illegal")
	ErrAlreadyExists    = errors.New("already exists")
	ErrNotExists        = errors.New("not exists")
	ErrDuplicated       = errors.New("duplicated")
)

type H map[string]interface{}
