Help us shape the future of Go! Take the 2026 Go Developer Survey

heap

package
v0.57.21 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Heap

type Heap interface {
	// IsEmpty checks if the heap is empty.
	IsEmpty(ctx context.Context) (bool, error)
	// Size returns the number of elements in the heap.
	Size(ctx context.Context) (uint64, error)
	// Min returns the minimum element and priority in the heap.
	Min(ctx context.Context) ([]byte, float64, error)
	// DequeueMin removes and returns the lowest element.
	DequeueMin(ctx context.Context) (rmin []byte, pmin float64, rerr error)
	// DecreaseKey decreases the priority of the given element.
	// Note: returns error if not found or if priority is higher than given.
	DecreaseKey(ctx context.Context, key []byte, newPriority float64) (rerr error)
	// Enqueue enqueues the key with the given priority.
	//
	// If exists, updates the priority to the new value.
	Enqueue(ctx context.Context, key []byte, priority float64) error
	// Lookup checks priority of the given key.
	// Returns 0, false, nil if not found.
	Lookup(ctx context.Context, key []byte) (float64, bool, error)
	// Flush deletes all elements in the heap.
	Flush(ctx context.Context) error
	// Delete deletes an element from the heap.
	// No error is returned if not found.
	Delete(ctx context.Context, key []byte) (rerr error)
}

Heap implements a kvtx-backed heap.

Jump to

Keyboard shortcuts

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