//API /// <summary> /// Create new instance of <see cref="BlockCollection{T}"/> with specified <paramref name="balancer"/> /// and <paramref name="internalBlockCollection"/>. /// </summary> /// <param name="balancer">Balancer we use to get information about block sizes</param> /// <param name="internalBlockCollection">Collection which used to real containing of blocks</param> public BlockCollection(IBalancer balancer, IBigList <Block <T> > internalBlockCollection) { _balancer = balancer; _blocks = internalBlockCollection; IsReadOnly = false; }
public Node(int cellCount, int level, IBalancer balancer) { _innerArray = new ICell <TKey, TValue> [cellCount]; _isSubNodesOn = false; ElementCount = cellCount; _balancer = balancer; _level = level; }
/// <summary> /// Create new empty instance of <see cref="BigArray{T}"/> with specified <paramref name="configuration"/>. /// </summary> /// <param name="configuration">Configation object of new array.</param> public BigArray(BigArrayConfiguration <T> configuration) { _balancer = configuration.Balancer; _blockCollection = new BlockCollection <T>(_balancer, configuration.BlockCollection); _arrayMap = new ArrayMap <T>(_balancer, _blockCollection); _containsOperation = JITOMethodFactory.GetContainsOperation(this, configuration.UseJustInTimeOptimization); }
//API /// <summary> /// Create new instance of <see cref="ArrayMap{T}"/> describing specify <see cref="BlockCollection"/> /// </summary> /// <param name="balancer"></param> /// <param name="blockCollection"><see cref="BlockCollection"/> to descibe.</param> public ArrayMap(IBalancer balancer, BlockCollection <T> blockCollection) { _balancer = balancer; BlockCollection = blockCollection; _blocksInfoList = new List <BlockInfo>(blockCollection.Count); if (BlockCollection.Count != 0) { DataChanged(0); } }
/// <summary> /// Create new instance of <see cref="BigArrayConfiguration{T}"/> with specified <paramref name="balancer"/> /// and <paramref name="blockCollection"/>. /// </summary> /// <param name="balancer">Object to manage block size logic</param> /// <param name="blockCollection"> Collection for storage blocks of <see cref="BigArray"/>. You can /// defint you own collection for it to controll it. For example you can send BigArray{Block{T}} /// and have second level distribution.</param> public BigArrayConfiguration(IBalancer balancer, IBigList <Block <T> > blockCollection) : this() { if (balancer == null) { throw new ArgumentNullException("balancer", "Configuration must contains balancer!"); } if (blockCollection == null) { throw new ArgumentNullException("balancer", "Configuration must contains block collection!"); } Balancer = balancer; BlockCollection = blockCollection; }
internal Client(OrtcClient ortcClient) { context = ortcClient; _gotOnOpenCount = 0; _permissions = new List <KeyValuePair <string, string> >(); _subscribedChannels = new RealtimeDictionary <string, ChannelSubscription>(); _multiPartMessagesBuffer = new RealtimeDictionary <string, RealtimeDictionary <int, BufferedMessage> >(); _heartbeatTimer = new Timer(_heartbeatTimer_Elapsed, context.HeartbeatTime * 1000); _connectionTimer = new Timer(_connectionTimer_Elapsed, Constants.SERVER_HB_COUNT * 1000); _reconnectTimer = new Timer(_reconnectTimer_Elapsed, context.ConnectionTimeout * 1000); _balancer = DependencyService.Get <IBalancer> (); if (_balancer == null) { throw new OrtcGenericException( "DependencyService Failed, please include the platform plugins. This may be caused linker stripping."); } _webSocketConnection = DependencyService.Get <IWebsocketConnection>(); if (_webSocketConnection == null) { throw new OrtcGenericException( "DependencyService Failed, please include the platform plugins. This may be caused linker stripping."); } _webSocketConnection.OnOpened += _webSocketConnection_OnOpened; _webSocketConnection.OnClosed += _webSocketConnection_OnClosed; _webSocketConnection.OnError += _webSocketConnection_OnError; _webSocketConnection.OnMessageReceived += _webSocketConnection_OnMessageReceived; _msgProcessor = new MsgProcessor(this); }
public BigDictionary() { _balancer = new FastReducedBalancer(); _rootNode = new Node <TKey, TValue>(_balancer.GetNewNodeSize(0), 0, _balancer); _dictionaryMap = new StandardDictionaryMap <TKey, TValue>(); }
/// <summary> /// Create new instance of <see cref="BigArrayConfiguration{T}"/> with specified <paramref name="balancer"/> /// and default block collection. /// </summary> /// <param name="balancer">Object to manage block size logic</param> public BigArrayConfiguration(IBalancer balancer) : this(balancer, DefaultConfiguration.BlockCollection) { }
public ProxyService(IConfiguration configuration, IBalancer balancer, ILogger <ProxyService> logger) { _configuration = configuration.Get <BalancerConfiguration>(); _logger = logger; _balancer = balancer; }
internal async static Task <String> ResolveClusterUrlAsync(String clusterUrl, IBalancer balancer) { String server = ""; try { var result = await balancer.ResolveClusterUrlAsync(clusterUrl); var successStatusCode = result.Item1; var responseBody = result.Item2; if (successStatusCode) { var match = Regex.Match(responseBody, BALANCER_SERVER_PATTERN); if (match.Success) { server = match.Groups["server"].Value; return(server); } } } catch (Exception ex) { Debug.WriteLine(ex.Message); server = ""; } return(server); /*String server = ""; * try { * HttpClient aClient = new HttpClient(); * aClient.Timeout = new TimeSpan(0,0,Constants.HTTPCLIENT_TIMEOUT); * Uri requestUri = new Uri(clusterUrl); * * var result = await aClient.GetAsync(requestUri, HttpCompletionOption.ResponseContentRead); * var responseBody = await result.Content.ReadAsStringAsync(); * * if (result.IsSuccessStatusCode) { * var match = Regex.Match(responseBody, BALANCER_SERVER_PATTERN); * * if (match.Success) { * server = match.Groups["server"].Value; * return server; * } * } * } catch(Exception ex) { * Debug.WriteLine(ex.Message); * server = ""; * } * return server;*/ }
/// <summary> /// Create new instance of <see cref="BlockCollection{T}"/> with specified <paramref name="balancer"/> /// and default intenalBlockCollection (<see cref="InternalBlockList{T}"/>). /// </summary> /// <param name="balancer">Balancer we use to get information about block sizes</param> public BlockCollection(IBalancer balancer) : this(balancer, new InternalBlockList <Block <T> >()) { }