Documentation
¶
Index ¶
- Constants
- Variables
- func Abs(x float32) float32
- func Assert(x bool, y string)
- func BIT(x interface{}) interface{}
- func BIT64(x interface{}) interface{}
- func Bool(str string) bool
- func BytesToFloat32(data []byte) float32
- func BytesToFloat64(data []byte) float64
- func BytesToInt(data []byte) int
- func BytesToInt16(data []byte) int16
- func BytesToInt64(data []byte) int64
- func ChechErr(err error)
- func Clamp(val, low, high int) int
- func Float32(str string) float32
- func Float32ToByte(val float32) []byte
- func Float64(str string) float64
- func Float64ToByte(val float64) []byte
- func GetClassName(rType reflect.Type) string
- func GetDBTime(strTime string) *time.Time
- func GetLanAddr(ip string) string
- func Htonl(n uint64) []byte
- func Htons(n uint16) []byte
- func Int(str string) int
- func Int16ToBytes(val int16) []byte
- func Int64(str string) int64
- func Int64ToBytes(val int64) []byte
- func IntToBytes(val int) []byte
- func IntToInt32(val []int) []int32
- func Max(a, b int) int
- func Min(a, b int) int
- func ParseTag(sf reflect.StructField, tag string) map[string]string
- func ParseUUID(id int64) (ts int64, workerId int64, seq int64)
- func PathExists(path string) bool
- func ReadConf(path string, data interface{}) bool
- func SetTcpEnd(buff []byte) []byte
- func Time(str string) int64
- func ToHash(str string) uint32
- func TraceCode(code ...interface{})
- type BitStream
- func (b *BitStream) BuildPacketStream(buffer []byte, writeSize int) bool
- func (b *BitStream) GetBuffer() []byte
- func (b *BitStream) GetBytePtr() []byte
- func (b *BitStream) GetCurPos() int
- func (b *BitStream) GetPosition() int
- func (b *BitStream) GetReadByteSize() int
- func (b *BitStream) GetStreamSize() int
- func (b *BitStream) ReadBits(bitCount int) []byte
- func (b *BitStream) ReadFlag() bool
- func (b *BitStream) ReadFloat() float32
- func (b *BitStream) ReadFloat64() float64
- func (b *BitStream) ReadInt(bitCount int) int
- func (b *BitStream) ReadInt64(bitCount int) int64
- func (b *BitStream) ReadString() string
- func (b *BitStream) SetPosition(pos int) bool
- func (b *BitStream) WriteBits(bitPtr []byte, bitCount int)
- func (b *BitStream) WriteFlag(value bool) bool
- func (b *BitStream) WriteFloat(value float32)
- func (b *BitStream) WriteFloat64(value float64)
- func (b *BitStream) WriteInt(value int, bitCount int)
- func (b *BitStream) WriteInt64(value int64, bitCount int)
- func (b *BitStream) WriteString(value string)
- type Dh
- type HashRing
- type IBitStream
- type IDh
- type IHashRing
- type ILog
- type ISnowflake
- type IStuHashRing
- type IWorkIdQue
- type LG_TYPE
- type Log
- func (this *Log) Fatal(v1 ...interface{})
- func (this *Log) Fatalf(format string, params ...interface{})
- func (this *Log) Fatalln(v1 ...interface{})
- func (this *Log) GetSuffix(nType LG_TYPE) string
- func (this *Log) Init(fileName string) bool
- func (this *Log) Print(v1 ...interface{})
- func (this *Log) Printf(format string, params ...interface{})
- func (this *Log) Println(v1 ...interface{})
- func (this *Log) Write(nType LG_TYPE)
- func (this *Log) WriteFile(nType LG_TYPE)
- type Rand
- type Snowflake
- type StubHashRing
- type WorkIdQue
Constants ¶
View Source
const ( Bit8 = 8 Bit16 = 16 Bit32 = 32 Bit64 = 64 Bit128 = 128 MAX_PACKET = 1 * 1024 * 1024 MAX_CLIENT_PACKET = 10 * 1024 )
View Source
const ( NONE_ERROR = iota VERSION_ERROR //版本不正确 ACCOUNT_NOEXIST //账号不存在 PASSWORD_ERROR //密码不正确 )
View Source
const (
PATH = "log"
)
View Source
const (
REPLICASNUM = 5
)
View Source
const (
WorkeridMax = workeridMax //集群自增量
)
Variables ¶
View Source
var ErrEmptyRing = errors.New("empty ring")
ErrEmptyRing is the error returned when trying to get an element when nothing has been added to hash.
View Source
var (
SEVERNAME string
)
View Source
var (
UUID = ISnowflake(&Snowflake{})
)
Functions ¶
func BytesToFloat32 ¶
func BytesToFloat64 ¶
func BytesToInt64 ¶
func GetClassName ¶
func GetLanAddr ¶ added in v0.0.5
func PathExists ¶
Types ¶
type BitStream ¶
type BitStream struct {
// contains filtered or unexported fields
}
func NewBitStream ¶
func (*BitStream) BuildPacketStream ¶
func (*BitStream) GetBytePtr ¶
func (*BitStream) GetPosition ¶
func (*BitStream) GetReadByteSize ¶
func (*BitStream) GetStreamSize ¶
func (*BitStream) ReadFloat64 ¶
func (*BitStream) ReadString ¶
func (*BitStream) SetPosition ¶
func (*BitStream) WriteFloat ¶
func (*BitStream) WriteFloat64 ¶
func (*BitStream) WriteInt64 ¶
func (*BitStream) WriteString ¶
type Dh ¶ added in v0.0.5
func (*Dh) ExchangePubk ¶ added in v0.0.5
type HashRing ¶
HashRing holds the information about the members of the consistent hash ring.
func NewHashRing ¶
func NewHashRing() *HashRing
New creates a new HashRing( object with a default setting of 20 replicas for each entry. To change the number of replicas, set NumberOfReplicas before adding entries.
type IBitStream ¶
type IBitStream interface { BuildPacketStream([]byte, int) bool GetBuffer() []byte GetBytePtr() []byte GetReadByteSize() int GetCurPos() int GetPosition() int GetStreamSize() int SetPosition(int) bool WriteBits([]byte, int) ReadBits(int) []byte WriteInt(int, int) ReadInt(int) int ReadFlag() bool WriteFlag(bool) bool WriteString(string) ReadString() string WriteInt64(int64, int) ReadInt64(int) int64 WriteFloat(float32) ReadFloat() float32 WriteFloat64(float64) ReadFloat64() float64 // contains filtered or unexported methods }
type ISnowflake ¶
type IStuHashRing ¶
use for stubring
type StubHashRing ¶
type StubHashRing struct {
// contains filtered or unexported fields
}
HashRing holds the information about the members of the consistent hash ring.
func (*StubHashRing) Init ¶
func (h *StubHashRing) Init(endpoints []string)
Add inserts a string element in the consistent hash.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.