23 lines
No EOL
732 B
C#
23 lines
No EOL
732 B
C#
using System.Threading.Tasks;
|
|
|
|
namespace FrostFS.SDK.Client;
|
|
|
|
internal interface ISessionProvider
|
|
{
|
|
ValueTask<Session.SessionToken> GetOrCreateSession(ISessionToken args, CallContext ctx);
|
|
}
|
|
|
|
internal sealed class SessionProvider(ClientContext envCtx)
|
|
{
|
|
public async Task<FrostFsSessionToken> CreateSession(ISessionToken args, CallContext ctx)
|
|
{
|
|
var token = await GetDefaultSession(args, ctx).ConfigureAwait(false);
|
|
|
|
return new FrostFsSessionToken(token);
|
|
}
|
|
|
|
internal async Task<Session.SessionToken> GetDefaultSession(ISessionToken args, CallContext ctx)
|
|
{
|
|
return await envCtx.Client.CreateSessionInternalAsync(new PrmSessionCreate(uint.MaxValue), ctx).ConfigureAwait(false);
|
|
}
|
|
} |