storages

package
v0.0.0-...-ee0160b Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 3 Imported by: 0

README

storages

import "github.com/altessa-s/go-atlas/data/probfilter/cuckoo/storages"

Package storages defines the Storage interface for Cuckoo filter backends. Implementations live in subpackages and are injected into the cuckoo.Filter to supply the underlying bucket array and fingerprint operations.

Key types

Type / Interface Description
Storage Interface: MightExist, Add, AddBatch, Delete, Close
StatsProvider Optional interface for backends that expose filter statistics

Subpackages

Package Description
memory In-memory Cuckoo storage
redis Redis-backed Cuckoo storage

Documentation

Overview

Package storages defines the storage interface for Cuckoo filter backends. Implementations are provided in subpackages: memory, redis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StatsProvider

type StatsProvider interface {
	// Stats returns current filter statistics.
	Stats(ctx context.Context) (*stats.FilterStats, error)
}

StatsProvider defines the interface for storage backends that provide statistics.

type Storage

type Storage interface {
	// MightExist checks if a value might exist in the filter.
	MightExist(ctx context.Context, value string) (bool, error)

	// Add inserts a value into the filter.
	// Returns error if the filter is full.
	Add(ctx context.Context, value string) error

	// AddBatch inserts multiple values into the filter.
	// Returns error if the filter becomes full.
	AddBatch(ctx context.Context, values iter.Seq[string]) error

	// Delete removes a value from the filter.
	// Returns true if the value was found and removed.
	Delete(ctx context.Context, value string) (bool, error)

	// Close releases resources associated with the storage.
	Close(ctx context.Context) error
}

Storage defines the interface for Cuckoo filter storage backends. Implementations must be safe for concurrent use.

Directories

Path Synopsis
Package memory provides an in-memory Cuckoo filter storage implementation using the seiflotfy/cuckoofilter library.
Package memory provides an in-memory Cuckoo filter storage implementation using the seiflotfy/cuckoofilter library.
Package redis provides a Redis-backed Cuckoo filter storage implementation using RedisBloom module CF.* commands.
Package redis provides a Redis-backed Cuckoo filter storage implementation using RedisBloom module CF.* commands.

Jump to

Keyboard shortcuts

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