auto commit
This commit is contained in:
@@ -23,7 +23,7 @@ func NextId() uint64 {
|
||||
// 注册一个新的WorkerId
|
||||
//export RegisterWorkerId
|
||||
func RegisterWorkerId(ip *C.char, port int, password *C.char, maxWorkerId int) int {
|
||||
return regworkerid.RegisterWorkerId(C.GoString(ip), port, C.GoString(password), maxWorkerId)
|
||||
return int(regworkerid.RegisterWorkerId(C.GoString(ip), port, C.GoString(password), maxWorkerId))
|
||||
}
|
||||
|
||||
// 注销WorkerId
|
||||
@@ -32,9 +32,9 @@ func UnRegisterWorkerId() {
|
||||
regworkerid.UnRegisterWorkerId()
|
||||
}
|
||||
|
||||
// 检查本地WorkerId是否有效
|
||||
// 检查本地WorkerId是否有效(0-有效,其它-无效)
|
||||
//export ValidateLocalWorkerId
|
||||
func ValidateLocalWorkerId(workerId int) bool {
|
||||
func ValidateLocalWorkerId(workerId int) int {
|
||||
return regworkerid.ValidateLocalWorkerId(workerId)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,12 @@ const _WorkerIdValueKeyPrefix string = "IdGen:WorkerId:Value:" // redis 中的ke
|
||||
const _WorkerIdFlag = "Y" // IdGen:WorkerId:Value:xx 的值(将来可用 _token 替代)
|
||||
const _Log = false // 是否输出日志
|
||||
|
||||
func ValidateLocalWorkerId(workerId int) bool {
|
||||
return workerId == _usingWorkerId
|
||||
func ValidateLocalWorkerId(workerId int) int {
|
||||
if workerId == _usingWorkerId {
|
||||
return 0
|
||||
} else {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
func UnRegisterWorkerId() {
|
||||
|
||||
Binary file not shown.
@@ -75,8 +75,8 @@ extern __declspec(dllexport) GoInt RegisterWorkerId(char* ip, GoInt port, char*
|
||||
// 注销WorkerId
|
||||
extern __declspec(dllexport) void UnRegisterWorkerId();
|
||||
|
||||
// 检查本地WorkerId是否有效
|
||||
extern __declspec(dllexport) GoUint8 ValidateLocalWorkerId(GoInt workerId);
|
||||
// 检查本地WorkerId是否有效(0-有效,其它-无效)
|
||||
extern __declspec(dllexport) GoInt ValidateLocalWorkerId(GoInt workerId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user