flux

package
v0.0.0-...-c665954 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2018 License: MIT Imports: 4 Imported by: 0

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 Notif

type Notif interface {
	IsNotif()
}

type NotifPayload

type NotifPayload struct {
	Type Notif
	Done chan struct{}
	Data interface{}
}

type Notifier

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

func NewNotifier

func NewNotifier() *Notifier

func (*Notifier) Delete

func (s *Notifier) Delete(c chan NotifPayload)

func (*Notifier) Notify

func (s *Notifier) Notify(object interface{}, notif Notif, data interface{}) (done chan struct{})

Notify sends the notif notification to all subscribers of that notification for object. If object is nil, the notification is sent to all subscribers.

func (*Notifier) Watch

func (s *Notifier) Watch(object interface{}, notifs ...Notif) chan NotifPayload

Watch returns a channel subscribed to reveive notifs notifications about object. If object is nil, the subscription is for all objects in the store.

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(object interface{}, notif Notif, data interface{}) (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(object interface{}, notif Notif)

Notify sends the notif notification to all subscribers of that notification for object. If object is nil, the notification is sent to all subscribers.

func (*Payload) NotifyWithData

func (p *Payload) NotifyWithData(object interface{}, notif Notif, data interface{})

func (*Payload) Wait

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

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

type Store

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

func (*Store) Init

func (s *Store) Init(si StoreInterface)

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 View

type View struct {
	vecty.Core
	Ctx    context.Context
	App    AppInterface
	Notifs []chan NotifPayload
	Self   ViewInterface
	// contains filtered or unexported fields
}

func NewView

func NewView(ctx context.Context, self ViewInterface, app AppInterface) *View

func (*View) Receive

func (v *View) Receive(notif NotifPayload)

func (*View) Render

func (v *View) Render() vecty.ComponentOrHTML

func (*View) Unmount

func (v *View) Unmount()

func (*View) Watch

func (v *View) Watch(object interface{}, notifs ...Notif)

type ViewInterface

type ViewInterface interface {
	vecty.Component
	Receive(notif NotifPayload)
}

type Waiter

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

Waiter waits for all signals to fire before signalling a done channel

func (*Waiter) Add

func (w *Waiter) Add(wait chan struct{})

Add a signal to the list

func (*Waiter) Go

func (w *Waiter) Go(done chan struct{})

Go starts a gorouting that waits for all siglals before signalling the done channel.

type WatcherInterface

type WatcherInterface interface {
	// Watch returns a channel subscribed to reveive notifs notifications about
	// object. If object is nil, the subscription is for all objects in the
	// store.
	Watch(object interface{}, notif ...Notif) chan NotifPayload
	Delete(c chan NotifPayload)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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