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