broker

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgErrJSONMarshalFail   = "json marshal fail: %w"
	MsgErrCreateProducer    = "can't create producer connection to broker: %w "
	MsgErrCreateAdminClient = "can't create admin client connection to broker: %w"
	MsgErrCreateTopics      = "can't create topics in broker: %w"
	MsgErrProduceTopic      = "can't produce topic: %w"
	MsgErrCreatePartitions  = "can't create partitions in broker: %w"
)

Variables

This section is empty.

Functions

func WithValidatorCache

func WithValidatorCache(valCache cache[string, int64]) func(b *Broker)

func WithValidatorCommissionCache

func WithValidatorCommissionCache(valCommissionCache cache[string, int64]) func(b *Broker)

func WithValidatorDescriptionCache

func WithValidatorDescriptionCache(valDescriptionCache cache[string, int64]) func(b *Broker)

func WithValidatorInfoCache

func WithValidatorInfoCache(valInfoCache cache[string, int64]) func(b *Broker)

func WithValidatorStatusCache

func WithValidatorStatusCache(valStatusCache cache[string, int64]) func(b *Broker)

Types

type Broker

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

func New

func New(cfg Config, modules []string, l zerolog.Logger, opts ...opt) *Broker

func (*Broker) PublishAccount

func (b *Broker) PublishAccount(ctx context.Context, account model.Account) error

func (*Broker) PublishAccountBalance

func (b *Broker) PublishAccountBalance(ctx context.Context, ab model.AccountBalance) error

func (*Broker) PublishAcknowledgementMessage added in v0.2.1

func (b *Broker) PublishAcknowledgementMessage(ctx context.Context, msg model.AcknowledgementMessage) error

func (*Broker) PublishAnnualProvision

func (b *Broker) PublishAnnualProvision(ctx context.Context, ap model.AnnualProvision) error

func (*Broker) PublishAuthzGrant

func (b *Broker) PublishAuthzGrant(ctx context.Context, grant model.AuthzGrant) error

func (*Broker) PublishBandwidthParams added in v1.0.0

func (b *Broker) PublishBandwidthParams(ctx context.Context, msg model.BandwidthParams) error

func (*Broker) PublishBlock

func (b *Broker) PublishBlock(ctx context.Context, block model.Block) error

func (*Broker) PublishCancelUnbondingDelegationMessage

func (b *Broker) PublishCancelUnbondingDelegationMessage(_ context.Context, d model.CancelUnbondingDelegationMessage) error

func (*Broker) PublishCommunityPool

func (b *Broker) PublishCommunityPool(ctx context.Context, cp model.CommunityPool) error

func (*Broker) PublishCreateRouteMessage added in v1.0.0

func (b *Broker) PublishCreateRouteMessage(ctx context.Context, msg model.CreateRouteMessage) error

func (*Broker) PublishCreateValidatorMessage

func (b *Broker) PublishCreateValidatorMessage(_ context.Context, cvm model.CreateValidatorMessage) error
func (b *Broker) PublishCyberlink(ctx context.Context, msg model.Cyberlink) error

func (*Broker) PublishCyberlinkMessage added in v1.0.0

func (b *Broker) PublishCyberlinkMessage(ctx context.Context, msg model.CyberlinkMessage) error

func (*Broker) PublishDMNParams added in v1.0.0

func (b *Broker) PublishDMNParams(ctx context.Context, msg model.DMNParams) error

func (*Broker) PublishDelegation

func (b *Broker) PublishDelegation(ctx context.Context, d model.Delegation) error

func (*Broker) PublishDelegationMessage

func (b *Broker) PublishDelegationMessage(ctx context.Context, dm model.DelegationMessage) error

func (*Broker) PublishDelegationReward

func (b *Broker) PublishDelegationReward(ctx context.Context, dr model.DelegationReward) error

func (*Broker) PublishDelegationRewardMessage

