system

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT, Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInstrumentedSystemStore added in v1.1.0

func NewInstrumentedSystemStore(chainID tableland.ChainID, store sqlstore.SystemStore) (sqlstore.SystemStore, error)

NewInstrumentedSystemStore creates a new db pool and instantiate both the user and system stores.

Types

type InstrumentedSystemStore added in v1.1.0

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

InstrumentedSystemStore implements a instrumented SQLStore.

func (*InstrumentedSystemStore) AreEVMEventsPersisted added in v1.1.0

func (s *InstrumentedSystemStore) AreEVMEventsPersisted(ctx context.Context, txnHash common.Hash) (bool, error)

AreEVMEventsPersisted implements sqlstore.SystemStore.

func (*InstrumentedSystemStore) Begin added in v1.1.0

func (s *InstrumentedSystemStore) Begin(ctx context.Context) (*sql.Tx, error)

Begin returns a new tx.

func (*InstrumentedSystemStore) Close added in v1.1.0

func (s *InstrumentedSystemStore) Close() error

Close closes the connection pool.

func (*InstrumentedSystemStore) DeletePendingTxByHash added in v1.1.0

func (s *InstrumentedSystemStore) DeletePendingTxByHash(ctx context.Context, hash common.Hash) error

DeletePendingTxByHash deletes a pending tx.

func (*InstrumentedSystemStore) GetACLOnTableByController added in v1.1.0

func (s *InstrumentedSystemStore) GetACLOnTableByController(
	ctx context.Context,
	table tables.TableID,
	address string,
) (sqlstore.SystemACL, error)

GetACLOnTableByController increments the counter.

func (*InstrumentedSystemStore) GetBlockExtraInfo added in v1.1.0

func (s *InstrumentedSystemStore) GetBlockExtraInfo(
	ctx context.Context,
	blockNumber int64,
) (tableland.EVMBlockInfo, error)

GetBlockExtraInfo implements sqlstore.SystemStore.

func (*InstrumentedSystemStore) GetBlocksMissingExtraInfo added in v1.1.0

func (s *InstrumentedSystemStore) GetBlocksMissingExtraInfo(
	ctx context.Context,
	fromHeight *int64,
) ([]int64, error)

GetBlocksMissingExtraInfo implements sqlstore.SystemStore.

func (*InstrumentedSystemStore) GetEVMEvents added in v1.1.0

func (s *InstrumentedSystemStore) GetEVMEvents(ctx context.Context, txnHash common.Hash) ([]tableland.EVMEvent, error)

GetEVMEvents implements sqlstore.SystemStore.

func (*InstrumentedSystemStore) GetID added in v1.1.0

GetID returns node identifier.

func (*InstrumentedSystemStore) GetReceipt added in v1.1.0

func (s *InstrumentedSystemStore) GetReceipt(
	ctx context.Context,
	txnHash string,
) (eventprocessor.Receipt, bool, error)

GetReceipt returns the receipt of a processed event by txn hash.

func (*InstrumentedSystemStore) GetSchemaByTableName added in v1.1.0

func (s *InstrumentedSystemStore) GetSchemaByTableName(ctx context.Context, name string) (sqlstore.TableSchema, error)

GetSchemaByTableName get the schema of a table by its name.

func (*InstrumentedSystemStore) GetTable added in v1.1.0

GetTable fetchs a table from its UUID.

func (*InstrumentedSystemStore) GetTablesByController added in v1.1.0

func (s *InstrumentedSystemStore) GetTablesByController(
	ctx context.Context,
	controller string,
) ([]sqlstore.Table, error)

GetTablesByController fetchs a table from controller address.

func (*InstrumentedSystemStore) GetTablesByStructure added in v1.1.0

func (s *InstrumentedSystemStore) GetTablesByStructure(
	ctx context.Context,
	structure string,
) ([]sqlstore.Table, error)

GetTablesByStructure gets all tables with a particular structure hash.

func (*InstrumentedSystemStore) InsertBlockExtraInfo added in v1.1.0

func (s *InstrumentedSystemStore) InsertBlockExtraInfo(ctx context.Context, blockNumber int64, timestamp uint64) error

InsertBlockExtraInfo implements sqlstore.SystemStore.

func (*InstrumentedSystemStore) InsertPendingTx added in v1.1.0

func (s *InstrumentedSystemStore) InsertPendingTx(
	ctx context.Context,
	addr common.Address,
	nonce int64,
	hash common.Hash,
) error

InsertPendingTx insert a new pending tx.

func (*InstrumentedSystemStore) ListPendingTx added in v1.1.0

func (s *InstrumentedSystemStore) ListPendingTx(
	ctx context.Context,
	addr common.Address,
) ([]nonce.PendingTx, error)

ListPendingTx lists all pendings txs.

func (*InstrumentedSystemStore) Read added in v1.1.0

Read executes a read statement on the db.

func (*InstrumentedSystemStore) ReplacePendingTxByHash added in v1.1.0

func (s *InstrumentedSystemStore) ReplacePendingTxByHash(
	ctx context.Context,
	oldHash common.Hash,
	newHash common.Hash,
) error

ReplacePendingTxByHash replaces a pending txn hash and bumps the counter on how many times this happened.

func (*InstrumentedSystemStore) SaveEVMEvents added in v1.1.0

func (s *InstrumentedSystemStore) SaveEVMEvents(ctx context.Context, events []tableland.EVMEvent) error

SaveEVMEvents implements sqlstore.SystemStore.

func (*InstrumentedSystemStore) SetReadResolver added in v1.1.0

func (s *InstrumentedSystemStore) SetReadResolver(resolver sqlparser.ReadStatementResolver)

SetReadResolver sets the resolver for read queries.

func (*InstrumentedSystemStore) WithTx added in v1.1.0

WithTx returns a copy of the current InstrumentedSQLStore with a tx attached.

type SystemStore

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

SystemStore provides a persistent layer for storage requests. The methods implemented by this layer can be executed inside a given transaction or not. For safety reasons, this layer has no access to the database object or the transaction object. The access is made through the dbWithTx interface.

func New

func New(dbURI string, chainID tableland.ChainID) (*SystemStore, error)

New returns a new SystemStore backed by database/sql.

func (*SystemStore) AreEVMEventsPersisted

func (s *SystemStore) AreEVMEventsPersisted(ctx context.Context, txnHash common.Hash) (bool, error)

AreEVMEventsPersisted returns true if there're events persisted for the provided txn hash, and false otherwise.

func (*SystemStore) Begin

func (s *SystemStore) Begin(_ context.Context) (*sql.Tx, error)

Begin returns a new tx.

func (*SystemStore) Close

func (s *SystemStore) Close() error

Close closes the store.

func (*SystemStore) DeletePendingTxByHash

func (s *SystemStore) DeletePendingTxByHash(ctx context.Context, hash common.Hash) error

DeletePendingTxByHash deletes a pending tx.

func (*SystemStore) GetACLOnTableByController

func (s *SystemStore) GetACLOnTableByController(
	ctx context.Context,
	id tables.TableID,
	controller string,
) (sqlstore.SystemACL, error)

GetACLOnTableByController returns the privileges on table stored in the database for a given controller.

func (*SystemStore) GetBlockExtraInfo

func (s *SystemStore) GetBlockExtraInfo(ctx context.Context, blockNumber int64) (tableland.EVMBlockInfo, error)

GetBlockExtraInfo info returns stored information about an EVM block.

func (*SystemStore) GetBlocksMissingExtraInfo

func (s *SystemStore) GetBlocksMissingExtraInfo(ctx context.Context, lastKnownHeight *int64) ([]int64, error)

GetBlocksMissingExtraInfo returns a list of block numbers that don't contain enhanced information. It receives an optional fromHeight to only look for blocks after a block number. If null it will look for blocks at any height.

