Documentation
¶
Index ¶
- Constants
- type ClusterAdminClient
- type ClusterAdminClientCreator
- type ClusterAdminClientMockImpl
- func (c *ClusterAdminClientMockImpl) Close() error
- func (c *ClusterAdminClientMockImpl) CreateTopic(topic string, detail *sarama.TopicDetail, _ bool) error
- func (c *ClusterAdminClientMockImpl) DescribeCluster() (brokers []*sarama.Broker, controllerID int32, err error)
- func (c *ClusterAdminClientMockImpl) DescribeConfig(_ sarama.ConfigResource) ([]sarama.ConfigEntry, error)
- func (c *ClusterAdminClientMockImpl) GetDefaultMaxMessageBytes() int
- func (c *ClusterAdminClientMockImpl) GetDefaultMockTopicName() string
- func (c *ClusterAdminClientMockImpl) ListTopics() (map[string]sarama.TopicDetail, error)
Constants ¶
const ( // BrokerMessageMaxBytesConfigName specifies the largest record batch size allowed by // Kafka brokers. // See: https://kafka.apache.org/documentation/#brokerconfigs_message.max.bytes BrokerMessageMaxBytesConfigName = "message.max.bytes" // TopicMaxMessageBytesConfigName specifies the largest record batch size allowed by // Kafka topics. // See: https://kafka.apache.org/documentation/#topicconfigs_max.message.bytes TopicMaxMessageBytesConfigName = "max.message.bytes" )
const (
// DefaultMockTopicName specifies the default mock topic name.
DefaultMockTopicName = "mock_topic"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterAdminClient ¶
type ClusterAdminClient interface { // ListTopics list the topics available in the cluster with the default options. ListTopics() (map[string]sarama.TopicDetail, error) // DescribeCluster gets information about the nodes in the cluster DescribeCluster() (brokers []*sarama.Broker, controllerID int32, err error) // DescribeConfig gets the configuration for the specified resources. DescribeConfig(resource sarama.ConfigResource) ([]sarama.ConfigEntry, error) // CreateTopic creates a new topic. CreateTopic(topic string, detail *sarama.TopicDetail, validateOnly bool) error // Close shuts down the admin and closes underlying client. Close() error }
ClusterAdminClient is the administrative client for Kafka, which supports managing and inspecting topics, brokers, configurations and ACLs.
func NewMockAdminClient ¶
func NewMockAdminClient(_ []string, _ *sarama.Config) (ClusterAdminClient, error)
NewMockAdminClient constructs a ClusterAdminClient with mock implementation.
func NewSaramaAdminClient ¶
func NewSaramaAdminClient(addrs []string, conf *sarama.Config) (ClusterAdminClient, error)
NewSaramaAdminClient constructs a ClusterAdminClient with sarama.
type ClusterAdminClientCreator ¶
type ClusterAdminClientCreator func([]string, *sarama.Config) (ClusterAdminClient, error)
ClusterAdminClientCreator defines the type of cluster admin client crater.
type ClusterAdminClientMockImpl ¶
type ClusterAdminClientMockImpl struct {
// contains filtered or unexported fields
}
ClusterAdminClientMockImpl mock implements the admin client interface.
func NewClusterAdminClientMockImpl ¶
func NewClusterAdminClientMockImpl() *ClusterAdminClientMockImpl
NewClusterAdminClientMockImpl news a ClusterAdminClientMockImpl struct with default configurations.
func (*ClusterAdminClientMockImpl) Close ¶
func (c *ClusterAdminClientMockImpl) Close() error
Close do nothing.
func (*ClusterAdminClientMockImpl) CreateTopic ¶
func (c *ClusterAdminClientMockImpl) CreateTopic(topic string, detail *sarama.TopicDetail, _ bool) error
CreateTopic adds topic into map.
func (*ClusterAdminClientMockImpl) DescribeCluster ¶
func (c *ClusterAdminClientMockImpl) DescribeCluster() (brokers []*sarama.Broker, controllerID int32, err error)
DescribeCluster returns the controller ID.
func (*ClusterAdminClientMockImpl) DescribeConfig ¶
func (c *ClusterAdminClientMockImpl) DescribeConfig(_ sarama.ConfigResource) ([]sarama.ConfigEntry, error)
DescribeConfig return brokerConfigs directly.
func (*ClusterAdminClientMockImpl) GetDefaultMaxMessageBytes ¶
func (c *ClusterAdminClientMockImpl) GetDefaultMaxMessageBytes() int
GetDefaultMaxMessageBytes returns defaultMaxMessageBytes as a number.
func (*ClusterAdminClientMockImpl) GetDefaultMockTopicName ¶
func (c *ClusterAdminClientMockImpl) GetDefaultMockTopicName() string
GetDefaultMockTopicName returns the default topic name
func (*ClusterAdminClientMockImpl) ListTopics ¶
func (c *ClusterAdminClientMockImpl) ListTopics() (map[string]sarama.TopicDetail, error)
ListTopics returns all topics directly.