2021-01-07 05:07:36 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using Realms;
|
|
|
|
|
|
|
|
namespace osu.Game.Database
|
|
|
|
{
|
|
|
|
public interface IRealmFactory
|
|
|
|
{
|
2021-01-13 08:34:44 +00:00
|
|
|
/// <summary>
|
|
|
|
/// The main realm context, bound to the update thread.
|
2021-07-04 10:07:31 +00:00
|
|
|
/// If querying from a non-update thread is needed, use <see cref="GetForRead"/> or <see cref="GetForWrite"/> to receive a context instead.
|
2021-01-13 08:34:44 +00:00
|
|
|
/// </summary>
|
2021-04-23 17:13:29 +00:00
|
|
|
Realm Context { get; }
|
2021-01-13 08:34:44 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get a fresh context for read usage.
|
|
|
|
/// </summary>
|
2021-01-22 08:28:47 +00:00
|
|
|
RealmContextFactory.RealmUsage GetForRead();
|
2021-01-07 05:07:36 +00:00
|
|
|
|
|
|
|
/// <summary>
|
2021-01-13 08:34:44 +00:00
|
|
|
/// Request a context for write usage.
|
2021-01-07 05:07:36 +00:00
|
|
|
/// This method may block if a write is already active on a different thread.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>A usage containing a usable context.</returns>
|
2021-01-13 09:24:19 +00:00
|
|
|
RealmContextFactory.RealmWriteUsage GetForWrite();
|
2021-01-07 05:07:36 +00:00
|
|
|
}
|
|
|
|
}
|