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); }
/// <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); }
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); }
public TermFactory(TypeCache typeCache, TermCache termCache, ResourceCollection resourceCollection) { TypeCache = typeCache; TermCache = termCache; ResourceCollection = resourceCollection; }