node

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package node is a generated generator package.

Package node is a generated generator package.

Package node is a generated generator package.

Package node is a generated generator package.

Package node is a generated generator package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equals

func Equals[K comparable, V any](a, b Node[K, V]) bool

Types

type B

type B[K comparable, V any] struct {
	// contains filtered or unexported fields
}

B is a cache entry that provide the following features:

1. Base

func (*B[K, V]) AsPointer

func (n *B[K, V]) AsPointer() unsafe.Pointer

func (*B[K, V]) Cost

func (n *B[K, V]) Cost() uint32

func (*B[K, V]) DecrementFrequency

func (n *B[K, V]) DecrementFrequency()

func (*B[K, V]) Die

func (n *B[K, V]) Die()

func (*B[K, V]) Expiration

func (n *B[K, V]) Expiration() uint32

func (*B[K, V]) Frequency

func (n *B[K, V]) Frequency() uint8

func (*B[K, V]) HasExpired added in v1.2.0

func (n *B[K, V]) HasExpired() bool

func (*B[K, V]) IncrementFrequency

func (n *B[K, V]) IncrementFrequency()

func (*B[K, V]) IsAlive

func (n *B[K, V]) IsAlive() bool

func (*B[K, V]) IsMain

func (n *B[K, V]) IsMain() bool

func (*B[K, V]) IsSmall

func (n *B[K, V]) IsSmall() bool

func (*B[K, V]) Key

func (n *B[K, V]) Key() K

func (*B[K, V]) MarkMain

func (n *B[K, V]) MarkMain()

func (*B[K, V]) MarkSmall

func (n *B[K, V]) MarkSmall()

func (*B[K, V]) Next

func (n *B[K, V]) Next() Node[K, V]

func (*B[K, V]) NextExp

func (n *B[K, V]) NextExp() Node[K, V]

func (*B[K, V]) Prev

func (n *B[K, V]) Prev() Node[K, V]

func (*B[K, V]) PrevExp

func (n *B[K, V]) PrevExp() Node[K, V]

func (*B[K, V]) ResetFrequency

func (n *B[K, V]) ResetFrequency()

func (*B[K, V]) SetNext

func (n *B[K, V]) SetNext(v Node[K, V])

func (*B[K, V]) SetNextExp

func (n *B[K, V]) SetNextExp(v Node[K, V])

func (*B[K, V]) SetPrev

func (n *B[K, V]) SetPrev(v Node[K, V])

func (*B[K, V]) SetPrevExp

func (n *B[K, V]) SetPrevExp(v Node[K, V])

func (*B[K, V]) Unmark

func (n *B[K, V]) Unmark()

func (*B[K, V]) Value

func (n *B[K, V]) Value() V

type BC

type BC[K comparable, V any] struct {
	// contains filtered or unexported fields
}

BC is a cache entry that provide the following features:

1. Base

2. Cost

func (*BC[K, V]) AsPointer

func (n *BC[K, V]) AsPointer() unsafe.Pointer

func (*BC[K, V]) Cost

func (n *BC[K, V]) Cost() uint32

func (*BC[K, V]) DecrementFrequency

func (n *BC[K, V]) DecrementFrequency()

func (*BC[K, V]) Die

func (n *BC[K, V]) Die()

func (*BC[K, V]) Expiration

func (n *BC[K, V]) Expiration() uint32

func (*BC[K, V]) Frequency

func (n *BC[K, V]) Frequency() uint8

func (*BC[K, V]) HasExpired added in v1.2.0

func (n *BC[K, V]) HasExpired() bool

func (*BC[K, V]) IncrementFrequency

func (n *BC[K, V]) IncrementFrequency()

func (*BC[K, V]) IsAlive

func (n *BC[K, V]) IsAlive() bool

func (*BC[K, V]) IsMain

func (n *BC[K, V]) IsMain() bool

func (*BC[K, V]) IsSmall

func (n *BC[K, V]) IsSmall() bool

func (*BC[K, V]) Key

func (n *BC[K, V]) Key() K

func (*BC[K, V]) MarkMain

func (n *BC[K, V]) MarkMain()

func (*BC[K, V]) MarkSmall

func (n *BC[K, V]) MarkSmall()

func (*BC[K, V]) Next

func (n *BC[K, V]) Next() Node[K, V]

func (*BC[K, V]) NextExp

func (n *BC[K, V]) NextExp() Node[K, V]

func (*BC[K, V]) Prev

func (n *BC[K, V]) Prev() Node[K, V]

func (*BC[K, V]) PrevExp

func (n *BC[K, V]) PrevExp() Node[K, V]

func (*BC[K, V]) ResetFrequency

func (n *BC[K, V]) ResetFrequency()

func (*BC[K, V]) SetNext

func (n *BC[K, V]) SetNext(v Node[K, V])

