Help us shape the future of Go! Take the 2026 Go Developer Survey

topics

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 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 partitions, value range: 1-100
	Partition int `json:"partition,omitempty"`
	// topic replications, value range: 1-3
	Replication int `json:"replication,omitempty"`
	// aging time in hours, value range: 1-168, defaults to 72
	RetentionTime int `json:"retention_time,omitempty"`

	SyncMessageFlush bool `json:"sync_message_flush,omitempty"`
	SyncReplication  bool `json:"sync_replication,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 {
	Name    string `json:"id"`
	Success bool   `json:"success"`
}

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"`
	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    int  `json:"lag"`
}

Replica represents the details of a replica

type Topic

type Topic struct {
	Name             string      `json:"name"`
	Partition        int         `json:"partition"`
	Replication      int         `json:"replication"`
	RetentionTime    int         `json:"retention_time"`
	SyncReplication  bool        `json:"sync_replication"`
	SyncMessageFlush bool        `json:"sync_message_flush"`
	TopicType        int         `json:"topic_type"`
	PoliciesOnly     bool        `json:"policiesOnly"`
	ExternalConfigs  interface{} `json:"external_configs"`
}

Topic includes the parameters of an topic REDO this part

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 an topic with detailed information by instance id and topic name

type UpdateItem

type UpdateItem struct {
	// Name can not be updated
	Name             string `json:"id" required:"true"`
	Partition        *int   `json:"new_partition_numbers,omitempty"`
	RetentionTime    *int   `json:"retention_time,omitempty"`
	SyncMessageFlush *bool  `json:"sync_message_flush,omitempty"`
	SyncReplication  *bool  `json:"sync_replication,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