topics

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Update

func Update(client *golangsdk.ServiceClient, instanceID string, opts UpdateOpts) error

Update is a method which can be able to update topics

Types

type CreateOpts

type CreateOpts struct {
	// the name/ID of a topic
	Name string `json:"id" required:"true"`
	// topic replications, value range: 1-3
	Replication int `json:"replication,omitempty"`
	// Whether synchronous flushing is enabled. The default value is false.
	// Synchronous flushing compromises performance.
	SyncMessageFlush bool `json:"sync_message_flush,omitempty"`
	// topic partitions, value range: 1-100
	Partition int `json:"partition,omitempty"`
	// Number of topic partitions, which is used to set the number of concurrently
	// consumed messages.Value range: 1-200
	SyncReplication bool `json:"sync_replication,omitempty"`
	// aging time in hours, value range: 1-168, defaults to 72
	RetentionTime int `json:"retention_time,omitempty"`
	// Topic configuration.
	TopicOtherConfigs []TopicOtherConfigs `json:"topic_other_configs,omitempty"`
	// Topic description.
	Description string `json:"topic_desc,omitempty"`
}

CreateOps is a struct that contains all the parameters of create function

type CreateResponse

type CreateResponse struct {
	Name string `json:"name"`
}

CreateResponse is a struct that contains the create response

func Create

func Create(client *golangsdk.ServiceClient, instanceID string, opts CreateOpts) (*CreateResponse, error)

Create a kafka topic with given parameters

type DeleteResponse

type DeleteResponse struct {
	Topics []TopicDelete `json:"topics"`
}

DeleteResponse is a struct that contains the deletion response

func Delete

func Delete(client *golangsdk.ServiceClient, instanceID string, topics []string) (*DeleteResponse, error)

Delete given topics belong to the instance id

type ListResponse

type ListResponse struct {
	Total              int     `json:"total"`
	Size               int     `json:"size"`
	RemainPartitions   int     `json:"remain_partitions"`
	MaxPartitions      int     `json:"max_partitions"`
	TopicMaxPartitions int     `json:"topic_max_partitions"`
	Topics             []Topic `json:"topics"`
}

ListResponse is a struct that contains the list response

func List

func List(client *golangsdk.ServiceClient, instanceID string) (*ListResponse, error)

List all topics belong to the instance id

type Partition

type Partition struct {
	Partition int       `json:"partition"`
	Replicas  []Replica `json:"replicas"`
	// Node ID
	Leader int `json:"leader"`
	// Log End Offset
	Leo int `json:"leo"`
	// High Watermark
	Hw int `json:"hw"`
	// Log Start Offset
	Lso int `json:"lso"`
	// time stamp
	UpdateTimestamp int64 `json:"last_update_timestamp"`
}

Partition represents the details of a partition

type Replica

type Replica struct {
	Broker int   `json:"broker"`
	Leader bool  `json:"leader"`
	InSync bool  `json:"in_sync"`
	Size   int   `json:"size"`
	Lag    int64 `json:"lag"`
}

Replica represents the details of a replica

type Topic

type Topic struct {
	PoliciesOnly      bool                    `json:"policiesOnly"`
	Name              string                  `json:"name"`
	Replication       int                     `json:"replication"`
	Partition         int                     `json:"partition"`
	RetentionTime     int                     `json:"retention_time"`
	SyncReplication   bool                    `json:"sync_replication"`
	SyncMessageFlush  bool                    `json:"sync_message_flush"`
	ExternalConfigs   interface{}             `json:"external_configs"`
	TopicType         int                     `json:"topic_type"`
	TopicOtherConfigs []TopicOtherConfigsResp `json:"topic_other_configs"`
	Description       string                  `json:"topic_desc"`
	CreatedAt         int64                   `json:"created_at"`
}

type TopicDelete added in v0.9.4

type TopicDelete struct {
	Name    string `json:"id"`
	Success bool   `json:"success"`
}

type TopicDetail

type TopicDetail struct {
	Name            string      `json:"topic"`
	Partitions      []Partition `json:"partitions"`
	GroupSubscribed []string    `json:"group_subscribed"`
}

TopicDetail includes the detail parameters of an topic

func Get

func Get(client *golangsdk.ServiceClient, instanceID, topicName string) (*TopicDetail, error)

Get a topic with detailed information by instance id and topic name

type TopicOtherConfigs added in v0.9.4

type TopicOtherConfigs struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type TopicOtherConfigsResp added in v0.9.4

type TopicOtherConfigsResp struct {
	Name         string `json:"name"`
	ValidValues  string `json:"valid_values"`
	DefaultValue string `json:"default_value"`
	ConfigType   string `json:"config_type"`
	Value        string `json:"value"`
	ValueType    string `json:"value_type"`
}

type UpdateItem

type UpdateItem struct {
	// Name can not be updated
	Name string `json:"id" required:"true"`
	// Aging time in hour.
	RetentionTime *int `json:"retention_time,omitempty"`
	// Whether synchronous replication is enabled.
	SyncReplication *bool `json:"sync_replication,omitempty"`
	// Whether synchronous flushing is enabled.
	SyncMessageFlush *bool `json:"sync_message_flush,omitempty"`
	// Number of the partitions.
	NewPartitionNumbers *int `json:"new_partition_numbers,omitempty"`
	// Specifying brokers for new partitions.
	NewPartitionBrokers []int `json:"new_partition_brokers,omitempty"`
	// Topic configuration.
	TopicOtherConfigs []TopicOtherConfigs `json:"topic_other_configs,omitempty"`
	// Topic description.
	Description string `json:"topic_desc,omitempty"`
}

UpdateItem represents the object of one topic in update function

type UpdateOpts

type UpdateOpts struct {
	Topics []UpdateItem `json:"topics" required:"true"`
}

UpdateOpts is a struct which represents the parameters of update function

Jump to

Keyboard shortcuts

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