sharding

package
v1.3.7-yckms.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

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

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

func TreeID(entryID string) (int64, error)

func ValidateEntryID

func ValidateEntryID(id string) error

func ValidateTreeID

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

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

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

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

func (*LogRanges) ActiveTreeID

func (l *LogRanges) ActiveTreeID() int64

func (*LogRanges) AllShards

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

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

func (*LogRanges) AppendInactive

func (l *LogRanges) AppendInactive(r LogRange)

func (*LogRanges) GetActive

func (l *LogRanges) GetActive() int64

func (*LogRanges) GetInactive

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

func (*LogRanges) NoInactive

func (l *LogRanges) NoInactive() bool

func (*LogRanges) PublicKey

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

func (l *LogRanges) SetActive(i int64)

func (*LogRanges) SetInactive

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

func (*LogRanges) String

func (l *LogRanges) String() string

func (*LogRanges) TotalInactiveLength

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

type Ranges []LogRange

Jump to

Keyboard shortcuts

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