s3vectors

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 29 Imported by: 0

README

S3vectors

Parity grade: B · SDK aws-sdk-go-v2/service/s3vectors@v1.16.3 · last audited 2026-10-18 (c1af87ba3)

Coverage

Metric Value
PARITY entries audited 21 (21 ok)
Feature families 6 (6 ok)
Known gaps 8
Structural gaps (can't be emulated) 1
Deferred items 0
Resource leaks clean
Known gaps
  • Limits: topK 100, batch sizes 500 and 100, metadata byte limits and the 10000 bucket and index quotas come from AWS documentation; the SDK does not encode them
  • Filter semantics: a missing field satisfies $ne and $nin and fails every other operator, and list-valued metadata matches when any element matches; both are taken from the documented operator behaviour, not SDK evidence
  • PutVectors: a key repeated inside one batch keeps the last occurrence; AWS behaviour is unverified
  • Index mode cutoff: the 2026-09-30 rule for CLASSIC comes from SDK documentation text and compares against the emulator clock
  • Encryption: sseType and kmsKeyArn are stored but nothing is encrypted and the KMS key is not looked up, so the Kms*Exception errors are never raised
  • Bucket policies: stored and returned, not enforced
  • Throttling: TooManyRequestsException and ServiceUnavailableException are never produced
  • Memory: vectors live in process memory (4 bytes per dimension plus metadata) with no spill to disk
Structural gaps

These do not block an A grade — no implementation could produce real data here because the underlying data source cannot exist in an emulator.

  • QueryVectors in CLASSIC mode: AWS filters during an approximate search and may return fewer than topK matches; the emulator is exact in both modes

More

Documentation

Overview

Package s3vectors emulates Amazon S3 Vectors: vector buckets, indexes and exact nearest-neighbour search.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	Created          time.Time         `json:"created"`
	Tags             map[string]string `json:"tags,omitempty"`
	Encryption       Encryption        `json:"encryption"`
	Account          string            `json:"account"`
	Region           string            `json:"region"`
	Name             string            `json:"name"`
	ARN              string            `json:"arn"`
	DefaultIndexMode string            `json:"defaultIndexMode"`
	Policy           string            `json:"policy,omitempty"`
}

Bucket is a vector bucket.

type Encryption

type Encryption struct {
	SseType   string `json:"sseType"`
	KmsKeyArn string `json:"kmsKeyArn,omitempty"`
}

Encryption is a bucket or index encryption configuration.

type Handler

type Handler struct {
	Backend *InMemoryBackend

	DefaultRegion string
	// contains filtered or unexported fields
}

Handler serves the S3 Vectors REST-JSON API.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler wraps a backend.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations lists the fault-injectable operations.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions lists the regions this handler serves.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase service name for fault rules.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation returns the operation name.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource returns the tagged resource ARN, when the operation has one.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations lists every implemented operation.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the echo handler.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher matches by SigV4 signing name (or SDK user agent) plus a known path shape.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable.

type InMemoryBackend

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

InMemoryBackend is the S3 Vectors state; one coarse lock guards every table.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates an empty backend.

func (*InMemoryBackend) AccountID

func (b *InMemoryBackend) AccountID() string

AccountID returns the default account.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the default Region.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears every table.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads a snapshot; an incompatible version is discarded.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state.

type Index

type Index struct {
	Created        time.Time         `json:"created"`
	Tags           map[string]string `json:"tags,omitempty"`
	Encryption     Encryption        `json:"encryption"`
	Account        string            `json:"account"`
	Region         string            `json:"region"`
	Bucket         string            `json:"bucket"`
	Name           string            `json:"name"`
	ARN            string            `json:"arn"`
	DataType       string            `json:"dataType"`
	DistanceMetric string            `json:"distanceMetric"`
	Mode           string            `json:"mode"`
	NonFilterable  []string          `json:"nonFilterable,omitempty"`
	Dimension      int               `json:"dimension"`
}

Index is a vector index inside a bucket.

type Provider

type Provider struct{}

Provider implements service.Provider for Amazon S3 Vectors.

func (*Provider) Init

Init builds the backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type Vector

type Vector struct {
	Meta map[string]any `json:"meta,omitempty"`
	Key  string         `json:"key"`
	Data f32s           `json:"data"`
}

Vector is one stored vector.

type VectorSet

type VectorSet struct {
	Vectors map[string]*Vector `json:"vectors"`
	Key     string             `json:"key"`
}

VectorSet holds every vector of one index.

Jump to

Keyboard shortcuts

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