postgresql

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 34 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoTransaction = errors.New("no transaction for action")

ErrNoTransaction is returned when an attempt to carry out a mutation to the database is not inside a transaction.

Functions

This section is empty.

Types

type Parameter

type Parameter interface {
	// contains filtered or unexported methods
}

Parameter is the interface for service parameters.

func WithCACert added in v0.4.1

func WithCACert(cert []byte) Parameter

WithCACert sets the bytes of the certificate authority TLS certificate.

func WithClientCert added in v0.4.1

func WithClientCert(cert []byte) Parameter

WithClientCert sets the bytes of the client TLS certificate.

func WithClientKey added in v0.4.1

func WithClientKey(key []byte) Parameter

WithClientKey sets the bytes of the client TLS key.

func WithConnectionURL

func WithConnectionURL(connectionURL string) Parameter

WithConnectionURL sets the connection URL for this module. Deprecated. Use the individual Server/User/Port/... functions.

func WithLogLevel

func WithLogLevel(logLevel zerolog.Level) Parameter

WithLogLevel sets the log level for the module.

func WithMaxConnections added in v0.6.11

func WithMaxConnections(maxConnections uint) Parameter

WithMaxConnections sets the maximum number of connections for the database pool.

func WithPartitioned added in v0.8.3

func WithPartitioned(partitioned bool) Parameter

WithPartitioned is true if the database uses partitioned tables.

func WithPassword added in v0.4.1

func WithPassword(password string) Parameter

WithPassword sets the password for this module.

func WithPort added in v0.4.1

func WithPort(port int32) Parameter

WithPort sets the port for this module.

func WithServer added in v0.4.1

func WithServer(server string) Parameter

WithServer sets the server for this module.

func WithUser added in v0.4.1

func WithUser(user string) Parameter

WithUser sets the user for this module.

type Service

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

Service is a chain database service.

func New

func New(ctx context.Context, params ...Parameter) (*Service, error)

New creates a new service.

func (*Service) AggregateValidatorBalancesByIndexAndEpoch added in v0.2.0

func (s *Service) AggregateValidatorBalancesByIndexAndEpoch(
	ctx context.Context,
	validatorIndices []phase0.ValidatorIndex,
	epoch phase0.Epoch,
) (
	*chaindb.AggregateValidatorBalance,
	error,
)

AggregateValidatorBalancesByIndexAndEpoch fetches the aggregate validator balances for the given validators and epoch.

func (*Service) AggregateValidatorBalancesByIndexAndEpochRange added in v0.2.0

func (s *Service) AggregateValidatorBalancesByIndexAndEpochRange(
	ctx context.Context,
	validatorIndices []phase0.ValidatorIndex,
	startEpoch phase0.Epoch,
	endEpoch phase0.Epoch,
) (
	[]*chaindb.AggregateValidatorBalance,
	error,
)

AggregateValidatorBalancesByIndexAndEpochRange fetches the aggregate validator balances for the given validators and epoch range. Ranges are inclusive of start and exclusive of end i.e. a request with startEpoch 2 and endEpoch 4 will provide balances for epochs 2 and 3.

func (*Service) AggregateValidatorBalancesByIndexAndEpochs added in v0.2.0

func (s *Service) AggregateValidatorBalancesByIndexAndEpochs(
	ctx context.Context,
	validatorIndices []phase0.ValidatorIndex,
	epochs []phase0.Epoch,
) (
	[]*chaindb.AggregateValidatorBalance,
	error,
)

AggregateValidatorBalancesByIndexAndEpochs fetches the validator balances for the given validators at the specified epochs.

func (*Service) Attestations added in v0.7.7

func (s *Service) Attestations(ctx context.Context, filter *chaindb.AttestationFilter) ([]*chaindb.Attestation, error)

Attestations provides attestations according to the filter.

func (*Service) AttestationsForBlock added in v0.1.5

func (s *Service) AttestationsForBlock(ctx context.Context, blockRoot phase0.Root) ([]*chaindb.Attestation, error)

AttestationsForBlock fetches all attestations made for the given block.

func (*Service) AttestationsForSlotRange added in v0.1.5

