[#28] Client: Apply code optimizations
Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
766f61a5f7
commit
749000a090
57 changed files with 845 additions and 1116 deletions
|
@ -9,14 +9,15 @@ internal interface ISessionProvider
|
|||
|
||||
internal sealed class SessionProvider(ClientContext envCtx)
|
||||
{
|
||||
public async ValueTask<Session.SessionToken> GetOrCreateSession(ISessionToken args, CallContext ctx)
|
||||
public async Task<FrostFsSessionToken> CreateSession(ISessionToken args, CallContext ctx)
|
||||
{
|
||||
if (args.SessionToken is null)
|
||||
{
|
||||
return await envCtx.Client.CreateSessionInternalAsync(new PrmSessionCreate(uint.MaxValue, ctx))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
var token = await GetDefaultSession(args, ctx).ConfigureAwait(false);
|
||||
|
||||
return new Session.SessionToken().Deserialize(args.SessionToken.Token);
|
||||
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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue