Skip to main content

package @rimbu/channel

The @rimbu/channel package provides various channel implementations in the spirit of Go. Channels are ways to exechange synchronous messages in an asynchronous context.

See the Rimbu docs Channel API page for more information.

Interfaces

NameDescription
Channel<T>A Rimbu Channel offers various ways to synchronize communication between asynchronous processes. These processes can send and receive messages in a blocking way. Channel messages are of type T, and channels can be buffered or unbuffered. A buffered channel can queue a given amount of messages before blocking the sender.
CrossChannel<TSend,TReceive>A CrossChannel is a channel of which the send and receive modules are not internally connected. This means that the send and receive message types can also differ. A normal Channel can receive its own message, but a CrossChannel cannot, and so they are usually created in pairs to perform bidirectional communication with some other entity.
MutexA Mutex is used to restrict access to a shared resource in a concurrent environment. The Mutex can be used to acquire a lock for the resource, preventing others using the Mutext from accessing the resource. When finished using the resource, the lock can be released, allowing other waiting processes to acquire a lock.
RemoteChannelClientA RemoteChannelClient allows creating channels to communicate with a RemoteChannelServer. The server should be configured to listen to channels with the channel ids provided to the channel creation functions in the client.
RemoteChannelServerA RemoteChannel server communicates with a RemoteChannel client through the given message port, and allows clients to easily create new channels to communicate with processes in the server context. The server needs to set up handlers to deal with the created channels.
RpcProxy<T>A remote procedure call proxy that can be used to perform methods on a remote object as though it is accessible locally.
SemaphoreA Semaphore is a generalized version of a Mutex, allowing boundaries on the amount of concurrent processes that can have simultaneous access to a shared resource. The semaphore is weighted, meaning that the semaphore has a maximum size/capacity available for the shared resources. When acquiring the resource, a weight can be provided allowing more intensive tasks to acquire a larger share of the shared resource, preventing too many other tasks from also acquiring the resource.
WaitGroupA WaitGroup is a way to perform fork-join logic in an asynchronous context. It allows a process to create an arbitrary amount of sub-processes, and wait for all of them to finish before continuing.

Namespaces

NameDescription
ChannelA Rimbu Channel offers various ways to synchronize communication between asynchronous processes. These processes can send and receive messages in a blocking way. Channel messages are of type T, and channels can be buffered or unbuffered. A buffered channel can queue a given amount of messages before blocking the sender.
ChannelErrorundocumented
CrossChannelA CrossChannel is a channel of which the send and receive modules are not internally connected. This means that the send and receive message types can also differ. A normal Channel can receive its own message, but a CrossChannel cannot, and so they are usually created in pairs to perform bidirectional communication with some other entity.
MutexA Mutex is used to restrict access to a shared resource in a concurrent environment. The Mutex can be used to acquire a lock for the resource, preventing others using the Mutext from accessing the resource. When finished using the resource, the lock can be released, allowing other waiting processes to acquire a lock.
RemoteChannelA RemoteChannel is a channel that communicates through a message port of the RemoteChannel.SimpleMessagePort type. This makes it usable for cross-environment channel communication, e.g. cross threads or even cross network. Like CrossChannel, RemoteChannel does not receive its own sent messages, but requires another end to communicate.
RemoteChannelClientA RemoteChannelClient allows creating channels to communicate with a RemoteChannelServer. The server should be configured to listen to channels with the channel ids provided to the channel creation functions in the client.
RemoteChannelServerA RemoteChannel server communicates with a RemoteChannel client through the given message port, and allows clients to easily create new channels to communicate with processes in the server context. The server needs to set up handlers to deal with the created channels.
RemoteObjectRemoteObject offers a convenient way to retrieve data and invoke methods across a RemoteChannel. It involves setting up a remote object server that takes a given TypeScript object and allows a remote object client to perform remote calls to this object and getting the results.
RemoteObjectErrorundocumented
RpcProxyA remote procedure call proxy that can be used to perform methods on a remote object as though it is accessible locally.
RpcProxyErrorundocumented
SemaphoreA Semaphore is a generalized version of a Mutex, allowing boundaries on the amount of concurrent processes that can have simultaneous access to a shared resource. The semaphore is weighted, meaning that the semaphore has a maximum size/capacity available for the shared resources. When acquiring the resource, a weight can be provided allowing more intensive tasks to acquire a larger share of the shared resource, preventing too many other tasks from also acquiring the resource.
SemaphoreErrorundocumented
WaitGroupA WaitGroup is a way to perform fork-join logic in an asynchronous context. It allows a process to create an arbitrary amount of sub-processes, and wait for all of them to finish before continuing.