auto commit
This commit is contained in:
@@ -18,11 +18,11 @@ add_subdirectory(idgen)
|
|||||||
# PREFIX "")
|
# PREFIX "")
|
||||||
|
|
||||||
##编译执行文件
|
##编译执行文件
|
||||||
set(LIB_SRC YitIdHelper.h YitIdHelper.c)
|
#set(LIB_SRC idgen/YitIdHelper.h idgen/YitIdHelper.c)
|
||||||
add_library(YitIdHelper ${LIB_SRC})
|
#add_library(YitIdHelper ${LIB_SRC})
|
||||||
|
|
||||||
add_executable(YitIdGen main.c)
|
add_executable(YitIdGen main.c)
|
||||||
target_link_libraries(YitIdGen YitIdHelper)
|
#target_link_libraries(YitIdGen YitIdHelper)
|
||||||
target_link_libraries(YitIdGen idgen)
|
target_link_libraries(YitIdGen idgen)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,23 +5,24 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "YitIdHelper.h"
|
#include "YitIdHelper.h"
|
||||||
#include "idgen/IdGenerator.h"
|
#include "IdGenerator.h"
|
||||||
|
|
||||||
extern void SetIdGenerator(IdGeneratorOptions options) {
|
extern void SetIdGenerator(IdGeneratorOptions options) {
|
||||||
SetOptions(options);
|
SetOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void SetWorkerId(uint32_t workerId) {
|
extern void SetWorkerId(uint32_t workerId) {
|
||||||
IdGeneratorOptions options = BuildIdGenOptions(workerId);
|
// IdGeneratorOptions options = BuildIdGenOptions(workerId);
|
||||||
SetOptions(options);
|
// SetOptions(options);
|
||||||
//SetIdGenerator(options);
|
SetIdGenerator(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern uint64_t NextId() {
|
extern uint64_t NextId() {
|
||||||
IdGenerator *generator = GetIdGenInstance();
|
return GetIdGenInstance()->NextId();
|
||||||
uint64_t id = generator->NextId();
|
// IdGenerator *generator = GetIdGenInstance();
|
||||||
free(generator);
|
// uint64_t id = generator->NextId();
|
||||||
return id;
|
// free(generator);
|
||||||
|
// return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern uint64_t TestId() {
|
extern uint64_t TestId() {
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "idgen/IdGenOptions.h"
|
#include "IdGenOptions.h"
|
||||||
#include "idgen/common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
|
||||||
TAP_DLLEXPORT
|
TAP_DLLEXPORT
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "idgen/SnowWorkerM1.h"
|
#include "idgen/SnowWorkerM1.h"
|
||||||
#include "idgen/IdGenerator.h"
|
#include "idgen/IdGenerator.h"
|
||||||
#include "YitIdHelper.h"
|
#include "idgen/YitIdHelper.h"
|
||||||
|
|
||||||
|
|
||||||
const int GenIdCount = 50000;
|
const int GenIdCount = 50000;
|
||||||
|
|||||||
Reference in New Issue
Block a user