events

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: MIT Imports: 12 Imported by: 8

Documentation

Index

Constants

View Source
const (
	E_COLLECTION_CREATE               = "COLLECTION_CREATE"
	E_COLLECTION_UPDATE               = "COLLECTION_UPDATE"
	E_COLLECTION_DELETE               = "COLLECTION_DELETE"
	E_COLLECTION_PUBLISHED_CHANGE     = "COLLECTION_PUBLISHED_CHANGE"
	E_COLLECTION_CONTENT_UNITS_CHANGE = "COLLECTION_CONTENT_UNITS_CHANGE"

	E_CONTENT_UNIT_CREATE             = "CONTENT_UNIT_CREATE"
	E_CONTENT_UNIT_UPDATE             = "CONTENT_UNIT_UPDATE"
	E_CONTENT_UNIT_DELETE             = "CONTENT_UNIT_DELETE"
	E_CONTENT_UNIT_PUBLISHED_CHANGE   = "CONTENT_UNIT_PUBLISHED_CHANGE"
	E_CONTENT_UNIT_DERIVATIVES_CHANGE = "CONTENT_UNIT_DERIVATIVES_CHANGE"
	E_CONTENT_UNIT_SOURCES_CHANGE     = "CONTENT_UNIT_SOURCES_CHANGE"
	E_CONTENT_UNIT_TAGS_CHANGE        = "CONTENT_UNIT_TAGS_CHANGE"
	E_CONTENT_UNIT_PERSONS_CHANGE     = "CONTENT_UNIT_PERSONS_CHANGE"
	E_CONTENT_UNIT_PUBLISHERS_CHANGE  = "CONTENT_UNIT_PUBLISHERS_CHANGE"

	E_FILE_UPDATE    = "FILE_UPDATE"
	E_FILE_PUBLISHED = "FILE_PUBLISHED"
	E_FILE_INSERT    = "FILE_INSERT"
	E_FILE_REPLACE   = "FILE_REPLACE"
	E_FILE_REMOVE    = "FILE_REMOVE"

	E_SOURCE_CREATE = "SOURCE_CREATE"
	E_SOURCE_UPDATE = "SOURCE_UPDATE"

	E_TAG_CREATE = "TAG_CREATE"
	E_TAG_UPDATE = "TAG_UPDATE"

	E_PERSON_CREATE = "PERSON_CREATE"
	E_PERSON_UPDATE = "PERSON_UPDATE"
	E_PERSON_DELETE = "PERSON_DELETE"

	E_PUBLISHER_CREATE = "PUBLISHER_CREATE"
	E_PUBLISHER_UPDATE = "PUBLISHER_UPDATE"

	E_BLOG_POST_CREATE = "BLOG_POST_CREATE"
	E_BLOG_POST_UPDATE = "BLOG_POST_UPDATE"
	E_BLOG_POST_DELETE = "BLOG_POST_DELETE"

	E_TWEET_CREATE = "TWEET_CREATE"
	E_TWEET_UPDATE = "TWEET_UPDATE"
	E_TWEET_DELETE = "TWEET_DELETE"
)

Variables

This section is empty.

Functions

func CloseEmitter added in v1.2.3

func CloseEmitter(ctx context.Context)

Types

type BufferedEmitter

type BufferedEmitter struct {
	// contains filtered or unexported fields
}

func InitEmitter added in v1.2.3

func InitEmitter() (*BufferedEmitter, error)

func NewBufferedEmitter

func NewBufferedEmitter(size int, handlers ...EventHandler) (*BufferedEmitter, error)

func (*BufferedEmitter) Emit

func (e *BufferedEmitter) Emit(events ...Event)

func (*BufferedEmitter) Shutdown

func (e *BufferedEmitter) Shutdown()

type Event

type Event struct {
	ID                  string                 `json:"id"`
	Type                string                 `json:"type"`
	ReplicationLocation string                 `json:"rloc"`
	Payload             map[string]interface{} `json:"payload"`
}

func BlogPostCreateEvent added in v1.2.2

func BlogPostCreateEvent(p *models.BlogPost) Event

func BlogPostDeleteEvent added in v1.2.2

func BlogPostDeleteEvent(p *models.BlogPost) Event

func BlogPostUpdateEvent added in v1.2.2

func BlogPostUpdateEvent(p *models.BlogPost) Event

func CollectionContentUnitsChangeEvent

