示例#1
0
        /// <summary>
        /// Adds another TAG file buffer queue key into the tracked groups for processing
        /// </summary>
        public void Add(ITAGFileBufferQueueKey key)
        {
            lock (_lockObj)
            {
                //if (_log.IsTraceEnabled())
                {
                    _log.LogInformation($"Grouper adding TAG file {key.FileName} representing asset {key.AssetUID} within project {key.ProjectUID} into an appropriate group");
                }

                if (_groupMap.TryGetValue(key.ProjectUID, out var keyList))
                {
                    // Check if this bucket is full
                    if (keyList.Count >= _maxNumberOfTagFilesPerBucket)
                    {
                        _fullBuckets.Add(keyList.ToArray());
                        keyList.Clear();
                    }

                    keyList.Add(key);
                }
                else
                {
                    _groupMap.Add(key.ProjectUID, new List <ITAGFileBufferQueueKey> {
                        key
                    });
                }
            }
        }
示例#2
0
 /// <summary>
 /// Adds a new TAG file to the buffer queue.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 /// <returns>If an element with this key already exists in the cache this method will false, true otherwise</returns>
 public bool Add(ITAGFileBufferQueueKey key, TAGFileBufferQueueItem value)
 {
     return(_queueCache.PutIfAbsent(key, value));
 }