4using System.Reflection;
6using System.Threading.Tasks;
52 private readonly Dictionary<string, NodeStatus> nodeStatus =
new Dictionary<string, NodeStatus>();
53 private readonly Dictionary<string, bool> loading =
new Dictionary<string, bool>();
59 private readonly
bool internalScheduler;
76 this.webServer = WebServer;
77 this.e2eEncryption = E2eEncryption;
85 this.internalScheduler =
false;
90 this.internalScheduler =
true;
93 this.webServer.Register(this.blockResource =
new BlockResource(
"/NL/B", this.provider, this.
client,
this, this.webServer,
"User"));
94 this.blockListResource = this.webServer.Register(
new BlockListResource(
"/NL/L", this.
client, this.webServer,
"User"));
95 this.multiGetResource = this.webServer.Register(
new MultiGetResource(
"/NL/MG", this.
client, this.webServer,
"User"));
114 this.client.OnStateChanged += this.Client_OnStateChanged;
115 this.client.OnPresence += this.Client_OnPresence;
119 Task
_ = this.ResendPresences();
128 private async Task ResendPresences()
133 await this.Client_OnPresence(this.
client, e);
158 return "Peer not a Neuro-Ledger node.";
162 lock (this.nodeStatus)
175 BareJid = PeerStatus.BareJid
184 lock (this.nodeStatus)
198 if (!(ToDelete is
null))
203 NodeStatus.LastBlockId =
string.Empty;
233 BareJid = e.FromBareJID
259 string[] Features =
new string[e2.
Features.Count];
260 e2.
Features.Keys.CopyTo(Features, 0);
265 PeerStatus.Features = Features;
270 PeerStatus.RequestingCapabilitiesFunction =
string.Empty;
271 PeerStatus.RequestingCapabilitiesNode =
string.Empty;
272 PeerStatus.RequestingCapabilitiesVersion =
string.Empty;
289 PeerStatus.IsSynchronizing =
false;
296 bool IgnoreIfRunning,
bool Repopulate)
308 PeerStatus.IsSynchronizing =
true;
313 DateTime LastReported = DateTime.Now;
319 List<BlockReference> Blocks =
new List<BlockReference>();
320 Dictionary<string, bool> Collections =
new Dictionary<string, bool>();
322 List<KeyValuePair<BlockReference, string>> Bulk =
new List<KeyValuePair<BlockReference, string>>();
328 LastReported = await this.UpdateStatus(LastReported, Status, Callback);
330 XmlElement Result = await this.GetBlockList(
NodeStatus.
BareJid, LastId, MaxCount);
332 if (Result is
null || Result.LocalName !=
"blockReferences" || Result.NamespaceURI !=
NeuroLedgerNamespace)
336 foreach (XmlNode N
in Result.ChildNodes)
343 LastReported = await this.UpdateStatus(LastReported, Status, Callback);
353 Bulk.Add(
new KeyValuePair<BlockReference, string>(Ref,
Event.Url));
354 BulkSize += Ref.
Bytes;
356 if (Bulk.Count >= 100 || BulkSize >= 16 * 1024 * 1024)
358 await this.BulkLoad(
PeerStatus, Bulk.ToArray(), LastReported, Status, Callback,
false, Blocks);
369 More = Count >= MaxCount;
374 await this.BulkLoad(
PeerStatus, Bulk.ToArray(), LastReported, Status, Callback,
false, Blocks);
376 if (Blocks.Count > 0)
380 List<BlockReference> Subset =
new List<BlockReference>();
381 List<ObjectState> ObjectsInBlock =
new List<ObjectState>();
384 foreach (
string Collection
in Collections.Keys)
397 if (Subset.Count == 0)
422 ObjectsInBlock.Reverse();
427 LastReported = await this.UpdateStatus(LastReported, Status, Callback);
446 Log.
Error(
"Unable to enumerate objects in block properly when repairing collection:\r\n\r\n" +
447 ex.Message, TempBlockEnumerator.
Current.FileName,
string.Empty,
string.Empty,
449 new KeyValuePair<string, object>(
"Collection", Collection));
462 ObjectsInBlock.Clear();
472 this.externalEvents?.RaiseCollectionCleared(Collection);
480 Tuple<uint, uint, uint, uint> Counts = await this.provider.
Process(ObjectEvents, Collection);
482 Status.ObjectsAdded += Counts.Item1;
483 Status.ObjectsUpdated += Counts.Item2;
484 Status.ObjectsDeleted += Counts.Item3;
485 Status.ObjectErrors += Counts.Item4;
487 LastReported = await this.UpdateStatus(LastReported, Status, Callback);
498 NodeStatus.LastBlockId = LastId;
510 foreach (
string Source
in Ref.
Sources)
517 Uri Uri =
new Uri(Source);
520 LastReported = await this.UpdateStatus(LastReported, Status, Callback);
521 await this.RetrieveBlock(Ref, Source, Status,
true);
541 foreach (
string Source
in Ref.
Sources)
548 Uri Uri =
new Uri(Source);
551 LastReported = await this.UpdateStatus(LastReported, Status, Callback);
552 await this.RetrieveBlock(Ref, Source, Status,
true);
575 PeerStatus.IsSynchronizing =
false;
579 await this.UpdateStatus(DateTime.MinValue, Status, Callback);
586 private async Task BulkLoad(
PeerStatus PeerStatus, KeyValuePair<BlockReference, string>[] Resources,
588 bool Unpack, List<BlockReference> Blocks)
595 StringBuilder Csv =
new StringBuilder();
597 foreach (KeyValuePair<BlockReference, string>
Item in Resources)
601 Csv.Append(
Item.Value);
602 Csv.AppendLine(
",application/octet-stream");
607 Encoding.UTF8.GetBytes(Csv.ToString()),
"text/csv; charset=utf-8",
608 new KeyValuePair<string, string>(
"Accept",
"multipart/mixed"));
617 int c = Resources.Length;
624 LastReported = await this.UpdateStatus(LastReported, Status, Callback);
627 KeyValuePair<BlockReference, string> P = Resources[i++];
629 string Url = P.Value;
631 if (!
int.TryParse(Content.
Description, out
int StatusCode))
633 Status?.IncBlockError(Url,
"Invalid content description: " + Content.
Description);
637 if (StatusCode == 200)
642 if (this.provider is
null)
644 Log.
Warning(
"Bulk loading of blocks aborted. Neuro-Ledger closed.");
648 using (MemoryStream ms =
new MemoryStream(Block))
657 Ref.AccessDenied =
false;
661 if (!(Status is
null))
664 Status.LoadedBytes += Ref.
Bytes;
668 await this.UnpackObjects(Ref, Status);
672 else if (StatusCode == HTTP.ForbiddenException.Code ||
673 StatusCode == HTTP.FailedDependencyException.Code)
679 Ref.AccessDenied =
true;
683 if (!(Status is
null))
686 else if (StatusCode == HTTP.NotFoundException.Code)
690 if (Ref.
Creator ==
this.provider.ExternalIdentity &&
691 Content.
Decoded is
string ErrorMsg &&
696 if (!(Status is
null))
700 Status?.IncBlockError(Url, Msg);
704 this.
client.
Warning(Msg =
"Unable to retrieve block. Trying again later. Error reported: " + StatusCode.ToString() +
", " + Content.
Decoded?.ToString());
705 this.scheduler?.
Add(DateTime.Now.AddHours(1),
this.RetryProcessing,
new object[] { Ref, Url });
707 Status?.IncBlockError(Url, Msg);
714 this.
client.Error(Msg =
"Unable to retrieve blocks. Error reported: " + ex.Message);
715 Status?.IncBlockError(
PeerStatus.
BareJid, Msg, (uint)(Resources.Length - Processed));
719 private async Task<XmlElement> GetBlockList(
string Jid,
string LastBlockId,
int MaxCount)
721 StringBuilder Url =
new StringBuilder();
723 Url.Append(
"httpx://");
725 Url.Append(
"/NL/L?Max=");
726 Url.Append(MaxCount.ToString());
728 if (!
string.IsNullOrEmpty(LastBlockId))
730 Url.Append(
"&Last=");
731 Url.Append(LastBlockId);
738 XmlDocument Doc =
new XmlDocument();
740 Content.Encoded.Position = 0;
741 Doc.Load(Content.Encoded);
743 return Doc.DocumentElement;
746 private async Task<DateTime> UpdateStatus(DateTime LastReported,
SynchronizationStatus Status, CallbackAsync<SynchronizationStatus> Callback)
748 DateTime TP = DateTime.Now;
749 if ((TP - LastReported).TotalSeconds > 1)
752 if (!(Callback is
null))
756 await Callback(Status);
760 Status?.IncBlockError(
string.Empty, ex.Message);
768 private async Task GetBlockReferences(
object Sender,
IqEventArgs e)
781 await e.
IqError(
new ForbiddenException(
"You must have an active presence subscription to the node to request information.", e.
IQ));
788 IEnumerable<BlockReference> Blocks;
793 if (
string.IsNullOrEmpty(Last))
805 StringBuilder Xml =
new StringBuilder();
807 Xml.Append(
"<blockReferences xmlns=\"");
812 Xml.Append(
" more=\"true\"");
823 Xml.Append(
"<ref id='");
827 Xml.Append(Convert.ToBase64String(Ref.
Digest));
829 Xml.Append(Convert.ToBase64String(Ref.
Signature));
831 if (!(Ref.
Link is
null))
834 Xml.Append(Convert.ToBase64String(Ref.
Link));
837 Xml.Append(
"' cn='");
839 Xml.Append(
"' cr='");
841 Xml.Append(
"' ct='");
844 if (Ref.
Updated != DateTime.MinValue)
850 if (Ref.
Expires != DateTime.MaxValue)
859 Xml.Append(Ref.
Status.ToString());
863 Xml.Append(
"httpx://");
865 Xml.Append(
"/NL/B/");
868 Xml.Append(Ref.
Bytes.ToString());
872 Xml.Append(
"</blockReferences>");
880 private Task Client_OnStateChanged(
object Sender,
XmppState NewState)
883 Task.Run(() => this.CheckOutgoingEvents());
885 return Task.CompletedTask;
888 private async Task CheckOutgoingEvents()
892 IEnumerable<OutgoingEvent> Events;
907 if (this.pepClient is
null)
930 if (!(this.provider is
null))
932 this.webServer.Unregister(this.blockResource);
933 this.webServer.Unregister(this.blockListResource);
934 this.webServer.Unregister(this.multiGetResource);
939 this.client.OnStateChanged -= this.Client_OnStateChanged;
940 this.client.OnPresence -= this.Client_OnPresence;
949 if (this.internalScheduler)
952 this.scheduler =
null;
955 this.peerStatus =
null;
957 this.provider =
null;
958 this.pepClient =
null;
991 T =
this.Queue(
Event);
993 return Task.CompletedTask;
998 T = this.Queue(
Event);
1000 return Task.CompletedTask;
1008 Event.Created = Block.
Created;
1009 Event.Creator = Block.
Creator;
1010 Event.Digest = Block.
Digest;
1011 Event.Expires = Block.
Expires;
1012 Event.Link = Block.
Link;
1014 Event.Status = Block.
Status;
1015 Event.Updated = Block.
Updated;
1016 Event.Bytes = Block.
Bytes;
1025 this.Fill(
Event, e);
1032 T =
this.Queue(
Event);
1034 return Task.CompletedTask;
1039 T = this.Queue(
Event);
1041 return Task.CompletedTask;
1048 lock (this.processingQueue)
1050 if (this.processing)
1052 this.processingQueue.AddLast(
Event);
1056 this.processing =
true;
1063 await this.Process(
Event,
null);
1069 catch (Exception ex)
1074 lock (this.processingQueue)
1076 if (this.processingQueue.First is
null)
1079 this.processing =
false;
1083 Event = this.processingQueue.First.Value;
1084 this.processingQueue.RemoveFirst();
1088 while (!(
Event is
null));
1092 private readonly LinkedList<BlockAdded> processingQueue =
new LinkedList<BlockAdded>();
1093 private bool processing =
false;
1099 await this.RetrieveBlock(Ref,
Event.Url, Status,
true);
1104 if (!(Status is
null))
1107 Status.TotalBytes +=
Event.Bytes;
1110 Status.First =
Event.Created;
1113 Status.Last =
Event.Created;
1122 Collection =
Event.Collection,
1123 Created =
Event.Created,
1124 Creator =
Event.Creator,
1125 Digest =
Event.Digest,
1126 Expires =
Event.Expires,
1128 Signature =
Event.Signature,
1129 Status =
Event.Status,
1130 Updated =
Event.Updated,
1131 Bytes =
Event.Bytes,
1132 Sources =
new string[] { Event.Url },
1133 AccessDenied =
false,
1139 if (!(Status is
null))
1146 bool Updated =
false;
1147 bool Changed =
false;
1149 if (Ref.
Creator !=
this.provider?.ExternalIdentity &&
1162 Ref.Collection =
Event.Collection;
1163 Ref.Created =
Event.Created;
1164 Ref.Creator =
Event.Creator;
1165 Ref.Expires =
Event.Expires;
1166 Ref.Digest =
Event.Digest;
1167 Ref.Link =
Event.Link;
1168 Ref.Signature =
Event.Signature;
1169 Ref.Status =
Event.Status;
1170 Ref.Updated =
Event.Updated;
1171 Ref.Bytes =
Event.Bytes;
1172 Ref.AccessDenied =
false;
1179 int c = Ref.
Sources?.Length ?? 0;
1181 string[] s =
new string[c + 1];
1183 Array.Copy(Ref.
Sources, 0, s, 0, c);
1190 if (Updated || Changed)
1194 if (!(Status is
null))
1197 if (Changed || !NullIfNotChanged)
1202 else if (
string.IsNullOrEmpty(Ref.
FileName) || !NullIfNotChanged)
1209 private static bool Compare(
byte[] A1,
byte[] A2)
1211 if ((A1 is
null) ^ (A2 is
null))
1217 int i, c = A1.Length;
1221 for (i = 0; i < c; i++)
1232 string FileName = this.provider?.GetFullFileName(Ref.
FileName);
1234 if (
string.IsNullOrEmpty(Ref.
FileName) || !File.Exists(FileName))
1236 string Key = Convert.ToBase64String(Ref.
Digest);
1240 if (this.loading.ContainsKey(Key))
1243 this.loading[Key] =
true;
1251 new KeyValuePair<string, string>(
"Accept",
"application/octet-stream"));
1256 await this.provider.
AddBlockFile(Content.Encoded, Ref);
1262 Ref.AccessDenied =
false;
1266 if (!(Status is
null))
1269 Status.LoadedBytes += Ref.
Bytes;
1273 await this.UnpackObjects(Ref, Status);
1277 catch (HTTP.ForbiddenException ex)
1279 string ErrorMessage = await this.GetErrorMessage(ex);
1285 Ref.AccessDenied =
true;
1289 if (!(Status is
null))
1294 catch (HTTP.FailedDependencyException ex)
1296 string ErrorMessage = await this.GetErrorMessage(ex);
1302 Ref.AccessDenied =
true;
1306 if (!(Status is
null))
1311 catch (HTTP.NotFoundException ex)
1313 string ErrorMessage = await this.GetErrorMessage(ex);
1321 if (!(Status is
null))
1327 catch (Exception ex)
1329 this.
client.
Warning(
"Unable to retrieve block. Trying again later. Error reported: " + ex.Message +
" (" + ex.GetType().FullName +
")");
1330 this.scheduler?.
Add(DateTime.Now.AddHours(1),
this.RetryProcessing,
new object[] { Ref, Url });
1332 Status?.IncBlockError(Url, ex.Message);
1340 this.loading.Remove(Key);
1348 private async Task<string> GetErrorMessage(HTTP.HttpException ex)
1350 object ContentObject = await ex.GetContentObjectAsync();
1351 if (ContentObject is
string s)
1353 else if (!(ex.Content is
null))
1354 return Encoding.UTF8.GetString(ex.Content);
1364 Dictionary<string, bool> UnpackType =
new Dictionary<string, bool>();
1374 while (await e.MoveNextAsync())
1378 if (!UnpackType.TryGetValue(Obj.
TypeName, out
bool UnpackObject))
1382 UnpackType[Obj.
TypeName] = UnpackObject;
1391 switch (e.CurrentEntry.Type)
1399 this.externalEvents?.RaiseEntryAdded(Obj);
1401 if (!(Status is
null))
1408 catch (Exception ex)
1410 this.
client.Error(ex.Message);
1413 if (!(Status is
null))
1424 this.externalEvents?.RaiseEntryUpdated(Obj);
1426 if (!(Status is
null))
1429 catch (KeyNotFoundException)
1436 this.externalEvents?.RaiseEntryAdded(Obj);
1438 if (!(Status is
null))
1441 catch (Exception ex)
1443 this.
client.Error(ex.Message);
1446 if (!(Status is
null))
1450 catch (Exception ex)
1452 this.
client.Error(ex.Message);
1455 if (!(Status is
null))
1466 this.externalEvents?.RaiseEntryDeleted(Obj);
1468 if (!(Status is
null))
1471 catch (KeyNotFoundException)
1475 catch (Exception ex)
1477 this.
client.Error(ex.Message);
1480 if (!(Status is
null))
1525 Ref.Unpacked =
true;
1530 private async
void RetryProcessing(
object State)
1537 object[] P = (
object[])State;
1539 string Url = (string)P[1];
1550 await this.RetrieveBlock(Ref, Url,
null,
true);
1555 catch (Exception ex)
1569 return Task.CompletedTask;
1577 return this.blockResource.ProcessRequest(Accept, Response, Ref);
Static class that does BASE64URL encoding (using URL and filename safe alphabet), as defined in RFC46...
static string Encode(byte[] Data)
Converts a binary block of data to a Base64URL-encoded string.
Contains information about a binary response to a content request.
string ContentType
Internet Content-Type of encoded object.
void AssertOk()
Asserts response is OK.
byte[] Encoded
Encoded object.
Contains information about a response to a content request.
object Decoded
Decoded object.
void AssertOk()
Asserts response is OK.
Contains information about a stream response to a content request.
Static class managing encoding and decoding of internet content.
static Task< ContentResponse > PostAsync(Uri Uri, object Data, params KeyValuePair< string, string >[] Headers)
Posts to a resource, using a Uniform Resource Identifier (or Locator).
static Task< ContentStreamResponse > GetTempStreamAsync(Uri Uri, params KeyValuePair< string, string >[] Headers)
Gets a (possibly big) resource, given its URI.
static Task< ContentResponse > DecodeAsync(string ContentType, byte[] Data, Encoding Encoding, KeyValuePair< string, string >[] Fields, Uri BaseUri)
Decodes an object.
Represents content embedded in other content.
string Description
Content-Description of embedded object, if defined.
object Decoded
Decoded body of embedded object. ContentType defines how TransferDecoded is transformed into Decoded.
byte[] TransferDecoded
Transformed body of embedded object. TransferEncoding defines how Raw is transformed into TransferDec...
Represents mixed content, encoded with multipart/mixed
const string DefaultContentType
Default content type for XML documents.
Helps with common XML-related tasks.
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
static string Encode(string s)
Encodes a string for use in XML.
Class representing an event.
Event(DateTime Timestamp, EventType Type, string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Class representing an event.
Static class managing the application event log. Applications and services log events on this static ...
static string CleanStackTrace(string StackTrace)
Cleans a Stack Trace string, removing entries from the asynchronous execution model,...
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
static void Warning(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs a warning event.
static void Error(string Message, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, string StackTrace, params KeyValuePair< string, object >[] Tags)
Logs an error event.
void Warning(string Warning)
Called to inform the viewer of a warning state.
void Information(string Comment)
Called to inform the viewer of something.
Base class for all HTTP resources.
Implements an HTTP server.
Event arguments for IQ queries.
async Task IqError(string Xml)
Returns an error response to the current request.
async Task IqResult(string Xml)
Returns a response to the current request.
XmlElement Query
Query element, if found, null otherwise.
string FromBareJid
Bare version of the "from" JID.
Event arguments for presence events.
string EntityCapabilityHashFunction
Hash function used in calculation of entity capabilities version of sender. Entity capabilities are d...
string EntityCapabilityNode
Node of entity capabilities of sender. Entity capabilities are defined in XEP-0115: http://xmpp....
bool HasEntityCapabilities
If the presence stanza includes entity capabilities information. Entity capabilities are defined in X...
bool IsOnline
If contact is online.
string EntityCapabilityVersion
Version of entity capabilities of sender. Entity capabilities are defined in XEP-0115: http://xmpp....
string From
From where the presence was received.
string FromBareJID
Bare JID of resource sending the presence.
XmppClient Client
XMPP Client. Is null if event raised by a component.
uint NrBlocks
Number of blocks processed
DateTime First
Earliest block
uint NrNew
Number of new blocks
ulong ObjectsDeleted
Objects deleted
DateTime Last
Latest block
uint NrDenied
Number of blocks denied access to.
ulong ObjectsAdded
Objects added
ulong ObjectsUpdated
Objects updated
uint ObjectErrors
Number of object errors.
uint NrUpdated
Number of updated blocks
uint NrLoaded
Number of blocks loaded
async Task< string > SynchronizePeer(PeerStatus PeerStatus, bool StartFromBeginning, CallbackAsync< SynchronizationStatus > Callback)
Synchronizes blocks hosted by a peer.
const int DefaultTimeoutMs
Default timeout = 2 minutes.
Task ProcessBlockRequest(HTTP.HeaderFields.HttpFieldAccept Accept, HTTP.HttpResponse Response, BlockReference Ref)
TODO
NeuroLedgerProvider Provider
Neuro-Ledger provider.
override string[] Extensions
Implemented extensions.
override void Dispose()
IDisposable.Dispose
const string NeuroLedgerNamespace
http://waher.se/NL
void StopSynchronization(PeerStatus PeerStatus)
Stops synchronization, if such is in progress.
NeuroLedgerClient(XmppClient Client, EndpointSecurity E2eEncryption, HTTP.HttpServer WebServer, NeuroLedgerProvider Provider)
Neuro-Ledger XMPP Client
async Task< PeerStatus > GetPeerStatus(PresenceEventArgs e)
Gets status information related to a peer.
Contains information about current synchronization status for a node in the network.
string LastBlockId
Last Block ID
Contains information about current synchronization status for a peer in the network.
int SynchCounter
Synchronization Counter
bool IsSynchronizing
If a synchronizating process is underway.
string RequestingCapabilitiesFunction
Entity RequestingCapabilities Function being requested
string RequestingCapabilitiesNode
Entity RequestingCapabilities Node being requested
string CapabilitiesFunction
Entity Capabilities Function
string RequestingCapabilitiesVersion
Entity Capabilities Version being requested
bool IsNeuroLedger
If the peer is a Neuro-Ledger node.
string CapabilitiesVersion
Entity Capabilities Version
string CapabilitiesNode
Entity Capabilities Node
Event raised when a block has been added.
Event raised when a block has been deleted.
Abstract base class for Neuro-Ledger block PEP events.
Abstract base class for Neuro-Ledger PEP events.
Outgoing event, waiting to be sent.
Provides authenticated and authorized clients with lists of available blocks.
Provides authenticated and authorized clients with binary blocks.
const string ErrorMsg_BlockFileHasBeenRemoved
Block file has been removed.
Allows a client to get multiple resources in one call
Class managing end-to-end encryption.
Event argument for personal event notification events.
IPersonalEvent PersonalEvent
Parsed personal event, if appropriate type was found.
Client managing the Personal Eventing Protocol (XEP-0163). https://xmpp.org/extensions/xep-0163....
Task Publish(string Node, EventHandlerAsync< ItemResultEventArgs > Callback, object State)
Publishes an item on a node.
void RegisterHandler(Type PersonalEventType, EventHandlerAsync< PersonalEventNotificationEventArgs > Handler)
Registers an event handler of a specific type of personal events.
async Task< string > PublishAsync(string Node)
Publishes an item on a node.
bool UnregisterHandler(Type PersonalEventType, EventHandlerAsync< PersonalEventNotificationEventArgs > Handler)
Unregisters an event handler of a specific type of personal events.
Maintains information about an item in the roster.
Contains information about an item of an entity.
Event arguments for service discovery responses.
Dictionary< string, bool > Features
Features
The sender has sent a stanza containing XML that does not conform to the appropriate schema or that c...
The requesting entity does not possess the necessary permissions to perform an action that only certa...
Manages an XMPP client connection. Implements XMPP, as defined in https://tools.ietf....
XmppState State
Current state of connection.
bool UnregisterIqGetHandler(string LocalName, string Namespace, EventHandlerAsync< IqEventArgs > Handler, bool RemoveNamespaceAsClientFeature)
Unregisters an IQ-Get handler.
IXmppExtension[] Extensions
Registered extensions.
bool Disposed
If the client has been disposed.
Task< ServiceDiscoveryEventArgs > ServiceDiscoveryAsync(string To)
Performs an asynchronous service discovery request
void RegisterIqGetHandler(string LocalName, string Namespace, EventHandlerAsync< IqEventArgs > Handler, bool PublishNamespaceAsClientFeature)
Registers an IQ-Get handler.
RosterItem[] Roster
Items in the roster.
Base class for XMPP Extensions.
bool ClientDisposed
If the client has been disposed.
XmppClient client
XMPP Client used by the extension.
void Exception(Exception Exception)
Called to inform the viewer of an exception state.
XmppClient Client
XMPP Client.
This attribute defines that objects of this type can be archived, and the time objects can be archive...
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static Task< IPersistentDictionary > GetDictionary(string Collection)
Gets a persistent dictionary containing objects in a collection.
static Task EndBulk()
Ends bulk-processing of data. Must be called once for every call to StartBulk.
static IDatabaseProvider Provider
Registered database provider.
static Task StartBulk()
Starts bulk-proccessing of data. Must be followed by a call to EndBulk.
static async Task Update(object Object)
Updates an object in the database.
static async Task Delete(object Object)
Deletes an object in the database.
static Task< IEnumerable< object > > Find(string Collection, params string[] SortOrder)
Finds objects in a given collection.
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
static async Task Clear(string CollectionName)
Clears a collection of all objects.
An attempt to insert a key was done, but the key was already there.
This filter selects objects that conform to all child-filters provided.
Custom filter used to filter objects using an external expression.
This filter selects objects that have a named field equal to a given value.
This filter selects objects that have a named field greater than a given value.
Event arguments for block reference events.
BlockReference Block
Block reference.
Optimizes a persistent IPersistentDictionary using a cache.
void DeleteAndDispose()
TODO
Task AddAsync(string key, object value)
TODO
async Task< bool > ContainsKeyAsync(string key)
TODO
async Task AddBlockFile(Stream File, BlockReference BlockReference)
Adds a block file to the ledger.
static bool AreEqual(DateTime TP1, DateTime TP2)
Compares two timestamps, to the millisecond (but not tick) level.
ILedgerExternalEvents ExternalEvents
Interface for reporting external events.
static Task< BlockReference > FindReference(byte[] Digest)
Finds a BlockReference object related to a block, given its digest.
async Task< Tuple< uint, uint, uint, uint > > Process(CachedStringDictionary Records, string CollectionName)
Processes an ordered set of records containing ObjectState objects in a cached string dictionary (for...
Enumeratres through objects available in a series of blocks.
T Current
Gets the element in the collection at the current position of the enumerator.
async Task< bool > MoveNextAsync()
Advances the enumerator to the next element of the collection.
Entry CurrentEntry
Current encoded entry.
static async Task< ObjectEnumerator< T > > Create(IAsyncEnumerator< BlockReference > BlockEnumerator, NeuroLedgerProvider Provider)
Creates an object enumerator from a block enumerator.
Represents an object state.
GenericObject Object
Object
Contains a reference to a block in the ledger.
ulong Bytes
Size of block, in bytes.
bool AccessDenied
If access to the block was denied.
bool Unpacked
If objects in the block have been unpacked.
string[] Sources
Sources of block
byte[] Digest
Digest of block
byte[] Signature
Signature of block
string FileName
Local filename of block
Generic object. Contains a sequence of properties.
string TypeName
Type name.
Implements an in-memory cache.
void Dispose()
IDisposable.Dispose
bool TryGetValue(KeyType Key, out ValueType Value)
Tries to get a value from the cache.
Static class that dynamically manages types and interfaces available in the runtime environment.
static Type GetType(string FullName)
Gets a type, given its full name.
static bool TryGetModuleParameter(string Name, out object Value)
Tries to get a module parameter value.
Class that can be used to schedule events in time. It uses a timer to execute tasks at the appointed ...
void Dispose()
IDisposable.Dispose
DateTime Add(DateTime When, Action< object > Callback, object State)
Adds an event.
Task Update(object Object)
Updates an object in the database.
Task Delete(object Object)
Deletes an object in the database.
Task Clear(string CollectionName)
Clears a collection of all objects.
Task Insert(object Object)
Inserts an object into the database.
Interface for proxy for reporting changes to the ledger from external sources.
Persistent dictionary that can contain more entries than possible in the internal memory.
Task ClearAsync()
Clears the dictionary.
SubscriptionState
State of a presence subscription.
XmppState
State of XMPP connection.
BlockStatus
Status of the block.
EntryType
Ledger entry type.