-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLEANUP: Move event callback functions to mc_util files #713
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
#ifndef MC_UTIL_H | ||
#define MC_UTIL_H | ||
|
||
#include <memcached/engine.h> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. engine.h가 아니라 callback.h만 include해도 충분할 것으로 생각합니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 해당 내용 수정되었습니다. 별개로 다른 모듈에서의 헤더 계층 구조도 이상하다고 생각됩니다. #include <memcached/extension.h>
#include <memcached/engine.h> 위와 같이 모듈을 include하고 있는 모듈은 아래와 같습니다.
이는 해당 모듈이 extension과 engine API를 활용한다는 것을 알려주는 목적인가요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ing-eoking
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 네. 정리하여 올리겠습니다. |
||
#include <memcached/extension.h> | ||
|
||
/* length of string representing 4 bytes integer is 10 */ | ||
|
@@ -95,4 +96,11 @@ ENGINE_ERROR_CODE tokenize_sblocks(mblck_list_t *blist, int keylen, int keycnt, | |
int maxklen, bool must_backward_compatible, | ||
token_t *tokens); | ||
|
||
/* event callback functions */ | ||
void register_callback(ENGINE_HANDLE *eh, | ||
ENGINE_EVENT_TYPE type, | ||
EVENT_CALLBACK cb, const void *cb_data); | ||
void perform_callbacks(ENGINE_EVENT_TYPE type, | ||
const void *data, const void *c); | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
개인적으로 기존처럼 구조체 정의와 배열 선언이 분리되어 있는 편이 더 읽기 좋다고 생각합니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
engine_event_handlers 배열이 초기화되는 것이 보장되나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@namsic
구조체 내부 길이가 길지 않아 변수 선언과 구조체 내부가 함께 있으면,
내부 정보를 같이 볼 수 있어 코드에 대한 빠른 파악이 될 수 있다고 생각했습니다.
분리되어 있는 편이 읽기가 편하시다면 변경하겠습니다.
추가 의견으로 저는 별개로 분리 시 eigne_event_handler 구조체를 memcached.h와 같이
mc_util.h에 위치시켜 외부로 드러낼 필요는 없다고 생각됩니다.
@jhpark816
해당 구조체 변수는 global 변수이므로 OS에서 무조건 0으로 초기화가 보장됩니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eigne_event_handler 구조체를 헤더 파일에 두지 맙시다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@namsic
의견 부탁드립니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ing-eoking
eigne_event_handler 구조체를 여기에 두더라도,
구조체 정의와 배열 선언을 분리하자는 의견입니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jhpark816
구조체 정의와 배열 선언을 분리할 경우
구조체 정의를 소스의 맨 위로 두거나
아래와 같이 구현되어야 합니다.
예제의 형태는 크게 차이가 없다고 생각되어서
구조체 정의를 소스의 맨 위로 위치시키는게 읽기 편하신 형태인건지 궁금하여 요청드렸습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
위의 예와 같이 구현합시다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정되었습니다.