ssd.command_buffer ================== .. py:module:: ssd.command_buffer Attributes ---------- .. autoapisummary:: ssd.command_buffer.BUFFER_FILE_PATH Classes ------- .. autoapisummary:: ssd.command_buffer.CommandBuffer Module Contents --------------- .. py:data:: BUFFER_FILE_PATH .. py:class:: CommandBuffer CommandBuffer 클래스는 명령어를 버퍼에 저장하고 최적화하는 기능을 제공합니다. 명령어는 buffer.txt 파일에 저장되며, 필요한 경우 버퍼를 비울 수 있습니다. .. attribute:: buffer_file_path 버퍼 파일 경로 :type: Path .. attribute:: buffer 명령어를 저장하는 리스트 :type: list .. py:attribute:: buffer_file_path :type: pathlib.Path .. py:attribute:: buffer :type: List[ssd.command.Command] :value: [] .. py:method:: initialize() 버퍼 파일을 초기화합니다. 만일 buffer.txt 파일이 없으면, 초기화된 파일을 생성합니다. .. py:method:: load_buffer() 버퍼 파일에서 명령어를 읽어와 버퍼에 저장합니다. .. py:method:: save_buffer() 버퍼 파일에 현재 버퍼의 명령어를 저장합니다. .. py:method:: get_saved_data() -> str 버퍼에 저장된 명령어 데이터를 문자열 형식으로 반환합니다. :returns: 버퍼에 저장된 명령어 문자열 :rtype: str .. py:method:: push_command(command: ssd.command.Command) 명령어를 버퍼에 추가하고 최적화합니다. :param command: 버퍼에 추가할 명령어 .. py:method:: pop() 버퍼에서 명령어를 제거하고 반환합니다. :returns: 제거된 명령어 :rtype: 명령어 .. py:method:: is_able_to_fast_read(cmd: ssd.command.Command) -> bool 빠른 읽기가 가능한지 확인합니다. :param cmd: 확인할 명령어 :returns: 빠른 읽기가 가능한 경우 True, 그렇지 않으면 False :rtype: bool .. py:method:: get_read_fast(cmd: ssd.command.ReadCommand) -> int 버퍼에서 빠른 읽기 값을 반환합니다. :param cmd: 읽기 명령어 :returns: 읽은 값 :rtype: int .. py:method:: flush() -> List[ssd.command.Command] 버퍼를 비우고 모든 명령어를 반환합니다. :returns: 비워진 버퍼의 모든 명령어 :rtype: list .. py:method:: optimize() 버퍼 내 명령어를 최적화합니다. .. py:method:: merge_write_with_erase(erase_commands: Set[Tuple[str, int, int]], key: Tuple[str, int, int]) :staticmethod: 쓰기 명령어와 삭제 명령어를 병합합니다. :param erase_commands: 삭제 명령어 집합 :type erase_commands: set :param key: 쓰기 명령어의 키 :type key: tuple :returns: 병합 가능한 경우 True, 그렇지 않으면 False :rtype: bool .. py:method:: need_flush() -> bool 버퍼를 비울 필요가 있는지 확인합니다. :returns: 버퍼를 비울 필요가 있는 경우 True, 그렇지 않으면 False :rtype: bool