fileLinkedList

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileLinkedList

type FileLinkedList[T serialization.Serializer[T]] struct {
	// contains filtered or unexported fields
}

func NewFileLinkedList

func NewFileLinkedList[T serialization.Serializer[T]](filename string, readOnly bool) (*FileLinkedList[T], error)

NewFileLinkedList initializes a new instance of FileLinkedList[T] and its associated file arrays. It takes a filename as input and creates two file arrays: one for elements and one for index. Returns a pointer to the new FileLinkedList[T] and an error if any.

func (*FileLinkedList[T]) Add

func (list *FileLinkedList[T]) Add(listID serialization.Offset, item T) error

Add appends an item to the specified list ID. If the list doesn't exist, it creates a new list. Returns an error if any.

func (*FileLinkedList[T]) Close

func (list *FileLinkedList[T]) Close() error

func (*FileLinkedList[T]) Contains

func (list *FileLinkedList[T]) Contains(listID serialization.Offset, item T) (bool, error)

Contains checks if the specified list ID contains the given item. Returns true if the item is found, false if not, and an error if any.

func (*FileLinkedList[T]) Count

func (list *FileLinkedList[T]) Count(index serialization.Offset) (bool, serialization.Length, error)

Count returns the number of items in the specified list ID. Returns the count and an error if any.

func (*FileLinkedList[T]) ExpandElements

func (list *FileLinkedList[T]) ExpandElements(length serialization.Length) error

func (*FileLinkedList[T]) ExpandIndex

func (list *FileLinkedList[T]) ExpandIndex(length serialization.Length) error

func (*FileLinkedList[T]) Get

func (list *FileLinkedList[T]) Get(listID serialization.Offset, index serialization.Offset) (T, error)

Get retrieves an item from the specified list ID at the given index. Returns the item and an error if any. If the list or index is out of bounds, it returns an error.

func (*FileLinkedList[T]) GetFileName

func (list *FileLinkedList[T]) GetFileName() (string, string)

func (*FileLinkedList[T]) Prefetch

func (list *FileLinkedList[T]) Prefetch()

func (*FileLinkedList[T]) Remove

func (list *FileLinkedList[T]) Remove(listID serialization.Offset, indexItem T) error

Remove removes an item from the specified list ID that matches the provided indexItem. Returns an error if the item is not found or if any other error occurs.

func (*FileLinkedList[T]) ShrinkWrap

func (list *FileLinkedList[T]) ShrinkWrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL