pubsub

package
v0.0.0-...-7f3d85a Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FixedDirName

func FixedDirName(name string) string

func PersistentDirName

func PersistentDirName(name string) string

func PubDirName

func PubDirName(name string) string

func PublishToDir

func PublishToDir(dirName string, key string, item interface{}) error

One shot create directory and publish one key in that directory

func SockName

func SockName(name string) string

func TypeToName

func TypeToName(something interface{}) string

func WriteRename

func WriteRename(fileName string, b []byte) error

Types

type LockedStringMap

type LockedStringMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewLockedStringMap

func NewLockedStringMap() *LockedStringMap

func (*LockedStringMap) Delete

func (sm *LockedStringMap) Delete(key string)

func (*LockedStringMap) Load

func (sm *LockedStringMap) Load(key string) (value interface{}, ok bool)

func (*LockedStringMap) Range

func (sm *LockedStringMap) Range(callback fn)

func (*LockedStringMap) Store

func (sm *LockedStringMap) Store(key string, value interface{})

type Publication

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

func Publish

func Publish(agentName string, topicType interface{}) (*Publication, error)

func PublishPersistent

func PublishPersistent(agentName string, topicType interface{}) (*Publication, error)

func PublishScope

func PublishScope(agentName string, agentScope string, topicType interface{}) (*Publication, error)

func (*Publication) ClearRestarted

func (pub *Publication) ClearRestarted() error

func (*Publication) Get

func (pub *Publication) Get(key string) (interface{}, error)

func (*Publication) GetAll

func (pub *Publication) GetAll() map[string]interface{}

Enumerate all the key, value for the collection

func (*Publication) Publish

func (pub *Publication) Publish(key string, item interface{}) error

func (*Publication) SignalRestarted

func (pub *Publication) SignalRestarted() error

func (*Publication) Unpublish

func (pub *Publication) Unpublish(key string) error

type SubDeleteHandler

type SubDeleteHandler func(ctx interface{}, key string, status interface{})

type SubModifyHandler

type SubModifyHandler func(ctx interface{}, key string, status interface{})

type SubRestartHandler

type SubRestartHandler func(ctx interface{}, restarted bool)

type Subscription

type Subscription struct {
	C                   <-chan string
	ModifyHandler       SubModifyHandler
	DeleteHandler       SubDeleteHandler
	RestartHandler      SubRestartHandler
	SynchronizedHandler SubRestartHandler
	// contains filtered or unexported fields
}

func Subscribe

func Subscribe(agentName string, topicType interface{}, activate bool,
	ctx interface{}) (*Subscription, error)

Init function for Subscribe; returns a context. Assumption is that agent with call Get(key) later or specify handleModify and/or handleDelete functions watch ensures that any restart/restarted notification is after any other notifications from ReadDir

func SubscribePersistent

func SubscribePersistent(agentName string, topicType interface{}, activate bool,
	ctx interface{}) (*Subscription, error)

func SubscribeScope

func SubscribeScope(agentName string, agentScope string, topicType interface{},
	activate bool, ctx interface{}) (*Subscription, error)

func (*Subscription) Activate

func (sub *Subscription) Activate() error

If the agentName is empty we interpret that as being dir /var/tmp/zededa

func (*Subscription) Get

func (sub *Subscription) Get(key string) (interface{}, error)

func (*Subscription) GetAll

func (sub *Subscription) GetAll() map[string]interface{}

Enumerate all the key, value for the collection

func (*Subscription) ProcessChange

func (sub *Subscription) ProcessChange(change string)

We handle both subscribeFromDir and subscribeFromSock Note that change filename includes .json for subscribeFromDir. That is removed by HandleStatusEvent.

func (*Subscription) Restarted

func (sub *Subscription) Restarted() bool

func (*Subscription) Synchronized

func (sub *Subscription) Synchronized() bool

Jump to

Keyboard shortcuts

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