func (s *Service) AttestationsForSlotRange(ctx context.Context, startSlot phase0.Slot, endSlot phase0.Slot) ([]*chaindb.Attestation, error)

AttestationsForSlotRange fetches all attestations made for the given slot range. Ranges are inclusive of start and exclusive of end i.e. a request with startSlot 2 and endSlot 4 will provide attestations for slots 2 and 3.

func (*Service) AttestationsInBlock added in v0.1.5

func (s *Service) AttestationsInBlock(ctx context.Context, blockRoot phase0.Root) ([]*chaindb.Attestation, error)

AttestationsInBlock fetches all attestations contained in the given block.

func (*Service) AttestationsInSlotRange added in v0.2.0

func (s *Service) AttestationsInSlotRange(ctx context.Context, startSlot phase0.Slot, endSlot phase0.Slot) ([]*chaindb.Attestation, error)

AttestationsInSlotRange fetches all attestations made in the given slot range. Ranges are inclusive of start and exclusive of end i.e. a request with startSlot 2 and endSlot 4 will provide attestations in slots 2 and 3.

func (*Service) AttesterDuties added in v0.1.5

func (s *Service) AttesterDuties(ctx context.Context, startSlot phase0.Slot, endSlot phase0.Slot, validatorIndices []phase0.ValidatorIndex) ([]*chaindb.AttesterDuty, error)

AttesterDuties fetches the attester duties at the given slot range for the given validator indices.

func (*Service) AttesterSlashingsForSlotRange added in v0.3.0

func (s *Service) AttesterSlashingsForSlotRange(ctx context.Context, minSlot phase0.Slot, maxSlot phase0.Slot) ([]*chaindb.AttesterSlashing, error)

AttesterSlashingsForSlotRange fetches all attester slashings made for the given slot range. It will return slashings from blocks that are canonical or undefined, but not from non-canonical blocks.

func (*Service) AttesterSlashingsForValidator added in v0.3.0

func (s *Service) AttesterSlashingsForValidator(ctx context.Context, index phase0.ValidatorIndex) ([]*chaindb.AttesterSlashing, error)

AttesterSlashingsForValidator fetches all attester slashings made for the given validator. It will return slashings from blocks that are canonical or undefined, but not from non-canonical blocks.

func (*Service) BLSToExecutionChanges added in v0.7.0

func (s *Service) BLSToExecutionChanges(ctx context.Context, filter *chaindb.BLSToExecutionChangeFilter) ([]*chaindb.BLSToExecutionChange, error)

BLSToExecutionChanges provides withdrawals according to the filter.

func (*Service) BeaconCommitteeBySlotAndIndex added in v0.1.5

func (s *Service) BeaconCommitteeBySlotAndIndex(ctx context.Context, slot phase0.Slot, index phase0.CommitteeIndex) (*chaindb.BeaconCommittee, error)

BeaconCommitteeBySlotAndIndex fetches the beacon committee with the given slot and index.

func (*Service) BeaconCommittees added in v0.7.0

func (s *Service) BeaconCommittees(ctx context.Context,
	filter *chaindb.BeaconCommitteeFilter,
) (
	[]*chaindb.BeaconCommittee,
	error,
)

BeaconCommittees fetches the beacon committees matching the filter.

func (*Service) BeginROTx added in v0.6.17

func (s *Service) BeginROTx(ctx context.Context) (context.Context, error)

BeginROTx begins a read-only transaction on the database. The transaction should be committed.

func (*Service) BeginTx

BeginTx begins a transaction on the database. The transaction can be rolled back by invoking the cancel function.

func (*Service) BlobSidecars added in v0.8.0

func (s *Service) BlobSidecars(ctx context.Context,
	filter *chaindb.BlobSidecarFilter,
) (
	[]*chaindb.BlobSidecar,
	error,
)

BlobSidecars provides blob sidecars according to the filter.

func (*Service) BlockByRoot added in v0.1.5

func (s *Service) BlockByRoot(ctx context.Context, root phase0.Root) (*chaindb.Block, error)

BlockByRoot fetches the block with the given root.

func (*Service) BlockSummaries added in v0.7.5

