checkpoint

package
v1.6.8 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaVersion = "https://spacemesh.io/checkpoint.schema.json.1.0"

	CommandString = "grpcurl -plaintext -d '%s' 0.0.0.0:9093 spacemesh.v1.AdminService.CheckpointStream"
)

Variables

View Source
var (
	ErrCheckpointNotFound    = errors.New("checkpoint not found")
	ErrUrlSchemeNotSupported = errors.New("url scheme not supported")
)
View Source
var Schema string

Functions

func CopyFile

func CopyFile(fs afero.Fs, src, dst string) error

func Generate

func Generate(
	ctx context.Context,
	fs afero.Fs,
	db *sql.Database,
	dataDir string,
	snapshot types.LayerID,
	numAtxs int,
) error

func RecoveryDir

func RecoveryDir(dataDir string) string

func RecoveryFilename

func RecoveryFilename(dataDir, base string, restore types.LayerID) string

func SelfCheckpointFilename

func SelfCheckpointFilename(dataDir string, snapshot types.LayerID) string

func ValidateSchema

func ValidateSchema(data []byte) error

Types

type AtxDep added in v1.5.0

type AtxDep struct {
	ID           types.ATXID
	PublishEpoch types.EpochID
	Blob         []byte
}

type Config

type Config struct {
	Uri     string `mapstructure:"recovery-uri"`
	Restore uint32 `mapstructure:"recovery-layer"`

	// set to false if atxs are not compatible before and after the checkpoint recovery.
	PreserveOwnAtx bool `mapstructure:"preserve-own-atx"`
}

func DefaultConfig

func DefaultConfig() Config

type PreservedData

type PreservedData struct {
	Deps   []*AtxDep
	Proofs []*types.PoetProofMessage
}

func Recover

func Recover(
	ctx context.Context,
	logger *zap.Logger,
	fs afero.Fs,
	cfg *RecoverConfig,
) (*PreservedData, error)

func RecoverFromLocalFile added in v1.6.1

func RecoverFromLocalFile(
	ctx context.Context,
	logger *zap.Logger,
	db *sql.Database,
	localDB *localsql.Database,
	fs afero.Fs,
	cfg *RecoverConfig,
	file string,
) (*PreservedData, error)

func RecoverWithDb

func RecoverWithDb(
	ctx context.Context,
	logger *zap.Logger,
	db *sql.Database,
	localDB *localsql.Database,
	fs afero.Fs,
	cfg *RecoverConfig,
) (*PreservedData, error)

type RecoverConfig

type RecoverConfig struct {
	GoldenAtx   types.ATXID
	DataDir     string
	DbFile      string
	LocalDbFile string
	NodeIDs     []types.NodeID // IDs to preserve own ATXs
	Uri         string
	Restore     types.LayerID
}

func (*RecoverConfig) DbPath added in v1.6.1

func (c *RecoverConfig) DbPath() string

type RecoveryFile

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

func NewRecoveryFile

func NewRecoveryFile(aferoFs afero.Fs, path string) (*RecoveryFile, error)

func (*RecoveryFile) Copy

func (rf *RecoveryFile) Copy(fs afero.Fs, src io.Reader) error

func (*RecoveryFile) Save

func (rf *RecoveryFile) Save(fs afero.Fs) error

Jump to

Keyboard shortcuts

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