Documentation ¶
Overview ¶
Package key contains a single Key interface. The key package was created to prevent cicular dependencies between "github.com/lleo/go-hamt" and either "github.com/lleo/go-hamt/hamt32" or "github.com/lleo/go-hamt/hamt64".
Additionally, the github.com/lleo/go-hamt/key provides a Base structure. The Base structure if added to a derivative key type will provide the Hamt30() and Hamt60() methods. Base needs to be populated by the derivative key constructor calling the Initialize([]byte) method.
Any key created using the Key interface must be read only after construction.
The key package is used by the functional HAMT variation in "github.com/lleo/go-hamt-functional".
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
Base struct is intended to be the base struct of all structs that satisfy Key interface. It caches the calculated hash30 and hash60 generated when the method Initialize([]byte) is called.
func (*Base) Initialize ¶
Initialize the Base part of any struct that has the Base struct embedded. will be called by the New() function of any descendant class.
k.Initialize(bs)
where k is interpreted as a *Base and bs is a unique []byte to calculate the 30bit hash from.
type Key ¶
type Key interface { String() string // ISA/statisfies fmt.Stringer interface Equals(Key) bool Hash30() uint32 Hash60() uint64 }
Key interface descibes the methods any struct needs to implement to be used in either the github.com/lleo/go-hamt or github.com/lleo/go-hamt-functional packages.