snapshots

package
v0.0.0-...-80b2b3e Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const CyclesInAdvance = 6
View Source
const FirstCycleWithSnapshots = 7

Variables

This section is empty.

Functions

func SaveNewSnapshots

func SaveNewSnapshots(ctx context.Context, unit UnitOfWork, provider SnapshotProvider) (count int, err error)

func SaveSnapshotForCycle

func SaveSnapshotForCycle(ctx context.Context, cycle int64, unit UnitOfWork, provider SnapshotProvider, isFromFuture bool) error

Types

type BlocksRepo

type BlocksRepo interface {
	Last() (block models.Block, err error)
}

type RightsRepo

type RightsRepo interface {
	List(limit, offset uint) (count int64, snaps []models.Snapshot, err error)
	Create(right models.Snapshot) error
}

type SnapshotProvider

type SnapshotProvider interface {
	SnapshotForCycle(ctx context.Context, cycle int64, useHead bool) (snap models.Snapshot, err error)
	RollsForBlock(ctx context.Context, blockLevel int64) (roll []models.Roll, err error)
}

type UnitOfWork

type UnitOfWork interface {
	Start(ctx context.Context)
	RollbackUnlessCommitted()
	Commit() error
	GetBlock() block.Repo
	GetSnapshots() snapshots.Repo
	GetRolls() rolls.Repo
}

Jump to

Keyboard shortcuts

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