Show / Hide Table of Contents

Class ObjectStoreService

Implements service that stores object in proccess's memory, asynchronously saving objects to external non-volatile storage upon change and synchronously saving objects upon service stop. This service is useful for scenarious like ASP.NET volatile domain that can be torn down at any time. Note for ASP.NET uses: the key difference of this approach from .NET session state management is the fact that this service never blocks object CheckIn() operations as backing store is being updated asynchronously. This class is thread-safe unless specified otherwise on a property/method level

Inheritance
System.Object
DisposableObject
ApplicationComponent
Service
Service<System.Object>
ServiceWithInstrumentationBase<System.Object>
ObjectStoreService
Implements
IService
INamed
IObjectStoreImplementation
IObjectStore
IApplicationComponent
ILocalizedTimeProvider
System.IDisposable
IConfigurable
IInstrumentable
IExternallyParameterized
Inherited Members
ServiceWithInstrumentationBase<Object>.ExternalParameters
ServiceWithInstrumentationBase<Object>.ExternalParametersForGroups(String[])
ServiceWithInstrumentationBase<Object>.ExternalGetParameter(String, Object, String[])
ServiceWithInstrumentationBase<Object>.ExternalSetParameter(String, Object, String[])
Service<Object>.ComponentDirector
Service.CONFIG_NAME_ATTR
Service.Destructor()
Service.ApplicationDontAutoStartService
Service.Status
Service.Running
Service.Name
Service.TimeLocation
Service.LocalizedTime
Service.Configure(IConfigSectionNode)
Service.Start()
Service.SignalStop()
Service.CheckForCompleteStop()
Service.WaitForCompleteStop()
Service.AcceptManagerVisit(Object, DateTime)
Service.UniversalTimeToLocalizedTime(DateTime)
Service.LocalizedTimeToUniversalTime(DateTime)
Service.AbortStart()
Service.DoCheckForCompleteStop()
Service.CheckServiceInactive()
Service.CheckServiceActive()
Service.CheckServiceActiveOrStarting()
Service.DoAcceptManagerVisit(Object, DateTime)
Service.____ObtainPrivateServiceStatusLockObject()
ApplicationComponent.AllComponents
ApplicationComponent.GetAppComponentBySID(UInt64)
ApplicationComponent.GetAppComponentByCommonName(String)
ApplicationComponent.ComponentSID
ApplicationComponent.ComponentStartTime
DisposableObject.DisposeAndNull<T>(T)
DisposableObject.DisposeStarted
DisposableObject.Disposed
DisposableObject.EnsureObjectNotDisposed()
DisposableObject.Dispose()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: NFX.ApplicationModel.Volatile
Assembly: NFX.dll
Syntax
[ConfigMacroContext]
public class ObjectStoreService : ServiceWithInstrumentationBase<object>, IService, INamed, IObjectStoreImplementation, IObjectStore, IApplicationComponent, ILocalizedTimeProvider, IDisposable, IConfigurable, IInstrumentable, IExternallyParameterized

Constructors

ObjectStoreService()

Creates instance of the store service

Declaration
public ObjectStoreService()

ObjectStoreService(Guid)

Creates instance of the store service with the state identified by "storeGUID". Refer to "StoreGUID" property.

Declaration
public ObjectStoreService(Guid storeGUID)
Parameters
Type Name Description
System.Guid storeGUID

Fields

CONFIG_BUCKET_COUNT_ATTR

Declaration
public const string CONFIG_BUCKET_COUNT_ATTR = "bucket-count"
Field Value
Type Description
System.String

CONFIG_GUID_ATTR

Declaration
public const string CONFIG_GUID_ATTR = "guid"
Field Value
Type Description
System.String

CONFIG_OBJECT_LIFE_SPAN_MS_ATTR

Declaration
public const string CONFIG_OBJECT_LIFE_SPAN_MS_ATTR = "object-life-span-ms"
Field Value
Type Description
System.String

CONFIG_PROVIDER_SECT

Declaration
public const string CONFIG_PROVIDER_SECT = "provider"
Field Value
Type Description
System.String

DEFAULT_BUCKET_COUNT

Declaration
public const int DEFAULT_BUCKET_COUNT = 1024
Field Value
Type Description
System.Int32

DEFAULT_OBJECT_LEFESPAN_MS

Declaration
public const int DEFAULT_OBJECT_LEFESPAN_MS = 3600000
Field Value
Type Description
System.Int32

MAX_BUCKET_COUNT

Declaration
public const int MAX_BUCKET_COUNT = 65535
Field Value
Type Description
System.Int32

MIN_OBJECT_LIFESPAN_MS

Declaration
public const int MIN_OBJECT_LIFESPAN_MS = 1000
Field Value
Type Description
System.Int32

MUST_ACQUIRE_INTERVAL_MS

Declaration
public const int MUST_ACQUIRE_INTERVAL_MS = 3000
Field Value
Type Description
System.Int32

