utsm

package
v0.0.0-...-1d4abbb Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

utsm is the Unconfirmed Transaction State Manager. These types of transactions do not necessarily have a single destination but rather multiple destinations. Using this library, we setup a simple pub-sub model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager handles subscriptions and publications. Each manager is thread-safe

func NewManager

func NewManager(options ...ManagerOption) *Manager

NewManager initializes a manager's internals. Do not allocate a struct of the manager directly.

func (*Manager) Publish

func (m *Manager) Publish(id int, data interface{})

func (*Manager) Subscribe

func (m *Manager) Subscribe(start int, end int, options ...SubscriberOption) ([]interface{}, error)

Subscribe receives data meant for ids that fall between the start and end range.

type ManagerOption

type ManagerOption func(m *Manager)

ManagerOption are function passed to NewManager to configure the manager

func DefaultSubscriberLastReceivedTimeout

func DefaultSubscriberLastReceivedTimeout(timeout time.Duration) ManagerOption

DefaultSubscriberTimeout option sets a a timeout period when we have not received any packages to a subscriber for the timeout period

func DefaultSubscriberTimeout

func DefaultSubscriberTimeout(timeout time.Duration) ManagerOption

DefaultSubscriberTimeout option sets a a timeout period when we have not received any packages to a subscriber for the timeout period

type SubscriberOption

type SubscriberOption func(s *subscriber)

SubscriberOption are options passed to a particular subscribe function

Jump to

Keyboard shortcuts

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