• Avalanche.Core
Search Results for

    Show / Hide Table of Contents
    • Avalanche.Accessor
      • Introduction
      • IAccessor
        • IAccessor
        • IListAccessor
        • IMapAccessor
        • IRecordAccessor
        • IContentAccessor
        • IOneOfAccessor
        • IAnyAccessor
      • .Net
        • Introduction
        • IList<T>
        • IDictionary<K,V>
        • FieldInfo
        • OneOfAttribute
        • StructLayoutAttribute
        • Class
      • Protobuf
        • Introduction
      • Articles
        • Dependency Injection
        • AccessorMessages
    • Avalanche.Binding
      • Introduction
    • Avalanche.Configuration
      • Introduction
      • Configuration Binding
      • ConfigurationExtensions
      • MemoryConfiguration
      • PrintTree
      • Saving IOptions
      • Yaml
    • Avalanche.Converter
      • Introduction
      • EnumConverter
      • Func<,>
      • HexConverter
      • PrimitiveConverter
      • StringConverter
    • Avalanche.Core
      • License
    • Avalanche.DataType
      • Introduction
      • DataType
        • IDataType
        • IListType
        • IMapType
        • IRecordType
        • IFieldType
        • IOneOfType
        • IAnyType
        • IStringType
        • IValueType
        • IIntegerType
        • IEnumerationType
        • IRealType
      • .Net
        • Introduction
        • IList<T>
        • IDictionary<K,V>
        • FieldInfo
        • Enum
        • OneOfAttribute
        • StructLayoutAttribute
        • Class
      • Protobuf
        • Introduction
      • Articles
        • DataTypeRequest
        • PrintTree
        • DataTypeMessages
    • Avalanche.Emit
      • Introduction
      • TypeBuilder
      • ConstructorBuilder
      • MethodBuilder
      • PropertyBuilder
      • FieldBuilder
      • Emit
      • Utilities
    • Avalanche.FileSystem
      • Introduction
      • Abstractions
        • IFileSystem
          • IFileSystemBrowse
          • IFileSystemCreateDirectory
          • IFileSystemDelete
          • IFileSystemFileAttribute
          • IFileSystemMount
          • IFileSystemMove
          • IFileSystemObserve
          • IFileSystemOpen
        • IEvent
        • IEntry
        • IOption
        • IToken
      • FileSystem
      • VirtualFileSystem
      • MemoryFileSystem
      • EmbeddedFileSystem
      • HttpFileSystem
      • Decoration
      • IFileProvider
      • Events
      • Utilities
        • Dispose
        • File Scanner
        • Visit Tree
        • File Operation
        • FilterEnumerable
        • PollingFilterWatchToken
    • Avalanche.Identity
      • Introduction
      • Identity
      • IdentityParts
      • IdentityInterner
      • IdentityComparer
      • Print Tree
      • IdentityAccessors
        • Introduction
        • TypeName
    • Avalanche.Localization
      • Introduction
      • Localization
      • LocalizationFile
      • LocalizationFiles
      • LocalizationFileSystem
      • LocalizationFileFormat
      • LocalizationLine
      • LocalizationLines
      • TemplateFormat
      • CultureProvider
      • FallbackCultureProvider
      • ResourceManager
      • LocalizationError
      • Microsoft.Extensions
        • Introduction
        • DependencyInjection
        • FileProvider
        • Logging
        • ITextLocalizer
        • IFileLocalizer
        • Localization
      • Asp.Net
        • Introduction
        • Supplying localization
        • Inject to pages
        • Culture Assigned
        • Minimalistic Api
        • Diagnostics
      • Pluralization
        • Introduction
        • Multiple plural parameters
        • Custom PluralRules
        • Invariant Culture
        • Unit Prefix
        • IPluralRule
        • IPluralNumber
        • IPluralRules
        • CLDRs
        • Unicode.CLDR40
        • Unicode.CLDR41
        • Unicode.CLDR42
      • Articles
        • Alphabet localization
        • Benchmarks
        • Caching
        • Class Library
        • Demo
        • Diagnostics
        • Embedded resources
        • Emplacement
        • File localization
        • Text localization
        • Printing templates
    • Avalanche.Message
      • Introduction
      • IMessage
      • IMessageProvider
      • IMessageDescription
      • IMessageDescriptions
      • MessageLevel
      • Message printing
      • Messages and Exceptions
      • Microsoft.Extensions
        • DependencyInjection
      • Articles
        • Aggregate Messages
        • Localization
        • Logging
        • Validation
    • Avalanche.Options
      • Introduction
      • OptionsExtensions
      • OptionsMonitorCast
    • Avalanche.Service
      • Introduction
      • Service
        • Introduction
        • IService
        • IServiceDisposable
        • IServiceDecoration
        • IServiceCast
        • IServiceObservable
        • IServiceContainer
        • Construction
        • Query
        • CancellationToken
        • CachePolicy
        • Scope
      • Handler
        • Introduction
        • IHandler
        • IHandlerCast
        • IHandlerDecoration
        • IHandlerWithOrder
        • CancellationToken
        • Cyclicity
        • Delegates
        • Invokable
        • ExportAttribute
        • OrderAttribute
        • PrintTree
        • Recursion
      • Query
        • Introduction
        • IQuery
        • IQueryCast
        • IQueryDecoration
      • Entry
        • Introduction
        • IEntry
        • IEntryCast
        • IEntryDecoration
        • IEntryObservable
        • IEntryVisitable
        • EntryState
      • Request
        • Introduction
        • IRequest
        • IRequestFor
        • IRequestToBeCached
        • IRequestToBeDisposed
        • RequestAttribute
        • ContextParameterAttribute
        • Print Tree
      • Dependency Injection
        • Introduction
        • Asp.Net
        • ServiceRequest<T>
        • Decorating a service
        • Handler
        • CachePolicy
        • CancellationToken
        • QueryLogger
        • IHostBuilder
      • Examples
        • NodeCount
        • Expression
        • Mapper
      • Articles
        • Benchmarks
        • Error Handling
        • ServiceMessages
    • Avalanche.StatusCode
      • Introduction
      • HResult
        • Introduction
        • HResult.Facilities
        • BasicMessages
        • RpcMessages
        • DispatchMessages
        • StorageMessages
        • ItfMessages
        • Win32Messages
        • WindowsMessages
        • SspiMessages
        • CertMessages
        • MediaServerMessages
        • SetupApiMessages
        • ScardMessages
        • ComPlusMessages
        • ClrMessages
        • UserModeFilterManagerMessages
        • GraphicsMessages
        • TpmServicesMessages
        • TpmSoftwareMessages
        • PlaMessages
        • FveMessages
        • FwpMessages
        • NdisMessages
        • DltMessages
      • System
        • Introduction
        • AccessControlMessages
        • AggregateMessages
        • AppDomainMessages
        • ArgumentMessages
        • ArgumentNullMessages
        • ArgumentOutOfRangeMessages
        • ArithmeticMessages
        • ArrayMessages
        • AssemblyMessages
        • BadImageFormatMessages
        • CodeContractMessages
        • CodePageMessages
        • CollectionsMessages
        • CompilerServiceMessages
        • CryptographyMessages
        • CultureMessages
        • DiagnosticsMessages
        • EventSourceMessages
        • ExecutionEngineMessages
        • FormatMessages
        • HostProtectionMessages
        • IOMessages
        • IndexOutOfRangeMessages
        • InteropServiceMessages
        • InvalidCastMessages
        • InvalidOperationMessages
        • IsolatedStorageMessages
        • LazyMessages
        • MarshalerMessages
        • MemoryMessages
        • MiscellaneousMessages
        • NotImplementedMessages
        • NotSupportedMessages
        • ObjectDisposedMessages
        • OperationCanceledMessages
        • OverflowMessages
        • PlatformMessages
        • PolicyMessages
        • PrincipalMessages
        • ProgramMessages
        • ReferenceMessages
        • ReflectionMessages
        • RegionMessages
        • RemotingMessages
        • ResourcesMessages
        • SecurityMessages
        • SerializationMessages
        • StackMessages
        • TaskMessages
        • TextMessages
        • ThreadingMessages
        • TimeZoneMessages
        • TypeMessages
        • XmlMessages
      • HttpStatusCode
      • OpcUaStatusCode
    • Avalanche.Template
      • Introduction
      • TemplateFormats
      • ITemplatePrintable
      • ITemplateFormatPrintable
      • ITemplateText
      • ITemplateBreakdown
      • ITemplateFormat
      • ITemplateFormats
      • Extract Arguments
      • Emplacement
    • Avalanche.Tokenizer
      • Introduction
      • IToken
      • ITokenizer
      • Tokenizers
    • Avalanche.Utilities
      • Introduction
      • Collections
        • Tuples
        • StructList
        • ArrayList
        • BijectionMap
        • LocakableDictionary
        • LockableList
        • MapList
        • Pipe
        • RingQueue
        • EnumerableExtensions
        • TupleUtilities
        • ArrayUtilities
      • Comparers
        • IGraphComparer
        • IGraphComparable
        • AlphaNumericComparer
        • EnumerableComparer
        • EnumerableGraphComparer
        • ReferenceComparer
        • KeyValuePairComparer
        • DefaultComparerProvider
        • RecordComparer
      • Cloners
        • ICloner
        • IGraphCloner
        • IGraphCloneable
        • ListCloner
        • DictionaryCloner
        • FieldCloner
        • PassthroughCloner
        • RecordCloner
        • ClonerProvider
      • Dispose
        • IDisposeAttachable
        • IDisposeBelatable
      • Provider
        • Introduction
        • ProviderBase
        • Delegate
        • Pipe
        • Cache
        • ResultCapture
        • AsReadOnly
        • AsService
        • IProviderEvent
      • Record
        • IRecordDescription
        • IFieldDescription
        • IConstructorDescription
        • IConstructionDescription
        • IParameterDescription
        • IRecordProviders
        • RecordDelegates
          • RecordCreate
          • RecordClone
          • RecordCopy
          • IRecordDelegates
        • FieldDelegates
          • FieldRead
          • FieldWrite
          • RecreateWith
          • IFieldDelegates
      • Reflection
        • EnumDescription
      • String
        • IEscaper
        • UnicodeString
        • Hex
      • Miscellaneous
        • IIdGenerator
        • Permutation
        • IReadOnly
        • IUserDataContainer
        • ITreeNode
        • Void
    • Avalanche.Writer
      • Introduction
      • ConstantWriter
      • Context
      • ConvertWriter
      • DefaultConstructor
      • DelegateWriter
      • PassthroughWriter
      • Referer
      • TypeCast
      • Writer
      • WriterPipe
      • WriterMessages

    EntryStatus

    EntryStatus represents status flags of an IEntry object:

    Enum Description
    Unassigned Initial state. Query processing has not started.
    Processing State is set when handlers start processing the request.
    Cancelled Request is cancelled.
    Value Result is assigned by a handler.
    NoValue No handler has produced a result.
    Error Handler has assigned an error status.
    UnexpectedError Unexpected exception was captured from handler.
    ValueDisposed Value is disposed along with service or cache.
    ValueNulled Reference to value is removed from entry.
    Disposed Entry has been disposed.

    Entry starts at Unassigned state.

    // Create entry
    IEntry<string> entry = new Entry<string>();
    // Print status
    WriteLine(entry.Status); // "Unassigned"
    

    .SetProcessing() marks entry into Processing state.

    // Set processing
    entry.SetProcessing();
    // Print status
    WriteLine(entry.Status); // "Processing"
    

    .SetValue() marks entry into Value state.

    // Set value
    entry.SetValue("Result");
    // Print status
    WriteLine(entry.Status); // "Value"
    

    .SetError() marks entry into Error state.

    // Set error result
    entry.SetError(new NotSupportedException());
    // Print status
    WriteLine(entry.Status); // "Error"
    

    .SetUnexpectedError() marks entry into UnexpectedError state.

    // Set unexpected error
    entry.SetUnexpectedError(new InvalidOperationException());
    // Print status
    WriteLine(entry.Status); // "UnexpectedError"
    

    .Dispose() marks entry into Disposed state.

    // Set value
    entry.SetValue(new Semaphore(1, 1));
    // Disepose entry and value
    ((IDisposable)entry).Dispose();
    // Print status
    WriteLine(entry.Status); // "Disposed"
    

    Flow chart of entry states. EntryStatus


    EntryStatus enum definition.

    /// <summary>Status of <see cref="IEntry"/>.</summary>
    [Flags]
    public enum EntryStatus : ulong
    {
        ////// Below here are states. Only one state may apply. //////
        ////// However, they are listed as flags so that multiple states may be indicated. //////
        /// <summary>Unassigned.</summary>
        Unassigned = 0,
        /// <summary>Query started.</summary>
        Processing = 1UL << 10,
        /// <summary>Query was cancelled.</summary>
        Cancelled = 1UL << 12,
        /// <summary>Request was processed, but no handler was able to produce a value.</summary>
        NoValue = 1UL << 14,
        /// <summary>Query resolved to a successful value.</summary>
        Value = 1UL << 16,
        /// <summary>Query resolved successfully but result is an error value.</summary>
        Error = 1UL << 18,
        /// <summary>Unexpected exception was captured.</summary>
        UnexpectedError = 1UL << 20,
        /// <summary>Value is disposed.</summary>
        ValueDisposed = 1UL << 22,
        /// <summary>Value reference is nulled or defaulted.</summary>
        ValueNulled = 1UL << 23,
        /// <summary>Entry container is disposed.</summary>
        Disposed = 1UL << 24,
    
    
        /// <summary>Any value assigned. Used with <see cref="IService.TryGetInitialized"/></summary>
        AssignedStates = Cancelled | NoValue | Value | Error | UnexpectedError | ValueDisposed | ValueNulled | Disposed,
    
        ////// Below here are status flags //////
        /// <summary>Query completed (or broken). This flag that indicates that resolver has applied query on every <see cref="IHandlerBase"/>.</summary>
        Completed = 1UL << 30,
        /// <summary>Entry is being managed by a cache.</summary>
        Cached = 1UL << 31,
        /// <summary>Reserved for future use for the library</summary>
        Reserved2 = 1UL << 32,
        /// <summary>Reserved for future use for the library</summary>
        Reserved3 = 1UL << 33,
        /// <summary>Reserved for future use for the library</summary>
        Reserved4 = 1UL << 34,
        /// <summary>Reserved for future use for the library</summary>
        Reserved5 = 1UL << 35,
        /// <summary>Reserved for future use for the library</summary>
        Reserved6 = 1UL << 36,
        /// <summary>Reserved for future use for the library</summary>
        Reserved7 = 1UL << 37,
        /// <summary>Reserved for future use for the library</summary>
        Reserved8 = 1UL << 38,
        /// <summary>Reserved for future use for the library</summary>
        Reserved9 = 1UL << 39,
        /// <summary>Flag allocated for any 3rd party use</summary>
        User0 = 1UL << 40,
        /// <summary>Flag allocated for any 3rd party use</summary>
        User1 = 1UL << 41,
        /// <summary>Flag allocated for any 3rd party use</summary>
        User2 = 1UL << 42,
        /// <summary>Flag allocated for any 3rd party use</summary>
        User3 = 1UL << 43,
        /// <summary>Flag allocated for any 3rd party use</summary>
        User4 = 1UL << 44,
        /// <summary>Flag allocated for any 3rd party use</summary>
        User5 = 1UL << 45,
        /// <summary>Flag allocated for any 3rd party use</summary>
        User6 = 1UL << 46,
        /// <summary>Flag allocated for any 3rd party use</summary>
        User7 = 1UL << 47,
        /// <summary>Mask for flags</summary>
        Flags = Completed | Cached | Reserved2 | Reserved3 | Reserved4 | Reserved5 | Reserved6 | Reserved7 | Reserved8 | Reserved9 | User0 | User1 | User3 | User4 | User5 | User6 | User7,
    }
    

    Full Example

    Full example
    using System;
    using System.Threading;
    using Avalanche.Service;
    using static System.Console;
    
    public class entry_entrystate
    {
        public static void Run()
        {
            {
                // <01>
                // Create entry
                IEntry<string> entry = new Entry<string>();
                // Print status
                WriteLine(entry.Status); // "Unassigned"
                // </01>
            }
            {
                // Create entry
                IEntry<string> entry = new Entry<string>();
                // <02>
                // Set processing
                entry.SetProcessing();
                // Print status
                WriteLine(entry.Status); // "Processing"
                // </02>
            }
            {
                // Create entry
                IEntry<string> entry = new Entry<string>();
                // <03>
                // Set value
                entry.SetValue("Result");
                // Print status
                WriteLine(entry.Status); // "Value"
                // </03>
            }
            {
                // Create entry
                IEntry<string> entry = new Entry<string>();
                // <04>
                // Set error result
                entry.SetError(new NotSupportedException());
                // Print status
                WriteLine(entry.Status); // "Error"
                // </04>
            }
            {
                // Create entry
                IEntry<string> entry = new Entry<string>();
                // <05>
                // Set unexpected error
                entry.SetUnexpectedError(new InvalidOperationException());
                // Print status
                WriteLine(entry.Status); // "UnexpectedError"
                // </05>
            }
            {
                // Create entry
                IEntry<Semaphore> entry = new Entry<Semaphore>(EntryPolicy.Default);
                // <06>
                // Set value
                entry.SetValue(new Semaphore(1, 1));
                // Disepose entry and value
                ((IDisposable)entry).Dispose();
                // Print status
                WriteLine(entry.Status); // "Disposed"
                // </06>
            }
        }
    }
    
    In This Article
    Back to top Copyright © Toni Kalajainen