ConfidentialLedgerClient.GetLedgerEntry Method

Definition

Overloads

Name Description
GetLedgerEntry(String, String, RequestContext)

Gets the ledger entry at the specified transaction id.

GetLedgerEntry(String, String, CancellationToken)

To return older ledger entries, the relevant sections of the ledger must be read from disk and validated. To prevent blocking within the enclave, the response will indicate whether the entry is ready and part of the response, or if the loading is still ongoing.

GetLedgerEntry(String, String, RequestContext)

Source:
ConfidentialLedgerClient.cs
Source:
ConfidentialLedgerClient.cs

Gets the ledger entry at the specified transaction id.

public virtual Azure.Response GetLedgerEntry(string transactionId, string collectionId = default, Azure.RequestContext context = default);
public virtual Azure.Response GetLedgerEntry(string transactionId, string collectionId, Azure.RequestContext context);
abstract member GetLedgerEntry : string * string * Azure.RequestContext -> Azure.Response
override this.GetLedgerEntry : string * string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetLedgerEntry (transactionId As String, Optional collectionId As String = Nothing, Optional context As RequestContext = Nothing) As Response
Public Overridable Function GetLedgerEntry (transactionId As String, collectionId As String, context As RequestContext) As Response

Parameters

transactionId
String

Identifies a write transaction.

collectionId
String

The collection id.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

transactionId is null.

transactionId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call GetLedgerEntry and parse the result.

TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);

Response response = client.GetLedgerEntry("<transactionId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("state").ToString());

This sample shows how to call GetLedgerEntry with all parameters and parse the result.

TokenCredential credential = new DefaultAzureCredential();
ConfidentialLedgerClient client = new ConfidentialLedgerClient(new Uri("http://localhost:3000"), credential);

Response response = client.GetLedgerEntry("<transactionId>", collectionId: "<collectionId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("state").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("contents").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("collectionId").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("transactionId").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("preHooks")[0].GetProperty("functionId").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("preHooks")[0].GetProperty("properties").GetProperty("arguments")[0].ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("preHooks")[0].GetProperty("properties").GetProperty("exportedFunctionName").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("preHooks")[0].GetProperty("properties").GetProperty("runtimeOptions").GetProperty("log_exception_details").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("preHooks")[0].GetProperty("properties").GetProperty("runtimeOptions").GetProperty("max_cached_interpreters").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("preHooks")[0].GetProperty("properties").GetProperty("runtimeOptions").GetProperty("max_execution_time_ms").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("preHooks")[0].GetProperty("properties").GetProperty("runtimeOptions").GetProperty("max_heap_bytes").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("preHooks")[0].GetProperty("properties").GetProperty("runtimeOptions").GetProperty("max_stack_bytes").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("preHooks")[0].GetProperty("properties").GetProperty("runtimeOptions").GetProperty("return_exception_details").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("postHooks")[0].GetProperty("functionId").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("postHooks")[0].GetProperty("properties").GetProperty("arguments")[0].ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("postHooks")[0].GetProperty("properties").GetProperty("exportedFunctionName").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("postHooks")[0].GetProperty("properties").GetProperty("runtimeOptions").GetProperty("log_exception_details").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("postHooks")[0].GetProperty("properties").GetProperty("runtimeOptions").GetProperty("max_cached_interpreters").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("postHooks")[0].GetProperty("properties").GetProperty("runtimeOptions").GetProperty("max_execution_time_ms").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("postHooks")[0].GetProperty("properties").GetProperty("runtimeOptions").GetProperty("max_heap_bytes").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("postHooks")[0].GetProperty("properties").GetProperty("runtimeOptions").GetProperty("max_stack_bytes").ToString());
Console.WriteLine(result.GetProperty("entry").GetProperty("postHooks")[0].GetProperty("properties").GetProperty("runtimeOptions").GetProperty("return_exception_details").ToString());

Remarks

To return older ledger entries, the relevant sections of the ledger must be read from disk and validated. To prevent blocking within the enclave, the response will indicate whether the entry is ready and part of the response, or if the loading is still ongoing.

Below is the JSON schema for the response payload.

Response Body:

Schema for LedgerQueryResult:

{
  state: "Loading" | "Ready", # Required. State of a ledger query.
  entry: {
    contents: string, # Required. Contents of the ledger entry.
    collectionId: string, # Optional.
    transactionId: string, # Optional. A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read.
  }, # Optional. The ledger entry found as a result of the query. This is only available if the query is in Ready state.
}

Applies to

GetLedgerEntry(String, String, CancellationToken)

Source:
ConfidentialLedgerClient.cs

To return older ledger entries, the relevant sections of the ledger must be read from disk and validated. To prevent blocking within the enclave, the response will indicate whether the entry is ready and part of the response, or if the loading is still ongoing.

public virtual Azure.Response<Azure.Security.ConfidentialLedger.Models.LedgerQueryResult> GetLedgerEntry(string transactionId, string collectionId = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetLedgerEntry : string * string * System.Threading.CancellationToken -> Azure.Response<Azure.Security.ConfidentialLedger.Models.LedgerQueryResult>
override this.GetLedgerEntry : string * string * System.Threading.CancellationToken -> Azure.Response<Azure.Security.ConfidentialLedger.Models.LedgerQueryResult>
Public Overridable Function GetLedgerEntry (transactionId As String, Optional collectionId As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response(Of LedgerQueryResult)

Parameters

transactionId
String

Identifies a write transaction.

collectionId
String

The collection id.

cancellationToken
CancellationToken

The cancellation token that can be used to cancel the operation.

Returns

Exceptions

transactionId is null.

transactionId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Applies to