Documentation ¶
Index ¶
- Variables
- type Parameter
- type Service
- func (s *Service) BeginTx(ctx context.Context) (context.Context, context.CancelFunc, error)
- func (s *Service) CommitTx(ctx context.Context) error
- func (s *Service) GetAttestationsForBlock(ctx context.Context, blockRoot []byte) ([]*chaindb.Attestation, error)
- func (s *Service) GetAttestationsForSlotRange(ctx context.Context, minSlot uint64, maxSlot uint64) ([]*chaindb.Attestation, error)
- func (s *Service) GetAttestationsInBlock(ctx context.Context, blockRoot []byte) ([]*chaindb.Attestation, error)
- func (s *Service) GetAttesterDuties(ctx context.Context, startSlot uint64, endSlot uint64, ...) ([]*chaindb.AttesterDuty, error)
- func (s *Service) GetBeaconCommitteeBySlotAndIndex(ctx context.Context, slot uint64, index uint64) (*chaindb.BeaconCommittee, error)
- func (s *Service) GetBlockByRoot(ctx context.Context, root []byte) (*chaindb.Block, error)
- func (s *Service) GetBlocksByParentRoot(ctx context.Context, parentRoot []byte) ([]*chaindb.Block, error)
- func (s *Service) GetBlocksBySlot(ctx context.Context, slot uint64) ([]*chaindb.Block, error)
- func (s *Service) GetEmptySlots(ctx context.Context, minSlot uint64, maxSlot uint64) ([]uint64, error)
- func (s *Service) GetProposerSlashingsForSlotRange(ctx context.Context, minSlot uint64, maxSlot uint64) ([]*chaindb.ProposerSlashing, error)
- func (s *Service) Metadata(ctx context.Context, key string) ([]byte, error)
- func (s *Service) SetAttestation(ctx context.Context, attestation *chaindb.Attestation) error
- func (s *Service) SetAttesterSlashing(ctx context.Context, attesterSlashing *chaindb.AttesterSlashing) error
- func (s *Service) SetBeaconCommittee(ctx context.Context, beaconCommittee *chaindb.BeaconCommittee) error
- func (s *Service) SetBlock(ctx context.Context, block *chaindb.Block) error
- func (s *Service) SetMetadata(ctx context.Context, key string, value []byte) error
- func (s *Service) SetProposerDuty(ctx context.Context, proposerDuty *chaindb.ProposerDuty) error
- func (s *Service) SetProposerSlashing(ctx context.Context, proposerSlashing *chaindb.ProposerSlashing) error
- func (s *Service) SetValidator(ctx context.Context, validator *chaindb.Validator) error
- func (s *Service) SetValidatorBalance(ctx context.Context, balance *chaindb.ValidatorBalance) error
- func (s *Service) SetVoluntaryExit(ctx context.Context, voluntaryExit *chaindb.VoluntaryExit) error
- func (s *Service) ValidatorBalancesByValidatorsAndEpoch(ctx context.Context, validators []*chaindb.Validator, epoch spec.Epoch) (map[spec.ValidatorIndex]*chaindb.ValidatorBalance, error)
- func (s *Service) Validators(ctx context.Context) ([]*chaindb.Validator, error)
- type Tx
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoTransaction is returned when an attempt to carry out a mutation to the database // is not inside a transaction. ErrNoTransaction = errors.New("no transaction for action") )
Functions ¶
This section is empty.
Types ¶
type Parameter ¶
type Parameter interface {
// contains filtered or unexported methods
}
Parameter is the interface for service parameters.
func WithConnectionURL ¶
WithConnectionURL sets the connection URL for this module.
func WithLogLevel ¶
WithLogLevel sets the log level for the module.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a chain database service.
func (*Service) BeginTx ¶
BeginTx begins a transaction on the database. The transaction can be rolled back by invoking the cancel function.
func (*Service) GetAttestationsForBlock ¶ added in v0.1.3
func (s *Service) GetAttestationsForBlock(ctx context.Context, blockRoot []byte) ([]*chaindb.Attestation, error)
GetAttestationsForBlock fetches all attestations made for the given block.
func (*Service) GetAttestationsForSlotRange ¶ added in v0.1.3
func (s *Service) GetAttestationsForSlotRange(ctx context.Context, minSlot uint64, maxSlot uint64) ([]*chaindb.Attestation, error)
GetAttestationsForSlotRange fetches all attestations made for the given slot range.
func (*Service) GetAttestationsInBlock ¶ added in v0.1.3
func (s *Service) GetAttestationsInBlock(ctx context.Context, blockRoot []byte) ([]*chaindb.Attestation, error)
GetAttestationsInBlock fetches all attestations contained in the given block.
func (*Service) GetAttesterDuties ¶ added in v0.1.3
func (s *Service) GetAttesterDuties(ctx context.Context, startSlot uint64, endSlot uint64, validatorIndices []uint64) ([]*chaindb.AttesterDuty, error)
GetAttesterDuties fetches the attester duties at the given slot range for the given validator indices.
func (*Service) GetBeaconCommitteeBySlotAndIndex ¶ added in v0.1.3
func (s *Service) GetBeaconCommitteeBySlotAndIndex(ctx context.Context, slot uint64, index uint64) (*chaindb.BeaconCommittee, error)
GetBeaconCommitteeBySlotAndIndex fetches the beacon committee with the given slot and index.
func (*Service) GetBlockByRoot ¶ added in v0.1.3
GetBlockByRoot fetches the block with the given root.
func (*Service) GetBlocksByParentRoot ¶ added in v0.1.3
func (s *Service) GetBlocksByParentRoot(ctx context.Context, parentRoot []byte) ([]*chaindb.Block, error)
GetBlocksByParentRoot fetches the blocks with the given root.
func (*Service) GetBlocksBySlot ¶ added in v0.1.3
GetBlocksBySlot fetches all blocks with the given slot.
func (*Service) GetEmptySlots ¶ added in v0.1.3
func (s *Service) GetEmptySlots(ctx context.Context, minSlot uint64, maxSlot uint64) ([]uint64, error)
GetEmptySlots fetches the slots in the given range without a block in the database.
func (*Service) GetProposerSlashingsForSlotRange ¶ added in v0.1.3
func (s *Service) GetProposerSlashingsForSlotRange(ctx context.Context, minSlot uint64, maxSlot uint64) ([]*chaindb.ProposerSlashing, error)
GetProposerSlashingsForSlotRange fetches all proposer slashings made for the given slot range.
func (*Service) SetAttestation ¶
SetAttestation sets an attestation.
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) SetMetadata ¶
SetMetadata sets a metadata key to a JSON value.
func (*Service) SetProposerDuty ¶
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) SetValidator ¶
SetValidator sets a validator.
func (*Service) SetValidatorBalance ¶
SetValidatorBalance sets a validator's balance.
func (*Service) SetVoluntaryExit ¶
SetVoluntaryExit sets a voluntary exit.
func (*Service) ValidatorBalancesByValidatorsAndEpoch ¶ added in v0.1.4
func (s *Service) ValidatorBalancesByValidatorsAndEpoch(ctx context.Context, validators []*chaindb.Validator, epoch spec.Epoch) (map[spec.ValidatorIndex]*chaindb.ValidatorBalance, error)
ValidatorBalancesByValidatorsAndEpoch fetches the validator balances for the given validators and epoch.