metatopic

package
v0.12.8 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Mimetype      = "application/msgpack"
	SchemaName    = "metatopic.TopicUpdate"
	SchemaVersion = "1.0.0"
)

Constants useful for creating ensign Events.

Variables

View Source
var (
	// TopicUpdate validation errors.
	ErrMissingOrgID      = errors.New("missing organization id")
	ErrMissingProjectID  = errors.New("missing project id")
	ErrMissingTopicID    = errors.New("missing topic id")
	ErrMissingTopic      = errors.New("missing topic details")
	ErrUnknownUpdateType = errors.New("unknown topic update type")

	// Topic validation errors.
	ErrMissingName        = errors.New("missing topic name")
	ErrInvalidEvents      = errors.New("total events must be greater than or equal to 0")
	ErrInvalidStorage     = errors.New("data storage must be greater than or equal to 0")
	ErrMissingPublishers  = errors.New("missing topic publishers")
	ErrMissingSubscribers = errors.New("missing topic subscribers")
	ErrMissingCreated     = errors.New("missing topic created timestamp")
	ErrMissingModified    = errors.New("missing topic modified timestamp")
)

Functions

func ParseVersion

func ParseVersion() (major, minor, patch uint32)

Parse the version components of the schema version to create an event version.

Types

type Activity

type Activity struct {
	Active   uint64 `msgpack:"active"`
	Inactive uint64 `msgpack:"inactive"`
}

Activity represents the number of active/inactive items in a group. The total number of items in a group is the sum of active + inactive.

func (*Activity) PercentActive

func (a *Activity) PercentActive() float64

func (*Activity) PercentInactive

func (a *Activity) PercentInactive() float64

func (*Activity) Total

func (a *Activity) Total() uint64

type Topic

type Topic struct {
	ID          []byte    `msgpack:"id"`
	ProjectID   []byte    `msgpack:"project_id"`
	Name        string    `msgpack:"name"`
	ReadOnly    bool      `msgpack:"readonly"`
	Offset      uint64    `msgpack:"offset"`
	Shards      uint32    `msgpack:"shards"`
	Events      float64   `msgpack:"events"`
	Storage     float64   `msgpack:"storage"`
	Publishers  *Activity `msgpack:"publishers"`
	Subscribers *Activity `msgpack:"subscribers"`
	Created     time.Time `msgpack:"created"`
	Modified    time.Time `msgpack:"modified"`
}

A non-protocol buffer representation of the Topic. In the Topic Update struct it represents the modified topic (e.g. the current version of the topic). TODO: add placements and types to this struct.

type TopicUpdate

type TopicUpdate struct {
	UpdateType TopicUpdateType `msgpack:"update_type"`
	OrgID      ulid.ULID       `msgpack:"org_id,omitempty"`
	ProjectID  ulid.ULID       `msgpack:"project_id"`
	TopicID    ulid.ULID       `msgpack:"topic_id"`
	ClientID   string          `msgpack:"client_id"`
	Topic      *Topic          `msgpack:"topic,omitempty"`
}

This is the top-level event type that is sent on the metatopic topic. It describes an update to a specific topic and provides information about the topic and how it was modified, and, if available, who it was modified by.

func (*TopicUpdate) Marshal

func (t *TopicUpdate) Marshal() ([]byte, error)

func (*TopicUpdate) Unmarshal

func (t *TopicUpdate) Unmarshal(data []byte) error

func (*TopicUpdate) Validate added in v0.7.1

func (t *TopicUpdate) Validate() (err error)

Validate that all required fields are present in a topic update.

type TopicUpdateType

type TopicUpdateType uint8

The type of update made to the topic, e.g. created, modified, deleted, etc.

const (
	TopicUpdateUnknown TopicUpdateType = iota
	TopicUpdateCreated
	TopicUpdateModified
	TopicUpdateStateChange
	TopicUpdateDeleted
)

func (TopicUpdateType) String

func (t TopicUpdateType) String() string

Jump to

Keyboard shortcuts

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