buffer

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

Should be guarded by lock

func (*Node) Iteration

func (n *Node) Iteration() uint64

func (*Node) Load

func (n *Node) 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()

Should be guarded by lock

func (*Node) Unloadable

func (n *Node) Unloadable() bool

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