buffer

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EVICT_HOLDER_CAPACITY uint64 = 100000
)

Variables

This section is empty.

Functions

func NewNodeManager

func NewNodeManager(maxsize uint64, evicter IEvictHolder) *nodeManager

Types

type EvictNode

type EvictNode struct {
	Handle base.IEvictHandle
	Iter   uint64
}

func (*EvictNode) String

func (node *EvictNode) String() string

func (*EvictNode) Unloadable

func (node *EvictNode) Unloadable(h base.IEvictHandle) bool

type IEvictHolder

type IEvictHolder interface {
	sync.Locker
	Enqueue(n *EvictNode)
	Dequeue() *EvictNode
}

func NewSimpleEvictHolder

func NewSimpleEvictHolder(ctx ...any) IEvictHolder

type Node

type Node struct {
	common.RefHelper
	sync.RWMutex

	HardEvictableFunc func() bool
	DestroyFunc       func()
	LoadFunc          func()
	UnloadableFunc    func() bool
	UnloadFunc        func()
	// contains filtered or unexported fields
}

func NewNode

func NewNode(impl base.INode, mgr base.INodeManager, key any, size uint64) *Node

func (*Node) Close

func (n *Node) Close() error

func (*Node) Destroy

func (n *Node) Destroy()

func (*Node) Expand

func (n *Node) Expand(delta uint64, fn func() error) error

func (*Node) GetState

func (n *Node) GetState() base.NodeState

GetState should be guarded by lock

func (*Node) HardEvictable added in v0.6.0

func (n *Node) HardEvictable() bool

func (*Node) IncIteration

func (n *Node) IncIteration() uint64

func (*Node) IsClosed

func (n *Node) IsClosed() bool

func (*Node) IsLoaded

func (n *Node) IsLoaded() bool

IsLoaded should be guarded by lock

func (*Node) Iteration

func (n *Node) Iteration() uint64

func (*Node) Key added in v0.6.0

func (n *Node) Key() any

func (*Node) Load

func (n *Node) Load()

Load should be guarded by lock

func (*Node) MakeHandle

func (n *Node) MakeHandle() base.INodeHandle

func (*Node) Size

func (n *Node) Size() uint64

func (*Node) TryClose added in v0.6.0

func (n *Node) TryClose() (closed bool)

func (*Node) Unload

func (n *Node) Unload()

Unload should be guarded by lock

func (*Node) Unloadable

func (n *Node) Unloadable() bool

Unloadable should be guarded by lock

type SimpleEvictHolder

type SimpleEvictHolder struct {
	Queue *sq.EsQueue
	sync.Mutex
}

func (*SimpleEvictHolder) Dequeue

func (holder *SimpleEvictHolder) Dequeue() *EvictNode

func (*SimpleEvictHolder) Enqueue

func (holder *SimpleEvictHolder) Enqueue(node *EvictNode)

type SimpleEvictHolderCtx

type SimpleEvictHolderCtx struct {
	QCapacity uint64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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