33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using SurrealDb.Net;
|
|
using SurrealDb.Net.Models.Response;
|
|
|
|
namespace ZB.MOM.WW.CBDDC.Persistence.Surreal;
|
|
|
|
/// <summary>
|
|
/// Abstraction over the embedded Surreal client used by CBDDC persistence stores.
|
|
/// </summary>
|
|
public interface ICBDDCSurrealEmbeddedClient : IAsyncDisposable, IDisposable
|
|
{
|
|
/// <summary>
|
|
/// Gets the underlying Surreal client.
|
|
/// </summary>
|
|
ISurrealDbClient Client { get; }
|
|
|
|
/// <summary>
|
|
/// Connects and selects namespace/database exactly once.
|
|
/// </summary>
|
|
Task InitializeAsync(CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Executes a raw SurrealQL statement.
|
|
/// </summary>
|
|
Task<SurrealDbResponse> RawQueryAsync(string query,
|
|
IReadOnlyDictionary<string, object?>? parameters = null,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Checks whether the embedded client responds to health probes.
|
|
/// </summary>
|
|
Task<bool> HealthAsync(CancellationToken cancellationToken = default);
|
|
}
|