핸들러 로직과 버퍼 풀 로직을 어느 경계선에서 구분해야할까요? #4
Chocochip101
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
현재 제 코드 구조에서 StorageEngineHandler와 BufferPool 클래스가 존재합니다. StorageEngineHandler는 MySQL 엔진이 스토리지 엔진으로 요청을 보내는 구현체입니다.
현재 고민인 두 코드입니다. 참고 PR
먼저 첫 번째 코드는 StorageEngineHandler에 간단하게 구현할 수 있게 BufferPool에 사용할 수 가능한 Page를 반환합니다. 코드가 깔끔하다는 장점이 있지만, BufferPool에 적절한 메서드 책임인지는 잘 모르겠습니다.
두번째는 StorageEngineHandler에서 구현했습니다. 여기서 문제는 StorageEngineHandler는 페이지 번호를 모르기 때문에 반복문을 계속 돌게 되고, 코드고 더럽습니다. 그렇다고 해서 StorageEngineHandler에서 페이지 번호를 알고 있는 FileManager를 주입하기에는 의존성이 많이 복잡할 것 같다는 생각이 드네요.
더 좋은 제안이 있다면 알려주세요.
Beta Was this translation helpful? Give feedback.
All reactions