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 ¶
- type Store
- func (s *Store) Delete(ctx context.Context, pk, sk string) error
- func (s *Store) Get(ctx context.Context, pk, sk string) (*opaquedatav1.OpaqueData, error)
- func (s *Store) Put(ctx context.Context, od *opaquedatav1.OpaqueData) error
- func (s *Store) Query(ctx context.Context, pkAttr, pkValue, skAttr string, ...) ([]*opaquedatav1.OpaqueData, error)
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) 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)