Class BackgroundSip<TChildProxy, TChildServer>
- Namespace
- MarymoorStudios.Core.Rpc
- Assembly
- MarymoorStudios.Core.Rpc.dll
A Software Isolated Process (Sip) that runs in a background thread.
public sealed class BackgroundSip<TChildProxy, TChildServer> : IPromiseDisposable where TChildProxy : Proxy<TChildServer>, IProxy<TChildProxy, TChildServer> where TChildServer : AServer<TChildServer>
Type Parameters
TChildProxy
TChildServer
- Inheritance
-
BackgroundSip<TChildProxy, TChildServer>
- Implements
- Inherited Members
Remarks
A BackgroundSip<TChildProxy, TChildServer> executes as a separate isolated container with its own Scheduler and lifetime on its own background thread.
The only way to communicate with a BackgroundSip<TChildProxy, TChildServer> is through a proxy to its root object. Each BackgroundSip<TChildProxy, TChildServer> begins its lifetime with an established shared-memory channel between itself and its parent Sip. A BackgroundSip<TChildProxy, TChildServer>'s parent can control its lifetime through its CancellationToken. The parent establishes the root object during the creation process, and the root's proxy is made available to the parent as part of initialization.
Any other objects that live within the isolation boundary of the BackgroundSip<TChildProxy, TChildServer> must be created indirectly through a request made on the root object. The lifetime of all such objects are managed by the internal state of BackgroundSip<TChildProxy, TChildServer> including its comm system, the state of all objects reachable from it (including the root object).
Properties
Root
A proxy to the root object exported by the child sip.
public TChildProxy Root { get; }
Property Value
- TChildProxy
Methods
Create(UserIdentity?, UserIdentity?, MemoryPool<byte>, Func<UserIdentity?, MemoryPool<byte>, ILoggerFactory, Resolver<TChildServer>, CancellationToken, Promise>, ILoggerFactory?)
Creates a new background sip.
public static BackgroundSip<TChildProxy, TChildServer> Create(UserIdentity? localIdentity, UserIdentity? remoteIdentity, MemoryPool<byte> pool, Func<UserIdentity?, MemoryPool<byte>, ILoggerFactory, Resolver<TChildServer>, CancellationToken, Promise> init, ILoggerFactory? loggerFactory = null)
Parameters
localIdentity
UserIdentityThe user identity of this sip.
remoteIdentity
UserIdentityThe user identity of the background sip.
pool
MemoryPool<byte>A memory pool.
init
Func<UserIdentity, MemoryPool<byte>, ILoggerFactory, Resolver<TChildServer>, CancellationToken, Promise>A factory for the new root object.
loggerFactory
ILoggerFactoryThe logging factory.
Returns
- BackgroundSip<TChildProxy, TChildServer>
The background sip.
Create(UserIdentity?, UserIdentity?, MemoryPool<byte>, Func<CancellationToken, TChildProxy>, ILoggerFactory?)
Creates a new background sip.
public static BackgroundSip<TChildProxy, TChildServer> Create(UserIdentity? localIdentity, UserIdentity? remoteIdentity, MemoryPool<byte> pool, Func<CancellationToken, TChildProxy> init, ILoggerFactory? loggerFactory = null)
Parameters
localIdentity
UserIdentityThe user identity of this sip.
remoteIdentity
UserIdentityThe user identity of the background sip.
pool
MemoryPool<byte>A memory pool.
init
Func<CancellationToken, TChildProxy>A factory for the new root object.
loggerFactory
ILoggerFactoryThe logging factory.
Returns
- BackgroundSip<TChildProxy, TChildServer>
The background sip.
Create<TArg>(UserIdentity?, UserIdentity?, MemoryPool<byte>, Func<UserIdentity?, MemoryPool<byte>, ILoggerFactory, TArg, Resolver<TChildServer>, CancellationToken, Promise>, TArg, ILoggerFactory?)
Creates a new background sip.
public static BackgroundSip<TChildProxy, TChildServer> Create<TArg>(UserIdentity? localIdentity, UserIdentity? remoteIdentity, MemoryPool<byte> pool, Func<UserIdentity?, MemoryPool<byte>, ILoggerFactory, TArg, Resolver<TChildServer>, CancellationToken, Promise> init, TArg arg, ILoggerFactory? loggerFactory = null)
Parameters
localIdentity
UserIdentityThe user identity of this sip.
remoteIdentity
UserIdentityThe user identity of the background sip.
pool
MemoryPool<byte>A memory pool.
init
Func<UserIdentity, MemoryPool<byte>, ILoggerFactory, TArg, Resolver<TChildServer>, CancellationToken, Promise>A factory for the new root object.
arg
TArgA serializable argument to marshall to the init function.
loggerFactory
ILoggerFactoryThe logging factory.
Returns
- BackgroundSip<TChildProxy, TChildServer>
The background sip.
Type Parameters
TArg
The type of the serializable argument to marshall to the init function.
Create<TArg>(UserIdentity?, UserIdentity?, MemoryPool<byte>, Func<TArg, CancellationToken, TChildProxy>, TArg, ILoggerFactory?)
Creates a new background sip.
public static BackgroundSip<TChildProxy, TChildServer> Create<TArg>(UserIdentity? localIdentity, UserIdentity? remoteIdentity, MemoryPool<byte> pool, Func<TArg, CancellationToken, TChildProxy> init, TArg arg, ILoggerFactory? loggerFactory = null)
Parameters
localIdentity
UserIdentityThe user identity of this sip.
remoteIdentity
UserIdentityThe user identity of the background sip.
pool
MemoryPool<byte>A memory pool.
init
Func<TArg, CancellationToken, TChildProxy>A factory for the new root object.
arg
TArgA serializable argument to marshall to the init function.
loggerFactory
ILoggerFactoryThe logging factory.
Returns
- BackgroundSip<TChildProxy, TChildServer>
The background sip.
Type Parameters
TArg
The type of the serializable argument to marshall to the init function.
Create<TParentProxy, TParentServer>(UserIdentity?, UserIdentity?, MemoryPool<byte>, Func<UserIdentity?, MemoryPool<byte>, ILoggerFactory, TParentProxy, Resolver<TChildServer>, CancellationToken, Promise>, TParentProxy, ILoggerFactory?)
Creates a new background sip.
public static BackgroundSip<TChildProxy, TChildServer> Create<TParentProxy, TParentServer>(UserIdentity? localIdentity, UserIdentity? remoteIdentity, MemoryPool<byte> pool, Func<UserIdentity?, MemoryPool<byte>, ILoggerFactory, TParentProxy, Resolver<TChildServer>, CancellationToken, Promise> init, TParentProxy parent, ILoggerFactory? loggerFactory = null) where TParentProxy : Proxy<TParentServer>, IProxy<TParentProxy, TParentServer> where TParentServer : AServer<TParentServer>
Parameters
localIdentity
UserIdentityThe user identity of this sip.
remoteIdentity
UserIdentityThe user identity of the background sip.
pool
MemoryPool<byte>A memory pool.
init
Func<UserIdentity, MemoryPool<byte>, ILoggerFactory, TParentProxy, Resolver<TChildServer>, CancellationToken, Promise>A factory for the new root object.
parent
TParentProxyA capability for the new sip to access the parent.
loggerFactory
ILoggerFactoryThe logging factory.
Returns
- BackgroundSip<TChildProxy, TChildServer>
The background sip.
Type Parameters
TParentProxy
The proxy type of the object exported by the parent to the new sip.
TParentServer
The server type of the object exported by the parent to the new sip.
Create<TParentProxy, TParentServer>(UserIdentity?, UserIdentity?, MemoryPool<byte>, Func<TParentProxy, CancellationToken, TChildProxy>, TParentProxy, ILoggerFactory?)
Creates a new background sip.
public static BackgroundSip<TChildProxy, TChildServer> Create<TParentProxy, TParentServer>(UserIdentity? localIdentity, UserIdentity? remoteIdentity, MemoryPool<byte> pool, Func<TParentProxy, CancellationToken, TChildProxy> init, TParentProxy parent, ILoggerFactory? loggerFactory = null) where TParentProxy : Proxy<TParentServer>, IProxy<TParentProxy, TParentServer> where TParentServer : AServer<TParentServer>
Parameters
localIdentity
UserIdentityThe user identity of this sip.
remoteIdentity
UserIdentityThe user identity of the background sip.
pool
MemoryPool<byte>A memory pool.
init
Func<TParentProxy, CancellationToken, TChildProxy>A factory for the new root object.
parent
TParentProxyA capability for the new sip to access the parent.
loggerFactory
ILoggerFactoryThe logging factory.
Returns
- BackgroundSip<TChildProxy, TChildServer>
The background sip.
Type Parameters
TParentProxy
The proxy type of the object exported by the parent to the new sip.
TParentServer
The server type of the object exported by the parent to the new sip.
DisposeAsync()
public Promise DisposeAsync()