sharding

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const EntryIDHexStringLen = TreeIDHexStringLen + UUIDHexStringLen
View Source
const TreeIDHexStringLen = 16
View Source
const UUIDHexStringLen = 64

Variables

View Source
var ErrPlainUUID = errors.New("cannot get treeID from plain UUID")

Functions

func GetTreeIDFromIDString added in v0.6.0

func GetTreeIDFromIDString(id string) (string, error)

GetTreeIDFromIDString Returns TreeID (with no appended UUID) from a TreeID or EntryID string. Validates TreeID and also UUID if present.

func GetUUIDFromIDString

func GetUUIDFromIDString(id string) (string, error)

GetUUIDFromIDString Returns UUID (with no prepended TreeID) from a UUID or EntryID string. Validates UUID and also TreeID if present.

func PadToTreeIDLen

func PadToTreeIDLen(t string) (string, error)

func TreeID added in v0.8.0

func TreeID(entryID string) (int64, error)

func ValidateEntryID added in v0.6.0

func ValidateEntryID(id string) error

func ValidateTreeID added in v0.6.0

func ValidateTreeID(t string) error

ValidateTreeID This is permissive in that if passed an EntryID, it will find the TreeID and validate it.

func ValidateUUID added in v0.6.0

func ValidateUUID(u string) error

ValidateUUID This is permissive in that if passed an EntryID, it will find the UUID and validate it.

func VirtualLogIndex added in v0.6.0

func VirtualLogIndex(leafIndex int64, tid int64, ranges LogRanges) int64

VirtualLogIndex returns the virtual log index for a given leaf index

Types

type EntryID

type EntryID struct {
	TreeID string
	UUID   string
}

func CreateEntryIDFromParts

func CreateEntryIDFromParts(treeid string, uuid string) (EntryID, error)

CreateEntryIDFromParts This function can take a TreeID of equal or lesser length than TreeIDHexStringLen. In case the TreeID length is less than TreeIDHexStringLen, it will be padded to the correct length.

func (EntryID) ReturnEntryIDString

func (e EntryID) ReturnEntryIDString() string

type LogRange

type LogRange struct {
	TreeID           int64  `json:"treeID" yaml:"treeID"`
	TreeLength       int64  `json:"treeLength" yaml:"treeLength"`
	EncodedPublicKey string `json:"encodedPublicKey" yaml:"encodedPublicKey"`
	// contains filtered or unexported fields
}

type LogRanges

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

func NewLogRanges added in v0.6.0

func NewLogRanges(ctx context.Context, logClient trillian.TrillianLogClient, path string, treeID uint) (LogRanges, error)

func (*LogRanges) ActiveTreeID added in v0.6.0

func (l *LogRanges) ActiveTreeID() int64

func (*LogRanges) AllShards added in v0.12.2

func (l *LogRanges) AllShards() []int64

AllShards returns all shards, starting with the active shard and then the inactive shards

func (*LogRanges) AppendInactive added in v0.6.0

func (l *LogRanges) AppendInactive(r LogRange)

func (*LogRanges) GetActive added in v0.6.0

func (l *LogRanges) GetActive() int64

func (*LogRanges) GetInactive added in v0.6.0

func (l *LogRanges) GetInactive() []LogRange

func (*LogRanges) NoInactive added in v0.6.0

func (l *LogRanges) NoInactive() bool

func (*LogRanges) PublicKey added in v0.6.0

func (l *LogRanges) PublicKey(activePublicKey, treeID string) (string, error)

PublicKey returns the associated public key for the given Tree ID and returns the active public key by default

func (*LogRanges) ResolveVirtualIndex

func (l *LogRanges) ResolveVirtualIndex(index int) (int64, int64)

func (*LogRanges) SetActive added in v0.6.0

func (l *LogRanges) SetActive(i int64)

func (*LogRanges) SetInactive added in v0.6.0

func (l *LogRanges) SetInactive(r []LogRange)

func (*LogRanges) String added in v0.6.0

func (l *LogRanges) String() string

func (*LogRanges) TotalInactiveLength added in v0.6.0

func (l *LogRanges) TotalInactiveLength() int64

TotalInactiveLength returns the total length across all inactive shards; we don't know the length of the active shard.

type Ranges added in v0.6.0

type Ranges []LogRange

Jump to

Keyboard shortcuts

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