Documentation
¶
Overview ¶
Package record holds a document shaped like one a handful of independent services would share: a row in a store, held as a serialized blob, whose fields are each owned by a different writer.
It exists for the contention benchmark. Whole-payload compare-and-swap conflicts whenever any field changes; a conditional patch conflicts only when the field its condition names changes. The fields here are deliberately independent so the difference between those two is what the benchmark measures.
Code generated by deep-gen. DO NOT EDIT.
Index ¶
- Variables
- type Record
- func (t *Record) Clone() *Record
- func (t *Record) Diff(other *Record) deep.Patch[Record]
- func (t *Record) Equal(other *Record) bool
- func (r *Record) Get(path string) int
- func (t *Record) Patch(p deep.Patch[Record], logger *slog.Logger) error
- func (r *Record) Set(path string, v int)
- func (r *Record) Total() int
Constants ¶
This section is empty.
Variables ¶
var Fields = []string{
"/stock", "/price", "/views", "/rating",
"/reserved", "/shipped", "/returned", "/flagged",
}
Fields lists the JSON Pointer path of every service-owned counter, in the order the benchmark hands them out to writers.
Functions ¶
This section is empty.
Types ¶
type Record ¶
type Record struct {
ID string `json:"id"`
Version int `json:"version"`
Stock int `json:"stock"` // inventory service
Price int `json:"price"` // pricing service, in cents
Views int `json:"views"` // analytics
Rating int `json:"rating"` // reviews
Reserved int `json:"reserved"` // checkout
Shipped int `json:"shipped"` // fulfilment
Returned int `json:"returned"` // returns
Flagged int `json:"flagged"` // moderation
}
Record is an inventory row. Version is what a compare-and-swap writer checks; the rest are owned one apiece by the services that update them.