dedup

package
v0.0.0-...-10e72c1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package dedup limits the number of duplicate entries a personality allows in a Tessera log.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateFromLog

UpdateFromLog synchronises a local best effort deduplication storage with a log.

Types

type BEDedupStorage

type BEDedupStorage interface {
	Add(ctx context.Context, lidxs []LeafDedupInfo) error
	Get(ctx context.Context, leafID []byte) (SCTDedupInfo, bool, error)
}

type LeafDedupInfo

type LeafDedupInfo struct {
	LeafID []byte
	SCTDedupInfo
}

LeafDedupInfo enables building deduplicated add-pre-chain/add-chain responses.

func DedupFromBundle

func DedupFromBundle(bundle []byte, bundleIdx uint64) ([]LeafDedupInfo, error)

DedupFromBundle converts a bundle into an array of LeafDedupInfo.

The index of a leaf is computed from its position in the log, instead of parsing SCTs. Greatly inspired by https://github.com/FiloSottile/sunlight/blob/main/tile.go TODO(phboneff): move this somewhere else, and only leave crypto in this file

type LocalBEDedupStorage

type LocalBEDedupStorage interface {
	Add(ctx context.Context, lidxs []LeafDedupInfo) error
	Get(ctx context.Context, leafID []byte) (SCTDedupInfo, bool, error)
	LogSize() (uint64, error)
}

TODO: re-architecture to prevent creating a LocaLBEDedupStorage without calling UpdateFromLog

type ParseBundleFunc

type ParseBundleFunc func([]byte, uint64) ([]LeafDedupInfo, error)

type SCTDedupInfo

type SCTDedupInfo struct {
	Idx       uint64
	Timestamp uint64
}

SCTDedupInfo contains data to build idempotent SCTs.

Jump to

Keyboard shortcuts

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