func (s *Service) BlockSummaries(ctx context.Context, filter *chaindb.BlockSummaryFilter) ([]*chaindb.BlockSummary, error)

BlockSummaries provides summaries according to the filter.

func (*Service) BlockSummaryForSlot added in v0.5.3

func (s *Service) BlockSummaryForSlot(ctx context.Context, slot phase0.Slot) (*chaindb.BlockSummary, error)

BlockSummaryForSlot obtains the summary of a block for a given slot.

func (*Service) Blocks added in v0.7.3

func (s *Service) Blocks(ctx context.Context, filter *chaindb.BlockFilter) ([]*chaindb.Block, error)

Blocks provides blocks according to the filter.

func (*Service) BlocksByParentRoot added in v0.1.5

func (s *Service) BlocksByParentRoot(ctx context.Context, parentRoot phase0.Root) ([]*chaindb.Block, error)

BlocksByParentRoot fetches the blocks with the given root.

func (*Service) BlocksBySlot added in v0.1.5

func (s *Service) BlocksBySlot(ctx context.Context, slot phase0.Slot) ([]*chaindb.Block, error)

BlocksBySlot fetches all blocks with the given slot.

func (*Service) BlocksForSlotRange added in v0.3.0

func (s *Service) BlocksForSlotRange(ctx context.Context, startSlot phase0.Slot, endSlot phase0.Slot) ([]*chaindb.Block, error)

BlocksForSlotRange fetches all blocks with the given slot range. Ranges are inclusive of start and exclusive of end i.e. a request with startSlot 2 and endSlot 4 will provide blocks duties for slots 2 and 3.

func (*Service) CanonicalBlockPresenceForSlotRange added in v0.3.0

func (s *Service) CanonicalBlockPresenceForSlotRange(ctx context.Context, startSlot phase0.Slot, endSlot phase0.Slot) ([]bool, error)

CanonicalBlockPresenceForSlotRange returns a boolean for each slot in the range for the presence of a canonical block. Ranges are inclusive of start and exclusive of end i.e. a request with startSlot 2 and endSlot 4 will provide presence duties for slots 2 and 3.

func (*Service) ChainSpec added in v0.2.0

func (s *Service) ChainSpec(ctx context.Context) (map[string]any, error)

ChainSpec fetches all chain specification values.

func (*Service) ChainSpecValue added in v0.2.0

func (s *Service) ChainSpecValue(ctx context.Context, key string) (any, error)

ChainSpecValue fetches a chain specification value given its key.

func (*Service) CommitROTx added in v0.6.17

func (s *Service) CommitROTx(ctx context.Context)

CommitROTx commits a read-only transaction on the ops datastore.

func (*Service) CommitTx

func (s *Service) CommitTx(ctx context.Context) error

CommitTx commits a transaction on the ops datastore.

func (*Service) DepositsByPublicKey added in v0.2.0

func (s *Service) DepositsByPublicKey(ctx context.Context, pubKeys []phase0.BLSPubKey) (map[phase0.BLSPubKey][]*chaindb.Deposit, error)

DepositsByPublicKey fetches deposits for a given set of validator public keys.

func (*Service) DepositsForSlotRange added in v0.3.0

func (s *Service) DepositsForSlotRange(ctx context.Context, minSlot phase0.Slot, maxSlot phase0.Slot) ([]*chaindb.Deposit, error)

DepositsForSlotRange fetches all deposits made in the given slot range. It will return deposits from blocks that are canonical or undefined, but not from non-canonical blocks.

func (*Service) ETH1DepositsByPublicKey added in v0.2.0

func (s *Service) ETH1DepositsByPublicKey(ctx context.Context, pubKeys []phase0.BLSPubKey) ([]*chaindb.ETH1Deposit, error)

ETH1DepositsByPublicKey fetches Ethereum 1 deposits for a given set of validator public keys.

func (*Service) EmptySlots added in v0.1.5

func (s *Service) EmptySlots(ctx context.Context, minSlot phase0.Slot, maxSlot phase0.Slot) ([]phase0.Slot, error)

EmptySlots fetches the slots in the given range without a block in the database.