Properties

BucketCount

Specifies how many buckets objects are kept in. Increasing this number improves thread concurrency

Declaration
public int BucketCount { get; set; }
Property Value
Type Description
System.Int32

ComponentCommonName

Declaration
public override string ComponentCommonName { get; }
Property Value
Type Description
System.String
Overrides
ApplicationComponent.ComponentCommonName

InstrumentationEnabled

Implements IInstrumentable

Declaration
[Config(Default = false)]
[ExternalParameter(new string[]{"objectstore", "instrumentation"})]
public override bool InstrumentationEnabled { get; set; }
Property Value
Type Description
System.Boolean
Overrides
NFX.ServiceModel.ServiceWithInstrumentationBase<System.Object>.InstrumentationEnabled

ObjectLifeSpanMS

Specifies how long objects live without being touched before becoming evicted from the list

Declaration
[ExternalParameter(new string[]{"objectstore"})]
public int ObjectLifeSpanMS { get; set; }
Property Value
Type Description
System.Int32

Provider

References provider that persists objects

Declaration
public ObjectStoreProvider Provider { get; set; }
Property Value
Type Description
ObjectStoreProvider

StoreGUID

Returns unique identifier that identifies this particular store. This ID is used to load store's state from external medium upon start-up. One may think of this ID as of a "pointer/handle" that survives phisical object destroy/create cycle

Declaration
public Guid StoreGUID { get; set; }
Property Value
Type Description
System.Guid

Methods

CheckIn(Guid, Int32)

Puts an object back into store identified by the "key". The object is written in the provider when call count to this method equals to CheckOut(). Returns true if object with such id exists and was checked-in

Declaration
public bool CheckIn(Guid key, int msTimeout = 0)
Parameters
Type Name Description
System.Guid key
System.Int32 msTimeout
Returns
Type Description
System.Boolean

CheckIn(Guid, Object, Int32)

Puts an object reference "value" into store identified by the "key". The object is written in the provider when call count to this method equals to CheckOut()

Declaration
public void CheckIn(Guid key, object value, int msTimeout = 0)
Parameters
Type Name Description
System.Guid key
System.Object value
System.Int32 msTimeout

CheckInUnderNewKey(Guid, Guid, Object, Int32)

Puts an object reference "value" into store identified by the "oldKey" under the "newKey". If oldKey was not checked in, then checks-in under new key as normally would

Declaration
public void CheckInUnderNewKey(Guid oldKey, Guid newKey, object value, int msTimeout = 0)
Parameters
Type Name Description
System.Guid oldKey
System.Guid newKey
System.Object value
System.Int32 msTimeout

CheckOut(Guid)

Retrieves an object reference from the store identified by the "key" or returns null if such object does not exist. Object is not going to be persisted until it is checked back in the store using the same number of calls to CheckIn() for the same GUID.

Declaration
public object CheckOut(Guid key)
Parameters
Type Name Description
System.Guid key
Returns
Type Description
System.Object

Delete(Guid)

Deletes object identified by key. Returns true when object was found and marked for deletion

Declaration
public bool Delete(Guid key)
Parameters
Type Name Description
System.Guid key
Returns
Type Description
System.Boolean

DoConfigure(IConfigSectionNode)

Declaration
protected override void DoConfigure(IConfigSectionNode node)
Parameters
Type Name Description
IConfigSectionNode node
Overrides
Service.DoConfigure(IConfigSectionNode)

DoSignalStop()

Declaration
protected override void DoSignalStop()
Overrides
Service.DoSignalStop()

DoStart()

Declaration
protected override void DoStart()
Overrides
Service.DoStart()

DoWaitForCompleteStop()

Declaration
protected override void DoWaitForCompleteStop()
Overrides
Service.DoWaitForCompleteStop()

Fetch(Guid, Boolean)

Retrieves an object reference from the store identified by the "key" or returns null if such object does not exist. Object is not going to be persisted as this method provides logical read-only access. If touch=true then object timestamp is updated

Declaration
public object Fetch(Guid key, bool touch = false)
Parameters
Type Name Description
System.Guid key
System.Boolean touch
Returns
Type Description
System.Object

UndoCheckout(Guid)

Reverts object state to Normal after the call to Checkout. This way the changes (if any) are not going to be persisted. Returns true if object was found and checkout canceled. Keep in mind: this method CAN NOT revert inner object state to its original state if it was changed, it only unmarks object as changed. This method is reentrant just like the Checkout is

Declaration
public bool UndoCheckout(Guid key)
Parameters
Type Name Description
System.Guid key
Returns
Type Description
System.Boolean

visit(Boolean)

Declaration
public void visit(bool stopping)
Parameters
Type Name Description
System.Boolean stopping

Implements

IService
INamed
IObjectStoreImplementation
IObjectStore
IApplicationComponent
ILocalizedTimeProvider
System.IDisposable
IConfigurable
IInstrumentable
IExternallyParameterized

