borepin/FabAccessAPI/Connection.cs

65 lines
2.5 KiB
C#
Raw Normal View History

2021-09-07 23:00:48 +02:00
//using Capnp.Rpc;
//using FabAccessAPI.Schema;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Threading;
//using System.Threading.Tasks;
2020-10-26 14:35:31 +01:00
2021-09-07 23:00:48 +02:00
//namespace FabAccessAPI {
// public class Connection {
// #region private variables
// private readonly TcpRpcClient? _rpcClient = null;
// private readonly IBootstrap? _bootstrapCap = null;
// private Auth? _auth = null;
// private Machines? _machines = null;
// #endregion
2020-12-19 21:04:17 +01:00
2021-09-07 23:00:48 +02:00
// public TcpRpcClient? RpcClient => _rpcClient;
2020-12-21 13:44:29 +01:00
2021-09-07 23:00:48 +02:00
// #region Log
// private static readonly log4net.ILog _Log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// #endregion
2020-12-19 21:04:17 +01:00
2021-09-07 23:00:48 +02:00
// /// <summary>
// ///
// /// </summary>
// /// <param name="rpcClient">Should be an already configured and connected TcpRpcClient</param>
// public Connection(TcpRpcClient rpcClient) {
// _rpcClient = rpcClient;
// _bootstrapCap = _rpcClient.GetMain<IBootstrap>();
// _Log.Debug($"Done bootstraping API connection.");
// }
2020-10-26 14:35:31 +01:00
2021-09-07 23:00:48 +02:00
// /// <summary>
// /// Authenticate this connection.
// /// Calling this more then once is UB
// /// </summary>
// /// <param name="mech">The desired authentication mechanism</param>
// /// <param name="kvs">Key-Value data specific to the mechanism</param>
// /// <returns></returns>
// public async Task Auth(string mech, Dictionary<string, object> kvs, CancellationToken cancellationToken_ = default) {
// // _bootstrapCap = await _bootstrapCap.Unwrap();
// var authCap = await _bootstrapCap.Auth(cancellationToken_);
// _auth = new Auth(authCap);
// var mechs = await _auth.GetMechanisms();
// _Log.Debug($"The Server supports the following auth mechs: {string.Join(", ", mechs)}");
2020-11-12 10:12:56 +01:00
2021-09-07 23:00:48 +02:00
// if (!mechs.Contains(mech)) {
// throw new UnsupportedMechanismException();
// }
2020-11-12 10:12:56 +01:00
2021-09-07 23:00:48 +02:00
// await _auth.Authenticate(mech, kvs);
// }
2020-11-12 10:12:56 +01:00
2021-09-07 23:00:48 +02:00
// /// <summary>
// /// Get a wrapped capability to interact with machines
// /// </summary>
// /// <returns>A wrapped capability to interact with machines</returns>
// public async Task<Machines> AccessMachines() {
// _machines ??= new Machines(await _bootstrapCap.Machines());
// return _machines;
// }
// }
//}