/// <summary> /// Creates a new hash filter. /// </summary> /// <param name="hashType">Hash function to use.</param> /// <param name="salt">Salt used in hashing. It will be appended to the hashed value before hashing and /// hashed together.</param> /// <param name="monitoringOption">How to behave when invoking <see cref="EventSourceBase.Send"/> callbacks.</param> /// <param name="keysToHash">Message keys whose values will be hashed and saved under the key.</param> public HashFilter(HashType hashType, Func<string> salt, EventSourceCallbackMonitoringOptions monitoringOption, params string[] keysToHash) : base(monitoringOption) { _salt = salt; _keysToHash = keysToHash; switch (hashType) { case HashType.Sha256: _hashProvider = new SHA256Managed(); break; default: throw new ArgumentException($"Not implemented HashType option {hashType}"); } }
/// <summary> /// Creates a new instance. /// </summary> /// <param name="sets">Sets used by k-set algorithm.</param> /// <param name="chooseSet">This function have to choose a proper set from the sets /// based on passed <see cref="NuntiusMessage"/>.</param> /// <param name="options">Configuration regarding checking of tasks returned by <see cref="EventSourceBase.Send"/> event /// handlers.</param> public KAnonymityFilter(IKAnonymitySet[] sets, Func<NuntiusMessage, int> chooseSet, EventSourceCallbackMonitoringOptions options) : base(options) { if (sets == null || sets.Length == 0) throw new ArgumentException($"Parameter {nameof(sets)} must be array of length at least 1."); foreach (var set in sets) { if (set == null) throw new ArgumentNullException($"One set from {nameof(sets)} was null."); if (_sets.ContainsKey(set.Id)) throw new ArgumentException($"There was a set with the same id {set.Id} as a different set."); _sets.Add(set.Id, set); } if (chooseSet == null) throw new ArgumentNullException($"{nameof(chooseSet)} function was null."); _chooseSet = chooseSet; }
/// <summary> /// Creates a new instance. /// </summary> /// <param name="monitoringOption">Configuration regarding checking of tasks returned by <see cref="Send"/> event /// handlers.</param> protected EventSourceBase(EventSourceCallbackMonitoringOptions monitoringOption) { MonitoringOption = monitoringOption; }
/// <summary> /// Creates a new trim message filter. /// </summary> /// <param name="checkKeyPressenceInMessage">If set to true throws <see cref="KeyNotFoundException"/> when deleted key /// is not in the message.</param> /// <param name="monitoringOption">How to behave when invoking <see cref="EventSourceBase.Send"/> callbacks.</param> /// <param name="keysToDelete">Keys to delete from the message.</param> public TrimMessageFilter(bool checkKeyPressenceInMessage, EventSourceCallbackMonitoringOptions monitoringOption, params string[] keysToDelete) : base(monitoringOption) { _checkKeyPressenceInMessage = checkKeyPressenceInMessage; _keysToDelete = keysToDelete; }
public TestFilter(EventSourceCallbackMonitoringOptions options, Action<NuntiusMessage> filterBody, Action<NuntiusMessage> preTaskBody) : base(options) { _filterBody = filterBody; _preTaskBody = preTaskBody; }
/// <summary> /// /// </summary> /// <param name="intervalInMs">Interval in milliseconds. After receiving the first message, a timer is started /// and only a last message from the interval given by this parameter is sent.</param> /// <param name="options">Configuration regarding checking of tasks returned by /// <see cref="EventSourceBase.Send"/> event.</param> public LastFilter(int intervalInMs, EventSourceCallbackMonitoringOptions options) : base(options) { _intervalInMs = intervalInMs; }