Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DatabaseQueueCollection.cs
2using System.Threading.Tasks;
4
6{
11 {
12 private static readonly Dictionary<string, IPersistedQueue> queues = new Dictionary<string, IPersistedQueue>();
13
18 {
19 }
20
28 {
29 return Grade.Barely; // Slow compared to more efficient queues, so it should only be used if no other is found.
30 }
31
43 public Task<IPersistedQueue> GetQueue(IDatabaseProvider Provider, string QueueName,
44 bool CanBeNull)
45 {
46 lock (queues)
47 {
48 if (!queues.TryGetValue(QueueName, out IPersistedQueue Result))
49 {
50 Result = new DatabaseQueue(QueueName);
51 queues[QueueName] = Result;
52 }
53
54 return Task.FromResult(Result);
55 }
56 }
57
63 public Task<string[]> GetQueues(IDatabaseProvider Provider)
64 {
65 lock (queues)
66 {
67 string[] Result = new string[queues.Count];
68 queues.Keys.CopyTo(Result, 0);
69 return Task.FromResult(Result);
70 }
71 }
72 }
73}
Collection of database-based persisted queues.
DatabaseQueueCollection()
Collection of database-based persisted queues.
Task< string[]> GetQueues(IDatabaseProvider Provider)
Gets an array of available queue names.
Grade Supports(IDatabaseProvider Provider)
How well the database-based queue collection supports the specified database provider.
Task< IPersistedQueue > GetQueue(IDatabaseProvider Provider, string QueueName, bool CanBeNull)
Gets a persisted queue with the specified name. If one is not found, a new one is created.
Queue persisted into the database.
Interface for database providers that can be plugged into the static Database class.
Inteface for persisted queues.
Inteface for collections of persisted queues matching a given database provider.
Grade
Grade enumeration
Definition: Grade.cs:7