func (*BC[K, V]) SetNextExp

func (n *BC[K, V]) SetNextExp(v Node[K, V])

func (*BC[K, V]) SetPrev

func (n *BC[K, V]) SetPrev(v Node[K, V])

func (*BC[K, V]) SetPrevExp

func (n *BC[K, V]) SetPrevExp(v Node[K, V])

func (*BC[K, V]) Unmark

func (n *BC[K, V]) Unmark()

func (*BC[K, V]) Value

func (n *BC[K, V]) Value() V

type BE

type BE[K comparable, V any] struct {
	// contains filtered or unexported fields
}

BE is a cache entry that provide the following features:

1. Base

2. Expiration

func (*BE[K, V]) AsPointer

func (n *BE[K, V]) AsPointer() unsafe.Pointer

func (*BE[K, V]) Cost

func (n *BE[K, V]) Cost() uint32

func (*BE[K, V]) DecrementFrequency

func (n *BE[K, V]) DecrementFrequency()

func (*BE[K, V]) Die

func (n *BE[K, V]) Die()

func (*BE[K, V]) Expiration

func (n *BE[K, V]) Expiration() uint32

func (*BE[K, V]) Frequency

func (n *BE[K, V]) Frequency() uint8

func (*BE[K, V]) HasExpired added in v1.2.0

func (n *BE[K, V]) HasExpired() bool

func (*BE[K, V]) IncrementFrequency

func (n *BE[K, V]) IncrementFrequency()

func (*BE[K, V]) IsAlive

func (n *BE[K, V]) IsAlive() bool

func (*BE[K, V]) IsMain

func (n *BE[K, V]) IsMain() bool

func (*BE[K, V]) IsSmall

func (n *BE[K, V]) IsSmall() bool

func (*BE[K, V]) Key

func (n *BE[K, V]) Key() K

func (*BE[K, V]) MarkMain

func (n *BE[K, V]) MarkMain()

func (*BE[K, V]) MarkSmall

func (n *BE[K, V]) MarkSmall()

func (*BE[K, V]) Next

func (n *BE[K, V]) Next() Node[K, V]

func (*BE[K, V]) NextExp

func (n *BE[K, V]) NextExp() Node[K, V]

func (*BE[K, V]) Prev

func (n *BE[K, V]) Prev() Node[K, V]

func (*BE[K, V]) PrevExp

func (n *BE[K, V]) PrevExp() Node[K, V]

func (*BE[K, V]) ResetFrequency

func (n *BE[K, V]) ResetFrequency()

func (*BE[K, V]) SetNext

func (n *BE[K, V]) SetNext(v Node[K, V])

func (*BE[K, V]) SetNextExp

func (n *BE[K, V]) SetNextExp(v Node[K, V])

func (*BE[K, V]) SetPrev

func (n *BE[K, V]) SetPrev(v Node[K, V])

func (*BE[K, V]) SetPrevExp

func (n *BE[K, V]) SetPrevExp(v Node[K, V])

func (*BE[K, V]) Unmark

func (n *BE[K, V]) Unmark()

func (*BE[K, V]) Value

func (n *BE[K, V]) Value() V

type BEC

type BEC[K comparable, V any] struct {
	// contains filtered or unexported fields
}

BEC is a cache entry that provide the following features:

1. Base

2. Expiration

3. Cost

func (*BEC[K, V]) AsPointer

func (n *BEC[K, V]) AsPointer() unsafe.Pointer

func (*BEC[K, V]) Cost

func (n *BEC[K, V]) Cost() uint32

func (*BEC[K, V]) DecrementFrequency

func (n *BEC[K, V]) DecrementFrequency()

func (*BEC[K, V]) Die

func (n *BEC[K, V]) Die()

func (*BEC[K, V]) Expiration

func (n *BEC[K, V]) Expiration() uint32

func (*BEC[K, V]) Frequency

func (n *BEC[K, V]) Frequency() uint8

func (*BEC[K, V]) HasExpired added in v1.2.0

func (n *BEC[K, V]) HasExpired() bool

func (*BEC[K, V]) IncrementFrequency

func (n *BEC[K, V]) IncrementFrequency()

func (*BEC[K, V]) IsAlive

func (n *BEC[K, V]) IsAlive() bool

func (*BEC[K, V]) IsMain

func (n *BEC[K, V]) IsMain() bool

func (*BEC[K, V]) IsSmall

func (n *BEC[K, V]) IsSmall() bool

func (*BEC[K, V]) Key

func (n *BEC[K, V]) Key() K

func (*BEC[K, V]) MarkMain

func (n *BEC[K, V]) MarkMain()

func (*BEC[K, V]) MarkSmall

func (n *BEC[K, V]) MarkSmall()

func (*BEC[K, V]) Next

