monetize-product 0.1.0

The product plugin trait for monetize: how a metered product reports Usage and receives an Entitlement. Types and one trait, serde only — no ledger, no vendor, no network.
Documentation
  • Coverage
  • 79.01%
    64 out of 81 items documented0 out of 35 items with examples
  • Size
  • Source code size: 36.95 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.1 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 5s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Ignalina

Product — the plugin that makes monetize speak one product's language.

monetize handles MANY products, and each product's plugin lives in this repository. So monetize is one service for gunnar.rs, holger.rs, njord, …, and each product is a crate under products/<name> implementing this trait. The product itself carries only the thin monetize-embed hook behind a cargo feature; it never learns what capacity costs.

  product box ──Usage (gRPC, the product's own API)──▶ Product plugin ──▶ monetize core
  product box ◀──Entitlement (product's own API)──── Product plugin ◀── monetize core

Two directions, both facts

  • [Product::read_usage] — what a tenant is consuming, in the product's own units (gunnar: pack bytes, read-cache bytes, LFS bytes, tombstoned bytes, open-store RAM; holger: whatever holger meters). The plugin maps them to [Usage], a flat bag of named meters, so core never has product-specific fields.
  • [Product::push_entitlement] — the verdict, written back over the product's own control plane (gunnar: Entitlement.Set with source = payment:<vendor>:<ref>). Signed by monetize's key; the product appends it to its attestation log.

A plugin never blocks the product

Counting is done inside the product, always, open source — a self-hoster wants the numbers too. The plugin only reads them. If monetize is down the product keeps serving on its cached entitlement; the plugin's job on reconnect is to catch up, not to have been in the request path.