connection

package
v4.0.9+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package connection implements connection code

Index

Constants

This section is empty.

Variables

View Source
var SHA256 scram.HashGeneratorFcn = func() hash.Hash { return sha256.New() }

SHA256 is a scram.HashGeneratorFcn

View Source
var SHA512 scram.HashGeneratorFcn = func() hash.Hash { return sha512.New() }

SHA512 is a scram.HashGeneratorFcn

Functions

This section is empty.

Types

type Broker

type Broker struct {
	Config      *sarama.Config
	JMXPort     int
	JMXUser     string
	JMXPassword string
	Host        string
	ID          string
	SaramaBroker
}

Broker is a struct containing all the information to collect from both Kafka and from JMX

func GetBrokerFromZookeeper

func GetBrokerFromZookeeper(zkConn zookeeper.Connection, id, preferredListener string) (*Broker, error)

GetBrokerFromZookeeper gets a broker with given ID from zookeeper

func GetBrokerListFromZookeeper

func GetBrokerListFromZookeeper(zkConn zookeeper.Connection, preferredListener string) ([]*Broker, error)

GetBrokerListFromZookeeper gets a list of brokers from zookeeper

func NewBroker

func NewBroker(brokerArgs *args.BrokerHost) (*Broker, error)

NewBroker creates a new broker

func (*Broker) Entity

Entity gets the entity object for the broker

type Client

type Client interface {
	Config() *sarama.Config
	Controller() (*sarama.Broker, error)
	Brokers() []*sarama.Broker
	Topics() ([]string, error)
	Partitions(topic string) ([]int32, error)
	WritablePartitions(topic string) ([]int32, error)
	Leader(topic string, partitionID int32) (*sarama.Broker, error)
	Replicas(topic string, partitionID int32) ([]int32, error)
	InSyncReplicas(topic string, partitionID int32) ([]int32, error)
	OfflineReplicas(topic string, partitionID int32) ([]int32, error)
	RefreshMetadata(topics ...string) error
	GetOffset(topic string, partitionID int32, time int64) (int64, error)
	Coordinator(consumerGroup string) (*sarama.Broker, error)
	RefreshCoordinator(consumerGroup string) error
	RefreshController() (*sarama.Broker, error)
	InitProducerID() (*sarama.InitProducerIDResponse, error)
	Close() error
	Closed() bool
}

Client is a wrapper around sarama.Client so that we can generate mocks See sarama.Client for documentation

func NewSaramaClientFromBrokerList

func NewSaramaClientFromBrokerList(brokers []*Broker) (Client, error)

NewSaramaClientFromBrokerList creates a new Client from a list of brokers

type SaramaBroker

type SaramaBroker interface {
	AddOffsetsToTxn(request *sarama.AddOffsetsToTxnRequest) (*sarama.AddOffsetsToTxnResponse, error)
	AddPartitionsToTxn(request *sarama.AddPartitionsToTxnRequest) (*sarama.AddPartitionsToTxnResponse, error)
	Addr() string
	AlterConfigs(request *sarama.AlterConfigsRequest) (*sarama.AlterConfigsResponse, error)
	ApiVersions(request *sarama.ApiVersionsRequest) (*sarama.ApiVersionsResponse, error)
	Close() error
	CommitOffset(request *sarama.OffsetCommitRequest) (*sarama.OffsetCommitResponse, error)
	Connected() (bool, error)
	CreateAcls(request *sarama.CreateAclsRequest) (*sarama.CreateAclsResponse, error)
	CreatePartitions(request *sarama.CreatePartitionsRequest) (*sarama.CreatePartitionsResponse, error)
	CreateTopics(request *sarama.CreateTopicsRequest) (*sarama.CreateTopicsResponse, error)
	DeleteAcls(request *sarama.DeleteAclsRequest) (*sarama.DeleteAclsResponse, error)
	DeleteGroups(request *sarama.DeleteGroupsRequest) (*sarama.DeleteGroupsResponse, error)
	DeleteRecords(request *sarama.DeleteRecordsRequest) (*sarama.DeleteRecordsResponse, error)
	DeleteTopics(request *sarama.DeleteTopicsRequest) (*sarama.DeleteTopicsResponse, error)
	DescribeAcls(request *sarama.DescribeAclsRequest) (*sarama.DescribeAclsResponse, error)
	DescribeConfigs(request *sarama.DescribeConfigsRequest) (*sarama.DescribeConfigsResponse, error)
	DescribeGroups(request *sarama.DescribeGroupsRequest) (*sarama.DescribeGroupsResponse, error)
	EndTxn(request *sarama.EndTxnRequest) (*sarama.EndTxnResponse, error)
	Fetch(request *sarama.FetchRequest) (*sarama.FetchResponse, error)
	FetchOffset(request *sarama.OffsetFetchRequest) (*sarama.OffsetFetchResponse, error)
	FindCoordinator(request *sarama.FindCoordinatorRequest) (*sarama.FindCoordinatorResponse, error)
	GetAvailableOffsets(request *sarama.OffsetRequest) (*sarama.OffsetResponse, error)
	GetConsumerMetadata(request *sarama.ConsumerMetadataRequest) (*sarama.ConsumerMetadataResponse, error)
	GetMetadata(request *sarama.MetadataRequest) (*sarama.MetadataResponse, error)
	Heartbeat(request *sarama.HeartbeatRequest) (*sarama.HeartbeatResponse, error)
	ID() int32
	InitProducerID(request *sarama.InitProducerIDRequest) (*sarama.InitProducerIDResponse, error)
	JoinGroup(request *sarama.JoinGroupRequest) (*sarama.JoinGroupResponse, error)
	LeaveGroup(request *sarama.LeaveGroupRequest) (*sarama.LeaveGroupResponse, error)
	ListGroups(request *sarama.ListGroupsRequest) (*sarama.ListGroupsResponse, error)
	Open(conf *sarama.Config) error
	Produce(request *sarama.ProduceRequest) (*sarama.ProduceResponse, error)
	Rack() string
	SyncGroup(request *sarama.SyncGroupRequest) (*sarama.SyncGroupResponse, error)
	TxnOffsetCommit(request *sarama.TxnOffsetCommitRequest) (*sarama.TxnOffsetCommitResponse, error)
}

SaramaBroker is an interface over sarama.Broker for mocking

type XDGSCRAMClient

type XDGSCRAMClient struct {
	*scram.Client
	*scram.ClientConversation
	scram.HashGeneratorFcn
}

XDGSCRAMClient implements sarama.SCRAMClient

func (*XDGSCRAMClient) Begin

func (x *XDGSCRAMClient) Begin(userName, password, authzID string) (err error)

Begin is an implementation of sarams.SCRAMClient.Begin()

func (*XDGSCRAMClient) Done

func (x *XDGSCRAMClient) Done() bool

Done is an implementation of sarams.SCRAMClient.Done()

func (*XDGSCRAMClient) Step

func (x *XDGSCRAMClient) Step(challenge string) (response string, err error)

Step is an implementation of sarams.SCRAMClient.Step()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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