func (b *Broker) PublishDelegationRewardMessage(ctx context.Context, drm model.DelegationRewardMessage) error

func (*Broker) PublishDeleteRouteMessage added in v1.0.0

func (b *Broker) PublishDeleteRouteMessage(ctx context.Context, msg model.DeleteRouteMessage) error

func (*Broker) PublishDenomTrace added in v0.2.2

func (b *Broker) PublishDenomTrace(ctx context.Context, dt model.DenomTrace) error

func (*Broker) PublishDisabledDelegation added in v0.3.2

func (b *Broker) PublishDisabledDelegation(ctx context.Context, d model.Delegation) error

func (*Broker) PublishDistributionCommission

func (b *Broker) PublishDistributionCommission(_ context.Context, commission model.DistributionCommission) error

func (*Broker) PublishDistributionParams

func (b *Broker) PublishDistributionParams(ctx context.Context, dp model.DistributionParams) error

func (*Broker) PublishDistributionReward

func (b *Broker) PublishDistributionReward(_ context.Context, reward model.DistributionReward) error

func (*Broker) PublishEditRouteMessage added in v1.0.0

func (b *Broker) PublishEditRouteMessage(ctx context.Context, msg model.EditRouteMessage) error

func (*Broker) PublishEditRouteNameMessage added in v1.0.0

func (b *Broker) PublishEditRouteNameMessage(ctx context.Context, msg model.EditRouteNameMessage) error

func (*Broker) PublishEditValidatorMessage

func (b *Broker) PublishEditValidatorMessage(_ context.Context, msg model.EditValidatorMessage) error

func (*Broker) PublishExecMessage

func (b *Broker) PublishExecMessage(ctx context.Context, em model.ExecMessage) error

func (*Broker) PublishFeeAllowance

func (b *Broker) PublishFeeAllowance(ctx context.Context, feeAllowance model.FeeAllowance) error

func (*Broker) PublishGovParams

func (b *Broker) PublishGovParams(ctx context.Context, params model.GovParams) error

func (*Broker) PublishGrantAllowanceMessage

func (b *Broker) PublishGrantAllowanceMessage(ctx context.Context, gam model.GrantAllowanceMessage) error

func (*Broker) PublishGrantMessage

func (b *Broker) PublishGrantMessage(ctx context.Context, gm model.GrantMessage) error

func (*Broker) PublishGridParams added in v1.0.0

func (b *Broker) PublishGridParams(ctx context.Context, msg model.GridParams) error

func (*Broker) PublishHandleValidatorSignature added in v0.0.4

func (b *Broker) PublishHandleValidatorSignature(ctx context.Context, hvs model.HandleValidatorSignature) error

func (*Broker) PublishInvestmintMessage added in v1.0.0

func (b *Broker) PublishInvestmintMessage(ctx context.Context, msg model.InvestmintMessage) error

func (*Broker) PublishLiquidityPool added in v0.2.4

func (b *Broker) PublishLiquidityPool(_ context.Context, v model.LiquidityPool) error

func (*Broker) PublishMessage

func (b *Broker) PublishMessage(ctx context.Context, message model.Message) error

func (*Broker) PublishMintParams

func (b *Broker) PublishMintParams(ctx context.Context, mp model.MintParams) error

func (*Broker) PublishMultiSendMessage

func (b *Broker) PublishMultiSendMessage(ctx context.Context, msm model.MultiSendMessage) error

func (*Broker) PublishParticle added in v1.0.0

func (b *Broker) PublishParticle(ctx context.Context, msg model.Particle) error

func (*Broker) PublishProposal

func (b *Broker) PublishProposal(ctx context.Context, proposal model.Proposal) error

func (*Broker) PublishProposalDeposit

func (b *Broker) PublishProposalDeposit(ctx context.Context, pvm model.ProposalDeposit) error

func (*Broker) PublishProposalDepositMessage

