Repository navigation
Description
Summary
Dapr 1.19 adds the binary store building block as an alpha API. An app uses it to store, read and delete files as byte streams through a binary store component. The Java SDK has no client API for it yet. The .NET SDK already supports it, so its implementation is a reference for this work.
Runtime API
gRPC, in the Dapr service (binarystore.proto):
SetBinaryFileAlpha1is a client stream. The first message must containinitial_requestwithcomponent_name,file_nameandoverwrite, and it must arrive within 5 seconds. Each later message contains onepayloadchunk (common.v1.StreamPayload). Itsseqstarts at 0 and goes up by 1 for each chunk. Ifoverwriteis false (the default), the call fails when the file exists. Ifoverwriteis true, the call replaces the file.GetBinaryFileAlpha1returns a server stream ofpayloadchunks of up to 32 KiB, withseqfrom 0.DeleteBinaryFileAlpha1is a unary call.
HTTP, on /v1.0-alpha1/binarystore/{name}/{fileName}:
PUTstores the request body and replaces an existing file.POSTstores the request body, and returns 409 if the file exists.GETreturns the file asapplication/octet-stream.DELETEdeletes the file.
Components in 1.19: binarystore.aws.s3, binarystore.azure.blobstorage, binarystore.azure.datalake, binarystore.gcp.bucket, binarystore.oci.objectstorage and binarystore.in-memory.
Reference: the .NET SDK
- Adding binary store SDK package dotnet-sdk#1933 (merged) adds the
Dapr.BinaryStore.*packages.IDaprBinaryStoreClienthas these methods:SetBinaryFileAsync, from a stream or a byte buffer, withoverwriteand a 32 KiB default chunk sizeGetBinaryFileChunksAsync,GetBinaryFileAsync(to a stream) andGetBinaryFileBytesAsyncDeleteBinaryFileAsync
- Adding binary store example dotnet-sdk#1935 (in review) adds an example app.
- Adding documentation for .NET implementation of binary store docs#5388 (in review) adds the .NET SDK docs.
Related links: the proposal (dapr/proposals#88), the runtime implementation (dapr/dapr#10367) and the components (dapr/components-contrib#4559 and dapr/components-contrib#4637). dapr/dotnet-sdk#1934 stores workflow data references in the binary store. That is a separate feature (dapr/dapr#8706), and it is not part of this issue.
Scope
- Generated types: chore: Use dapr 1.19.0-rc.3 #1850 adds
binarystore.prototo the proto downloads. This givesDaprBinaryStoreProtosand the new stub methods. - Add the set, get and delete methods to
DaprPreviewClient, where the SDK keeps alpha APIs, and implement them inDaprClientImpl. Set takes a stream or bytes and anoverwriteflag. Get returns a stream or bytes. - Send the upload chunks in order after the initial request, with
seqfrom 0. - Add tests, and an example that uses the
binarystore.in-memorycomponent. - Add docs to the Java SDK section of dapr/docs.
The API is alpha, so its names and behavior can change in a later release.
Activity
Support the binary store API (alpha) from Dapr 1.19 (#1870)
Support the binary store API (alpha) from Dapr 1.19 (#1870) (#1873)