lsh

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const SetDedup = "lsh_dedup"

SetDedup is the query-helper group for LSH dedup storage. The server scopes this group by request namespace when computing client-visible bucket IDs.

View Source
const SetVector = "lsh_vector"

SetVector is the set name for LSH vector storage.

Variables

This section is empty.

Functions

func DeleteDedup

func DeleteDedup(ctx context.Context, c deleteClient, req DedupRequest, src queries.Source) error

DeleteDedup removes the LSH dedup bucket entry for the given reference value. The server stores dedup data under the namespace with the reference value as key.

func DeleteVector

func DeleteVector(ctx context.Context, c deleteClient, req VectorRequest, src queries.Source) error

DeleteVector removes the LSH vector bucket entry for the given attribute vector.

Types

type DedupRequest

type DedupRequest struct {
	Namespace string        // FrogoDB namespace and server dedup scope for SetDedup
	Reference string        // source key for reference value (e.g., "standard.email")
	TTL       time.Duration // REQUIRED. Expiration for LSH bucket entries.
}

DedupRequest describes an LSH string deduplication query.

func (DedupRequest) Validate

func (r DedupRequest) Validate() error

Validate checks that required fields are set.

type DedupResult

type DedupResult struct {
	BucketID string // client-visible lowercase hex LSH dedup bucket identifier
}

DedupResult holds the outcome of an LSH deduplication query.

func Dedup

func Dedup(ctx context.Context, c dedupClient, req DedupRequest, src queries.Source) (DedupResult, error)

Dedup performs an LSH string deduplication query. It extracts the reference value from the source, sends it to the FrogoDB LSH dedup service, and returns the bucket ID.

Flow:

  1. value = src.String(req.Reference)
  2. Send OpLSHDedup to FrogoDB with group lsh_dedup and value
  3. Server computes bucket ID from req.Namespace and value
  4. Return DedupResult{BucketID: bucketID}

type VectorRequest

type VectorRequest struct {
	Namespace  string        // FrogoDB namespace for vector LSH index
	Attributes []string      // ordered source keys for vector components
	TTL        time.Duration // REQUIRED. Expiration for vector LSH bucket entries.
}

VectorRequest describes an LSH vector query for behavioural clustering.

func (VectorRequest) Validate

func (r VectorRequest) Validate() error

Validate checks that required fields are set.

type VectorResult

type VectorResult struct {
	BehavioralID string // LSH bucket identifier for this behavior vector
}

VectorResult holds the outcome of an LSH vector query.

func Vector

func Vector(ctx context.Context, c vectorClient, req VectorRequest, src queries.Source) (VectorResult, error)

Vector performs an LSH vector query. It extracts ordered attribute floats from the source, forms a vector, sends it to the FrogoDB LSH vector service, and returns the behavioural ID.

Flow:

  1. vec[i] = src.Float(req.Attributes[i]) for each attribute
  2. Send OpLSHVector to FrogoDB with vector bytes
  3. Server computes vector LSH -> behavioral_id
  4. Return VectorResult{BehavioralID: id}

Jump to

Keyboard shortcuts

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