remote

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IObjectSource

type IObjectSource interface {
	ObjectId() string
	Invoke(methodId string, args core.Args) (core.Any, error)
	SetProperty(propertyId string, value core.Any) error
	Linked(objectId string, node *Node) error
	CollectProperties() (core.KWArgs, error)
}

type Node

type Node struct {
	sync.Mutex

	Registry  *Registry
	Converter core.MessageConverter
	// contains filtered or unexported fields
}

func NewNode

func NewNode(registry *Registry) *Node

func (*Node) BroadcastMessage

func (n *Node) BroadcastMessage(objectId string, msg core.Message)

func (*Node) Close

func (n *Node) Close() error

func (*Node) Id

func (n *Node) Id() string

func (*Node) IncomingPump

func (n *Node) IncomingPump()

func (*Node) NotifyPropertyChange

func (n *Node) NotifyPropertyChange(propertyId string, value core.Any)

func (*Node) NotifySignal

func (n *Node) NotifySignal(signalId string, args core.Args)

func (*Node) RemoveNode

func (n *Node) RemoveNode()

func (*Node) SendMessage

func (n *Node) SendMessage(msg core.Message)

func (*Node) SetOutput

func (n *Node) SetOutput(out io.WriteCloser)

func (*Node) Write

func (n *Node) Write(data []byte) (int, error)

type Registry

type Registry struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Registry is the registry of remote objects. It is optimized for the retrieval of object sources A object source is registered in the registry and can be retrieved by the object id. The source can have one or more remote nodes linked to it.

func NewRegistry

func NewRegistry() *Registry

func (*Registry) AddObjectSource

func (r *Registry) AddObjectSource(source IObjectSource)

AddObjectSource adds the object source to the registry.

func (*Registry) AttachRemoteNode

func (r *Registry) AttachRemoteNode(node *Node)

AttachRemoteNode attaches the node to the registry.

func (*Registry) DetachRemoteNode

func (r *Registry) DetachRemoteNode(node *Node)

DetachRemoteNode removes the link between the object and the node.

func (*Registry) GetObjectSource

func (r *Registry) GetObjectSource(objectId string) IObjectSource

GetObjectSource returns the object source by name.

func (*Registry) GetRemoteNodes

func (r *Registry) GetRemoteNodes(objectId string) []*Node

GetRemoteNode returns the node that is linked to the object.

func (*Registry) Id

func (r *Registry) Id() string

func (*Registry) IsRegistered

func (r *Registry) IsRegistered(objectId string) bool

Checks if the object is registered.

func (*Registry) LinkRemoteNode

func (r *Registry) LinkRemoteNode(objectId string, node *Node)

LinkRemoteNode adds a link between the object and the node.

func (*Registry) NotifyPropertyChange

func (e *Registry) NotifyPropertyChange(objectId string, kwargs core.KWArgs)

func (*Registry) NotifySignal added in v0.3.0

func (e *Registry) NotifySignal(objectId string, name string, args core.Args)

func (*Registry) RemoveObjectSource

func (r *Registry) RemoveObjectSource(source IObjectSource)

RemoveObjectSource removes the object source from the registry.

func (*Registry) SetSourceFactory

func (r *Registry) SetSourceFactory(factory SourceFactory)

SetSourceFactory sets the source factory.

func (*Registry) UnlinkRemoteNode

func (r *Registry) UnlinkRemoteNode(objectId string, node *Node)

UnlinkRemoteNode removes the link between the object and the node.

type SourceFactory

type SourceFactory func(objectId string) IObjectSource

type SourceToNodeEntry

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

Jump to

Keyboard shortcuts

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