From 376a16129d56734a954bcecb63baf5ca15599863 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Tue, 3 Dec 2019 22:54:17 -0600 Subject: [PATCH] Added IConfigStore interface --- IPA.Loader/Config/IConfigStore.cs | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 IPA.Loader/Config/IConfigStore.cs diff --git a/IPA.Loader/Config/IConfigStore.cs b/IPA.Loader/Config/IConfigStore.cs new file mode 100644 index 00000000..fc8f7c3b --- /dev/null +++ b/IPA.Loader/Config/IConfigStore.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace IPA.Config +{ + /// + /// A storage for a config structure. + /// + public interface IConfigStore + { + /// + /// A synchronization object for the save thread to wait on for changes. + /// It should be signaled whenever the internal state of the object is changed. + /// The writer will never signal this handle. + /// + WaitHandle SyncObject { get; } + + /// + /// A synchronization object for the load thread and accessors to maintain safe synchronization. + /// Any readers should take a read lock with or + /// , and any writers should take a + /// write lock with . + /// + /// + /// Read and write are read and write to *this object*, not to the file on disk. + /// + ReaderWriterLockSlim WriteSyncObject { get; } + + /// + /// Writes the config structure stored by the current to the given + /// . + /// + /// the provider to write to + void WriteTo(IConfigProvider provider); + + /// + /// Reads the config structure from the given into the current + /// . + /// + /// + void ReadFrom(IConfigProvider provider); + + } +}