cosmos

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 12 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 cosmos implements opaquedata.OpaqueStore against Azure Cosmos DB (NoSQL / Core SQL API). It mirrors the DynamoDB adapter in opaquedata/dynamo: a single aggregates container holds materialized aggregate documents keyed by (pk, sk), and the 20 GSI slot pairs (gsi1pk/gsi1sk … gsi20pk/gsi20sk) support secondary access patterns via cross-partition queries against the same container — Cosmos does not need a separate index object per GSI.

Document shape (JSON):

{
  "id":      "<sk>",   // Cosmos doc id, unique within the partition
  "pk":      "<pk>",   // logical partition key value
  "sk":      "<sk>",   // sort key (also stored separately for queries)
  "body":    "<b64>",  // opaque proto bytes, base64-encoded
  "t":       0,         // absolute epoch seconds; 0 means no expiry
  "ttl":     N,         // Cosmos auto-purge seconds; written only when t > 0
  "version": 0,
  "gsi1pk":  "...",     // omitted when empty
  "gsi1sk":  "...",
  ...
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store implements opaquedata.OpaqueStore backed by a single Cosmos container.

func New

func New(client cosmosclient.ContainerClient) *Store

New creates a new Cosmos-backed OpaqueStore. The container is implicit in the supplied client — callers wire one Store per Cosmos container.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, pk, sk string) error

func (*Store) Get

func (s *Store) Get(ctx context.Context, pk, sk string) (*opaquedatav1.OpaqueData, error)

func (*Store) Put

func (s *Store) Put(ctx context.Context, od *opaquedatav1.OpaqueData) error

func (*Store) Query

func (s *Store) Query(ctx context.Context, pkAttr, pkValue, skAttr string, sort *opaquedata.SortCondition, opts ...opaquedata.QueryOption) ([]*opaquedatav1.OpaqueData, error)

Jump to

Keyboard shortcuts

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