func (b *Broker) PublishProposalDepositMessage(ctx context.Context, pvm model.ProposalDepositMessage) error

func (*Broker) PublishProposalTallyResult

func (b *Broker) PublishProposalTallyResult(ctx context.Context, ptr model.ProposalTallyResult) error

func (*Broker) PublishProposalVoteMessage

func (b *Broker) PublishProposalVoteMessage(ctx context.Context, pvm model.ProposalVoteMessage) error

func (*Broker) PublishProposerReward

func (b *Broker) PublishProposerReward(ctx context.Context, r model.ProposerReward) error

func (*Broker) PublishRankParams added in v1.0.0

func (b *Broker) PublishRankParams(ctx context.Context, msg model.RankParams) error

func (*Broker) PublishRawBlock added in v1.1.0

func (b *Broker) PublishRawBlock(_ context.Context, block interface{}) error

func (*Broker) PublishRawBlockResults added in v1.1.0

func (b *Broker) PublishRawBlockResults(_ context.Context, br interface{}) error

func (*Broker) PublishRawGenesis added in v1.1.0

func (b *Broker) PublishRawGenesis(_ context.Context, g interface{}) error

func (*Broker) PublishRawTransaction added in v1.1.0

func (b *Broker) PublishRawTransaction(_ context.Context, tx interface{}) error

func (*Broker) PublishReceivePacketMessage added in v0.2.1

func (b *Broker) PublishReceivePacketMessage(ctx context.Context, r model.RecvPacketMessage) error

func (*Broker) PublishRedelegation

func (b *Broker) PublishRedelegation(ctx context.Context, r model.Redelegation) error

func (*Broker) PublishRedelegationMessage

func (b *Broker) PublishRedelegationMessage(ctx context.Context, rm model.RedelegationMessage) error

func (*Broker) PublishRevokeAllowanceMessage

func (b *Broker) PublishRevokeAllowanceMessage(ctx context.Context, ram model.RevokeAllowanceMessage) error

func (*Broker) PublishRevokeMessage

func (b *Broker) PublishRevokeMessage(ctx context.Context, rm model.RevokeMessage) error

func (*Broker) PublishRoute added in v1.0.0

func (b *Broker) PublishRoute(ctx context.Context, msg model.Route) error

func (*Broker) PublishSendMessage

func (b *Broker) PublishSendMessage(ctx context.Context, sm model.SendMessage) error

func (*Broker) PublishSetWithdrawAddressMessage

func (b *Broker) PublishSetWithdrawAddressMessage(_ context.Context, swm model.SetWithdrawAddressMessage) error

func (*Broker) PublishSlashingParams added in v0.3.0

func (b *Broker) PublishSlashingParams(_ context.Context, params model.SlashingParams) error

func (*Broker) PublishStakingParams

func (b *Broker) PublishStakingParams(ctx context.Context, sp model.StakingParams) error

func (*Broker) PublishStakingPool

func (b *Broker) PublishStakingPool(ctx context.Context, sp model.StakingPool) error

func (*Broker) PublishSubmitProposalMessage

func (b *Broker) PublishSubmitProposalMessage(_ context.Context, spm model.SubmitProposalMessage) error

func (*Broker) PublishSupply

func (b *Broker) PublishSupply(ctx context.Context, supply model.Supply) error

func (*Broker) PublishSwap added in v0.2.4

func (b *Broker) PublishSwap(ctx context.Context, swap model.Swap) error

func (*Broker) PublishTransaction

func (b *Broker) PublishTransaction(ctx context.Context, tx model.Transaction) error

func (*Broker) PublishTransferMessage added in v0.2.1

func (b *Broker) PublishTransferMessage(ctx context.Context, tm model.TransferMessage) error

func (*Broker) PublishUnbondingDelegation

func (b *Broker) PublishUnbondingDelegation(ctx context.Context, ud model.UnbondingDelegation) error

func (*Broker) PublishUnbondingDelegationMessage

func (b *Broker) PublishUnbondingDelegationMessage(ctx context.Context, udm model.UnbondingDelegationMessage) error

func (*Broker) PublishUnjailMessage added in v0.0.2

func (b *Broker) PublishUnjailMessage(_ context.Context, msg model.UnjailMessage) error

func (*Broker) PublishValidator

func (b *Broker) PublishValidator(ctx context.Context, val model.Validator) error

func (*Broker) PublishValidatorCommission

func (b *Broker) PublishValidatorCommission(ctx context.Context, commission model.ValidatorCommission) error

func (*Broker) PublishValidatorDescription

func (b *Broker) PublishValidatorDescription(ctx context.Context, description model.ValidatorDescription) error

func (*Broker) PublishValidatorInfo

func (b *Broker) PublishValidatorInfo(ctx context.Context, info model.ValidatorInfo) error

func (*Broker) PublishValidatorPreCommit added in v1.0.0

func (b *Broker) PublishValidatorPreCommit(_ context.Context, v model.ValidatorPreCommit) error

func (*Broker) PublishValidatorStatus

func (b *Broker) PublishValidatorStatus(ctx context.Context, status model.ValidatorStatus) error

func (*Broker) PublishValidatorVotingPower added in v0.3.0

func (b *Broker) PublishValidatorVotingPower(_ context.Context, vp model.ValidatorVotingPower) error

func (*Broker) PublishVoteWeightedMessage

func (b *Broker) PublishVoteWeightedMessage(_ context.Context, vwm model.VoteWeightedMessage) error

func (*Broker) PublishWithdrawValidatorCommissionMessage

func (b *Broker) PublishWithdrawValidatorCommissionMessage(
	_ context.Context,
	msg model.WithdrawValidatorCommissionMessage,
) error

func (*Broker) Start

func (b *Broker) Start(ctx context.Context) error

func (*Broker) Stop

func (b *Broker) Stop(ctx context.Context) error

type Config

type Config struct {
	ServerURL       string `env:"BROKER_SERVER"`
	PartitionsCount int    `env:"PARTITIONS_COUNT" envDefault:"1"`
	MaxMessageBytes int    `env:"MAX_MESSAGE_MAX_BYTES" envDefault:"5242880"` // 5MB
	Enabled         bool   `env:"BROKER_ENABLED"`
}

type Topic

type Topic *string
var (
	Account                            Topic = newTopic("account")
	AccountBalance                     Topic = newTopic("account_balance")
	AcknowledgementMessage             Topic = newTopic("acknowledgement_message")
	AnnualProvision                    Topic = newTopic("annual_provision")
	AuthzGrant                         Topic = newTopic("authz_grant")
	BandwidthParams                    Topic = newTopic("bandwidth_params")
	Block                              Topic = newTopic("block")
	CancelUnbondingDelegationMessage   Topic = newTopic("cancel_unbonding_delegation_message")
	CommunityPool                      Topic = newTopic("community_pool")
	CreateRouteMessage                 Topic = newTopic("create_route_message")
	CreateValidatorMessage             Topic = newTopic("create_validator_message")
	Cyberlink                          Topic = newTopic("cyberlink")
	CyberlinkMessage                   Topic = newTopic("cyberlink_message")
	DMNParams                          Topic = newTopic("dmn_params")
	Delegation                         Topic = newTopic("delegation")
	DelegationMessage                  Topic = newTopic("delegation_message")
	DelegationReward                   Topic = newTopic("delegation_reward")
	DelegationRewardMessage            Topic = newTopic("delegation_reward_message")
	DeleteRouteMessage                 Topic = newTopic("delete_route_message")
	DenomTrace                         Topic = newTopic("denom_trace")
	DistributionCommission             Topic = newTopic("distribution_commission")
	DistributionParams                 Topic = newTopic("distribution_params")
	DistributionReward                 Topic = newTopic("distribution_reward")
	EditRouteMessage                   Topic = newTopic("edit_route_message")
	EditRouteNameMessage               Topic = newTopic("edit_route_name_message")
	EditValidatorMessage               Topic = newTopic("edit_validator_message")
	ExecMessage                        Topic = newTopic("exec_message")
	FeeAllowance                       Topic = newTopic("fee_allowance")
	GovParams                          Topic = newTopic("gov_params")
	GrantAllowanceMessage              Topic = newTopic("grant_allowance_message")
	GrantMessage                       Topic = newTopic("grant_message")
	GridParams                         Topic = newTopic("grid_params")
	HandleValidatorSignature           Topic = newTopic("handle_validator_signature")
	InvestmintMessage                  Topic = newTopic("investmint_message")
	LiquidityPool                      Topic = newTopic("liquidity_pool")
	Message                            Topic = newTopic("message")
	MintParams                         Topic = newTopic("mint_params")
	MultiSendMessage                   Topic = newTopic("multisend_message")
	Particle                           Topic = newTopic("particle")
	Proposal                           Topic = newTopic("proposal")
	ProposalDeposit                    Topic = newTopic("proposal_deposit")
	ProposalDepositMessage             Topic = newTopic("proposal_deposit_message")
	ProposalTallyResult                Topic = newTopic("proposal_tally_result")
	ProposalVoteMessage                Topic = newTopic("proposal_vote_message")
	ProposerReward                     Topic = newTopic("proposer_reward")
	RankParams                         Topic = newTopic("rank_params")
	RawBlock                           Topic = newTopic("raw_block")
	RawBlockResults                    Topic = newTopic("raw_block_results")
	RawGenesis                         Topic = newTopic("raw_genesis")
	RawTransaction                     Topic = newTopic("raw_transaction")
	ReceivePacketMessage               Topic = newTopic("receive_packet_message")
	Redelegation                       Topic = newTopic("redelegation")
	RedelegationMessage                Topic = newTopic("redelegation_message")
	RevokeAllowanceMessage             Topic = newTopic("revoke_allowance_message")
	RevokeMessage                      Topic = newTopic("revoke_message")
	Route                              Topic = newTopic("route")
	SendMessage                        Topic = newTopic("send_message")
	SetWithdrawAddressMessage          Topic = newTopic("set_withdraw_address_message")
	SlashingParams                     Topic = newTopic("slashing_params")
	StakingParams                      Topic = newTopic("staking_params")
	StakingPool                        Topic = newTopic("staking_pool")
	SubmitProposalMessage              Topic = newTopic("submit_proposal_message")
	Supply                             Topic = newTopic("supply")
	Swap                               Topic = newTopic("swap")
	Transaction                        Topic = newTopic("transaction")
	TransferMessage                    Topic = newTopic("transfer_message")
	UnbondingDelegation                Topic = newTopic("unbonding_delegation")
	UnbondingDelegationMessage         Topic = newTopic("unbonding_delegation_message")
	UnjailMessage                      Topic = newTopic("unjail_message")
	Validator                          Topic = newTopic("validator")
	ValidatorCommission                Topic = newTopic("validator_commission")
	ValidatorDescription               Topic = newTopic("validator_description")
	ValidatorInfo                      Topic = newTopic("validator_info")
	ValidatorPreCommit                 Topic = newTopic("validator_precommit")
	ValidatorStatus                    Topic = newTopic("validator_status")
	ValidatorVotingPower               Topic = newTopic("validator_voting_power")
	VoteWeightedMessage                Topic = newTopic("vote_weighted_message")
	WithdrawValidatorCommissionMessage Topic = newTopic("withdraw_validator_commission_message")
)

type Topics

type Topics []Topic

func (Topics) ToStringSlice

func (ts Topics) ToStringSlice() []string

Jump to

Keyboard shortcuts

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