binarystore

package
v0.0.28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package binarystore reads files from a Dapr Binary Store component through an app's sidecar gRPC API (GetBinaryFileAlpha1). The key goes through the gRPC FileName field unchanged: keys contain "/", which daprd's HTTP route cannot carry.

Index

Constants

View Source
const MaxBytes int64 = 1 << 20

MaxBytes is the largest payload Read returns (1 MiB).

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnProvider

type ConnProvider interface {
	ConnFor(addr string, useTLS bool) (*grpc.ClientConn, error)
}

ConnProvider hands out gRPC connections to sidecars (workflow.SidecarPool), with TLS when useTLS is set.

type Error

type Error struct {
	Kind Kind
	Msg  string
	// Size is the known payload size (KindTooLarge only).
	Size int64
	// Unavailable is true for gRPC Unavailable (KindUpstream only).
	Unavailable bool
}

Error is the typed failure returned by Service.Read.

func (*Error) Error

func (e *Error) Error() string

type Kind

type Kind int

Kind classifies a read failure so the HTTP layer can map it to a status.

const (
	KindAppNotFound        Kind = iota + 1 // 404
	KindSidecarUnreachable                 // 503 (also GRPCPort == 0)
	KindStoreNotLoaded                     // 400
	KindFileNotFound                       // 404 (gRPC NotFound)
	KindInvalid                            // 400 (gRPC InvalidArgument)
	KindUnsupported                        // 400 (gRPC Unimplemented)
	KindTooLarge                           // 413
	KindUpstream                           // 503 if Unavailable, else 502
	KindTimeout                            // 504 (gRPC DeadlineExceeded / read timeout)
)

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(apps discovery.Service, conns ConnProvider) *Service

func (*Service) Read

func (s *Service) Read(ctx context.Context, appKey, store, key string, declaredSize int64) ([]byte, error)

Read returns the bytes of file key in binary store component store, read via appKey's sidecar. declaredSize <= 0 means unknown.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL