/// <inheritdoc /> public DBStorageStatsValue GetDBStatsInfoByStorageType(DBStoredTypes storageType) { Contract.Requires(m_accessor != null, "XldbDataStore is not initialized"); var storageStatsKey = new DBStorageStatsKey { StorageType = storageType, }; var maybeFound = m_accessor.Use(database => { if (database.TryGetValue(storageStatsKey.ToByteArray(), out var storageStatValue)) { return(DBStorageStatsValue.Parser.ParseFrom(storageStatValue)); } return(null); }); if (!maybeFound.Succeeded) { maybeFound.Failure.Throw(); } return(maybeFound.Result); }
/// <summary> /// Adds storage event information to db storage dictionary /// </summary> private void AddToDbStorageDictionary(DBStoredTypes type, int payloadSize) { m_dBStorageStats.AddOrUpdate(type, new DBStorageStatsValue() { Count = 1, Size = (ulong)payloadSize, }, (key, dBStorageStatsValue) => { dBStorageStatsValue.Count++; dBStorageStatsValue.Size += (ulong)payloadSize; return(dBStorageStatsValue); }); }