Read BLOB

Motivation

Retrieve the BLOB from the field of a document or record, using API

Functional design

GET /api/v2/apps/{owner}/{app}/workspaces/{wsid}/docs/{pkg}.{table}/{id}/blobs/{fieldName}

Headers / Cookies

Authorization is supported via Bearer token. The token can be passed in the Authorization header or as a cookie. The token is obtained during the authentication process.

Key
Value
Description

Authorization

Bearer {PrincipalToken}

The token obtained during the authentication process

Parameters

Parameter
Type
Description

owner

string

name of a user who owns the application

app

string

name of an application

wsid

int64

the ID of workspace

pkg, table

string

identifies a table (document or record)

id

int64

ID of a document or record

fieldName

string

name of the field containing the BLOB

Response Headers

Key
Value
Description

Content-Type

BLOB metadata

Returns the originally provided metadata

Blob-Name

BLOB name

Returns the originally provided name

Result

Code
Description
Body

200

OK

BLOB binary data

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

429

Too Many Requests

500

Internal Server Error

503

Service Unavailable

Technical design

Schema

Components

  • pkg/router

    • API v2 URL path handler ~cmp.routerBlobsReadPathHandler~✅:

  • pkg/processors/blobber

    • BLOB request handler :

      • interface ~cmp.blobber.IRequestHandler~

      • implementation: read handler for APIv2, sends messages to the bus ~cmp.blobber.implIRequestHandler_Read2~

    • Provide BLOB processor, which handles read and write operations for BLOBs ~cmp.blobber.ProvideService~

    • Sync Pipeline of the BLOB processor ~cmp.blobber.ServicePipeline~

      • operator getBLOBMessageRead ~cmp.blobber.ServicePipeline_getBLOBMessageRead~

      • operator getBLOBIDFromOwner ~cmp.blobber.ServicePipeline_getBLOBIDFromOwner~

        • for APIv2: gets BLOB ID from the owner by fieldname by sending request to QPv2 to bus and verifies the access rights

      • operator getBLOBKeyRead ~cmp.blobber.ServicePipeline_getBLOBKeyRead~

        • creates BLOB key for reading

      • queryBLOBState ~cmp.blobber.ServicePipeline_queryBLOBState~

        • reads and verifies BLOB state from iblobstoragestg

      • downloadBLOBHelper ~cmp.blobber.ServicePipeline_downloadBLOBHelper~

        • for APIv1: verifies token by executing q.sys.DownloadBLOBAuthnz

      • initResponse ~cmp.blobber.ServicePipeline_initResponse~

        • init response with BLOB name and content type

      • readBLOB ~cmp.blobber.ServicePipeline_readBLOB~

        • reads BLOB from iblobstoragestg and writes it to the response

      • catchReadError ~cmp.blobber.ServicePipeline_catchReadError~

        • handles errors

  • pkg/sys/it

    • integration test for reading BLOBs

      • ~it.TestBlobsRead~

Last updated

Was this helpful?