storage

package
v0.67.5 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package storage defines the public storage-backend contract: backend capabilities and metadata, install/device/user/tenant scopes with their enforcement policies, and the configuration shape hosts use to construct a backend.

Index

Constants

View Source
const LocalInstallID = "local"

Variables

View Source
var (
	ErrScopeUserRequired   = errors.New("speechkit storage: user scope is required")
	ErrScopeTenantRequired = errors.New("speechkit storage: tenant scope is required")
)

Functions

func NormalizeBackendName

func NormalizeBackendName(name string) string

func NormalizeIdentifier

func NormalizeIdentifier(value string) string

func WithScope

func WithScope(ctx context.Context, scope Scope) context.Context

Types

type BackendInfo

type BackendInfo struct {
	Name         string       `json:"name"`
	DisplayName  string       `json:"displayName,omitempty"`
	ScopePolicy  ScopePolicy  `json:"scopePolicy"`
	Capabilities Capabilities `json:"capabilities"`
}

type Capabilities

type Capabilities struct {
	Scopes       bool `json:"scopes"`
	AudioAssets  bool `json:"audioAssets"`
	FullText     bool `json:"fullText"`
	Embeddings   bool `json:"embeddings"`
	VectorSearch bool `json:"vectorSearch"`
}

type Config

type Config struct {
	Backend      string
	DefaultScope Scope
	ScopePolicy  ScopePolicy
	Options      map[string]string
}

type Factory

type Factory[T any] func(Config) (T, error)

type Registry

type Registry[T any] struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry[T any]() *Registry[T]

func (*Registry[T]) RegisterBackend

func (r *Registry[T]) RegisterBackend(name string, factory Factory[T]) error

type Scope

type Scope struct {
	InstallID string            `json:"installId,omitempty"`
	DeviceID  string            `json:"deviceId,omitempty"`
	UserID    string            `json:"userId,omitempty"`
	TenantID  string            `json:"tenantId,omitempty"`
	Labels    map[string]string `json:"labels,omitempty"`
}

func NormalizeScope

func NormalizeScope(scope Scope) Scope

func ScopeFromContext

func ScopeFromContext(ctx context.Context) Scope

func (Scope) Key

func (s Scope) Key() string

type ScopePolicy

type ScopePolicy string
const (
	ScopeOptional       ScopePolicy = "optional"
	ScopeUserRequired   ScopePolicy = "user-required"
	ScopeTenantRequired ScopePolicy = "tenant-required"
)

func (ScopePolicy) Validate

func (p ScopePolicy) Validate(scope Scope) error

Jump to

Keyboard shortcuts

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