func CollectionContentUnitsChangeEvent(c *models.Collection) Event

func CollectionCreateEvent

func CollectionCreateEvent(c *models.Collection) Event

func CollectionDeleteEvent

func CollectionDeleteEvent(c *models.Collection) Event

func CollectionPublishedChangeEvent

func CollectionPublishedChangeEvent(c *models.Collection) Event

func CollectionUpdateEvent

func CollectionUpdateEvent(c *models.Collection) Event

func ContentUnitCreateEvent

func ContentUnitCreateEvent(cu *models.ContentUnit) Event

func ContentUnitDeleteEvent added in v1.0.0

func ContentUnitDeleteEvent(cu *models.ContentUnit) Event

func ContentUnitDerivativesChangeEvent

func ContentUnitDerivativesChangeEvent(cu *models.ContentUnit) Event

func ContentUnitPersonsChangeEvent

func ContentUnitPersonsChangeEvent(cu *models.ContentUnit) Event

func ContentUnitPublishedChangeEvent

func ContentUnitPublishedChangeEvent(cu *models.ContentUnit) Event

func ContentUnitPublishersChangeEvent added in v0.9.2

func ContentUnitPublishersChangeEvent(cu *models.ContentUnit) Event

func ContentUnitSourcesChangeEvent

func ContentUnitSourcesChangeEvent(cu *models.ContentUnit) Event

func ContentUnitTagsChangeEvent

func ContentUnitTagsChangeEvent(cu *models.ContentUnit) Event

func ContentUnitUpdateEvent

func ContentUnitUpdateEvent(cu *models.ContentUnit) Event

func FileInsertEvent

func FileInsertEvent(f *models.File, insertType string) Event

func FilePublishedEvent

func FilePublishedEvent(f *models.File) Event

func FileRemoveEvent added in v1.0.1

func FileRemoveEvent(f *models.File) Event

func FileReplaceEvent

func FileReplaceEvent(oldFile *models.File, newFile *models.File, insertType string) Event

func FileUpdateEvent

func FileUpdateEvent(f *models.File) Event

func PersonCreateEvent

func PersonCreateEvent(p *models.Person) Event

func PersonDeleteEvent added in v0.9.2

func PersonDeleteEvent(p *models.Person) Event

func PersonUpdateEvent

func PersonUpdateEvent(p *models.Person) Event

func PublisherCreateEvent added in v0.9.2

func PublisherCreateEvent(p *models.Publisher) Event

func PublisherUpdateEvent added in v0.9.2

func PublisherUpdateEvent(p *models.Publisher) Event

func SourceCreateEvent

func SourceCreateEvent(s *models.Source) Event

func SourceUpdateEvent

func SourceUpdateEvent(s *models.Source) Event

func TagCreateEvent

func TagCreateEvent(t *models.Tag) Event

func TagUpdateEvent

func TagUpdateEvent(t *models.Tag) Event

func TweetCreateEvent added in v1.2.2

func TweetCreateEvent(t *models.TwitterTweet) Event

func TweetDeleteEvent added in v1.2.2

func TweetDeleteEvent(t *models.TwitterTweet) Event

func TweetUpdateEvent added in v1.2.2

func TweetUpdateEvent(t *models.TwitterTweet) Event

type EventEmitter

type EventEmitter interface {
	Emit(...Event)
}

type EventHandler

type EventHandler interface {
	Handle(Event)
	Close(context.Context) error
}

type LoggerEventHandler

type LoggerEventHandler struct{}

func (*LoggerEventHandler) Close added in v1.2.4

func (eh *LoggerEventHandler) Close(ctx context.Context) error

func (*LoggerEventHandler) Handle

func (eh *LoggerEventHandler) Handle(event Event)

type NatsStreamingEventHandler

type NatsStreamingEventHandler struct {
	// contains filtered or unexported fields
}

func NewNatsStreamingEventHandler

func NewNatsStreamingEventHandler(subject, clusterID, clientID string,
	options ...stan.Option) (*NatsStreamingEventHandler, error)

func (*NatsStreamingEventHandler) Close

func (*NatsStreamingEventHandler) Handle

func (eh *NatsStreamingEventHandler) Handle(event Event)

type NoopEmitter

type NoopEmitter struct{}

func (*NoopEmitter) Emit

func (e *NoopEmitter) Emit(event ...Event)

Jump to

Keyboard shortcuts

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