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.
Add a new method
GetLedgerRaw(ctx context.Context, sequence uint32) ([]byte, error)to theLedgerBackendinterface and all of its implementations (e.g.BufferedStorageBackend) that returns the raw XDR-encoded bytes of axdr.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.GetLedgerfetches the compressedxdr.LedgerCloseMetaBatchobject from GCS, decompresses and unmarshals it intoxdr.LedgerCloseMetaBatch, then extracts the individualxdr.LedgerCloseMetastruct.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.