func (*Service) EpochSummaries added in v0.7.5

func (s *Service) EpochSummaries(ctx context.Context, filter *chaindb.EpochSummaryFilter) ([]*chaindb.EpochSummary, error)

EpochSummaries provides summaries according to the filter.

func (*Service) ForkSchedule added in v0.4.0

func (s *Service) ForkSchedule(ctx context.Context, _ *api.ForkScheduleOpts) (*api.Response[[]*phase0.Fork], error)

ForkSchedule provides details of past and future changes in the chain's fork version.

func (*Service) Genesis added in v0.2.0

func (s *Service) Genesis(ctx context.Context,
	_ *api.GenesisOpts,
) (
	*api.Response[*apiv1.Genesis],
	error,
)

Genesis fetches genesis values.

func (*Service) GenesisTime added in v0.2.0

func (s *Service) GenesisTime(ctx context.Context) (time.Time, error)

GenesisTime provides the genesis time of the chain.

func (*Service) IndeterminateAttestationSlots added in v0.2.0

func (s *Service) IndeterminateAttestationSlots(ctx context.Context, minSlot phase0.Slot, maxSlot phase0.Slot) ([]phase0.Slot, error)

IndeterminateAttestationSlots fetches the slots in the given range with attestations that do not have a canonical status.

func (*Service) IndeterminateBlocks added in v0.2.0

func (s *Service) IndeterminateBlocks(ctx context.Context, minSlot phase0.Slot, maxSlot phase0.Slot) ([]phase0.Root, error)

IndeterminateBlocks fetches the blocks in the given range that do not have a canonical status.

func (*Service) Init added in v0.2.0

func (s *Service) Init(ctx context.Context) error

Init initialises the database.

func (*Service) LatestBlocks added in v0.2.0

func (s *Service) LatestBlocks(ctx context.Context) ([]*chaindb.Block, error)

LatestBlocks fetches the blocks with the highest slot number for in the database.

func (*Service) LatestCanonicalBlock added in v0.3.0

func (s *Service) LatestCanonicalBlock(ctx context.Context) (phase0.Slot, error)

LatestCanonicalBlock returns the slot of the latest canonical block known in the database.

func (*Service) Metadata added in v0.1.4

func (s *Service) Metadata(ctx context.Context, key string) ([]byte, error)

Metadata obtains the JSON value from a metadata key.

func (*Service) ProposalCount added in v0.3.4

func (s *Service) ProposalCount(ctx context.Context, validatorIndices []phase0.ValidatorIndex, startSlot phase0.Slot, endSlot phase0.Slot) (uint64, error)

ProposalCount provides the number of proposals for the given validators. Ranges are inclusive of start and exclusive of end i.e. a request with startSlot 2 and endSlot 4 will provide blocks duties for slots 2 and 3.

func (*Service) ProposerDutiesForSlotRange added in v0.3.0

func (s *Service) ProposerDutiesForSlotRange(ctx context.Context,
	startSlot phase0.Slot,
	endSlot phase0.Slot,
) (
	[]*chaindb.ProposerDuty,
	error,
)

ProposerDutiesForSlotRange fetches all proposer duties for a slot range.

func (*Service) ProposerDutiesForValidator added in v0.5.2

func (s *Service) ProposerDutiesForValidator(ctx context.Context, proposer phase0.ValidatorIndex) ([]*chaindb.ProposerDuty, error)

ProposerDutiesForValidator provides all proposer duties for the given validator index.

func (*Service) ProposerSlashingsForSlotRange added in v0.1.5

func (s *Service) ProposerSlashingsForSlotRange(ctx context.Context, minSlot phase0.Slot, maxSlot phase0.Slot) ([]*chaindb.ProposerSlashing, error)

ProposerSlashingsForSlotRange fetches all proposer slashings made for the given slot range. It will return slashings from blocks that are canonical or undefined, but not from non-canonical blocks.

func (*Service) ProposerSlashingsForValidator added in v0.3.0

func (s *Service) ProposerSlashingsForValidator(ctx context.Context, index phase0.ValidatorIndex) ([]*chaindb.ProposerSlashing, error)

