dedup

package
v1.45.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles deduplication using two-phase locking

func NewManager

func NewManager() *Manager

NewManager creates a new deduplication manager

func (*Manager) AcquireContentLock

func (m *Manager) AcquireContentLock(sessionID string) (bool, error)

AcquireContentLock acquires a lock for content-based deduplication Uses a separate lock file with longer TTL (5s) to prevent race conditions between different hook types (Stop, Notification) with same content

func (*Manager) AcquireLock

func (m *Manager) AcquireLock(sessionID string, hookEvent ...string) (bool, error)

AcquireLock performs Phase 2 lock acquisition Returns true if lock was successfully acquired hookEvent parameter is optional - if provided, uses hook-specific lock file

func (*Manager) CheckEarlyDuplicate

func (m *Manager) CheckEarlyDuplicate(sessionID string, hookEvent ...string) bool

CheckEarlyDuplicate performs Phase 1 check for duplicates Returns true if this is a duplicate and should be skipped hookEvent parameter is optional - if provided, checks hook-specific lock file

func (*Manager) Cleanup

func (m *Manager) Cleanup(maxAge int64) error

Cleanup cleans up old lock files (older than maxAge seconds)

func (*Manager) CleanupForSession

func (m *Manager) CleanupForSession(sessionID string) error

CleanupForSession cleans up lock file for a specific session

func (*Manager) ReleaseContentLock

func (m *Manager) ReleaseContentLock(sessionID string) error

ReleaseContentLock releases the content-based deduplication lock

func (*Manager) ReleaseLock

func (m *Manager) ReleaseLock(sessionID string, hookEvent ...string) error

ReleaseLock releases a lock (optional, locks are cleaned up automatically) hookEvent parameter is optional - if provided, releases hook-specific lock file

Jump to

Keyboard shortcuts

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