示例#1
0
        /// <summary>
        /// Creates a new pool configuration.
        /// </summary>
        /// <param name="configName">The name for the configuration.</param>
        /// <param name="config">The configuration JSON.</param>
        /// <returns>An asynchronous Task with no return value.</returns>
        public static Task CreatePoolLedgerConfigAsync(string configName, string config)
        {
            var taskCompletionSource = new TaskCompletionSource <bool>();
            var commandHandle        = AddTaskCompletionSource(taskCompletionSource);

            var result = IndyNativeMethods.indy_create_pool_ledger_config(
                commandHandle,
                configName,
                config,
                _noValueCallback
                );

            CheckResult(result);

            return(taskCompletionSource.Task);
        }
示例#2
0
        /// <summary>
        /// Creates a new local pool configuration that can be used later to open a connection to pool nodes.
        /// </summary>
        /// <remarks>
        /// <para>
        /// If the configuration specified in the <paramref name="config"/> parameter is null then the
        /// default configuration will be used, however if specified the value should adhere to the following
        /// JSON format:
        /// <code>
        /// {
        ///     "genesis_txn": "path/to/genesis/transaction/file"
        /// }
        /// </code>
        /// If the value of the <c>genesis_txn</c> key in the JSON is null then a default file will be
        /// used.  If the file specified does not exist it will be created.
        /// </para>
        /// </remarks>
        /// <seealso cref="OpenPoolLedgerAsync(string, string)"/>
        /// <seealso cref="DeletePoolLedgerConfigAsync(string)"/>
        /// <param name="configName">The name for the configuration.</param>
        /// <param name="config">The configuration JSON.</param>
        /// <returns>An asynchronous <see cref="Task{T}"/> with no return value that completes when
        /// the configuration is created.</returns>
        public static Task CreatePoolLedgerConfigAsync(string configName, string config)
        {
            ParamGuard.NotNullOrWhiteSpace(configName, "configName");

            var taskCompletionSource = new TaskCompletionSource <bool>();
            var commandHandle        = PendingCommands.Add(taskCompletionSource);

            var result = IndyNativeMethods.indy_create_pool_ledger_config(
                commandHandle,
                configName,
                config,
                CallbackHelper.TaskCompletingNoValueCallback
                );

            CallbackHelper.CheckResult(result);

            return(taskCompletionSource.Task);
        }