watermark

package
v0.0.0-...-2bf11dd Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamoWatermark

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

DynamoWatermark stores the last-signed level in memory

func (*DynamoWatermark) IsSafeToSign

func (mw *DynamoWatermark) IsSafeToSign(keyHash string, chainID string, opMagicByte uint8, level *big.Int) bool

IsSafeToSign returns true if the provided (key, chainID, opMagicByte) tuple has not yet been signed at this or greater levels

type FileWatermark

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

FileWatermark stores the last-signed level in local files

func GetFileWatermark

func GetFileWatermark(file string) *FileWatermark

GetFileWatermark returns a new file watermark manager

func (*FileWatermark) IsSafeToSign

func (wm *FileWatermark) IsSafeToSign(keyHash string, chainID string, opType uint8, level *big.Int) bool

IsSafeToSign returns true if the provided (key, chainID, opType) tuple has not yet been signed at this or greater levels

type IgnoreWatermark

type IgnoreWatermark struct{}

IgnoreWatermark always retruns true

func (*IgnoreWatermark) IsSafeToSign

func (mw *IgnoreWatermark) IsSafeToSign(keyHash string, chainID string, opType uint8, level *big.Int) bool

IsSafeToSign is always true when we're ignoring the watermark

type SessionWatermark

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

SessionWatermark stores the last-signed level in memory

func GetSessionWatermark

func GetSessionWatermark() *SessionWatermark

GetSessionWatermark returns a new in-memory watermark manager

func (*SessionWatermark) IsSafeToSign

func (mw *SessionWatermark) IsSafeToSign(keyHash string, chainID string, opType uint8, level *big.Int) bool

IsSafeToSign returns true if the provided (key, chainID, opType) tuple has not yet been signed at this or greater levels

type Watermark

type Watermark interface {
	// IsSafeToSign returns true if the provided (key, chainID, opType) tuple has
	// not yet been signed at this or greater levels
	IsSafeToSign(keyHash string, chainID string, opMagicByte uint8, level *big.Int) bool
}

Watermark stores the last (key, level, chainID) tuple that has been signed and fails if you attempt to sign the same or lesser level for that tuple

func GetDynamoWatermark

func GetDynamoWatermark(table string) Watermark

GetDynamoWatermark returns a new dynamo watermark manager

func GetIgnoreWatermark

func GetIgnoreWatermark() Watermark

GetIgnoreWatermark that will always return true

Jump to

Keyboard shortcuts

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