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); + + } +}