more platform
This commit is contained in:
1 parent
8a71e32149
commit
2a66754f9e
27 files changed
+2435
-540
No files matched your search
+16
-13
@@ -36,6 +36,7 @@ import (
|
||||
"encoding/json"
|
||||
|
||||
"git.k6n.net/mats/platform/money"
|
||||
"git.k6n.net/mats/platform/projection"
|
||||
)
|
||||
|
||||
// Projection is the published, versioned catalog entry that commerce modules
|
||||
@@ -82,10 +83,10 @@ import (
|
||||
// the JSON token. The on-disk snapshot binary header/record layout is
|
||||
// unchanged \u2014 only the per-blob JSON payload gains a key.
|
||||
type Projection struct {
|
||||
ItemID uint32 `json:"item_id,omitempty"`
|
||||
ID string `json:"id"`
|
||||
SKU string `json:"sku"`
|
||||
Title string `json:"title,omitempty"`
|
||||
ItemID uint32 `json:"item_id,omitempty"`
|
||||
ID string `json:"id"`
|
||||
SKU string `json:"sku"`
|
||||
Title string `json:"title,omitempty"`
|
||||
PriceIncVat money.Cents `json:"price_inc_vat"`
|
||||
Currency string `json:"currency,omitempty"`
|
||||
// TaxClass uses a string identifier (see platform/tax class constants).
|
||||
@@ -154,7 +155,9 @@ func Decode(raw []byte) (Projection, error) {
|
||||
// catalog.projection_published carries two channels distinguished only by
|
||||
// event.Event.Meta. The producer (slask-finder writeradmin) sets these keys and
|
||||
// the consumer (ProjectionStore, consumer.go) reads them — one definition so the
|
||||
// two never drift. See docs/catalog-projection.md.
|
||||
// two never drift. The framing itself is domain-neutral and lives in
|
||||
// platform/projection; catalog re-exports the constants so the producer/consumer
|
||||
// keep their catalog.* names. See docs/catalog-projection.md.
|
||||
//
|
||||
// - A FULL SNAPSHOT is a framed begin → chunk* → end stream, all tagged with one
|
||||
// MetaEpoch. begin/end carry MetaCount (total projections) for completeness
|
||||
@@ -162,13 +165,13 @@ func Decode(raw []byte) (Projection, error) {
|
||||
// - A DELTA has NO MetaSnapshotPhase key, and MetaEpoch names the snapshot base
|
||||
// it builds on (consumers ignore a delta older than the base they hold).
|
||||
const (
|
||||
MetaSnapshotPhase = "snapshot" // begin|chunk|end; absent ⇒ delta
|
||||
MetaEpoch = "epoch" // int64 (Unix-ms), monotonic across rebuilds
|
||||
MetaSeq = "seq" // chunk sequence within a snapshot
|
||||
MetaCount = "count" // total projections (begin/end only)
|
||||
MetaTenant = "tenant" // namespace tag
|
||||
MetaSnapshotPhase = projection.MetaSnapshotPhase // begin|chunk|end; absent ⇒ delta
|
||||
MetaEpoch = projection.MetaEpoch // int64 (Unix-ms), monotonic across rebuilds
|
||||
MetaSeq = projection.MetaSeq // chunk sequence within a snapshot
|
||||
MetaCount = projection.MetaCount // total projections (begin/end only)
|
||||
MetaTenant = projection.MetaTenant // namespace tag
|
||||
|
||||
SnapshotBegin = "begin"
|
||||
SnapshotChunk = "chunk"
|
||||
SnapshotEnd = "end"
|
||||
SnapshotBegin = projection.SnapshotBegin
|
||||
SnapshotChunk = projection.SnapshotChunk
|
||||
SnapshotEnd = projection.SnapshotEnd
|
||||
)
|
||||
Reference in new issue
Block a user