Interface ILedgerService
- Namespace
- NuvTools.Blockchain
- Assembly
- NuvTools.Blockchain.dll
Defines the contract for blockchain ledger operations.
public interface ILedgerService
Methods
ReadAsync<T>(string, string?, int, int, CancellationToken)
Reads an entry from the ledger.
Task<LedgerEntry<T>?> ReadAsync<T>(string transactionId, string? collectionId = null, int maxRetries = 10, int delayMilliseconds = 500, CancellationToken cancellationToken = default) where T : class
Parameters
transactionIdstringThe transaction ID to read.
collectionIdstringOptional collection/sub-ledger identifier.
maxRetriesintMaximum retry attempts for pending entries.
delayMillisecondsintBase delay between retries in milliseconds.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<LedgerEntry<T>>
The ledger entry if found; otherwise, null.
Type Parameters
TThe type of the entry content.
WriteAsync<T>(T, string?, CancellationToken)
Writes an entry to the ledger.
Task<string> WriteAsync<T>(T entry, string? collectionId = null, CancellationToken cancellationToken = default) where T : class
Parameters
entryTThe entry to write.
collectionIdstringOptional collection/sub-ledger identifier.
cancellationTokenCancellationTokenCancellation token.
Returns
Type Parameters
TThe type of the entry content.