Skip to content

Add GetLedgerRaw to LedgerBackend interface for raw ledger byte access #5922

@karthikiyer56

Description

@karthikiyer56

Add a new method GetLedgerRaw(ctx context.Context, sequence uint32) ([]byte, error) to the LedgerBackend interface and all of its implementations (e.g. BufferedStorageBackend) that returns the raw XDR-encoded bytes of a xdr.LedgerCloseMeta, bypassing the full unmarshalling into Go structs.

In the full history stellar-rpc use case, the caller needs the raw XDR bytes of individual LedgerCloseMeta entries so they can be written directly to the local filesystem for later replay.

Today, BufferedStorageBackend.GetLedger fetches the compressed xdr.LedgerCloseMetaBatch object from GCS, decompresses and unmarshals it into xdr.LedgerCloseMetaBatch, then extracts the individual xdr.LedgerCloseMeta struct.

If the caller only needs the bytes (e.g., to persist to disk), it must re-marshal the struct back to XDR — paying the cost of a full unmarshal + re-marshal round-trip for no benefit.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions