Documentation ¶
Index ¶
- Variables
- type Parameter
- type Service
- func (s *Service) AttestationsForBlock(ctx context.Context, blockRoot spec.Root) ([]*chaindb.Attestation, error)
- func (s *Service) AttestationsForSlotRange(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]*chaindb.Attestation, error)
- func (s *Service) AttestationsInBlock(ctx context.Context, blockRoot spec.Root) ([]*chaindb.Attestation, error)
- func (s *Service) AttesterDuties(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot, ...) ([]*chaindb.AttesterDuty, error)
- func (s *Service) BeaconCommitteeBySlotAndIndex(ctx context.Context, slot spec.Slot, index spec.CommitteeIndex) (*chaindb.BeaconCommittee, error)
- func (s *Service) BeginTx(ctx context.Context) (context.Context, context.CancelFunc, error)
- func (s *Service) BlockByRoot(ctx context.Context, root spec.Root) (*chaindb.Block, error)
- func (s *Service) BlocksByParentRoot(ctx context.Context, parentRoot spec.Root) ([]*chaindb.Block, error)
- func (s *Service) BlocksBySlot(ctx context.Context, slot spec.Slot) ([]*chaindb.Block, error)
- func (s *Service) CommitTx(ctx context.Context) error
- func (s *Service) EmptySlots(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]spec.Slot, error)
- func (s *Service) Metadata(ctx context.Context, key string) ([]byte, error)
- func (s *Service) ProposerSlashingsForSlotRange(ctx context.Context, minSlot uint64, maxSlot uint64) ([]*chaindb.ProposerSlashing, 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) ValidatorBalancesByIndexAndEpoch(ctx context.Context, validatorIndices []spec.ValidatorIndex, epoch spec.Epoch) (map[spec.ValidatorIndex]*chaindb.ValidatorBalance, error)
- func (s *Service) ValidatorBalancesByIndexAndEpochRange(ctx context.Context, validatorIndices []spec.ValidatorIndex, ...) (map[spec.ValidatorIndex][]*chaindb.ValidatorBalance, error)
- func (s *Service) ValidatorBalancesByIndexAndEpochs(ctx context.Context, validatorIndices []spec.ValidatorIndex, ...) (map[spec.ValidatorIndex][]*chaindb.ValidatorBalance, error)
- func (s *Service) Validators(ctx context.Context) ([]*chaindb.Validator, error)
- func (s *Service) ValidatorsByIndex(ctx context.Context, indices []spec.ValidatorIndex) (map[spec.ValidatorIndex]*chaindb.Validator, error)
- func (s *Service) ValidatorsByPublicKey(ctx context.Context, pubKeys []spec.BLSPubKey) (map[spec.BLSPubKey]*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) AttestationsForBlock ¶ added in v0.1.5
func (s *Service) AttestationsForBlock(ctx context.Context, blockRoot spec.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, minSlot spec.Slot, maxSlot spec.Slot) ([]*chaindb.Attestation, error)
AttestationsForSlotRange fetches all attestations made for the given slot range.
func (*Service) AttestationsInBlock ¶ added in v0.1.5
func (s *Service) AttestationsInBlock(ctx context.Context, blockRoot spec.Root) ([]*chaindb.Attestation, error)
AttestationsInBlock fetches all attestations contained in the given block.
func (*Service) AttesterDuties ¶ added in v0.1.5
func (s *Service) AttesterDuties(ctx context.Context, startSlot spec.Slot, endSlot spec.Slot, validatorIndices []spec.ValidatorIndex) ([]*chaindb.AttesterDuty, error)
AttesterDuties fetches the attester duties at the given slot range for the given validator indices.
func (*Service) BeaconCommitteeBySlotAndIndex ¶ added in v0.1.5
func (s *Service) BeaconCommitteeBySlotAndIndex(ctx context.Context, slot spec.Slot, index spec.CommitteeIndex) (*chaindb.BeaconCommittee, error)
BeaconCommitteeBySlotAndIndex fetches the beacon committee with the given slot and index.
func (*Service) BeginTx ¶
BeginTx begins a transaction on the database. The transaction can be rolled back by invoking the cancel function.
func (*Service) BlockByRoot ¶ added in v0.1.5
BlockByRoot fetches the block with the given root.
func (*Service) BlocksByParentRoot ¶ added in v0.1.5
func (s *Service) BlocksByParentRoot(ctx context.Context, parentRoot spec.Root) ([]*chaindb.Block, error)
BlocksByParentRoot fetches the blocks with the given root.
func (*Service) BlocksBySlot ¶ added in v0.1.5
BlocksBySlot fetches all blocks with the given slot.
func (*Service) EmptySlots ¶ added in v0.1.5
func (s *Service) EmptySlots(ctx context.Context, minSlot spec.Slot, maxSlot spec.Slot) ([]spec.Slot, error)
EmptySlots fetches the slots in the given range without a block in the database.
func (*Service) ProposerSlashingsForSlotRange ¶ added in v0.1.5
func (s *Service) ProposerSlashingsForSlotRange(ctx context.Context, minSlot uint64, maxSlot uint64) ([]*chaindb.ProposerSlashing, error)
ProposerSlashingsForSlotRange 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) ValidatorBalancesByIndexAndEpoch ¶ added in v0.1.5
func (s *Service) ValidatorBalancesByIndexAndEpoch( ctx context.Context, validatorIndices []spec.ValidatorIndex, epoch spec.Epoch, ) ( map[spec.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 []spec.ValidatorIndex, startEpoch spec.Epoch, endEpoch spec.Epoch, ) ( map[spec.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 []spec.ValidatorIndex, epochs []spec.Epoch, ) ( map[spec.ValidatorIndex][]*chaindb.ValidatorBalance, error, )
ValidatorBalancesByIndexAndEpochs fetches the validator balances for the given validators at the specified epochs.
func (*Service) Validators ¶ added in v0.1.4
Validators fetches the validators.
func (*Service) ValidatorsByIndex ¶ added in v0.1.5
func (s *Service) ValidatorsByIndex(ctx context.Context, indices []spec.ValidatorIndex) (map[spec.ValidatorIndex]*chaindb.Validator, error)
ValidatorsByIndex fetches all validators matching the given indices.