Added methods to add a reserved tag and check whether a tag is reserved, added queue for notifications and also a list of reserved tags

This commit is contained in:
Tristan 🅱. Kildaire 2020-09-24 20:30:59 +02:00
parent d46da412b4
commit 485995bfe3
1 changed files with 30 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import tristanable.watcher : Watcher;
import tristanable.request : Request;
import tristanable.garbage : GarbageCollector;
import tristanable.encoding : DataMessage;
import tristanable.notifications : NotificationReply;
import std.socket : Socket;
import core.sync.mutex : Mutex;
import bmessage : bSendMessage = sendMessage;
@ -19,6 +20,16 @@ public final class Manager
*/
private Request[] requestQueue;
/**
* Reserved tags
*/
private ulong[] reservedTags;
/**
* The queue of received notifications
*/
private NotificationReply[] notificationQueue;
/**
* The associated Watcher object for this manager.
*/
@ -204,6 +215,25 @@ public final class Manager
{
queueMutex.unlock();
}
public void reserveTag(ulong tag)
{
reservedTags ~= tag;
}
public bool isReservedTag(ulong tag)
{
foreach(ulong currentTag; reservedTags)
{
if(currentTag == tag)
{
return true;
}
}
return false;
}
}
public final class TristanFokop : Exception