Node

source: bluebase/ix/node.py


class IxPointer(buffer: bytearray)[source]

Bases: LayoutMixin, ABC

Layout

Offset

Size

Name

Format

0

4

rid_pid

'<i'

4

4

rid_sid

'<i'

8

4

link

'<i'

NULL: ClassVar[PfPageId] = -1

pointer가 아무것도 가리키지 않을 때 사용하는 상수.

is_null() → bool[source]
set_null() → None[source]
size: ClassVar[int] = 12

The total size of the layout, automatically calculated from fields.

class IxLeafPointer(buffer: bytearray)[source]

Bases: IxPointer

classmethod new(rid: RmRecordId) → Self[source]
property rid: RmRecordIdread-write
property bid: IxBucketId | Noneread-write
size: ClassVar[int] = 12

The total size of the layout, automatically calculated from fields.

class IxBranchPointer(buffer: bytearray)[source]

Bases: IxPointer

classmethod new(child_nid: IxNodeId) → Self[source]
property child_nid: IxNodeIdread-write
size: ClassVar[int] = 12

The total size of the layout, automatically calculated from fields.

class IxNodeHeader(page: PfPage, *, offset: int, limit: int)[source]

Bases: PfPageView, LayoutMixin

node header를 나타내는 view 클래스입니다.

Layout

Offset

Size

Name

Format

0

1

leaf

'<B'

1

4

key_count

'<i'

5

4

parent_nid

'<i'

9

4

prev_nid

'<i'

13

4

next_nid

'<i'

NO_PARENT_NODE: ClassVar[IxNodeId] = -1

parent node가 없을 경우 사용하는 상수.

NO_PREV_NODE: ClassVar[IxNodeId] = -1

previous node가 없을 경우 사용하는 상수.

NO_NEXT_NODE: ClassVar[IxNodeId] = -1

next node가 없을 경우 사용하는 상수.

size: ClassVar[int] = 17

The total size of the layout, automatically calculated from fields.

class IxNode(page: PfPage, domain: Domain, slot_capacity: int)[source]

Bases: ABC

Variables:
classmethod parse(page: PfPage, domain: Domain, slot_capacity: int) → Self[source]
property header_offset: intread-only
property header_size: intread-only
property key_area_offset: intread-only
property key_size: intread-only
property key_capacity: intread-only
property key_count: intread-write
property pointer_area_offset: intread-only
property pointer_size: intread-only
property pointer_capacity: intread-only
property pointer_count: intread-only
abstract property PointerClass: type[IxPointer]read-only
abstract property slot_count_delta: intread-only
property underflow_threshold: intread-only
property last_sid: IxSlotIdread-only
property leaf: boolread-only
property parent_nid: IxNodeId | Noneread-write
property prev_nid: IxNodeId | Noneread-write
property next_nid: IxNodeId | Noneread-write
get_header() → IxNodeHeader[source]
get_key_offset(sid: IxSlotId) → int[source]
get_key(sid: IxSlotId) → bool | int | float | str[source]
set_key(sid: IxSlotId, key: bool | int | float | str) → None[source]
keys(begin: IxSlotId | None = None, end: IxSlotId | None = None) → Iterator[tuple[IxSlotId, bool | int | float | str]][source]
get_pointer_offset(sid: IxSlotId) → int[source]
get_pointer(sid: IxSlotId) → IxPointer[source]
set_pointer(sid: IxSlotId, pointer: IxPointer) → None[source]
pointers(begin: IxSlotId | None = None, end: IxSlotId | None = None) → Iterator[tuple[IxSlotId, IxPointer]][source]
is_empty() → bool[source]
is_full() → bool[source]
is_underflow() → bool[source]
can_lend() → bool[source]
snapshot() → tuple[list[bool | int | float | str], list[IxPointer]][source]
restore(keys: list[bool | int | float | str], pointers: list[IxPointer]) → None[source]
assignmentsearch_key(value: bool | int | float | str) → IxSlotId | None[source]
assignmentfind_slot(value: bool | int | float | str) → IxSlotId[source]
assignmentunpin() → None[source]
class IxLeafNode(page: PfPage, domain: Domain, slot_capacity: int)[source]

Bases: IxNode

classmethod new(page: PfPage, domain: Domain, slot_capacity: int) → Self[source]
property PointerClass: type[IxPointer]read-only
property slot_count_delta: intread-only
class IxBranchNode(page: PfPage, domain: Domain, slot_capacity: int)[source]

Bases: IxNode

classmethod new(page: PfPage, domain: Domain, slot_capacity: int, *, child_nid: IxNodeId) → Self[source]
property PointerClass: type[IxPointer]read-only
property slot_count_delta: intread-only
assignmentfind_pointer(nid: IxNodeId) → IxSlotId[source]