コード例 #1
0
 internal LeaderState(IRaftStateMachine stateMachine, bool allowPartitioning, long term)
     : base(stateMachine)
 {
     currentTerm            = term;
     this.allowPartitioning = allowPartitioning;
     timerCancellation      = new();
     replicationEvent       = new();
     replicationQueue       = new();
     precedingTermCache     = new TermCache(MaxTermCacheSize);
 }
コード例 #2
0
        /// <summary>
        /// Creates a new term for the given type, with the given key, component separator and binding rule. If a term with
        /// the given key already existed, simply returns that one.
        /// </summary>
        public Term MakeOrGetCachedTerm(Type resource, string key, string componentSeparator, TermBindingRule bindingRule)
        {
            var tuple = (resource.GetRESTableTypeName(), key.ToLower(), bindingRule);

            if (!TermCache.TryGetValue(tuple, out var term))
            {
                term = TermCache[tuple] = Parse(resource, key, componentSeparator, bindingRule, null);
            }
            return(term);
        }
コード例 #3
0
ファイル: TypeCache.cs プロジェクト: erikvk/RESTable
 public TypeCache
 (
     IEnumerable <IEntityTypeContractResolver> entityTypeContractResolvers,
     ResourceCollection resourceCollection,
     TermCache termCache
 )
 {
     EntityTypeContractResolvers       = entityTypeContractResolvers;
     ResourceCollection                = resourceCollection;
     DeclaredPropertyCache             = new ConcurrentDictionary <Type, IReadOnlyDictionary <string, DeclaredProperty> >();
     DeclaredPropertyCacheByActualName = new ConcurrentDictionary <Type, IReadOnlyDictionary <string, DeclaredProperty> >();
     EntityTypeContracts               = new ConcurrentDictionary <Type, EntityTypeContract>();
     TermFactory = new TermFactory(this, termCache, resourceCollection);
 }
コード例 #4
0
 public TermFactory(TypeCache typeCache, TermCache termCache, ResourceCollection resourceCollection)
 {
     TypeCache          = typeCache;
     TermCache          = termCache;
     ResourceCollection = resourceCollection;
 }