ProposerSlashingsForValidator fetches all proposer slashings made for the given validator. It will return slashings from blocks that are canonical or undefined, but not from non-canonical blocks.

func (*Service) PruneValidatorBalances added in v0.7.0

func (s *Service) PruneValidatorBalances(ctx context.Context, to phase0.Epoch, retain []phase0.BLSPubKey) error

PruneValidatorBalances prunes validator balances up to (but not including) the given epoch.

func (*Service) PruneValidatorEpochSummaries added in v0.7.0

func (s *Service) PruneValidatorEpochSummaries(ctx context.Context, to phase0.Epoch, retain []phase0.BLSPubKey) error

PruneValidatorEpochSummaries prunes validator epoch summaries up to (but not including) the given point.

func (*Service) SetAttestation

func (s *Service) SetAttestation(ctx context.Context, attestation *chaindb.Attestation) error

SetAttestation sets an attestation.

func (*Service) SetAttestations added in v0.7.0

func (s *Service) SetAttestations(ctx context.Context, attestations []*chaindb.Attestation) error

SetAttestations sets multiple attestations.

func (*Service) SetAttesterSlashing

func (s *Service) SetAttesterSlashing(ctx context.Context, attesterSlashing *chaindb.AttesterSlashing) error

SetAttesterSlashing sets an attester slashing.

func (*Service) SetBeaconCommittee

func (s *Service) SetBeaconCommittee(ctx context.Context, beaconCommittee *chaindb.BeaconCommittee) error

SetBeaconCommittee sets a beacon committee.

func (*Service) SetBlobSidecar added in v0.8.0

func (s *Service) SetBlobSidecar(ctx context.Context, blobSidecar *chaindb.BlobSidecar) error

SetBlobSidecar sets a blob sidecar.

func (*Service) SetBlobSidecars added in v0.8.0

func (s *Service) SetBlobSidecars(ctx context.Context, blobSidecars []*chaindb.BlobSidecar) error

SetBlobSidecars sets blob sidecars.

func (*Service) SetBlock

func (s *Service) SetBlock(ctx context.Context, block *chaindb.Block) error

SetBlock sets a block.

func (*Service) SetBlockSummary added in v0.3.0

func (s *Service) SetBlockSummary(ctx context.Context, summary *chaindb.BlockSummary) error

SetBlockSummary sets a block summary.

func (*Service) SetChainSpecValue added in v0.2.0

func (s *Service) SetChainSpecValue(ctx context.Context, key string, value any) error

SetChainSpecValue sets the value of the provided key.

func (*Service) SetDeposit added in v0.2.0

func (s *Service) SetDeposit(ctx context.Context, deposit *chaindb.Deposit) error

SetDeposit sets a deposit.

func (*Service) SetETH1Deposit added in v0.2.0

func (s *Service) SetETH1Deposit(ctx context.Context, deposit *chaindb.ETH1Deposit) error

SetETH1Deposit sets an Ethereum 1 deposit.

func (*Service) SetEpochSummary added in v0.3.0

func (s *Service) SetEpochSummary(ctx context.Context, summary *chaindb.EpochSummary) error

SetEpochSummary sets an epoch summary.

func (*Service) SetForkSchedule added in v0.4.0

func (s *Service) SetForkSchedule(ctx context.Context, schedule []*phase0.Fork) error

SetForkSchedule sets the fork schedule. This carries out a complete rewrite of the table.

func (*Service) SetGenesis added in v0.2.0

func (s *Service) SetGenesis(ctx context.Context, genesis *apiv1.Genesis) error

SetGenesis sets the genesis information.

func (*Service) SetMetadata

func (s *Service) SetMetadata(ctx context.Context, key string, value []byte) error

SetMetadata sets a metadata key to a JSON value.

func (*Service) SetProposerDuty

func (s *Service) SetProposerDuty(ctx context.Context, proposerDuty *chaindb.ProposerDuty) error

SetProposerDuty sets a proposer duty.

func (*Service) SetProposerSlashing

func (s *Service) SetProposerSlashing(ctx context.Context, proposerSlashing *chaindb.ProposerSlashing) error

