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
Name | Description |
---|---|
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. |
Mutex | A 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. |
RemoteChannelClient | A 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. |
RemoteChannelServer | A 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. |
Semaphore | A 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. |
WaitGroup | A 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
Name | Description |
---|---|
Channel | 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. |
ChannelError | undocumented |
CrossChannel | 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. |
Mutex | A 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. |
RemoteChannel | A 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. |
RemoteChannelClient | A 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. |
RemoteChannelServer | A 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. |
RemoteObject | RemoteObject 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. |
RemoteObjectError | undocumented |
RpcProxy | A remote procedure call proxy that can be used to perform methods on a remote object as though it is accessible locally. |
RpcProxyError | undocumented |
Semaphore | A 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. |
SemaphoreError | undocumented |
WaitGroup | A 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. |