pkg

package
v0.0.0-...-f2d07b8 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMultiplier

func NewMultiplier(constructor Constructor, subscribersCount int) message.Subscriber

TODO: Right now this is a copy-paste of Watermill's internal Multiplier

func RunBenchmark

func RunBenchmark(pubSubName string, messagesCount int, messageSize int) (Results, Results, error)

RunBenchmark runs benchmark on chosen pubsub and returns publishing and subscribing results.

Types

type Constructor

type Constructor func() (message.Subscriber, error)

type Counter

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

func NewCounter

func NewCounter() *Counter

func (*Counter) Add

func (c *Counter) Add(n uint64)

func (*Counter) Count

func (c *Counter) Count() uint64

func (*Counter) MeanPerSecond

func (c *Counter) MeanPerSecond() float64

type MySQLSchema

type MySQLSchema struct {
	sql.DefaultMySQLSchema
}

func (MySQLSchema) SchemaInitializingQueries

func (m MySQLSchema) SchemaInitializingQueries(topic string) []string

type PostgreSQLSchema

type PostgreSQLSchema struct {
	sql.DefaultPostgreSQLSchema
}

func (PostgreSQLSchema) SchemaInitializingQueries

func (p PostgreSQLSchema) SchemaInitializingQueries(topic string) []string

type PubSub

type PubSub struct {
	Publisher  message.Publisher
	Subscriber message.Subscriber

	MessagesCount int
	MessageSize   int

	Topic string

	UUIDFunc func() string
}

func NewPubSub

func NewPubSub(name string, topic string, messagesCount int, messageSize int) (PubSub, error)

func (PubSub) Close

func (ps PubSub) Close() error

func (PubSub) ConsumeMessages

func (ps PubSub) ConsumeMessages(wg *sync.WaitGroup, counter *Counter) error

func (PubSub) PublishMessages

func (ps PubSub) PublishMessages() error

type PubSubDefinition

type PubSubDefinition struct {
	MessagesCount int
	UUIDFunc      func() string
	Constructor   func() (message.Publisher, message.Subscriber)
}

type Results

type Results struct {
	Count          int
	MessageSize    int
	MeanRate       float64
	MeanThroughput float64
}

Jump to

Keyboard shortcuts

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