public SendCloudToDeviceMessage(ILoRaDeviceCacheStore cacheStore, RegistryManager registryManager, IServiceClient serviceClient, ILogger <SendCloudToDeviceMessage> log) { this.cacheStore = cacheStore; this.registryManager = registryManager; this.serviceClient = serviceClient; this.log = log; }
public DevAddrCacheTest(RedisFixture redis) { if (redis is null) { throw new ArgumentNullException(nameof(redis)); } this.cache = new LoRaDeviceCacheRedisStore(redis.Database); }
private static void InitCache(ILoRaDeviceCacheStore cache, List <DevAddrCacheInfo> deviceIds) { var loradevaddrcache = new LoRaDevAddrCache(cache, null, null); foreach (var device in deviceIds) { loradevaddrcache.StoreInfo(device); } }
public LoRaDevAddrCache(ILoRaDeviceCacheStore cacheStore, RegistryManager registryManager, ILogger logger, string gatewayId) { this.cacheStore = cacheStore; this.logger = logger ?? NullLogger.Instance; this.lockOwner = gatewayId ?? Guid.NewGuid().ToString(); // perform the necessary syncs _ = this.PerformNeededSyncs(registryManager); }
public static async Task TakeLocksAsync(ILoRaDeviceCacheStore loRaDeviceCache, string[] lockNames) { if (lockNames?.Length > 0) { foreach (var locks in lockNames) { await loRaDeviceCache.LockTakeAsync(locks, locks, TimeSpan.FromMinutes(3)); } } }
public PreferredGatewayTestWithRedis(RedisFixture redis, ITestOutputHelper testOutputHelper) { if (redis is null) { throw new ArgumentNullException(nameof(redis)); } this.cache = new LoRaDeviceCacheRedisStore(redis.Database); this.preferredGatewayExecutionItem = new PreferredGatewayExecutionItem(this.cache, new TestOutputLogger <PreferredGatewayExecutionItem>(testOutputHelper), null); }
public LoRaDeviceCache(ILoRaDeviceCacheStore cacheStore, DevEui devEUI, string gatewayId) { if (string.IsNullOrEmpty(gatewayId)) { throw new ArgumentNullException(nameof(gatewayId)); } this.cacheStore = cacheStore; this.devEUI = devEUI; this.gatewayId = gatewayId; this.cacheKey = devEUI.ToString(); }
public LoRaDeviceCache(ILoRaDeviceCacheStore cacheStore, string devEUI, string gatewayId) { if (string.IsNullOrEmpty(devEUI)) { throw new ArgumentNullException("devEUI"); } if (string.IsNullOrEmpty(gatewayId)) { throw new ArgumentNullException("gatewayId"); } this.cacheStore = cacheStore; this.devEUI = devEUI; this.gatewayId = gatewayId; this.cacheKey = devEUI; }
public PreferredGatewayExecutionItem(ILoRaDeviceCacheStore cacheStore, ILogger <PreferredGatewayExecutionItem> log, IConfiguration configuration) { this.log = log; this.cacheStore = cacheStore ?? throw new ArgumentNullException(nameof(cacheStore)); var receiveIntervalSetting = configuration?.GetValue <string>(PREFERREDGATEWAY_RECEIVE_REQUESTS_CONFIGURATIONNAME); if (!string.IsNullOrEmpty(receiveIntervalSetting) && int.TryParse(receiveIntervalSetting, out var receiveIntervalSettingInt) && receiveIntervalSettingInt > 0) { this.receiveInterval = receiveIntervalSettingInt; } else { this.receiveInterval = DEFAULT_RECEIVE_REQUESTS_PERIOD_IN_MS; } this.log.LogInformation("Using receive interval for in preferred gateway of {interval}ms", this.receiveInterval); }
public PreferredGatewayExecutionItem(ILoRaDeviceCacheStore cacheStore, ILogger <PreferredGatewayExecutionItem> log, IConfiguration configuration) { this.log = log; this.cacheStore = cacheStore ?? throw new ArgumentNullException(nameof(cacheStore)); var receiveIntervalSetting = configuration?.GetValue <string>(PreferredGatewayReceiveRequestsConfigurationname); if (!string.IsNullOrEmpty(receiveIntervalSetting) && int.TryParse(receiveIntervalSetting, out var receiveIntervalSettingInt) && receiveIntervalSettingInt > 0) { this.receiveInterval = receiveIntervalSettingInt; } else { this.receiveInterval = DefaultReceiveRequestsPeriodInMs; } this.log.LogInformation("Using receive interval for in preferred gateway of {interval}ms", this.receiveInterval); }
public LoRaADRServerManager(ILoRaADRStore store, ILoRaADRStrategyProvider strategyProvider, ILoRaDeviceCacheStore deviceCacheStore) : base(store, strategyProvider) { this.deviceCacheStore = deviceCacheStore; }
public DeviceGetter(RegistryManager registryManager, ILoRaDeviceCacheStore cacheStore) { this.registryManager = registryManager; this.cacheStore = cacheStore; }
public DevAddrCacheTest(RedisFixture redis) { this.cache = new LoRaDeviceCacheRedisStore(redis.Database); }
public PreferredGatewayTestWithRedis(RedisFixture redis) { this.cache = new LoRaDeviceCacheRedisStore(redis.Database); this.preferredGatewayExecutionItem = new PreferredGatewayExecutionItem(this.cache, new NullLogger <PreferredGatewayExecutionItem>(), null); }
public static DevAddrCacheInfo GetCachedDevAddr(ILoRaDeviceCacheStore loRaDeviceCache, string key) => loRaDeviceCache.GetObject <DevAddrCacheInfo>(key);
public static async Task PrepareLocksForTests(ILoRaDeviceCacheStore loRaDeviceCache, string[] locksGuideTest = null) { LockDevAddrHelper.ReleaseAllLocks(loRaDeviceCache); await LockDevAddrHelper.TakeLocksAsync(loRaDeviceCache, locksGuideTest); }
public static void ReleaseAllLocks(ILoRaDeviceCacheStore loRaDeviceCache) { loRaDeviceCache.KeyDelete(GlobalDevAddrUpdateKey); loRaDeviceCache.KeyDelete(FullUpdateKey); }
/// <summary> /// Initializes a new instance of the <see cref="LoRaDevAddrCache"/> class. /// This constructor is only used by the DI Manager. Use the other constructore for general usage. /// </summary> public LoRaDevAddrCache(ILoRaDeviceCacheStore cacheStore, ILogger logger, string gatewayId) { this.cacheStore = cacheStore; this.logger = logger ?? NullLogger.Instance; this.lockOwner = gatewayId ?? Guid.NewGuid().ToString(); }
public DeduplicationExecutionItem(ILoRaDeviceCacheStore cacheStore) { this.cacheStore = cacheStore; }
internal static LoRaDevicePreferredGateway LoadFromCache(ILoRaDeviceCacheStore cacheStore, string devEUI) { return(CreateFromCachedString(cacheStore.StringGet(PreferredGatewayCacheKey(devEUI)))); }
public PreferredGatewayTest() { this.cache = new LoRaInMemoryDeviceStore(); this.preferredGatewayExecutionItem = new PreferredGatewayExecutionItem(this.cache, new NullLogger <PreferredGatewayExecutionItem>(), null); }
public FCntCacheCheck(ILoRaDeviceCacheStore deviceCache) { this.deviceCache = deviceCache; }
internal static bool SaveToCache(ILoRaDeviceCacheStore cacheStore, string devEUI, LoRaDevicePreferredGateway preferredGateway, bool onlyIfNotExists = false) { return(cacheStore.StringSet(PreferredGatewayCacheKey(devEUI), preferredGateway.ToCachedString(), null, onlyIfNotExists)); }
public DevAddressCacheManager(RegistryManager registryManager, ILoRaDeviceCacheStore cacheStore, ILogger <DevAddressCacheManager> logger) { this.registryManager = registryManager; this.cacheStore = cacheStore; this.logger = logger; }