internal GossipBackend(ITransport transport, GossipConfiguration configuration, object owner) { _owner = owner ?? this; Transport = transport ?? throw new ArgumentNullException(nameof(transport)); Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _freshIndex = new ReverseTimeIndex(GetItemDirect); _gossipTimer = new Timer(_ => SpreadRumors(), null, Configuration.GossipInterval, Configuration.GossipInterval); _deletableTimer = new Timer(GetDeletableTimerMethod(), null, Configuration.CleanUpInterval, Configuration.CleanUpInterval); _applyMethods = new ApplyMethods((key, fi) => SetInternal(key, fi)); Transport.MessageHandler = Transport_MessageHandler; }
/// <summary> /// Constructor. /// </summary> /// <param name="transport">The message transport to use. The backend will dispose it when it gets disposed.</param> /// <param name="configuration">The configuration.</param> public GossipBackend(ITransport transport, GossipConfiguration configuration) : this(transport, configuration, null) { }
/// <summary> /// Constructor. /// </summary> /// <param name="transport">The message transport to use. The backend will dispose it when it gets disposed.</param> /// <param name="configuration">The configuration.</param> /// <param name="logger">The logger to use.</param> public GossipBackend(ITransport transport, GossipConfiguration configuration, ILogger logger = null) : this(transport, configuration, null, logger) { }