common

package
v0.0.0-...-8507792 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Producer Types (Async)
	ProducerSync  = iota // 0
	ProducerAsync        // 1
)
View Source
const (
	// Defaults
	DefaultKafkaBrokers        = "kafka:9094" // The default kafka brokers as a comma separate list
	DefaultKafkaVersion        = "2.8.1"      //The default kafka version
	DefaultTopic               = "trees"      // The default topic to publish or subscribe
	DefaultLoggingLevel        = "info"       // The default logging level of the application
	DefaultConnectionBackoffMs = 10000        // The defualt time in milliseconds before retrying to connect to kafka when creating producers
	// Defaults - Producer only defaults
	DefaultPartitioner           = PartitionHash // The default partitioner for producers
	DefaultMessageSendIntervalMs = 100           // The default interval between sending messages for producers
	// Defaults - Consumer only defaults
	DefaultConsumerGroup = "treeconsumer" // The default consumer group for querying kafka by consumers
	DefaultAssigner      = "range"        // The default consumer group assignment method for consumers
)
View Source
const (
	// User ID range
	UserIDMax = 5000 // The max possible value of user ID (not inclusive)
	UserIDMin = 50   // The min possible value of user ID (inclusive)
)
View Source
const (
	// Hashing
	PartitionHash       = "hash"       // compute the hash of the message and send the partition
	PartitionRand       = "rand"       // select a random partition
	PartitionRoundRobin = "roundrobin" // select partition using round robin i.e. (i+1)%n
)

Variables

View Source
var MetricsRegistry metrics.Registry

metrics registry

Supported partitioners

View Source
var Trees = []string{
	"American Beech",
	"American Chestnut",
	"American Elm",
	"American Hophornbeam",
	"American Hornbeam",
	"American Larch",
	"Arborvitae",
	"Balsam Fir",
	"Basswood",
	"Bigtooth Aspen",
	"Bitternut Hickory",
	"Black Ash",
	"Black Birch",
	"Black Cherry",
	"Black Locust",
	"Black Oak",
	"Black Walnut",
	"Black Willow",
	"Butternut",
	"Chestnut Oak",
	"Cucumber Tree",
	"Eastern Cottonwood",
	"Eastern Hemlock",
	"Eastern Redcedar",
	"Eastern White Pine",
	"Gray Birch",
	"Hawthorn",
	"Honey-Locust",
	"Northern Red Oak",
	"Paper Birch",
	"Pignut Hickory",
	"Pin Cherry",
	"Pitch Pine",
	"Quaking Aspen",
	"Red Maple",
	"Red Pine",
	"Red Spruce",
	"Sassafras",
	"Scarlet Oak",
	"Shadbush",
	"Shagbark Hickory",
	"Silver Maple",
	"Slippery Elm",
	"Sugar Maple",
	"Sycamore",
	"The Maples",
	"The Oaks",
	"Tulip Tree",
	"White Ash",
	"White Oak",
	"White Spruce",
	"Yellow Birch",
}

Tree Names

View Source
var UserIDRange = UserIDMax - UserIDMin

Functions

func Hostname

func Hostname() string

Hostname returns the hostname or `unknown`

func InitLoggerWithStdOut

func InitLoggerWithStdOut(loglevel string) *logrus.Logger

InitLoggerWithFileOutput initializes a logger for a given configuration

func Int32SliceEquals

func Int32SliceEquals(a, b []int32) bool

Int32SliceEquals is an O(n) function meant for comparing two int32 slices

func StartMetricsCollector

func StartMetricsCollector(subsystem string)

StartMetricsCollector starts the metric subsystem with an internal registry on port 8080 (and periodically updates)

func StringInSlice

func StringInSlice(s string, slce []string) bool

StringInSlice is an O(n) function meant for use where performance is not critical (for unsorted slice)

func StringSliceEquals

func StringSliceEquals(a, b []string) bool

StringSliceEquals is an O(n) function meant for comparing two string slices

func ValidateTopicInformation

func ValidateTopicInformation(brokers []string, topic string, config *sarama.Config, logger *logrus.Logger) bool

ValidateTopicInformation validates that the topic exists and is writeable

Types

This section is empty.

Jump to

Keyboard shortcuts

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