buffer

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 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

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

func NewNode

func NewNode(impl base.INode, mgr base.INodeManager, id common.ID, 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) GetID

func (n *Node) GetID() common.ID

func (*Node) GetState

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

GetState should be guarded by lock

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) 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) 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