mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Initial push to use ILive
in import process
This commit is contained in:
42
osu.Game/Database/ILive.cs
Normal file
42
osu.Game/Database/ILive.cs
Normal file
@ -0,0 +1,42 @@
|
||||
// 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 System;
|
||||
|
||||
namespace osu.Game.Database
|
||||
{
|
||||
/// <summary>
|
||||
/// A wrapper to provide access to database backed classes in a thread-safe manner.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The databased type.</typeparam>
|
||||
public interface ILive<out T> where T : class
|
||||
{
|
||||
Guid ID { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Perform a read operation on this live object.
|
||||
/// </summary>
|
||||
/// <param name="perform">The action to perform.</param>
|
||||
void PerformRead(Action<T> perform);
|
||||
|
||||
/// <summary>
|
||||
/// Perform a read operation on this live object.
|
||||
/// </summary>
|
||||
/// <param name="perform">The action to perform.</param>
|
||||
TReturn PerformRead<TReturn>(Func<T, TReturn> perform);
|
||||
|
||||
/// <summary>
|
||||
/// Perform a write operation on this live object.
|
||||
/// </summary>
|
||||
/// <param name="perform">The action to perform.</param>
|
||||
void PerformWrite(Action<T> perform);
|
||||
|
||||
/// <summary>
|
||||
/// Resolve the value of this instance on the current thread's context.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// After resolving the data should not be passed between threads.
|
||||
/// </remarks>
|
||||
T Value { get; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user