topics

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOps

type CreateOps 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

func (CreateOps) ToTopicCreateMap

func (ops CreateOps) ToTopicCreateMap() (map[string]interface{}, error)

ToTopicCreateMap is used for type convert

type CreateOpsBuilder

type CreateOpsBuilder interface {
	ToTopicCreateMap() (map[string]interface{}, error)
}

CreateOpsBuilder is an interface which is used for creating a kafka topic

type CreateResponse

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

CreateResponse is a struct that contains the create response

type CreateResult

type CreateResult struct {
	golangsdk.Result
}

CreateResult is a struct that contains all the return parameters of creation

func Create

func Create(client *golangsdk.ServiceClient, instanceID string, ops CreateOpsBuilder) (r CreateResult)

Create a kafka topic with given parameters

func (CreateResult) Extract

func (r CreateResult) Extract() (*CreateResponse, error)

Extract from CreateResult

type DeleteResponse

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

DeleteResponse is a struct that contains the deletion response

type DeleteResult

type DeleteResult struct {
	golangsdk.Result
}

DeleteResult is a struct which contains the result of deletion

func Delete

func Delete(client *golangsdk.ServiceClient, instanceID string, topics []string) (r DeleteResult)

Delete given topics belong to the instance id

func (DeleteResult) Extract

func (r DeleteResult) Extract() ([]DeleteResponse, error)

Extract from DeleteResult

type GetResult

type GetResult struct {
	golangsdk.Result
}

GetResult is a struct which contains the result of query

func Get

func Get(client *golangsdk.ServiceClient, instanceID, topicName string) (r GetResult)

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

func (GetResult) Extract

func (r GetResult) Extract() (*TopicDetail, error)

Extract from GetResult

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

type ListResult

type ListResult struct {
	golangsdk.Result
}

ListResult contains the body of getting detailed

func List

func List(client *golangsdk.ServiceClient, instanceID string) (r ListResult)

List all topics belong to the instance id

func (ListResult) Extract

func (r ListResult) Extract() ([]Topic, error)

Extract from ListResult

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

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

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

func (UpdateOpts) ToTopicUpdateMap

func (opts UpdateOpts) ToTopicUpdateMap() (map[string]interface{}, error)

ToTopicUpdateMap is used for type convert

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToTopicUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder is an interface which can build the map paramter of update function

type UpdateResult

type UpdateResult struct {
	golangsdk.ErrResult
}

UpdateResult is a struct from which can get the result of update method

func Update

func Update(client *golangsdk.ServiceClient, instanceID string, opts UpdateOptsBuilder) (r UpdateResult)

Update is a method which can be able to update topics

Jump to

Keyboard shortcuts

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