checkpoint

package
v1.3.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 27 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 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   []*types.VerifiedActivationTx
	Proofs []*types.PoetProofMessage
}

func Recover

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

func RecoverWithDb

func RecoverWithDb(
	ctx context.Context,
	logger log.Log,
	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
	PreserveOwnAtx bool
	NodeID         types.NodeID
	Uri            string
	Restore        types.LayerID
}

type RecoveryFile

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

func NewRecoveryFile

func NewRecoveryFile(fs 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