adcp-reporting-storage 0.1.0b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. adcp_reporting_storage-0.1.0b1/LICENSE +17 -0
  2. adcp_reporting_storage-0.1.0b1/PKG-INFO +108 -0
  3. adcp_reporting_storage-0.1.0b1/README.md +71 -0
  4. adcp_reporting_storage-0.1.0b1/pyproject.toml +87 -0
  5. adcp_reporting_storage-0.1.0b1/setup.cfg +4 -0
  6. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/__init__.py +353 -0
  7. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/_inline_storage_schema.py +131 -0
  8. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/feed/__init__.py +1 -0
  9. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/feed/pg.py +259 -0
  10. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/feed/required_schema.json +134 -0
  11. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/feed/schema.py +27 -0
  12. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/inline_storage.py +304 -0
  13. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/__init__.py +1 -0
  14. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/change_feed.py +436 -0
  15. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/delivery_pg.py +470 -0
  16. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/period_retirement.py +503 -0
  17. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/pg.py +3528 -0
  18. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_buyer_submissions.sql +33 -0
  19. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_caller_ownership.sql +15 -0
  20. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_changes.sql +68 -0
  21. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_feed.sql +43 -0
  22. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_inline_storage.sql +60 -0
  23. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_ledger.sql +390 -0
  24. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_ledger_account_generations.sql +36 -0
  25. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_ledger_obligation_currency.sql +63 -0
  26. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_ledger_reconciliation.sql +935 -0
  27. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_materializer.sql +421 -0
  28. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_notification_outbox.sql +148 -0
  29. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_period_retirement.sql +65 -0
  30. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_production.sql +673 -0
  31. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_projection.sql +242 -0
  32. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_projection_feed.sql +43 -0
  33. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_projection_notifications.sql +297 -0
  34. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_provisional_observations.sql +51 -0
  35. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_receipt_ingestion.sql +405 -0
  36. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_row_migration.sql +42 -0
  37. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_row_storage.sql +334 -0
  38. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_status_notifications.sql +465 -0
  39. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_status_selector_version.sql +66 -0
  40. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/reporting_webhook_activity.sql +140 -0
  41. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/required_provisional_schema.json +110 -0
  42. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/required_row_storage_schema.json +550 -0
  43. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/row_migration.py +276 -0
  44. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/row_retention.py +472 -0
  45. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/row_storage.py +1521 -0
  46. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/row_storage_azure.py +431 -0
  47. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/row_storage_gcs.py +342 -0
  48. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/row_storage_object.py +779 -0
  49. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/row_storage_provider_io.py +111 -0
  50. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/row_storage_s3.py +506 -0
  51. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/row_write.py +353 -0
  52. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/ledger/status_snapshot.py +206 -0
  53. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/materializer/__init__.py +1 -0
  54. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/materializer/pg.py +1004 -0
  55. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/materializer/required_schema.json +750 -0
  56. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/materializer/schema.py +57 -0
  57. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/migration.py +808 -0
  58. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/outbox/__init__.py +1 -0
  59. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/outbox/_activity_pg.py +261 -0
  60. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/outbox/_schema.py +275 -0
  61. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/outbox/pg.py +575 -0
  62. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/outbox/required_schema.json +1874 -0
  63. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/outbox/required_status_schema.json +998 -0
  64. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/outbox/required_status_selector_schema.json +42 -0
  65. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/outbox/status_activity_pg.py +70 -0
  66. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/outbox/status_pg.py +695 -0
  67. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/outbox/status_schema.py +66 -0
  68. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/production/__init__.py +1 -0
  69. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/production/pg.py +1003 -0
  70. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/production/required_schema.json +1342 -0
  71. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/production/schema.py +34 -0
  72. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/production/service_context.sql +59 -0
  73. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/production/service_context_schema.json +10 -0
  74. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/projection/__init__.py +1 -0
  75. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/projection/notifications.py +41 -0
  76. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/projection/pg.py +634 -0
  77. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/projection/required_schema.json +1270 -0
  78. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/projection/schema.py +26 -0
  79. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/py.typed +0 -0
  80. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/receipts/__init__.py +1 -0
  81. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/receipts/pg.py +393 -0
  82. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/receipts/required_schema.json +410 -0
  83. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/receipts/schema.py +27 -0
  84. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/service.py +58 -0
  85. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/submissions/__init__.py +1 -0
  86. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage/submissions/pg.py +341 -0
  87. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage.egg-info/PKG-INFO +108 -0
  88. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage.egg-info/SOURCES.txt +89 -0
  89. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage.egg-info/dependency_links.txt +1 -0
  90. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage.egg-info/requires.txt +15 -0
  91. adcp_reporting_storage-0.1.0b1/src/adcp_reporting_storage.egg-info/top_level.txt +1 -0
