metatopic

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: BSD-3-Clause Imports: 5 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

This section is empty.

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"`
	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

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