in10n

package
v1.202405300917.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrChannelDoesNotExist = errors.New("channel does not exist")
View Source
var ErrQuotaExceeded_Channels = errors.New(quotaExceededPrefix + "channels")
View Source
var ErrQuotaExceeded_ChannelsPerSubject = errors.New(quotaExceededPrefix + "channels per subject")
View Source
var ErrQuotaExceeded_Subsciptions = errors.New(quotaExceededPrefix + "subsciptions")
View Source
var ErrQuotaExceeded_SubsciptionsPerSubject = errors.New(quotaExceededPrefix + "subsciptions per subject")

Functions

This section is empty.

Types

type ChannelID

type ChannelID string

type IN10nBroker

type IN10nBroker interface {

	// Errors: ErrQuotaExceeded_Channels*
	// @ConcurrentAccess
	NewChannel(subject istructs.SubjectLogin, channelDuration time.Duration) (channelID ChannelID, err error)

	// ChannelID must be taken from NewChannel()
	// Errors: ErrChannelDoesNotExist, ErrQuotaExceeded_Subsciptions*
	// @ConcurrentAccess
	Subscribe(channelID ChannelID, projection ProjectionKey) (err error)

	// Channel with ChannelID must exist (panic)
	// If channelDuration expired WatchChannel terminates
	// When WatchChannel enters/exits Metrics must be updated
	// It is not guaranteed that all offsets from Update() comes to `notifySubscriber` callback, some can be missed
	// If ctx is Done function must exit
	// @ConcurrentAccess
	WatchChannel(ctx context.Context, channelID ChannelID, notifySubscriber func(projection ProjectionKey, offset istructs.Offset))

	// This method MUST NOT BLOCK longer than 500 ns
	// Updates all channels which subscribed for this projection
	// @ConcurrentAccess
	Update(projection ProjectionKey, offset istructs.Offset)

	// ChannelID must be taken from NewChannel()
	// Errors: ErrChannelDoesNotExist
	// @ConcurrentAccess
	Unsubscribe(channelID ChannelID, projection ProjectionKey) (err error)

	// @ConcurrentAccess
	MetricNumChannels() int
	// @ConcurrentAccess
	MetricNumSubcriptions() int
	// @ConcurrentAccess
	MetricSubject(ctx context.Context, cb func(subject istructs.SubjectLogin, numChannels int, numSubscriptions int))
}

Design: N10n https://dev.heeus.io/launchpad/#!13813 This interface is provided only once per process Provide() must have a parameter of Quotas type Workflow (ref. https://golang.org/ref/spec for syntax):

???/n10n/channel: NewChannel() {Subscribe()} WatchChannel()
???/n10n/subscribe: Subscribe()
???/n10n/unsubscribe: Unsubscribe()

type ProjectionKey

type ProjectionKey struct {
	App        istructs.AppQName
	Projection appdef.QName
	WS         istructs.WSID
}

type Quotas

type Quotas struct {
	Channels                int
	ChannelsPerSubject      int
	Subscriptions           int
	SubscriptionsPerSubject int
}

type SubscriptionID

type SubscriptionID string

Jump to

Keyboard shortcuts

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