Documentation
¶
Index ¶
- type DLL
- func (dll *DLL) Delete(node *Node)
- func (dll *DLL) GetLRUFreeSpace(lru *Node, blockSize int) []byte
- func (dll *DLL) Inset(value Value) *Node
- func (dll *DLL) LastNode() *Node
- func (dll *DLL) PopLastFreeSpace(blockSize int) ([]byte, string, bool)
- func (dll *DLL) Read(node *Node)
- func (dll *DLL) ReadAll()
- func (dll *DLL) ReadBack()
- func (dll *DLL) Remove()
- type Node
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DLL ¶
type DLL struct {
sync.RWMutex // Read-Write lock to ensure safe concurrent access.
// contains filtered or unexported fields
}
DLL represents a doubly linked list with root, last node, and a read-write lock.
func (*DLL) Delete ¶
Delete removes a given node from the doubly linked list. It locks the DLL to prevent race conditions during deletion.
func (*DLL) GetLRUFreeSpace ¶
GetLRUFreeSpace returns a slice of bytes representing the free space in the LRU node. It locks the list to avoid concurrent modification during the operation.
func (*DLL) Inset ¶
Inset adds a new node with the given value to the doubly linked list. It locks the DLL to prevent race conditions while modifying the list.
func (*DLL) PopLastFreeSpace ¶
func (*DLL) Read ¶
Read moves a node to the front of the doubly linked list (making it the new root). It locks the DLL to prevent concurrent modification.
func (*DLL) ReadAll ¶
func (dll *DLL) ReadAll()
ReadAll traverses the entire doubly linked list from root to last, printing each node's value.