@@ -0,0 +1,17 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2025 AdCP Community
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.4
2
+ Name: adcp-reporting-storage
3
+ Version: 0.1.0b1
4
+ Summary: PostgreSQL and object-storage implementations of the AdCP Reliable Reporting stores
5
+ Author-email: AdCP Community <maintainers@adcontextprotocol.org>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/adcontextprotocol/adcp-client-python
8
+ Project-URL: Documentation, https://github.com/adcontextprotocol/adcp-client-python/blob/main/packages/adcp-reporting-storage/README.md
9
+ Project-URL: Repository, https://github.com/adcontextprotocol/adcp-client-python
10
+ Project-URL: Issues, https://github.com/adcontextprotocol/adcp-client-python/issues
11
+ Keywords: adcp,reporting,postgresql,advertising
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: adcp<10,>=9.0.0
26
+ Requires-Dist: rfc8785>=0.1.4
27
+ Provides-Extra: pg
28
+ Requires-Dist: psycopg[binary]>=3.1.0; extra == "pg"
29
+ Requires-Dist: psycopg-pool>=3.2.0; extra == "pg"
30
+ Provides-Extra: gcs
31
+ Requires-Dist: google-cloud-storage>=2.18; extra == "gcs"
32
+ Provides-Extra: s3
33
+ Requires-Dist: boto3>=1.35; extra == "s3"
34
+ Provides-Extra: azure
35
+ Requires-Dist: azure-storage-blob>=12.20; extra == "azure"
36
+ Dynamic: license-file
37
+
38
+ # adcp-reporting-storage
39
+
40
+ PostgreSQL and object-storage implementations of the AdCP Reliable Reporting
41
+ stores, maintained in the [adcp-client-python](https://github.com/adcontextprotocol/adcp-client-python)
42
+ repository and versioned on its own line.
43
+
44
+ [`adcp`](https://pypi.org/project/adcp/) defines the store protocols, the
45
+ in-memory stores, the producer, the `get_reporting_status` handlers, the
46
+ reconciliation logic and the row encoding. This distribution implements those
47
+ protocols durably:
48
+
49
+ | What | Where |
50
+ | --- | --- |
51
+ | Core ledger, reconciliation, materializer, receipt, feed, projection and production stores over PostgreSQL | `adcp_reporting_storage.ledger.pg`, `.ledger.delivery_pg`, `.materializer.pg`, `.receipts.pg`, `.feed.pg`, `.projection.pg`, `.production.pg` |
52
+ | Notification, status and activity queues over PostgreSQL | `adcp_reporting_storage.outbox.pg`, `.outbox.status_pg`, `.outbox.status_activity_pg` |
53
+ | Chunked revision row storage, with filesystem, Google Cloud Storage, Amazon S3 and Azure Blob providers | `adcp_reporting_storage.ledger.row_storage*` |
54
+ | The host change feed, period retirement, row migration and retention | `adcp_reporting_storage.ledger.change_feed`, `.period_retirement`, `.row_migration`, `.row_retention` |
55
+ | Durable inline source staging and seals, buyer submission intents | `adcp_reporting_storage.inline_storage`, `.submissions.pg` |
56
+ | Caller-ownership migration helpers | `adcp_reporting_storage.migration` |
57
+ | The adapter-first `ReliableReportingService` over a borrowed pool | `adcp_reporting_storage.service` |
58
+
59
+ Every public name is also importable from the top-level package, lazily:
60
+
61
+ ```python
62
+ from psycopg_pool import AsyncConnectionPool
63
+
64
+ from adcp.reporting.ledger import ProducerOfferings, ReportingProducer
65
+ from adcp_reporting_storage import PgReportingLedgerStore, ReportingRowStorageOptionsV1
66
+
67
+ async with AsyncConnectionPool(dsn, min_size=2, max_size=10) as pool:
68
+ store = PgReportingLedgerStore(
69
+ pool=pool,
70
+ row_storage=ReportingRowStorageOptionsV1(deployment_namespace="prod-us"),
71
+ )
72
+ await store.create_schema()
73
+ producer = ReportingProducer(source=..., offerings=ProducerOfferings(...), store=store)
74
+ await producer.run_worker()
75
+ ```
76
+
77
+ ## Install
78
+
79
+ ```bash
80
+ pip install "adcp-reporting-storage[pg]" # PostgreSQL stores (psycopg)
81
+ pip install "adcp-reporting-storage[pg,gcs]" # + rows on Google Cloud Storage
82
+ pip install "adcp-reporting-storage[pg,s3]" # + rows on Amazon S3
83
+ pip install "adcp-reporting-storage[pg,azure]" # + rows on Azure Blob Storage
84
+ ```
85
+
86
+ `adcp` is a dependency and is installed with it. The cloud providers take a
87
+ client you build; the extras only pin the client libraries.
88
+
89
+ ## Compatibility
90
+
91
+ This package implements the protocols of one `adcp` major and imports a few
92
+ private helpers of `adcp.reporting` to do so (`adcp.reporting.ledger._record_rows`,
93
+ `_delivery_state`, `status_snapshot`). Its dependency range is therefore one
94
+ major (`adcp>=9.0.0,<10`), and a new `adcp` major means a new release here.
95
+ `adcp` never imports this package; a test in the main repository enforces that.
96
+
97
+ ## Versioning
98
+
99
+ 0.x: breaking changes may land in a minor release, each with a migration note in
100
+ [CHANGELOG.md](CHANGELOG.md). The package reaches 1.0 when the storage layout
101
+ shared with the JavaScript SDK (`@adcp/reporting-storage`) is declared stable.
102
+
103
+ ## Documentation
104
+
105
+ The guides live in the repository: [Reliable Reporting service](../../docs/reliable-reporting-service.md),
106
+ [row storage](../../docs/reporting-row-storage.md), [ledger migrations](../../docs/reporting-ledger-migration.md),
107
+ [caller-ownership migration](../../docs/reporting-caller-ownership-migration.md),
108
+ and the [migration note for the 9.0 split](../../docs/reporting-storage-package-migration.md).
@@ -0,0 +1,71 @@
1
+ # adcp-reporting-storage
2
+
3
+ PostgreSQL and object-storage implementations of the AdCP Reliable Reporting
4
+ stores, maintained in the [adcp-client-python](https://github.com/adcontextprotocol/adcp-client-python)
5
+ repository and versioned on its own line.
6
+
7
+ [`adcp`](https://pypi.org/project/adcp/) defines the store protocols, the
8
+ in-memory stores, the producer, the `get_reporting_status` handlers, the
9
+ reconciliation logic and the row encoding. This distribution implements those
10
+ protocols durably:
11
+
12
+ | What | Where |
13
+ | --- | --- |
14
+ | Core ledger, reconciliation, materializer, receipt, feed, projection and production stores over PostgreSQL | `adcp_reporting_storage.ledger.pg`, `.ledger.delivery_pg`, `.materializer.pg`, `.receipts.pg`, `.feed.pg`, `.projection.pg`, `.production.pg` |
15
+ | Notification, status and activity queues over PostgreSQL | `adcp_reporting_storage.outbox.pg`, `.outbox.status_pg`, `.outbox.status_activity_pg` |
16
+ | Chunked revision row storage, with filesystem, Google Cloud Storage, Amazon S3 and Azure Blob providers | `adcp_reporting_storage.ledger.row_storage*` |
17
+ | The host change feed, period retirement, row migration and retention | `adcp_reporting_storage.ledger.change_feed`, `.period_retirement`, `.row_migration`, `.row_retention` |
18
+ | Durable inline source staging and seals, buyer submission intents | `adcp_reporting_storage.inline_storage`, `.submissions.pg` |
19
+ | Caller-ownership migration helpers | `adcp_reporting_storage.migration` |
20
+ | The adapter-first `ReliableReportingService` over a borrowed pool | `adcp_reporting_storage.service` |
21
+
22
+ Every public name is also importable from the top-level package, lazily:
23
+
24
+ ```python
25
+ from psycopg_pool import AsyncConnectionPool
26
+
27
+ from adcp.reporting.ledger import ProducerOfferings, ReportingProducer
28
+ from adcp_reporting_storage import PgReportingLedgerStore, ReportingRowStorageOptionsV1
29
+
30
+ async with AsyncConnectionPool(dsn, min_size=2, max_size=10) as pool:
31
+ store = PgReportingLedgerStore(
32
+ pool=pool,
33
+ row_storage=ReportingRowStorageOptionsV1(deployment_namespace="prod-us"),
34
+ )
35
+ await store.create_schema()
36
+ producer = ReportingProducer(source=..., offerings=ProducerOfferings(...), store=store)
37
+ await producer.run_worker()
38
+ ```
39
+
40
+ ## Install
41
+
42
+ ```bash
43
+ pip install "adcp-reporting-storage[pg]" # PostgreSQL stores (psycopg)
44
+ pip install "adcp-reporting-storage[pg,gcs]" # + rows on Google Cloud Storage
45
+ pip install "adcp-reporting-storage[pg,s3]" # + rows on Amazon S3
46
+ pip install "adcp-reporting-storage[pg,azure]" # + rows on Azure Blob Storage
47
+ ```
48
+
49
+ `adcp` is a dependency and is installed with it. The cloud providers take a
50
+ client you build; the extras only pin the client libraries.
51
+
52
+ ## Compatibility
53
+
54
+ This package implements the protocols of one `adcp` major and imports a few
55
+ private helpers of `adcp.reporting` to do so (`adcp.reporting.ledger._record_rows`,
56
+ `_delivery_state`, `status_snapshot`). Its dependency range is therefore one
57
+ major (`adcp>=9.0.0,<10`), and a new `adcp` major means a new release here.
58
+ `adcp` never imports this package; a test in the main repository enforces that.
59
+
60
+ ## Versioning
61
+
62
+ 0.x: breaking changes may land in a minor release, each with a migration note in
63
+ [CHANGELOG.md](CHANGELOG.md). The package reaches 1.0 when the storage layout
64
+ shared with the JavaScript SDK (`@adcp/reporting-storage`) is declared stable.
65
+
66
+ ## Documentation
67
+
68
+ The guides live in the repository: [Reliable Reporting service](../../docs/reliable-reporting-service.md),
69
+ [row storage](../../docs/reporting-row-storage.md), [ledger migrations](../../docs/reporting-ledger-migration.md),
70
+ [caller-ownership migration](../../docs/reporting-caller-ownership-migration.md),
71
+ and the [migration note for the 9.0 split](../../docs/reporting-storage-package-migration.md).
@@ -0,0 +1,87 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "adcp-reporting-storage"
7
+ version = "0.1.0b1"
8
+ description = "PostgreSQL and object-storage implementations of the AdCP Reliable Reporting stores"
9
+ authors = [
10
+ {name = "AdCP Community", email = "maintainers@adcontextprotocol.org"}
11
+ ]
12
+ readme = "README.md"
13
+ requires-python = ">=3.10"
14
+ license = {text = "Apache-2.0"}
15
+ keywords = ["adcp", "reporting", "postgresql", "advertising"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: Apache Software License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Topic :: Software Development :: Libraries :: Python Modules",
26
+ "Typing :: Typed",
27
+ ]
28
+
29
+ dependencies = [
30
+ # The store protocols, in-memory stores, producer, handlers, row encoding
31
+ # and record codecs this distribution implements against. The stores in
32
+ # this package subclass nothing in ``adcp`` but import its private
33
+ # ``adcp.reporting`` helpers, so the range is one major: a new ``adcp``
34
+ # major means a new release here.
35
+ "adcp>=9.0.0,<10",
36
+ # RFC 8785 canonical JSON for row bodies and object keys; the same pin as adcp.
37
+ "rfc8785>=0.1.4",
38
+ ]
39
+
40
+ [project.optional-dependencies]
41
+ pg = [
42
+ # Every store in this package is PostgreSQL-backed. psycopg3 ships both
43
+ # sync and async pool interfaces; the stores take an AsyncConnectionPool.
44
+ "psycopg[binary]>=3.1.0",
45
+ "psycopg-pool>=3.2.0",
46
+ ]
47
+ gcs = [
48
+ # Row storage on Google Cloud Storage. The provider takes a client you build,
49
+ # with keyless credentials; it never imports the library itself.
50
+ "google-cloud-storage>=2.18",
51
+ ]
52
+ s3 = [
53
+ # Row storage on Amazon S3 or an S3-compatible store (needs bucket versioning).
54
+ "boto3>=1.35",
55
+ ]
56
+ azure = [
57
+ # Row storage on Azure Blob Storage (needs blob versioning on the account).
58
+ "azure-storage-blob>=12.20",
59
+ ]
60
+
61
+ [project.urls]
62
+ Homepage = "https://github.com/adcontextprotocol/adcp-client-python"
63
+ Documentation = "https://github.com/adcontextprotocol/adcp-client-python/blob/main/packages/adcp-reporting-storage/README.md"
64
+ Repository = "https://github.com/adcontextprotocol/adcp-client-python"
65
+ Issues = "https://github.com/adcontextprotocol/adcp-client-python/issues"
66
+
67
+ [tool.setuptools.packages.find]
68
+ where = ["src"]
69
+
70
+ [tool.setuptools.package-data]
71
+ adcp_reporting_storage = [
72
+ "py.typed",
73
+ "ledger/*.sql",
74
+ "ledger/*.json",
75
+ "outbox/*.json",
76
+ "materializer/*.json",
77
+ "receipts/*.json",
78
+ "feed/*.json",
79
+ "projection/*.json",
80
+ "production/*.json",
81
+ "production/*.sql",
82
+ ]
83
+
84
+ # Inside this repository the dependency is the checkout, not PyPI. uv ignores
85
+ # this when the package is installed from a built distribution.
86
+ [tool.uv.sources]
87
+ adcp = { workspace = true }
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,353 @@
1
+ """PostgreSQL and object-storage implementations of the AdCP Reliable Reporting stores.
2
+
3
+ ``adcp`` defines the store protocols, the in-memory stores, the producer, the
4
+ handlers and the row encoding. This distribution implements those protocols
5
+ over PostgreSQL and, for revision rows, over a filesystem or an object store
6
+ (Google Cloud Storage, Amazon S3, Azure Blob Storage). It is versioned on its
7
+ own line so a storage fix never has to ship as a protocol-client release.
8
+
9
+ What you assemble::
10
+
11
+ from psycopg_pool import AsyncConnectionPool
12
+ from adcp.reporting.ledger import ProducerOfferings, ReportingProducer
13
+ from adcp_reporting_storage import PgReportingLedgerStore
14
+
15
+ store = PgReportingLedgerStore(pool=pool)
16
+ await store.create_schema()
17
+ producer = ReportingProducer(source=..., offerings=..., store=store)
18
+
19
+ or, for the adapter-first service::
20
+
21
+ from adcp_reporting_storage import postgres_reliable_reporting_service
22
+
23
+ reporting = postgres_reliable_reporting_service(pool=pool, account_context=...)
24
+
25
+ Names are resolved lazily (:pep:`562`): importing this package loads no driver
26
+ and no cloud SDK until the first store or provider is touched. The layout
27
+ mirrors ``adcp.reporting`` (``adcp_reporting_storage.ledger.pg`` is where
28
+ ``PgReportingLedgerStore`` is defined), so a deep import is a supported
29
+ address too.
30
+ """
31
+
32
+ from __future__ import annotations
33
+
34
+ from typing import TYPE_CHECKING, Any
35
+
36
+ if TYPE_CHECKING:
37
+ __version__: str
38
+ from adcp_reporting_storage.feed.pg import PgReportingFeedStore as PgReportingFeedStore
39
+ from adcp_reporting_storage.inline_storage import (
40
+ PgReportingSealStore as PgReportingSealStore,
41
+ )
42
+ from adcp_reporting_storage.inline_storage import (
43
+ PgReportingStagingStore as PgReportingStagingStore,
44
+ )
45
+ from adcp_reporting_storage.ledger.change_feed import (
46
+ ReportingChangeCursorExpiredError as ReportingChangeCursorExpiredError,
47
+ )
48
+ from adcp_reporting_storage.ledger.change_feed import (
49
+ ReportingChangeKindV1 as ReportingChangeKindV1,
50
+ )
51
+ from adcp_reporting_storage.ledger.change_feed import (
52
+ ReportingChangeRecordV1 as ReportingChangeRecordV1,
53
+ )
54
+ from adcp_reporting_storage.ledger.change_feed import (
55
+ ReportingChangesPageV1 as ReportingChangesPageV1,
56
+ )
57
+ from adcp_reporting_storage.ledger.delivery_pg import (
58
+ PgReportingReconciliationStore as PgReportingReconciliationStore,
59
+ )
60
+ from adcp_reporting_storage.ledger.period_retirement import (
61
+ ReportingPeriodRetirementV1 as ReportingPeriodRetirementV1,
62
+ )
63
+ from adcp_reporting_storage.ledger.pg import (
64
+ PgReportingLedgerStore as PgReportingLedgerStore,
65
+ )
66
+ from adcp_reporting_storage.ledger.row_migration import (
67
+ ReportingRowMigrationBatchV1 as ReportingRowMigrationBatchV1,
68
+ )
69
+ from adcp_reporting_storage.ledger.row_migration import (
70
+ ReportingRowQuarantineReason as ReportingRowQuarantineReason,
71
+ )
72
+ from adcp_reporting_storage.ledger.row_retention import (
73
+ ReportingRowIntentSweepV1 as ReportingRowIntentSweepV1,
74
+ )
75
+ from adcp_reporting_storage.ledger.row_retention import (
76
+ ReportingRowPruneV1 as ReportingRowPruneV1,
77
+ )
78
+ from adcp_reporting_storage.ledger.row_storage import (
79
+ ReportingObjectRowBindingV1 as ReportingObjectRowBindingV1,
80
+ )
81
+ from adcp_reporting_storage.ledger.row_storage import (
82
+ ReportingPostgresRowBindingV1 as ReportingPostgresRowBindingV1,
83
+ )
84
+ from adcp_reporting_storage.ledger.row_storage import (
85
+ ReportingRowBindingSelectionInputV1 as ReportingRowBindingSelectionInputV1,
86
+ )
87
+ from adcp_reporting_storage.ledger.row_storage import (
88
+ ReportingRowStorageOptionsV1 as ReportingRowStorageOptionsV1,
89
+ )
90
+ from adcp_reporting_storage.ledger.row_storage import (
91
+ ReportingRowStorageV1 as ReportingRowStorageV1,
92
+ )
93
+ from adcp_reporting_storage.ledger.row_storage_azure import (
94
+ create_azure_blob_reporting_row_object_provider_v1 as create_azure_blob_reporting_row_object_provider_v1, # noqa: E501
95
+ )
96
+ from adcp_reporting_storage.ledger.row_storage_gcs import (
97
+ assert_gcs_reporting_row_bucket_policy_v1 as assert_gcs_reporting_row_bucket_policy_v1,
98
+ )
99
+ from adcp_reporting_storage.ledger.row_storage_gcs import (
100
+ create_gcs_reporting_row_object_provider_v1 as create_gcs_reporting_row_object_provider_v1,
101
+ )
102
+ from adcp_reporting_storage.ledger.row_storage_object import (
103
+ ReportingRowObjectContextV1 as ReportingRowObjectContextV1,
104
+ )
105
+ from adcp_reporting_storage.ledger.row_storage_object import (
106
+ ReportingRowObjectDeleteInputV1 as ReportingRowObjectDeleteInputV1,
107
+ )
108
+ from adcp_reporting_storage.ledger.row_storage_object import (
109
+ ReportingRowObjectGetInputV1 as ReportingRowObjectGetInputV1,
110
+ )
111
+ from adcp_reporting_storage.ledger.row_storage_object import (
112
+ ReportingRowObjectProviderV1 as ReportingRowObjectProviderV1,
113
+ )
114
+ from adcp_reporting_storage.ledger.row_storage_object import (
115
+ ReportingRowObjectPutInputV1 as ReportingRowObjectPutInputV1,
116
+ )
117
+ from adcp_reporting_storage.ledger.row_storage_object import (
118
+ ReportingRowObjectPutResultV1 as ReportingRowObjectPutResultV1,
119
+ )
120
+ from adcp_reporting_storage.ledger.row_storage_object import (
121
+ ReportingRowObjectStatInputV1 as ReportingRowObjectStatInputV1,
122
+ )
123
+ from adcp_reporting_storage.ledger.row_storage_object import (
124
+ ReportingRowObjectStatResultV1 as ReportingRowObjectStatResultV1,
125
+ )
126
+ from adcp_reporting_storage.ledger.row_storage_object import (
127
+ create_filesystem_reporting_row_object_provider_v1 as create_filesystem_reporting_row_object_provider_v1, # noqa: E501
128
+ )
129
+ from adcp_reporting_storage.ledger.row_storage_object import (
130
+ render_reporting_row_object_key_v1 as render_reporting_row_object_key_v1,
131
+ )
132
+ from adcp_reporting_storage.ledger.row_storage_object import (
133
+ reporting_period_date_v1 as reporting_period_date_v1,
134
+ )
135
+ from adcp_reporting_storage.ledger.row_storage_object import (
136
+ run_reporting_row_object_provider_conformance_v1 as run_reporting_row_object_provider_conformance_v1, # noqa: E501
137
+ )
138
+ from adcp_reporting_storage.ledger.row_storage_s3 import (
139
+ create_s3_reporting_row_object_provider_v1 as create_s3_reporting_row_object_provider_v1,
140
+ )
141
+ from adcp_reporting_storage.materializer.pg import (
142
+ PgReportingMaterializerStore as PgReportingMaterializerStore,
143
+ )
144
+ from adcp_reporting_storage.migration import (
145
+ ReportingOwnershipBackfill as ReportingOwnershipBackfill,
146
+ )
147
+ from adcp_reporting_storage.migration import (
148
+ ReportingOwnershipMigrationError as ReportingOwnershipMigrationError,
149
+ )
150
+ from adcp_reporting_storage.migration import (
151
+ backfill_legacy_reporting as backfill_legacy_reporting,
152
+ )
153
+ from adcp_reporting_storage.migration import (
154
+ legacy_generation_digest as legacy_generation_digest,
155
+ )
156
+ from adcp_reporting_storage.migration import (
157
+ migrate_legacy_reporting as migrate_legacy_reporting,
158
+ )
159
+ from adcp_reporting_storage.migration import (
160
+ replace_empty_legacy_reporting as replace_empty_legacy_reporting,
161
+ )
162
+ from adcp_reporting_storage.migration import (
163
+ replace_empty_legacy_reporting_sync as replace_empty_legacy_reporting_sync,
164
+ )
165
+ from adcp_reporting_storage.migration import (
166
+ replace_empty_owned_reporting as replace_empty_owned_reporting,
167
+ )
168
+ from adcp_reporting_storage.migration import (
169
+ replace_empty_owned_reporting_sync as replace_empty_owned_reporting_sync,
170
+ )
171
+ from adcp_reporting_storage.migration import (
172
+ require_owned_schema_or_empty as require_owned_schema_or_empty,
173
+ )
174
+ from adcp_reporting_storage.outbox.pg import PgReportingOutbox as PgReportingOutbox
175
+ from adcp_reporting_storage.outbox.status_activity_pg import (
176
+ PgReportingActivityUnionStore as PgReportingActivityUnionStore,
177
+ )
178
+ from adcp_reporting_storage.outbox.status_pg import (
179
+ PgReportingStatusOutbox as PgReportingStatusOutbox,
180
+ )
181
+ from adcp_reporting_storage.outbox.status_pg import (
182
+ PgStatusNotificationStore as PgStatusNotificationStore,
183
+ )
184
+ from adcp_reporting_storage.production.pg import (
185
+ PgReportingProductionOutbox as PgReportingProductionOutbox,
186
+ )
187
+ from adcp_reporting_storage.production.pg import (
188
+ PgReportingProductionStore as PgReportingProductionStore,
189
+ )
190
+ from adcp_reporting_storage.projection.notifications import (
191
+ PgReportingProjectionOutbox as PgReportingProjectionOutbox,
192
+ )
193
+ from adcp_reporting_storage.projection.pg import (
194
+ PgReportingProjectionStore as PgReportingProjectionStore,
195
+ )
196
+ from adcp_reporting_storage.projection.pg import (
197
+ PgReportingStatusProjection as PgReportingStatusProjection,
198
+ )
199
+ from adcp_reporting_storage.receipts.pg import (
200
+ PgReportingReceiptStore as PgReportingReceiptStore,
201
+ )
202
+ from adcp_reporting_storage.service import (
203
+ postgres_reliable_reporting_service as postgres_reliable_reporting_service,
204
+ )
205
+ from adcp_reporting_storage.submissions.pg import (
206
+ PgReportingSubmissionIntentStore as PgReportingSubmissionIntentStore,
207
+ )
208
+
209
+ #: Public name -> (module under this package, attribute). Resolved on first use.
210
+ _LAZY_EXPORTS: dict[str, tuple[str, str]] = {
211
+ # Stores
212
+ "PgReportingLedgerStore": ("ledger.pg", "PgReportingLedgerStore"),
213
+ "PgReportingReconciliationStore": ("ledger.delivery_pg", "PgReportingReconciliationStore"),
214
+ "PgReportingMaterializerStore": ("materializer.pg", "PgReportingMaterializerStore"),
215
+ "PgReportingReceiptStore": ("receipts.pg", "PgReportingReceiptStore"),
216
+ "PgReportingFeedStore": ("feed.pg", "PgReportingFeedStore"),
217
+ "PgReportingProjectionStore": ("projection.pg", "PgReportingProjectionStore"),
218
+ "PgReportingStatusProjection": ("projection.pg", "PgReportingStatusProjection"),
219
+ "PgReportingProjectionOutbox": ("projection.notifications", "PgReportingProjectionOutbox"),
220
+ "PgReportingProductionStore": ("production.pg", "PgReportingProductionStore"),
221
+ "PgReportingProductionOutbox": ("production.pg", "PgReportingProductionOutbox"),
222
+ "PgReportingOutbox": ("outbox.pg", "PgReportingOutbox"),
223
+ "PgReportingStatusOutbox": ("outbox.status_pg", "PgReportingStatusOutbox"),
224
+ "PgStatusNotificationStore": ("outbox.status_pg", "PgStatusNotificationStore"),
225
+ "PgReportingActivityUnionStore": ("outbox.status_activity_pg", "PgReportingActivityUnionStore"),
226
+ "PgReportingSubmissionIntentStore": ("submissions.pg", "PgReportingSubmissionIntentStore"),
227
+ "PgReportingStagingStore": ("inline_storage", "PgReportingStagingStore"),
228
+ "PgReportingSealStore": ("inline_storage", "PgReportingSealStore"),
229
+ # The adapter-first service over PostgreSQL
230
+ "postgres_reliable_reporting_service": ("service", "postgres_reliable_reporting_service"),
231
+ # Caller-ownership migration
232
+ "ReportingOwnershipBackfill": ("migration", "ReportingOwnershipBackfill"),
233
+ "ReportingOwnershipMigrationError": ("migration", "ReportingOwnershipMigrationError"),
234
+ "backfill_legacy_reporting": ("migration", "backfill_legacy_reporting"),
235
+ "legacy_generation_digest": ("migration", "legacy_generation_digest"),
236
+ "migrate_legacy_reporting": ("migration", "migrate_legacy_reporting"),
237
+ "replace_empty_legacy_reporting": ("migration", "replace_empty_legacy_reporting"),
238
+ "replace_empty_legacy_reporting_sync": ("migration", "replace_empty_legacy_reporting_sync"),
239
+ "replace_empty_owned_reporting": ("migration", "replace_empty_owned_reporting"),
240
+ "replace_empty_owned_reporting_sync": ("migration", "replace_empty_owned_reporting_sync"),
241
+ "require_owned_schema_or_empty": ("migration", "require_owned_schema_or_empty"),
242
+ # Host change feed
243
+ "ReportingChangeCursorExpiredError": (
244
+ "ledger.change_feed",
245
+ "ReportingChangeCursorExpiredError",
246
+ ),
247
+ "ReportingChangeKindV1": ("ledger.change_feed", "ReportingChangeKindV1"),
248
+ "ReportingChangeRecordV1": ("ledger.change_feed", "ReportingChangeRecordV1"),
249
+ "ReportingChangesPageV1": ("ledger.change_feed", "ReportingChangesPageV1"),
250
+ # Row storage: options, bindings, maintenance results
251
+ "ReportingRowStorageV1": ("ledger.row_storage", "ReportingRowStorageV1"),
252
+ "ReportingRowStorageOptionsV1": ("ledger.row_storage", "ReportingRowStorageOptionsV1"),
253
+ "ReportingObjectRowBindingV1": ("ledger.row_storage", "ReportingObjectRowBindingV1"),
254
+ "ReportingPostgresRowBindingV1": ("ledger.row_storage", "ReportingPostgresRowBindingV1"),
255
+ "ReportingRowBindingSelectionInputV1": (
256
+ "ledger.row_storage",
257
+ "ReportingRowBindingSelectionInputV1",
258
+ ),
259
+ "ReportingRowIntentSweepV1": ("ledger.row_retention", "ReportingRowIntentSweepV1"),
260
+ "ReportingRowPruneV1": ("ledger.row_retention", "ReportingRowPruneV1"),
261
+ "ReportingPeriodRetirementV1": ("ledger.period_retirement", "ReportingPeriodRetirementV1"),
262
+ "ReportingRowMigrationBatchV1": ("ledger.row_migration", "ReportingRowMigrationBatchV1"),
263
+ "ReportingRowQuarantineReason": ("ledger.row_migration", "ReportingRowQuarantineReason"),
264
+ # Row object providers: the contract, the filesystem reference, the cloud factories
265
+ "ReportingRowObjectProviderV1": ("ledger.row_storage_object", "ReportingRowObjectProviderV1"),
266
+ "ReportingRowObjectContextV1": ("ledger.row_storage_object", "ReportingRowObjectContextV1"),
267
+ "ReportingRowObjectPutInputV1": ("ledger.row_storage_object", "ReportingRowObjectPutInputV1"),
268
+ "ReportingRowObjectPutResultV1": ("ledger.row_storage_object", "ReportingRowObjectPutResultV1"),
269
+ "ReportingRowObjectGetInputV1": ("ledger.row_storage_object", "ReportingRowObjectGetInputV1"),
270
+ "ReportingRowObjectDeleteInputV1": (
271
+ "ledger.row_storage_object",
272
+ "ReportingRowObjectDeleteInputV1",
273
+ ),
274
+ "ReportingRowObjectStatInputV1": ("ledger.row_storage_object", "ReportingRowObjectStatInputV1"),
275
+ "ReportingRowObjectStatResultV1": (
276
+ "ledger.row_storage_object",
277
+ "ReportingRowObjectStatResultV1",
278
+ ),
279
+ "render_reporting_row_object_key_v1": (
280
+ "ledger.row_storage_object",
281
+ "render_reporting_row_object_key_v1",
282
+ ),
283
+ "reporting_period_date_v1": ("ledger.row_storage_object", "reporting_period_date_v1"),
284
+ "create_filesystem_reporting_row_object_provider_v1": (
285
+ "ledger.row_storage_object",
286
+ "create_filesystem_reporting_row_object_provider_v1",
287
+ ),
288
+ "run_reporting_row_object_provider_conformance_v1": (
289
+ "ledger.row_storage_object",
290
+ "run_reporting_row_object_provider_conformance_v1",
291
+ ),
292
+ "create_gcs_reporting_row_object_provider_v1": (
293
+ "ledger.row_storage_gcs",
294
+ "create_gcs_reporting_row_object_provider_v1",
295
+ ),
296
+ "assert_gcs_reporting_row_bucket_policy_v1": (
297
+ "ledger.row_storage_gcs",
298
+ "assert_gcs_reporting_row_bucket_policy_v1",
299
+ ),
300
+ "create_s3_reporting_row_object_provider_v1": (
301
+ "ledger.row_storage_s3",
302
+ "create_s3_reporting_row_object_provider_v1",
303
+ ),
304
+ "create_azure_blob_reporting_row_object_provider_v1": (
305
+ "ledger.row_storage_azure",
306
+ "create_azure_blob_reporting_row_object_provider_v1",
307
+ ),
308
+ }
309
+
310
+ _LAZY_SUBMODULES = frozenset(
311
+ {
312
+ "feed",
313
+ "inline_storage",
314
+ "ledger",
315
+ "materializer",
316
+ "migration",
317
+ "outbox",
318
+ "production",
319
+ "projection",
320
+ "receipts",
321
+ "service",
322
+ "submissions",
323
+ }
324
+ )
325
+
326
+ __all__ = sorted(_LAZY_EXPORTS)
327
+
328
+
329
+ def __getattr__(name: str) -> Any:
330
+ if name == "__version__":
331
+ # Read the installed distribution's PEP 440 version rather than a
332
+ # literal Release Please would rewrite in its own -beta.N spelling.
333
+ from importlib.metadata import PackageNotFoundError, version
334
+
335
+ try:
336
+ return version("adcp-reporting-storage")
337
+ except PackageNotFoundError:
338
+ return "0.0.0"
339
+ lazy_export = _LAZY_EXPORTS.get(name)
340
+ if lazy_export is not None:
341
+ import importlib
342
+
343
+ module_name, attribute = lazy_export
344
+ return getattr(importlib.import_module(f"{__name__}.{module_name}"), attribute)
345
+ if name in _LAZY_SUBMODULES:
346
+ import importlib
347
+
348
+ return importlib.import_module(f"{__name__}.{name}")
349
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
350
+
351
+
352
+ def __dir__() -> list[str]:
353
+ return sorted(set(__all__) | _LAZY_SUBMODULES | {"__version__"})