SetProposerSlashing sets a proposer slashing.

func (*Service) SetSyncAggregate added in v0.4.0

func (s *Service) SetSyncAggregate(ctx context.Context, syncAggregate *chaindb.SyncAggregate) error

SetSyncAggregate sets the sync aggregate.

func (*Service) SetSyncCommittee added in v0.4.0

func (s *Service) SetSyncCommittee(ctx context.Context, syncCommittee *chaindb.SyncCommittee) error

SetSyncCommittee sets a sync committee.

func (*Service) SetValidator

func (s *Service) SetValidator(ctx context.Context, validator *chaindb.Validator) error

SetValidator sets a validator.

func (*Service) SetValidatorBalance

func (s *Service) SetValidatorBalance(ctx context.Context, balance *chaindb.ValidatorBalance) error

SetValidatorBalance sets a validator's balance.

func (*Service) SetValidatorBalances added in v0.5.0

func (s *Service) SetValidatorBalances(ctx context.Context, balances []*chaindb.ValidatorBalance) error

SetValidatorBalances sets multiple validator balances.

func (*Service) SetValidatorDaySummaries added in v0.7.0

func (s *Service) SetValidatorDaySummaries(ctx context.Context, summaries []*chaindb.ValidatorDaySummary) error

SetValidatorDaySummaries sets multiple validator day summaries.

func (*Service) SetValidatorDaySummary added in v0.7.0

func (s *Service) SetValidatorDaySummary(ctx context.Context, summary *chaindb.ValidatorDaySummary) error

SetValidatorDaySummary sets a validator day summary.

func (*Service) SetValidatorEpochSummaries added in v0.5.0

func (s *Service) SetValidatorEpochSummaries(ctx context.Context, summaries []*chaindb.ValidatorEpochSummary) error

SetValidatorEpochSummaries sets multiple validator epoch summaries.

func (*Service) SetValidatorEpochSummary added in v0.3.0

func (s *Service) SetValidatorEpochSummary(ctx context.Context, summary *chaindb.ValidatorEpochSummary) error

SetValidatorEpochSummary sets a validator epoch summary.

func (*Service) SetVoluntaryExit

func (s *Service) SetVoluntaryExit(ctx context.Context, voluntaryExit *chaindb.VoluntaryExit) error

SetVoluntaryExit sets a voluntary exit.

func (*Service) Spec added in v0.2.0

func (s *Service) Spec(ctx context.Context,
	_ *api.SpecOpts,
) (
	*api.Response[map[string]any],
	error,
)

Spec provides the spec information of the chain.

func (*Service) SyncAggregates added in v0.7.0

func (s *Service) SyncAggregates(ctx context.Context, filter *chaindb.SyncAggregateFilter) ([]*chaindb.SyncAggregate, error)

SyncAggregates provides sync aggregates according to the filter.

func (*Service) SyncCommittee added in v0.4.0

func (s *Service) SyncCommittee(ctx context.Context, period uint64) (*chaindb.SyncCommittee, error)

SyncCommittee provides a sync committee for the given sync committee period.

func (*Service) Upgrade added in v0.2.0

func (s *Service) Upgrade(ctx context.Context) (bool, error)

Upgrade upgrades the database. Returns true if the upgrade requires blocks to be refetched.

func (*Service) ValidatorBalancesByEpoch added in v0.6.11

func (s *Service) ValidatorBalancesByEpoch(
	ctx context.Context,
	epoch phase0.Epoch,
) (
	[]*chaindb.ValidatorBalance,
	error,
)

ValidatorBalancesByEpoch fetches the validator balances for the given epoch.

func (*Service) ValidatorBalancesByIndexAndEpoch added in v0.1.5

func (s *Service) ValidatorBalancesByIndexAndEpoch(
	ctx context.Context,
	validatorIndices []phase0.ValidatorIndex,
	epoch phase0.Epoch,
) (
	map[phase0.ValidatorIndex]*chaindb.ValidatorBalance,
	error,
)

ValidatorBalancesByIndexAndEpoch fetches the validator balances for the given validators and epoch.