Extension Methods

MiscUtils.NonNull<T>(T, Func<Exception>, String)
ObjectValueConversion.AsString(Object, String, ConvertErrorHandling)
ObjectValueConversion.AsNonNullOrEmptyString(Object)
ObjectValueConversion.AsLaconicConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsJSONConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsXMLConfig(Object, ConfigSectionNode, ConvertErrorHandling)
ObjectValueConversion.AsChar(Object, Char, ConvertErrorHandling)
ObjectValueConversion.AsNullableChar(Object, Nullable<Char>, ConvertErrorHandling)
ObjectValueConversion.AsByte(Object, Byte, ConvertErrorHandling)
ObjectValueConversion.AsNullableByte(Object, Nullable<Byte>, ConvertErrorHandling)
ObjectValueConversion.AsSByte(Object, SByte, ConvertErrorHandling)
ObjectValueConversion.AsNullableSByte(Object, Nullable<SByte>, ConvertErrorHandling)
ObjectValueConversion.AsShort(Object, Int16, ConvertErrorHandling)
ObjectValueConversion.AsNullableShort(Object, Nullable<Int16>, ConvertErrorHandling)
ObjectValueConversion.AsUShort(Object, UInt16, ConvertErrorHandling)
ObjectValueConversion.AsNullableUShort(Object, Nullable<UInt16>, ConvertErrorHandling)
ObjectValueConversion.AsInt(Object, Int32, ConvertErrorHandling)
ObjectValueConversion.AsNullableInt(Object, Nullable<Int32>, ConvertErrorHandling)
ObjectValueConversion.AsUInt(Object, UInt32, ConvertErrorHandling)
ObjectValueConversion.AsNullableUInt(Object, Nullable<UInt32>, ConvertErrorHandling)
ObjectValueConversion.AsLong(Object, Int64, ConvertErrorHandling)
ObjectValueConversion.AsNullableLong(Object, Nullable<Int64>, ConvertErrorHandling)
ObjectValueConversion.AsULong(Object, UInt64, ConvertErrorHandling)
ObjectValueConversion.AsNullableULong(Object, Nullable<UInt64>, ConvertErrorHandling)
ObjectValueConversion.AsDouble(Object, Double, ConvertErrorHandling)
ObjectValueConversion.AsNullableDouble(Object, Nullable<Double>, ConvertErrorHandling)
ObjectValueConversion.AsFloat(Object, Single, ConvertErrorHandling)
ObjectValueConversion.AsNullableFloat(Object, Nullable<Single>, ConvertErrorHandling)
ObjectValueConversion.AsDecimal(Object, Decimal, ConvertErrorHandling)
ObjectValueConversion.AsNullableDecimal(Object, Nullable<Decimal>, ConvertErrorHandling)
ObjectValueConversion.AsBool(Object, Boolean, ConvertErrorHandling)
ObjectValueConversion.AsNullableBool(Object, Nullable<Boolean>, ConvertErrorHandling)
ObjectValueConversion.AsGUID(Object, Guid, ConvertErrorHandling)
ObjectValueConversion.AsNullableGUID(Object, Nullable<Guid>, ConvertErrorHandling)
ObjectValueConversion.AsDateTime(Object)
ObjectValueConversion.AsDateTime(Object, DateTime, ConvertErrorHandling)
ObjectValueConversion.AsNullableDateTime(Object, Nullable<DateTime>, ConvertErrorHandling)
ObjectValueConversion.AsGDID(Object)
ObjectValueConversion.AsGDID(Object, GDID, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDID(Object, Nullable<GDID>, ConvertErrorHandling)
ObjectValueConversion.AsGDIDSymbol(Object)
ObjectValueConversion.AsGDIDSymbol(Object, GDIDSymbol, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDIDSymbol(Object, Nullable<GDIDSymbol>, ConvertErrorHandling)
ObjectValueConversion.AsTimeSpan(Object)
ObjectValueConversion.AsTimeSpan(Object, TimeSpan, ConvertErrorHandling)
ObjectValueConversion.AsNullableTimeSpan(Object, Nullable<TimeSpan>, ConvertErrorHandling)
ObjectValueConversion.AsEnum<TEnum>(Object, TEnum, ConvertErrorHandling)
ObjectValueConversion.AsNullableEnum<TEnum>(Object, Nullable<TEnum>, ConvertErrorHandling)
ObjectValueConversion.AsUri(Object, Uri, ConvertErrorHandling)
JSONExtensions.ToJSON(Object, JSONWritingOptions)
JSONExtensions.ToJSON(Object, TextWriter, JSONWritingOptions)
JSONExtensions.ToJSON(Object, Stream, JSONWritingOptions, Encoding)
ErlObject.ToErlObject(Object)
ErlObject.ToErlObject(Object, ErlTypeOrder, Boolean)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX