Skip to content

INTERNAL: Extract hash tree module from set/map collections#983

Open
zhy2on wants to merge 8 commits into
naver:developfrom
zhy2on:internal/extract-hash-tree
Open

INTERNAL: Extract hash tree module from set/map collections#983
zhy2on wants to merge 8 commits into
naver:developfrom
zhy2on:internal/extract-hash-tree

Conversation

@zhy2on

@zhy2on zhy2on commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

🔗 Related Issue

⌨️ What I did

set, map 컬렉션에 중복으로 존재하던 hash tree 구현을 hash_tree.c/h로 추출하였습니다.

  • set_hash_node, map_hash_node 및 관련 상수를 제거하고 htree_node, htree_meta로 통일하였습니다.

  • set_meta_info, map_meta_inforoot 필드를 htree_meta htree로 교체하였습니다.

  • htree_opsget_key 콜백으로 컬렉션별 키 추출 로직을 분리하였습니다. (기존 elem->value/nbytes, elem->data/nfield 직접 접근 → htree_ops.get_key 콜백으로 추출. set은 set_get_key, map은 map_get_key를 등록)

  • hash tree의 공개 API를 hash_tree.h에 정의하였습니다.

함수 설명
htree_init htree 초기화 (root=NULL, ops 설정)
htree_elem_find key 기반 탐색, 삽입/교체 위치(htree_elem_pos) 반환
htree_elem_insert 중복 검사 포함 삽입
htree_elem_add 이미 찾은 위치에 삽입
htree_elem_replace 위치 기반 교체
htree_elem_delete 단건 삭제, deleted elem 반환하여 caller가 후처리
htree_elem_delete_bulk 다건 삭제, deleted_head로 chain 반환하여 caller가 후처리
htree_elem_get refcount++ 포함 단건 조회, delete=true면 delete도 수행. elem_array 인자에 반환
htree_elem_get_bulk 전체 또는 count개 조회. elem_array 인자에 반환
htree_elem_get_rand 랜덤 샘플링 조회

zhy2on added 8 commits June 22, 2026 18:06
- set_meta_info의 root를 htree_meta htree로 교체
- set_hash_node → htree_node, SET_* 상수 → HTREE_* 상수로 변경
- do_set_node_link/unlink, do_htree_elem_* 함수 시그니처를 htree_meta *로 변경
- map_meta_info의 root를 htree_meta htree로 교체
- map_hash_node → htree_node, MAP_* 상수 → HTREE_* 상수로 변경
- do_map_node_link/unlink, do_htree_elem_* 함수 시그니처를 htree_meta *로 변경
@zhy2on zhy2on requested a review from jhpark816 June 22, 2026 14:17
@zhy2on zhy2on assigned zhy2on and unassigned zhy2on Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant