utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const EthUnbond = "ethereum-unbond" //flushes every 3 days
View Source
const GroupEthUnbond = "group-ethereum-unbond"
View Source
const GroupMsgDelegate = "group-msg-delegate"
View Source
const GroupMsgSend = "group-msg-send"
View Source
const GroupMsgUnbond = "group-msg-unbond"
View Source
const GroupToEth = "group-to-ethereum"
View Source
const GroupToTendermint = "group-to-tendermint"
View Source
const MsgDelegate = "msg-delegate" //priority2
View Source
const MsgSend = "msg-send" //priority3
View Source
const MsgUnbond = "msg-unbond" //priority1
View Source
const ToEth = "to-ethereum"
View Source
const ToTendermint = "to-tendermint"

Variables

View Source
var TicketIDAtomicCounter int64

TicketIDAtomicCounter is a counter that adds when each time a function is called

Topics : is list of topics

Functions

func AddResponseToDB

func AddResponseToDB(ticket Ticket, response []byte, kafkaDB *dbm.GoLevelDB, cdc *codec.LegacyAmino)

AddResponseToDB : Updates response to DB

func GetResponseFromDB

func GetResponseFromDB(ticket Ticket, kafkaDB *dbm.GoLevelDB, cdc *codec.LegacyAmino) []byte

GetResponseFromDB : gives the response from DB

func KafkaAdmin

func KafkaAdmin(kafkaPorts []string, config *sarama.Config) sarama.ClusterAdmin

KafkaAdmin : is admin to create topics

func NewConsumerGroup

func NewConsumerGroup(kafkaPorts []string, groupID string, config *sarama.Config) sarama.ConsumerGroup

func NewProducer

func NewProducer(kafkaPorts []string, config *sarama.Config) sarama.SyncProducer

NewProducer is a producer to send messages to kafka

func ProducerDeliverMessage

func ProducerDeliverMessage(msgBytes []byte, topic string, producer sarama.SyncProducer) error

ProducerDeliverMessage : delivers messages to kafka

func ProducerDeliverMessages

func ProducerDeliverMessages(msgBytes [][]byte, topic string, producer sarama.SyncProducer) error

func QueryDB

func QueryDB(cdc *codec.LegacyAmino, kafkaDB *dbm.GoLevelDB) http.HandlerFunc

QueryDB : REST outputs info from DB

func SaramaConfig

func SaramaConfig() *sarama.Config

func SetTicketIDtoDB

func SetTicketIDtoDB(ticket Ticket, kafkaDB *dbm.GoLevelDB, cdc *codec.LegacyAmino, msg []byte)

SetTicketIDtoDB : initiates ticketID in Database

func TopicsInit

func TopicsInit(admin sarama.ClusterAdmin, topic string, topicDetail sarama.TopicDetail)

TopicsInit : is needed to initialise topics

Types

type KafkaState

type KafkaState struct {
	HomeDir       string
	Admin         sarama.ClusterAdmin
	ConsumerGroup map[string]sarama.ConsumerGroup
	Producer      sarama.SyncProducer
	Topics        []string
}

KafkaState : is a struct showing the state of kafka

func NewKafkaState

func NewKafkaState(kafkaPorts []string, homeDir string, topicDetail sarama.TopicDetail) KafkaState

NewKafkaState : returns a kafka state

type Ticket

type Ticket string

Ticket : is a type that implements string

func TicketIDGenerator

func TicketIDGenerator(prefix string) Ticket

TicketIDGenerator is a random unique ticket ID generator, output is a string

type TicketIDResponse

type TicketIDResponse struct {
	TicketID Ticket `json:"ticketID" valid:"required~ticketID is mandatory,length(20)~ticketID length should be 20" `
}

TicketIDResponse : is a json structure to send TicketID to user

Jump to

Keyboard shortcuts

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