2020-12-29 23:14:42 -06:00
|
|
|
using System.Collections.Generic;
|
2021-03-31 15:37:40 -05:00
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2021-04-20 23:55:03 -05:00
|
|
|
using GameServiceWarden.ModuleAPI;
|
2020-12-29 23:14:42 -06:00
|
|
|
|
|
|
|
namespace GameServiceWarden.Core.Persistence
|
|
|
|
{
|
2021-03-31 15:37:40 -05:00
|
|
|
public interface IReadOnlyPersistent<V> : IEnumerable<KeyValuePair<string, V>>
|
2020-12-29 23:14:42 -06:00
|
|
|
{
|
2021-03-31 15:37:40 -05:00
|
|
|
V this[string key] { get; }
|
|
|
|
|
2021-03-30 15:22:28 -05:00
|
|
|
/// <summary>
|
|
|
|
/// The directory for this dictionary to use.
|
|
|
|
/// </summary>
|
2020-12-29 23:14:42 -06:00
|
|
|
string MapDirectory { get; }
|
2021-03-31 15:37:40 -05:00
|
|
|
int Count { get; }
|
|
|
|
IEnumerable<V> Values { get; }
|
|
|
|
IEnumerable<string> Keys { get; }
|
|
|
|
|
|
|
|
bool ContainsKey(string key);
|
2021-03-30 15:22:28 -05:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The path to the data representing a specific key.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="key">The key to get the path for.</param>
|
|
|
|
/// <returns>A <see cref="string"/> representing the key.</returns>
|
2020-12-29 23:14:42 -06:00
|
|
|
string GetPathForKey(string key);
|
2021-03-31 19:33:37 -05:00
|
|
|
bool TryLoadValue(string key, [MaybeNullWhen(false)] out V value);
|
2020-12-29 23:14:42 -06:00
|
|
|
}
|
|
|
|
}
|