Manager
- class pf.manager.PfManager(page_size: int = 4096, buffer_capacity: int = 40, cache_policy: PfCachePolicy | None = None)[소스]
기반 클래스:
objectPF component의 메인 manager 클래스입니다.
manager당 buffer manager가 하나씩 있고, 이 buffer manager는 여러개의 file들을 처리합니다.
- 변수:
page_size (int) – page의 크기.
_buffer_manager (PfBufferManager) – buffer manager.
_next_fid_number (int) – 다음으로 부여할 file의 ID.
_opened_file_table (dict[Path, PfFile]) – 열린 file들의 테이블.
- __init__(page_size: int = 4096, buffer_capacity: int = 40, cache_policy: PfCachePolicy | None = None) None[소스]
manager를 초기화합니다.
- 매개변수:
page_size (int) – page의 크기 (기본값: 4096).
buffer_capacity (int) – buffer의 최대 크기 (기본값: 40).
cache_policy (PfCachePolicy | None) – 사용할 cache policy (기본값: None). None 이면 PfRandomPolicy 를 사용합니다.
- 예외 발생:
PfInvalidPageSizeError – page_size 가 유효하지 않은 경우.
PfInvalidBufferCapacityError – buffer_capacity 가 유효하지 않은 경우.
- create_file(path: Path) PfFile[소스]
file을 생성하고, file header를 초기화합니다.
file header는 0번째 페이지에 저장됩니다.
- 매개변수:
path (Path) – 대상 file의 경로.
- 반환:
생성된 file.
- 반환 형식:
- 예외 발생:
FileExistsError – path 에 file이 이미 있는 경우.
- destroy_file(path: Path) None[소스]
file을 삭제합니다.
- 매개변수:
path (Path) – 대상 file의 경로.
- 예외 발생:
PfFileIsOpenedError – path 에 file이 열려있는 경우.
FileNotFoundError – path 에 file이 없는 경우.
- open_file(path: Path) PfFile[소스]
file을 열고, fid 를 부여합니다.
_opened_file_table 에서 해당 path 로 열린 file을 추적합니다.
- 매개변수:
path (Path) – 대상 file의 경로.
- 반환:
열린 file.
- 반환 형식:
- 예외 발생:
PfFileIsOpenedError – path 에 file이 이미 열려있는 경우.
FileNotFoundError – path 에 file이 없는 경우.
- close_file(path: Path) None[소스]
file을 flush 하고, stream을 닫습니다.
_opened_file_table 에서 해당 path 로 열린 file을 제거합니다.
- 매개변수:
path (Path) – 대상 file의 경로.
- 예외 발생:
PfFileIsClosedError – path 에 file이 이미 닫혀있는 경우.