group

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Overview

Package group provides a method for taking an identifier and value pair, comparing them with other pairs, and then grouping identical values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeByteSliceToCRC32

func EncodeByteSliceToCRC32(byt []byte) uint32

func EncodeByteSliceToMD4

func EncodeByteSliceToMD4(byt []byte) string

func EncodeByteSliceToMD5

func EncodeByteSliceToMD5(byt []byte) string

func EncodeByteSliceToSha1

func EncodeByteSliceToSha1(byt []byte) string

func EncodeByteSliceToUint32

func EncodeByteSliceToUint32(b []byte) uint32

Only hashes first 4 bytes. Probably not useful.

func GetSortedGroupMapKeys

func GetSortedGroupMapKeys(m map[string][]string) []string

Types

type IdentifyingPair

type IdentifyingPair struct {
	Key string
	// WARN: Potentially memory intensive if returning lots of data from ssh command. Might want to consider temp files
	// if number of bytes exceeds a limit.
	Value []byte
	// contains filtered or unexported fields
}

func NewIdentifyingPair

func NewIdentifyingPair(Key string, Value []byte) *IdentifyingPair

Creates a new IdentifyingPair, using the provide Key and Value pair. This can then be added to a new ValueGrouping, or otherwise processed.

type ValueGrouping

type ValueGrouping struct {
	// Representing a byte slice as an encoded value for easy equality check. String slice of members.
	EncodedValueGroup map[string][]string
	// Preserve original byte slice
	EncodedValueToOriginal map[string][]byte

	Update chan struct{}
	// contains filtered or unexported fields
}

ValueGrouping contains value/member groupings, and should only be written to by using the AddToGroup method.

func NewValueGrouping

func NewValueGrouping() *ValueGrouping

Initialised a new ValueGrouping used to populate

func (*ValueGrouping) AddToGroup

func (v *ValueGrouping) AddToGroup(i *IdentifyingPair)

AddToGroup creates or adds to an EncodedValueGroup. If an entry already exists for the encoded value provided within IdentifyingPair, the additional members will be added. This should be considered the only function for adding groups and members to an EncodedValueGroup.

func (*ValueGrouping) GetMembers

func (v *ValueGrouping) GetMembers(hash string) ([]string, error)

func (*ValueGrouping) GetValue

func (v *ValueGrouping) GetValue(hash string) ([]byte, error)

Jump to

Keyboard shortcuts

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