Repository navigation
Tags
Tags
feat: fetch assets for multiple identities in one pipelined batch
Implements GetAssetsForIdentities on top of PrefetchOwnedAndPossessedAssets, so
fetching assets for N identities costs roughly one round trip instead of 2N.
Callers previously had to fan out N*2 requests, which saturated the connection
pool.
Identities are validated before a connection is taken, so malformed input never
costs a pooled connection. Empty lists, batches over the configured limit,
malformed identities and duplicates are all rejected with InvalidArgument. The
limit defaults to 15 and is configurable via
QUBIC_API_SIDECAR_SERVER_MAX_BATCH_IDENTITIES.
A failed batch leaves the connection byte unaligned, so the handler closes it
rather than returning it to the pool, and a test pins that.
To make the handler testable, the pool is reached through a nodePool/nodeClient
seam instead of the concrete *qubic.Pool, whose Get returns a client holding a
real socket. The seam covers every client method the handlers already use, so no
existing handler body changed, and a compile time assertion keeps the interface
honest as the client evolves.
BEHAVIOR CHANGE: the nested owned_asset of /assets/{identity}/possessed was
built from the possession record's own fields instead of the ownership record it
wraps, so it reported the possession type (3) rather than the ownership type (2),
and the possession's index and unit count. Extracting the duplicated conversion
into shared converters fixes this by construction, since the converter reads only
the ownership record it is given. README samples updated to match.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
PreviousNext