GrainService Class

Definition

Base class for implementing a grain-like partitioned service with per silo instances of it automatically instantiated and started by silo runtime

public abstract class GrainService : Orleans.Runtime.SystemTarget, Orleans.Services.IGrainService
type GrainService = class
    inherit SystemTarget
    interface IGrainService
    interface ISystemTarget
    interface IAddressable
Public MustInherit Class GrainService
Inherits SystemTarget
Implements IGrainService
Inheritance
GrainService
Implements

Constructors

GrainService()

Only to make Reflection happy. Do not use it in your implementation

GrainService(GrainId, Silo, ILoggerFactory)

Constructor to use for grain services

GrainService(IGrainIdentity, Silo, IGrainServiceConfiguration)

Constructor to use for grain services

GrainService(IGrainIdentity, Silo, ILoggerFactory)

Constructor to use for grain services

Properties

ActivationServices

Gets the IServiceProvider that provides access to the grain activation's service container.

(Inherited from SystemTarget)
Config

Configuration of service

Deactivated

Gets the Task which completes when the grain has deactivated.

(Inherited from SystemTarget)
GrainId

Gets the grain identity.

(Inherited from SystemTarget)
GrainReference

Gets a reference to this grain.

(Inherited from SystemTarget)
IsLowPriority (Inherited from SystemTarget)
Logger

Logger instance to be used by grain service subclasses

RangeSerialNumber

Gets the monotonically increasing serial number of the version of the ring range owned by the grain service instance

RingRange

Gets the range of the partitioning ring currently owned by the grain service instance

Scheduler

Gets the scheduler.

(Inherited from SystemTarget)
Silo

Silo address of the system target.

(Inherited from SystemTarget)
Status

Gets the status of the grain service instance

StoppedCancellationTokenSource

Gets the token for signaling cancellation upon stopping of grain service

Methods

Activate(Dictionary<String,Object>, Nullable<CancellationToken>)

Start activating this instance.

(Inherited from SystemTarget)
Deactivate(DeactivationReason, Nullable<CancellationToken>)

Start deactivating this instance.

(Inherited from SystemTarget)
Dispose() (Inherited from SystemTarget)
GetComponent<TComponent>()

Gets the component with the specified type.

(Inherited from SystemTarget)
GetExtension<TExtensionInterface>()

Returns the grain extension registered for the provided TExtensionInterface.

(Inherited from SystemTarget)
GetGrainReference()
GetOrSetExtension<TExtension,TExtensionInterface>(Func<TExtension>)

Binds an extension to an addressable object, if not already done.

(Inherited from SystemTarget)
GetTarget<TTarget>()

Gets the target.

(Inherited from SystemTarget)
Init(IServiceProvider)

Invoked upon initialization of the service

Migrate(Dictionary<String,Object>, Nullable<CancellationToken>) (Inherited from SystemTarget)
OnRangeChange(IRingRange, IRingRange, Boolean)

Invoked when the ring range owned by the service instance changes because of a change in the cluster state

ReceiveMessage(Object)

Submits an incoming message to this instance.

(Inherited from SystemTarget)
RegisterTimer(Func<Object,Task>, Object, TimeSpan, TimeSpan, String)

Registers a timer to send regular callbacks to this grain. This timer will keep the current grain from being deactivated.

(Inherited from SystemTarget)
Rehydrate(IRehydrationContext) (Inherited from SystemTarget)
SetComponent<TComponent>(TComponent)

Sets the provided value as the component for type TComponent.

(Inherited from SystemTarget)
Start()

Invoked when service is being started

StartInBackground()

Deferred part of initialization that executes after the service is already started (to speed up startup). Sets Status to Started.

Stop()

Invoked when service is being stopped

ToString()

Override of object.ToString()

(Inherited from SystemTarget)

Explicit Interface Implementations

IEquatable<IGrainContext>.Equals(IGrainContext) (Inherited from SystemTarget)
IFormattable.ToString(String, IFormatProvider) (Inherited from SystemTarget)
IGrainContext.ActivationId

Gets the activation id.

(Inherited from SystemTarget)
IGrainContext.Address

Gets the activation address.

(Inherited from SystemTarget)
IGrainContext.GrainInstance

Gets the grain instance, or null if the grain instance has not been set yet.

(Inherited from SystemTarget)
IGrainContext.ObservableLifecycle

Gets the observable Grain lifecycle, which can be used to add lifecycle hooks.

(Inherited from SystemTarget)
ISpanFormattable.TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider) (Inherited from SystemTarget)
ITargetHolder.GetComponent<TComponent>()

Gets the component with the specified type.

(Inherited from SystemTarget)

Extension Methods

GetGrainExtension<TComponent>(IGrainContext)

Used by generated code for IGrainExtension interfaces.

AsReference(IAddressable, Type)

Returns a typed reference to the provided grain.

AsReference<TGrainInterface>(IAddressable)

Returns a typed reference to the provided grain.

BindGrainReference(IAddressable, IGrainFactory)

Binds the grain reference to the provided IGrainFactory.

Cast(IAddressable, Type)

Returns a typed reference to the provided grain.

Cast<TGrainInterface>(IAddressable)

Returns a typed reference to the provided grain.

GetGrainId(IAddressable)

Returns the grain id corresponding to the provided grain.

GetPrimaryKey(IAddressable)

Returns the Guid representation of a grain primary key.

GetPrimaryKey(IAddressable, String)

Returns the Guid representation of a grain primary key.

GetPrimaryKeyLong(IAddressable)

Returns the long representation of a grain primary key.

GetPrimaryKeyLong(IAddressable, String)

Returns the long representation of a grain primary key.

GetPrimaryKeyString(IAddressable)

Returns the string primary key of the grain.

IsPrimaryKeyBasedOnLong(IAddressable)

Returns whether part of the primary key is of type long.

DeactivateAsync(IGrainContext, DeactivationReason, Nullable<CancellationToken>)

Deactivates the provided grain.

ScheduleTask(SystemTarget, Action)

Schedules the provided action on the SystemTarget's Orleans.Runtime.ISchedulingContext.

ScheduleTask(SystemTarget, Func<Task>)

Schedules the provided action on the SystemTarget's Orleans.Runtime.ISchedulingContext.

ScheduleTask<T>(SystemTarget, Func<Task<T>>)

Schedules the provided action on the SystemTarget.

Applies to