flux

package module
v0.0.0-...-0b08a93 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2018 License: MIT Imports: 2 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Multi

func Multi(cs ...chan struct{}) chan struct{}

Types

type ActionInterface

type ActionInterface interface{}

type AppInterface

type AppInterface interface {
	WatcherInterface
	DispatcherInterface
}

type Dispatcher

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

func NewDispatcher

func NewDispatcher(notifier NotifierInterface, stores ...StoreInterface) *Dispatcher

NewDispatcher creates a new dispatcher and registers the provided stores

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch(action ActionInterface) chan struct{}

Dispatch sends an action to all registered stores

func (*Dispatcher) Register

func (d *Dispatcher) Register(store StoreInterface)

Register adds a store to the dispatcher

type DispatcherInterface

type DispatcherInterface interface {
	Dispatch(action ActionInterface) chan struct{}
}

type Notifier

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

func NewNotifier

func NewNotifier() *Notifier

func (*Notifier) Delete

func (s *Notifier) Delete(key interface{})

func (*Notifier) Notify

func (s *Notifier) Notify() (done chan struct{})

func (*Notifier) Watch

func (s *Notifier) Watch(key interface{}, f func(done chan struct{}))

type NotifierInterface

type NotifierInterface interface {
	// Notify sends the notif notification to all subscribers of that
	// notification for object. If object is nil, the notification is sent to
	// all subscribers. The chanel returned is closed when the notify action
	// has finished.
	Notify() (done chan struct{})
}

type Payload

type Payload struct {
	Action ActionInterface
	Done   chan struct{}
	// contains filtered or unexported fields
}

func (*Payload) Notify

func (p *Payload) Notify()

func (*Payload) Wait

func (p *Payload) Wait(stores ...StoreInterface)

Wait is used by the store handler to wait for other stores to finish.

type StoreInterface

type StoreInterface interface {
	// Handle consumes the action in the payload. If the operation was performed syncronously,
	// return true. If not, return false and close the payload.Done channel when finished.
	Handle(payload *Payload) (finished bool)
}

type WatcherInterface

type WatcherInterface interface {
	Watch(key interface{}, f func(done chan struct{}))
	Delete(key interface{})
}

Directories

Path Synopsis
Package mock_flux is a generated GoMock package.
Package mock_flux is a generated GoMock package.

Jump to

Keyboard shortcuts

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