duplicateHandler

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyAlreadyExistsError = func() error { return errors.New("key for hashable already exists in the registered map") }()
)

Functions

This section is empty.

Types

type DuplicateHandler

type DuplicateHandler interface {
	CheckForDuplication(h Hashable) bool
	RegisterDuplication(h Hashable) error
	CheckAndRegisterForDuplication(h Hashable) (bool, error)
}

func New

func New() DuplicateHandler

New is the generator for the DuplicateHandler interface

type DuplicateWrapper

type DuplicateWrapper struct {

	// In memory quick search access
	HashMap map[string]Hashable
}

func (*DuplicateWrapper) CheckAndRegisterForDuplication

func (d *DuplicateWrapper) CheckAndRegisterForDuplication(h Hashable) (bool, error)

CheckAndRegisterForDuplication is a wrapper of CheckForDuplication and RegisterDuplication

func (*DuplicateWrapper) CheckForDuplication

func (d *DuplicateWrapper) CheckForDuplication(h Hashable) bool

CheckForDuplication will take a hashable and check to see if it exists in the in memory map

func (*DuplicateWrapper) RegisterDuplication

func (d *DuplicateWrapper) RegisterDuplication(h Hashable) error

RegisterDuplication will register a hashable object in the memory map

type Hashable

type Hashable interface {
	Hash() string
}

Jump to

Keyboard shortcuts

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