public void CommitBlock(BlockHandle handle, CommittedBlockId blockId) { var returnCode = PInvokes.terab_utxo_commit_block(_connection, handle, ref blockId); if (returnCode != ReturnCode.SUCCESS) { throw new TerabException("CommitBlock failed.", returnCode); } }
public BlockHandle GetUncommittedBlock(UncommittedBlockId blockUcid) { var returnCode = PInvokes.terab_utxo_get_uncommitted_block( _connection, ref blockUcid, out BlockHandle handle); if (returnCode != ReturnCode.SUCCESS) { throw new TerabException("GetUncommittedBlock failed.", returnCode); } return(handle); }
public void Dispose() { _connection.Dispose(); lock (InitializationRoot) { if (--_clientCount == 0) { PInvokes.terab_shutdown(); } } }
public BlockInfo GetBlockInfo(BlockHandle handle) { var info = new BlockInfo(); var returnCode = PInvokes.terab_utxo_get_blockinfo( _connection, handle, ref info); if (returnCode != ReturnCode.SUCCESS) { throw new TerabException("GetBlockInfo failed.", returnCode); } return(info); }
public BlockHandle OpenBlock(CommittedBlockId parent, out UncommittedBlockId ucid) { ucid = default; var returnCode = PInvokes.terab_utxo_open_block( _connection, ref parent, out BlockHandle handle, ref ucid); if (returnCode != ReturnCode.SUCCESS) { throw new TerabException("OpenBlock failed.", returnCode); } return(handle); }
public TerabClient(string connectionString) { lock (InitializationRoot) { if (++_clientCount == 1) { var err = PInvokes.terab_initialize(); if (err != ReturnCode.SUCCESS) { throw new TerabException("Terab initialization failed.", err); } } } var status = PInvokes.terab_connect(connectionString, out _connection); if (ReturnCode.SUCCESS != status) { throw new TerabException("Invalid connection to a Terab instance.", status); } }
protected override bool ReleaseHandle() { var returnCode = PInvokes.terab_disconnect(this, _reason); return(returnCode == ReturnCode.SUCCESS); }