public static void MustMatchMaxIdOf(this string sutDB, string masterDB) { var expctd = AnyLiteDB.GetMaxId(masterDB); var actual = AnyLiteDB.GetMaxId(sutDB); actual.Should().Be(expctd); }
private string ComposeBroadcastMessage(string fileKey, string filePath) { var desc = new AppendOnlyDbChangeInfo { FileKey = fileKey, MaxId = AnyLiteDB.GetMaxId(filePath) }; return(JsonConvert.SerializeObject(desc)); }
private bool SameMaxIDs(long remoteMaxId, out long localMaxId) { if (!File.Exists(_filePath)) { Log("Local DB currently does not exist."); localMaxId = 0; return(false); } localMaxId = AnyLiteDB.GetMaxId(_filePath); var isSame = localMaxId == remoteMaxId; Log(isSame ? $"Local and remote max IDs are both [{localMaxId}]." : $"Local max ID [{localMaxId}] differs from that of remote [{remoteMaxId}]."); return(isSame); }
public async Task <long> GetMaxId(string fileKey) { await Task.Delay(0); if (!IsValidDbKey(fileKey, out string filePath)) { return(-1); } try { return(AnyLiteDB.GetMaxId(filePath)); } catch (Exception ex) { _logs.Add(ex); return(-1); } }