topics

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2025 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachSchemaToTopic

func AttachSchemaToTopic(ctx context.Context, projectUUID, name, schemaUUID string, store stores.Store) error

AttachSchemaToTopic links the provided schema with the given topic

func DetachSchemaFromTopic

func DetachSchemaFromTopic(ctx context.Context, projectUUID, name string, store stores.Store) error

DetachSchemaFromTopic removes the link between the provided schema and the given topic

func HasTopic

func HasTopic(ctx context.Context, projectUUID string, name string, store stores.Store) bool

HasTopic returns true if project & topic combination exist

func RemoveTopic

func RemoveTopic(ctx context.Context, projectUUID string, name string, store stores.Store) error

RemoveTopic removes an existing topic

Types

type PaginatedTopics

type PaginatedTopics struct {
	Topics        []Topic `json:"topics"`
	NextPageToken string  `json:"nextPageToken"`
	TotalSize     int64   `json:"totalSize"`
}

PaginatedTopics holds information about a topics' page and how to access the next page

func Find

func Find(ctx context.Context, projectUUID, userUUID, name, pageToken string, pageSize int64, store stores.Store) (PaginatedTopics, error)

Find searches and returns a specific topic or all topics of a given project

func (*PaginatedTopics) Empty

func (tl *PaginatedTopics) Empty() bool

Empty returns true if Topics has no items

func (*PaginatedTopics) ExportJSON

func (tl *PaginatedTopics) ExportJSON() (string, error)

ExportJSON exports whole Topics List Structure as a json string

type Topic

type Topic struct {
	ProjectUUID   string    `json:"-"`
	Name          string    `json:"-"`
	FullName      string    `json:"name"`
	LatestPublish time.Time `json:"-"`
	PublishRate   float64   `json:"-"`
	Schema        string    `json:"schema,omitempty"`
	CreatedOn     string    `json:"created_on"`
}

Topic struct to hold information for a given topic

func CreateTopic

func CreateTopic(ctx context.Context, projectUUID string, name string, schemaUUID string, createdOn time.Time, store stores.Store) (Topic, error)

CreateTopic creates a new topic

func New

func New(projectUUID string, projectName string, name string) Topic

New creates a new topic based on name

func (*Topic) ExportJSON

func (tp *Topic) ExportJSON() (string, error)

ExportJSON exports whole Topic Structure as a json string

type TopicMetrics

type TopicMetrics struct {
	MsgNum        int64     `json:"number_of_messages"`
	TotalBytes    int64     `json:"total_bytes"`
	LatestPublish time.Time `json:"-"`
	PublishRate   float64   `json:"-"`
}

func FindMetric

func FindMetric(ctx context.Context, projectUUID string, name string, store stores.Store) (TopicMetrics, error)

FindMetric searches and returns a specific topic or all topics of a given project

func (*TopicMetrics) ExportJSON

func (tp *TopicMetrics) ExportJSON() (string, error)

ExportJSON exports whole TopicMetrics Structure as a json string

Jump to

Keyboard shortcuts

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