base

package
v1.1.0-beta.0...-b079b5f Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NilFlag    byte = 0
	NotNilFlag byte = 1
)

NilFlag and NotNilFlag are used to indicate whether a pointer/interface type field inside struct is nil or not. like a structure:

type MyStruct struct {
	 a *OtherStruct
}

Once a is nil, we should hash the NilFlag, otherwise, we should hash the NotNilFlag nil : [0] not nil : [1] [xxx] the NotNilFlag should not be missed, otherwise, once [xxx] is []byte{0}, it will be treated as nil.

Variables

This section is empty.

Functions

This section is empty.

Types

type Equals

type Equals interface {
	// Equals checks whether two base objects are equal.
	Equals(any) bool
}

Equals is the interface for equality check. When we need to compare two objects when countering hash conflicts, we can use this interface to check whether they are equal.

type Hash64

type Hash64 interface {
	// Hash64 returns the uint64 digest of an object.
	Hash64(h Hasher)
}

Hash64 is the interface for hashcode. It is used to calculate the lossy digest of an object to return uint64 rather than compacted bytes from cascaded operators bottom-up.

type Hash64a

type Hash64a uint64

Hash64a is the type for the hash value.

type HashEquals

type HashEquals interface {
	Hash64
	Equals
}

HashEquals is the interface for hash64 and equality check.

type Hasher

type Hasher interface {
	HashBool(val bool)
	HashInt(val int)
	HashInt64(val int64)
	HashUint64(val uint64)
	HashFloat64(val float64)
	HashRune(val rune)
	HashString(val string)
	HashByte(val byte)
	HashBytes(val []byte)
	Reset()
	SetCache([]byte)
	Cache() []byte
	Sum64() uint64
}

Hasher is the interface for computing hash values of different types.

func NewHashEqualer

func NewHashEqualer() Hasher

NewHashEqualer creates a new HashEqualer.

type Scheduler

type Scheduler interface {
	// ExecuteTasks start the internal scheduling.
	ExecuteTasks() error
	// Destroy release the internal resource if any.
	Destroy()
	// PushTask is outside portal for inserting a new task in. task running can also trigger another successive task.
	PushTask(task Task)
}

Scheduler is a scheduling interface defined for serializing(single thread)/concurrent(multi thread) running.

type Stack

type Stack interface {
	Push(one Task)
	Pop() Task
	Empty() bool
	Destroy()
}

Stack is abstract definition of task container.(TaskStack is a kind of array stack implementation of it)

type Task

type Task interface {
	// Execute task self executing logic
	Execute() error
	// Desc task self description string.
	Desc(w util.StrBufferWriter)
}

Task is an interface defined for all type of optimizing work: exploring, implementing, deriving-stats, join-reordering and so on.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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