func (*Service) ValidatorBalancesByIndexAndEpochRange added in v0.1.5

func (s *Service) ValidatorBalancesByIndexAndEpochRange(
	ctx context.Context,
	validatorIndices []phase0.ValidatorIndex,
	startEpoch phase0.Epoch,
	endEpoch phase0.Epoch,
) (
	map[phase0.ValidatorIndex][]*chaindb.ValidatorBalance,
	error,
)

ValidatorBalancesByIndexAndEpochRange fetches the validator balances for the given validators and epoch range. Ranges are inclusive of start and exclusive of end i.e. a request with startEpoch 2 and endEpoch 4 will provide balances for epochs 2 and 3.

func (*Service) ValidatorBalancesByIndexAndEpochs added in v0.1.5

func (s *Service) ValidatorBalancesByIndexAndEpochs(
	ctx context.Context,
	validatorIndices []phase0.ValidatorIndex,
	epochs []phase0.Epoch,
) (
	map[phase0.ValidatorIndex][]*chaindb.ValidatorBalance,
	error,
)

ValidatorBalancesByIndexAndEpochs fetches the validator balances for the given validators at the specified epochs.

func (*Service) ValidatorDaySummaries added in v0.7.0

func (s *Service) ValidatorDaySummaries(ctx context.Context, filter *chaindb.ValidatorDaySummaryFilter) ([]*chaindb.ValidatorDaySummary, error)

ValidatorDaySummaries provides validator day summaries according to the filter.

func (*Service) ValidatorSummaries added in v0.5.3

func (s *Service) ValidatorSummaries(ctx context.Context, filter *chaindb.ValidatorSummaryFilter) ([]*chaindb.ValidatorEpochSummary, error)

ValidatorSummaries provides summaries according to the filter.

func (*Service) ValidatorSummariesForEpoch added in v0.5.2

func (s *Service) ValidatorSummariesForEpoch(ctx context.Context, epoch phase0.Epoch) ([]*chaindb.ValidatorEpochSummary, error)

ValidatorSummariesForEpoch obtains all summaries for a given epoch.

func (*Service) ValidatorSummaryForEpoch added in v0.5.2

func (s *Service) ValidatorSummaryForEpoch(ctx context.Context,
	index phase0.ValidatorIndex,
	epoch phase0.Epoch,
) (
	*chaindb.ValidatorEpochSummary,
	error,
)

ValidatorSummaryForEpoch obtains the summary of a validator for a given epoch.

func (*Service) Validators added in v0.1.4

func (s *Service) Validators(ctx context.Context) ([]*chaindb.Validator, error)

Validators fetches all validators.

func (*Service) ValidatorsByIndex added in v0.1.5

func (s *Service) ValidatorsByIndex(ctx context.Context, indices []phase0.ValidatorIndex) (map[phase0.ValidatorIndex]*chaindb.Validator, error)

ValidatorsByIndex fetches all validators matching the given indices.

func (*Service) ValidatorsByPublicKey added in v0.1.5

func (s *Service) ValidatorsByPublicKey(ctx context.Context, pubKeys []phase0.BLSPubKey) (map[phase0.BLSPubKey]*chaindb.Validator, error)

ValidatorsByPublicKey fetches all validators matching the given public keys. This is a common starting point for external entities to query specific validators, as they should always have the public key at a minimum, hence the return map keyed by public key.

func (*Service) ValidatorsByWithdrawalCredential added in v0.7.1

func (s *Service) ValidatorsByWithdrawalCredential(ctx context.Context, withdrawalCredentials []byte) ([]*chaindb.Validator, error)

ValidatorsByWithdrawalCredential fetches all validators with the given withdrawal credential.

func (*Service) Withdrawals added in v0.7.0

func (s *Service) Withdrawals(ctx context.Context, filter *chaindb.WithdrawalFilter) ([]*chaindb.Withdrawal, error)

Withdrawals provides withdrawals according to the filter.

type Tx

type Tx struct{}

Tx is a context tag for the database transaction.

type TxID added in v0.6.11

type TxID struct{}

TxID is a context tag for the transaction TxID.

Jump to

Keyboard shortcuts

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