func (*SystemStore) GetEVMEvents

func (s *SystemStore) GetEVMEvents(ctx context.Context, txnHash common.Hash) ([]tableland.EVMEvent, error)

GetEVMEvents returns all the persisted events for a transaction.

func (*SystemStore) GetID

func (s *SystemStore) GetID(ctx context.Context) (string, error)

GetID returns node identifier.

func (*SystemStore) GetReceipt

func (s *SystemStore) GetReceipt(
	ctx context.Context,
	txnHash string,
) (eventprocessor.Receipt, bool, error)

GetReceipt returns a event receipt by transaction hash.

func (*SystemStore) GetSchemaByTableName

func (s *SystemStore) GetSchemaByTableName(ctx context.Context, name string) (sqlstore.TableSchema, error)

GetSchemaByTableName get the schema of a table by its name.

func (*SystemStore) GetTable

func (s *SystemStore) GetTable(ctx context.Context, id tables.TableID) (sqlstore.Table, error)

GetTable fetchs a table from its UUID.

func (*SystemStore) GetTablesByController

func (s *SystemStore) GetTablesByController(ctx context.Context, controller string) ([]sqlstore.Table, error)

GetTablesByController fetchs a table from controller address.

func (*SystemStore) GetTablesByStructure

func (s *SystemStore) GetTablesByStructure(ctx context.Context, structure string) ([]sqlstore.Table, error)

GetTablesByStructure gets all tables with a particular structure hash.

func (*SystemStore) InsertBlockExtraInfo

func (s *SystemStore) InsertBlockExtraInfo(ctx context.Context, blockNumber int64, timestamp uint64) error

InsertBlockExtraInfo inserts enhanced information for a block.

func (*SystemStore) InsertPendingTx

func (s *SystemStore) InsertPendingTx(
	ctx context.Context,
	addr common.Address,
	nonce int64, hash common.Hash,
) error

InsertPendingTx insert a new pending tx.

func (*SystemStore) ListPendingTx

func (s *SystemStore) ListPendingTx(ctx context.Context, addr common.Address) ([]nonce.PendingTx, error)

ListPendingTx lists all pendings txs.

func (*SystemStore) Read added in v1.1.0

Read executes a read statement on the db.

func (*SystemStore) ReplacePendingTxByHash

func (s *SystemStore) ReplacePendingTxByHash(ctx context.Context, oldHash common.Hash, newHash common.Hash) error

ReplacePendingTxByHash replaces the txn hash of a pending txn and bumps the counter of how many times this happened.

func (*SystemStore) SaveEVMEvents

func (s *SystemStore) SaveEVMEvents(ctx context.Context, events []tableland.EVMEvent) error

SaveEVMEvents saves the provider EVMEvents.

func (*SystemStore) SetReadResolver added in v1.1.0

func (s *SystemStore) SetReadResolver(resolver sqlparser.ReadStatementResolver)

SetReadResolver sets the resolver for read queries.

func (*SystemStore) WithTx

func (s *SystemStore) WithTx(tx *sql.Tx) sqlstore.SystemStore

WithTx returns a copy of the current SystemStore with a tx attached.

Directories

Path Synopsis
internal
db
Package migrations generated by go-bindata.// sources: migrations/001_init.down.sql migrations/001_init.up.sql migrations/002_receipterroridx.down.sql migrations/002_receipterroridx.up.sql migrations/003_evm_events.down.sql migrations/003_evm_events.up.sql migrations/004_system_id.down.sql migrations/004_system_id.up.sql
Package migrations generated by go-bindata.// sources: migrations/001_init.down.sql migrations/001_init.up.sql migrations/002_receipterroridx.down.sql migrations/002_receipterroridx.up.sql migrations/003_evm_events.down.sql migrations/003_evm_events.up.sql migrations/004_system_id.down.sql migrations/004_system_id.up.sql

Jump to

Keyboard shortcuts

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