func (n *BEC[K, V]) Next() Node[K, V]

func (*BEC[K, V]) NextExp

func (n *BEC[K, V]) NextExp() Node[K, V]

func (*BEC[K, V]) Prev

func (n *BEC[K, V]) Prev() Node[K, V]

func (*BEC[K, V]) PrevExp

func (n *BEC[K, V]) PrevExp() Node[K, V]

func (*BEC[K, V]) ResetFrequency

func (n *BEC[K, V]) ResetFrequency()

func (*BEC[K, V]) SetNext

func (n *BEC[K, V]) SetNext(v Node[K, V])

func (*BEC[K, V]) SetNextExp

func (n *BEC[K, V]) SetNextExp(v Node[K, V])

func (*BEC[K, V]) SetPrev

func (n *BEC[K, V]) SetPrev(v Node[K, V])

func (*BEC[K, V]) SetPrevExp

func (n *BEC[K, V]) SetPrevExp(v Node[K, V])

func (*BEC[K, V]) Unmark

func (n *BEC[K, V]) Unmark()

func (*BEC[K, V]) Value

func (n *BEC[K, V]) Value() V

type Config

type Config struct {
	WithExpiration bool
	WithCost       bool
}

type Manager

type Manager[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager[K comparable, V any](c Config) *Manager[K, V]

func (*Manager[K, V]) Create

func (m *Manager[K, V]) Create(key K, value V, expiration, cost uint32) Node[K, V]

func (*Manager[K, V]) FromPointer

func (m *Manager[K, V]) FromPointer(ptr unsafe.Pointer) Node[K, V]

type Node

type Node[K comparable, V any] interface {
	// Key returns the key.
	Key() K
	// Value returns the value.
	Value() V
	// AsPointer returns the node as a pointer.
	AsPointer() unsafe.Pointer
	// Prev returns the previous node in the eviction policy.
	Prev() Node[K, V]
	// SetPrev sets the previous node in the eviction policy.
	SetPrev(v Node[K, V])
	// Next returns the next node in the eviction policy.
	Next() Node[K, V]
	// SetNext sets the next node in the eviction policy.
	SetNext(v Node[K, V])
	// PrevExp returns the previous node in the expiration policy.
	PrevExp() Node[K, V]
	// SetPrevExp sets the previous node in the expiration policy.
	SetPrevExp(v Node[K, V])
	// NextExp returns the next node in the expiration policy.
	NextExp() Node[K, V]
	// SetNextExp sets the next node in the expiration policy.
	SetNextExp(v Node[K, V])
	// HasExpired returns true if node has expired.
	HasExpired() bool
	// Expiration returns the expiration time.
	Expiration() uint32
	// Cost returns the cost of the node.
	Cost() uint32
	// IsAlive returns true if the entry is available in the hash-table.
	IsAlive() bool
	// Die sets the node to the dead state.
	Die()
	// Frequency returns the frequency of the node.
	Frequency() uint8
	// IncrementFrequency increments the frequency of the node.
	IncrementFrequency()
	// DecrementFrequency decrements the frequency of the node.
	DecrementFrequency()
	// ResetFrequency resets the frequency.
	ResetFrequency()
	// MarkSmall sets the status to the small queue.
	MarkSmall()
	// IsSmall returns true if node is in the small queue.
	IsSmall() bool
	// MarkMain sets the status to the main queue.
	MarkMain()
	// IsMain returns true if node is in the main queue.
	IsMain() bool
	// Unmark sets the status to unknown.
	Unmark()
}

Node is a cache entry.

func CastPointerToB

func CastPointerToB[K comparable, V any](ptr unsafe.Pointer) Node[K, V]

CastPointerToB casts a pointer to B.

func CastPointerToBC

func CastPointerToBC[K comparable, V any](ptr unsafe.Pointer) Node[K, V]

CastPointerToBC casts a pointer to BC.

func CastPointerToBE

func CastPointerToBE[K comparable, V any](ptr unsafe.Pointer) Node[K, V]

CastPointerToBE casts a pointer to BE.

func CastPointerToBEC

func CastPointerToBEC[K comparable, V any](ptr unsafe.Pointer) Node[K, V]

CastPointerToBEC casts a pointer to BEC.

func NewB

func NewB[K comparable, V any](key K, value V, expiration, cost uint32) Node[K, V]

NewB creates a new B.

func NewBC

func NewBC[K comparable, V any](key K, value V, expiration, cost uint32) Node[K, V]

NewBC creates a new BC.

func NewBE

func NewBE[K comparable, V any](key K, value V, expiration, cost uint32) Node[K, V]

NewBE creates a new BE.

func NewBEC

func NewBEC[K comparable, V any](key K, value V, expiration, cost uint32) Node[K, V]

NewBEC creates a new BEC.

Jump to

Keyboard shortcuts

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