cosmos-sdk/docs/architecture
Ian Norden 1326fa2a7d
feat: ADR-038 Part 2: StreamingService interface, file writing implementation, and configuration (#8664)
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
v                               ✰  Thanks for creating a PR! ✰
v    Before smashing the submit button please review the checkboxes.
v    If a checkbox is n/a - please still include it but + a little note why
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  -->

## Description

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review.
-->

Hello 👋 this PR introduces the second stage of changes to support [ADR-038](https://github.com/cosmos/cosmos-sdk/pull/8012) state listening. This is rebased on top of the [first segment](https://github.com/cosmos/cosmos-sdk/pull/8551), which introduces the low level changes to the MultiStore and KVStore interfaces and implementations, the new WriteListener types, and the new listen.KVStore type.

In this segment we introduce the StreamingService interface, an implementation that writes out to files, and it's integration and configuration at the BaseApp level.

The idea was to have the first segment reviewed independently first but if people think it is easier/more time efficient to review both at the same time then we could start here.

Thanks!



This work is towards satisfying [ADR-038](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-038-state-listening.md)

---

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

- [x] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [x] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md).
- [x] Wrote unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [x] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`)
- [x] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code).
- [x] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md`
- [x] Re-reviewed `Files changed` in the Github PR explorer
- [x] Review `Codecov Report` in the comment section below once CI passes
2021-10-24 21:37:37 +00:00
..
PROCESS.md docs(adr): ADR-045: BaseApp `{Check,Deliver}Tx` as Middlewares (#9996) 2021-09-15 17:12:12 +00:00
README.md update ADR (#10402) 2021-10-19 14:02:32 +00:00
adr-002-docs-structure.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-003-dynamic-capability-store.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-004-split-denomination-keys.md chore: add markdownlint to lint commands (#9353) 2021-05-27 15:31:04 +00:00
adr-006-secret-store-replacement.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-007-specialization-groups.md chore: add markdownlint to lint commands (#9353) 2021-05-27 15:31:04 +00:00
adr-008-dCERT-group.md chore: add markdownlint to lint commands (#9353) 2021-05-27 15:31:04 +00:00
adr-009-evidence-module.md docs: link checker (#5860) 2020-03-24 11:21:30 +01:00
adr-010-modular-antehandler.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-011-generalize-genesis-accounts.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-012-state-accessors.md docs: fix typo in adr-012-state-accessors.md (#10374) 2021-10-16 07:48:41 +00:00
adr-013-metrics.md Merge PR #6761: telemetry: use UTC() in wrappers 2020-07-17 15:33:50 -04:00
adr-014-proportional-slashing.md chore: add markdownlint to lint commands (#9353) 2021-05-27 15:31:04 +00:00
adr-016-validator-consensus-key-rotation.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-017-historical-header-module.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-018-extendable-voting-period.md chore: add markdownlint to lint commands (#9353) 2021-05-27 15:31:04 +00:00
adr-019-protobuf-state-encoding.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-020-protobuf-transaction-encoding.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-021-protobuf-query-encoding.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-022-custom-panic-handling.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-023-protobuf-naming.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-024-coin-metadata.md x/bank: client denom metadata gRPC (#8317) 2021-01-19 17:08:09 -05:00
adr-027-deterministic-protobuf-serialization.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-028-public-key-addresses.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-029-fee-grant-module.md chore: add markdownlint to lint commands (#9353) 2021-05-27 15:31:04 +00:00
adr-030-authz-module.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-031-msg-service.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-032-typed-events.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-033-protobuf-inter-module-comm.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-034-account-rekeying.md chore: add markdownlint to lint commands (#9353) 2021-05-27 15:31:04 +00:00
adr-035-rosetta-api-support.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-036-arbitrary-signature.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-037-gov-split-vote.md chore: add markdownlint to lint commands (#9353) 2021-05-27 15:31:04 +00:00
adr-038-state-listening.md feat: ADR-038 Part 2: StreamingService interface, file writing implementation, and configuration (#8664) 2021-10-24 21:37:37 +00:00
adr-039-epoched-staking.md chore: add markdownlint to lint commands (#9353) 2021-05-27 15:31:04 +00:00
adr-040-storage-and-smt-state-commitments.md docs: adr-40: reduce multistore and make it atomic (#9355) 2021-10-22 12:45:00 +02:00
adr-041-in-place-store-migrations.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-042-group-module.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-043-nft-module.md docs: ADR-43: Aligning on interoperability (#9709) 2021-07-26 15:39:58 +00:00
adr-044-protobuf-updates-guidelines.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-045-check-delivertx-middlewares.md docs: 10180 Fix SDK (#10237) 2021-09-28 19:33:58 +02:00
adr-046-module-params.md update ADR (#10402) 2021-10-19 14:02:32 +00:00
adr-template.md chore: add markdownlint to lint commands (#9353) 2021-05-27 15:31:04 +00:00

README.md

order parent
false
order
false

Architecture Decision Records (ADR)

This is a location to record all high-level architecture decisions in the Cosmos-SDK.

An Architectural Decision (AD) is a software design choice that addresses a functional or non-functional requirement that is architecturally significant. An Architecturally Significant Requirement (ASR) is a requirement that has a measurable effect on a software systems architecture and quality. An Architectural Decision Record (ADR) captures a single AD, such as often done when writing personal notes or meeting minutes; the collection of ADRs created and maintained in a project constitute its decision log. All these are within the topic of Architectural Knowledge Management (AKM).

You can read more about the ADR concept in this blog post.

Rationale

ADRs are intended to be the primary mechanism for proposing new feature designs and new processes, for collecting community input on an issue, and for documenting the design decisions. An ADR should provide:

  • Context on the relevant goals and the current state
  • Proposed changes to achieve the goals
  • Summary of pros and cons
  • References
  • Changelog

Note the distinction between an ADR and a spec. The ADR provides the context, intuition, reasoning, and justification for a change in architecture, or for the architecture of something new. The spec is much more compressed and streamlined summary of everything as it stands today.

If recorded decisions turned out to be lacking, convene a discussion, record the new decisions here, and then modify the code to match.

Creating new ADR

Read about the PROCESS.

Use RFC 2119 Keywords

When writing ADRs, follow the same best practices for writing RFCs. When writing RFCs, key words are used to signify the requirements in the specification. These words are often capitalized: "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL. They are to be interpreted as described in RFC 2119.

ADR Table of Contents

Accepted

Proposed

Draft