remote

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 7 Imported by: 2

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 MockSource added in v0.4.0

type MockSource struct {
	Id                       string
	Messages                 core.Message
	InvokeHandler            func(methodId string, args core.Args) (core.Any, error)
	SetPropertyHandler       func(propertyId string, value core.Any) error
	LinkedHandler            func(objectId string, node *Node) error
	CollectPropertiesHandler func() (core.KWArgs, error)
}

func NewMockSource added in v0.4.0

func NewMockSource(id string) *MockSource

func (*MockSource) CollectProperties added in v0.4.0

func (s *MockSource) CollectProperties() (core.KWArgs, error)

func (*MockSource) Invoke added in v0.4.0

func (s *MockSource) Invoke(methodId string, args core.Args) (core.Any, error)

func (*MockSource) Linked added in v0.4.0

func (s *MockSource) Linked(objectId string, node *Node) error

func (*MockSource) ObjectId added in v0.4.0

func (s *MockSource) ObjectId() string

func (*MockSource) SetProperty added in v0.4.0

func (s *MockSource) SetProperty(propertyId string, value core.Any) error

type MockWriteCloser added in v0.4.0

type MockWriteCloser struct {
	Messages     [][]byte
	WriteHandler func(p []byte) (n int, err error)
	Closed       bool
	CloseHandler func() error
}

func NewMockWriteCloser added in v0.4.0

func NewMockWriteCloser() *MockWriteCloser

func (*MockWriteCloser) Close added in v0.4.0

func (m *MockWriteCloser) Close() error

func (*MockWriteCloser) Write added in v0.4.0

func (m *MockWriteCloser) Write(p []byte) (n int, err error)

type Node

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

func NewNode

func NewNode(registry *Registry) *Node

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) Registry

func (n *Node) Registry() *Registry

func (*Node) RemoveNode

func (n *Node) RemoveNode()

func (*Node) SendMessage

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

func (*Node) SendPropertyChange added in v0.5.0

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

func (*Node) SendSignal added in v0.5.0

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

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 {
	// 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

NewRegistry creates a new registry.

func (*Registry) AddObjectSource

func (r *Registry) AddObjectSource(source IObjectSource) error

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

Id returns the registry id.

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 (r *Registry) NotifyPropertyChange(objectId string, kwargs core.KWArgs)

NotifyPropertyChange notifies the property change to the nodes.

func (*Registry) NotifySignal added in v0.3.0

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

NotifySignal notifies the signal to the nodes that are linked to the object.

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

Jump to

Keyboard shortcuts

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