Manager

source: bluebase/pf/manager.py


class PfManager(*, page_size: int = 4096, cache_capacity: int = 40, replacer: PfReplacer | None = None)[source]

Bases: object

A manager for the PF component.

The manager manages files and pages in the database. Note that the page cache covers multiple files.

Variables:
  • page_size (int) – the size of a page

  • cache_capacity (int) – the capacity of the page cache

  • replacer (PfReplacer) – the replacement policy of the page cache

  • cache (PfPageCache) – the page cache object

  • fid_counter (dict[PfFileId, int]) – the container for managing file IDs

Raises:
create_file(path: Path) → None[source]

Create a new file.

Raises:

PfManagedFileCreateError – if the file is already managed

destroy_file(path: Path) → None[source]

Destroy a file.

Raises:

PfManagedFileDestroyError – if the file is still being managed

open_file(path: Path) → PfFile[source]

Open a file.

close_file(file: PfFile) → None[source]

Close a file.

Raises:

PfUnmanagedFileCloseError – if the file is not managed