Skip to main content

Module file_watcher

Module file_watcher 

Source
Expand description

§파일 변경 감지 모듈

notify 크레이트를 사용하여 사전 파일 변경을 감지하고 자동으로 핫 리로드를 트리거합니다.

§아키텍처

┌──────────────────────────────────────┐
│ FileWatcher                          │
│  - notify::RecommendedWatcher        │
│  - crossbeam::Receiver               │
└──────────────────────────────────────┘
         │
         ▼
┌──────────────────────────────────────┐
│ File System Events                   │
│  - Create, Modify, Delete            │
└──────────────────────────────────────┘
         │
         ▼
┌──────────────────────────────────────┐
│ HotReloadDictionary::reload()        │
└──────────────────────────────────────┘

§사용 예제

use mecab_ko_dict::file_watcher::{FileWatcher, WatchConfig};
use mecab_ko_dict::hot_reload::HotReloadDictionary;
use std::sync::Arc;

let dict = Arc::new(HotReloadDictionary::new("/path/to/dict").unwrap());
let config = WatchConfig::default();

let mut watcher = FileWatcher::new(dict.clone(), config).unwrap();
watcher.start().unwrap();

// 파일 변경 감지 및 자동 리로드
// ...

watcher.stop().unwrap();

Structs§

FileWatcher
파일 감시자
WatchConfig
파일 감시 설정

Enums§

FileEvent
파일 변경 이벤트