tmsqlite

package module
v0.0.0-...-7b5c878 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 15 Imported by: 1

README

tmsqlite

tmsqlite provides an SQLite-backed storage layer for Gordian's tmstore package.

This module defaults to using github.com/mattn/go-sqlite3/ for a CGo-backed SQLite driver. If CGo is unavailable, it falls back to the modernc.org/sqlite driver, which is a pure Go implementation of SQLite.

If CGo is available and you still prefer to run the pure Go driver, use the purego build tag, e.g. go test -tags=purego ./....

Project status

tmsqlite passes the tmstore compliance tests and it runs with gcosmos, but until there is a tagged release, you should assume that the database schema may change in a backwards-incompatible way.

License

The tmsqlite source code is available under the Apache 2.0 license.

Copyright (c) 2024 Strangelove Crypto, Inc.

Documentation

Overview

Package tmsqlite contains an SQLite implementation of the github.com/gordian-engine/gordian/tm/tmstore interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// The string "purego" or "cgo" depending on build tags.
	BuildType string
	// contains filtered or unexported fields
}

Store is a single type satisfying all the tmstore interfaces.

func NewInMemStore

func NewInMemStore(
	ctx context.Context,
	hashScheme tmconsensus.HashScheme,
	reg *gcrypto.Registry,
) (*Store, error)

func NewOnDiskStore

func NewOnDiskStore(
	ctx context.Context,
	dbPath string,
	hashScheme tmconsensus.HashScheme,
	reg *gcrypto.Registry,
) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) LoadActions

func (s *Store) LoadActions(ctx context.Context, height uint64, round uint32) (tmstore.RoundActions, error)

func (*Store) LoadCommittedHeader

func (s *Store) LoadCommittedHeader(ctx context.Context, height uint64) (tmconsensus.CommittedHeader, error)

func (*Store) LoadFinalizationByHeight

func (s *Store) LoadFinalizationByHeight(ctx context.Context, height uint64) (
	round uint32,
	blockHash string,
	valSet tmconsensus.ValidatorSet,
	appStateHash string,
	err error,
)

func (*Store) LoadPubKeys

func (s *Store) LoadPubKeys(ctx context.Context, hash string) ([]gcrypto.PubKey, error)

func (*Store) LoadRoundState

func (s *Store) LoadRoundState(ctx context.Context, height uint64, round uint32) (
	phs []tmconsensus.ProposedHeader,
	prevotes, precommits tmconsensus.SparseSignatureCollection,
	err error,
)

func (*Store) LoadValidators

func (s *Store) LoadValidators(ctx context.Context, keyHash, powHash string) ([]tmconsensus.Validator, error)

func (*Store) LoadVotePowers

func (s *Store) LoadVotePowers(ctx context.Context, hash string) ([]uint64, error)

func (*Store) NetworkHeightRound

func (s *Store) NetworkHeightRound(ctx context.Context) (
	votingHeight uint64, votingRound uint32,
	committingHeight uint64, committingRound uint32,
	err error,
)

func (*Store) OverwriteRoundPrecommitProofs

func (s *Store) OverwriteRoundPrecommitProofs(
	ctx context.Context,
	height uint64,
	round uint32,
	proofs tmconsensus.SparseSignatureCollection,
) error

func (*Store) OverwriteRoundPrevoteProofs

func (s *Store) OverwriteRoundPrevoteProofs(
	ctx context.Context,
	height uint64,
	round uint32,
	proofs tmconsensus.SparseSignatureCollection,
) error

func (*Store) SaveCommittedHeader

func (s *Store) SaveCommittedHeader(ctx context.Context, ch tmconsensus.CommittedHeader) error

func (*Store) SaveFinalization

func (s *Store) SaveFinalization(
	ctx context.Context,
	height uint64, round uint32,
	blockHash string,
	valSet tmconsensus.ValidatorSet,
	appStateHash string,
) error

func (*Store) SavePrecommitAction

func (s *Store) SavePrecommitAction(
	ctx context.Context,
	pubKey gcrypto.PubKey,
	vt tmconsensus.VoteTarget,
	sig []byte,
) error

func (*Store) SavePrevoteAction

func (s *Store) SavePrevoteAction(
	ctx context.Context,
	pubKey gcrypto.PubKey,
	vt tmconsensus.VoteTarget,
	sig []byte,
) error

func (*Store) SaveProposedHeaderAction

func (s *Store) SaveProposedHeaderAction(ctx context.Context, ph tmconsensus.ProposedHeader) error

func (*Store) SavePubKeys

func (s *Store) SavePubKeys(ctx context.Context, keys []gcrypto.PubKey) (string, error)

func (*Store) SaveRoundProposedHeader

func (s *Store) SaveRoundProposedHeader(ctx context.Context, ph tmconsensus.ProposedHeader) error

func (*Store) SaveRoundReplayedHeader

func (s *Store) SaveRoundReplayedHeader(ctx context.Context, h tmconsensus.Header) error

func (*Store) SaveVotePowers

func (s *Store) SaveVotePowers(ctx context.Context, powers []uint64) (string, error)

func (*Store) SetNetworkHeightRound

func (s *Store) SetNetworkHeightRound(
	ctx context.Context,
	votingHeight uint64, votingRound uint32,
	committingHeight uint64, committingRound uint32,
) error

func (*Store) SetStateMachineHeightRound

func (s *Store) SetStateMachineHeightRound(
	ctx context.Context,
	height uint64, round uint32,
) error

func (*Store) StateMachineHeightRound

func (s *Store) StateMachineHeightRound(ctx context.Context) (
	height uint64, round uint32,
	err error,
)

Jump to

Keyboard shortcuts

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