Interface IDeltaHashProvider
This service should be used by components which need to access the history of ledger state updates as they get confirmed and appear on the Dfs, it provides access to a chronology of updates, as well as a live stream of the updates.
Namespace: Catalyst.Abstractions.Consensus.Deltas
Assembly: Catalyst.Abstractions.dll
Syntax
public interface IDeltaHashProvider
Properties
| Improve this Doc View SourceDeltaHashUpdates
Subscribe to these updates to get live notifications for the hashes of new deltas as they get published on the Dfs.
Declaration
IObservable<MultiHash> DeltaHashUpdates { get; }
Property Value
Type | Description |
---|---|
System.IObservable<MultiHash> |
Methods
| Improve this Doc View SourceGetLatestDeltaHash(Nullable<DateTime>)
Retrieve the latest ledger update, as seen from an optional point in time in the past.
Declaration
MultiHash GetLatestDeltaHash(DateTime? asOf = default(DateTime? ))
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.DateTime> | asOf | An optional point in time in the past, if not provided, it will use UtcNow |
Returns
Type | Description |
---|---|
MultiHash | The hash, or address on the DFS, of the latest ledger state update as a string, as returned in AddAsync(Stream, String, CancellationToken) |
TryUpdateLatestHash(MultiHash, MultiHash)
Call this method to try and update the latest hash on the cache. This adds the new hash in memory, and if the cache is full, also evicts the oldest hash from the cache.
Declaration
bool TryUpdateLatestHash(MultiHash previousHash, MultiHash newHash)
Parameters
Type | Name | Description |
---|---|---|
MultiHash | previousHash | The hash that is supposed to chronologically precede the new one. |
MultiHash | newHash | The new and latest hash, which should replace |
Returns
Type | Description |
---|---|
System.Boolean |