cosmos-sdk/schema
Aaron Craelius 73ee336359
feat(schema): add API descriptors, struct, oneof & list types, and wire encoding spec (#21482)
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
Co-authored-by: Marko <marko@baricevic.me>
2024-10-01 07:40:42 +00:00
..
addressutil feat(schema/indexer): add address codec param (#21361) 2024-08-20 15:01:29 +00:00
appdata chore: bump golangci-lint and fix all linting issues (#21761) 2024-09-16 19:11:19 +00:00
decoding feat(schema/indexer)!: implement start indexing (#21636) 2024-09-23 16:09:01 +00:00
diff feat: make validator key injectable by application developers (#21608) 2024-09-18 12:27:25 +00:00
indexer chore(baseapp): fix api break latest schema (#21978) 2024-09-30 12:07:40 +00:00
logutil feat(schema/indexer)!: implement start indexing (#21636) 2024-09-23 16:09:01 +00:00
testing chore: bump golangci-lint and fix all linting issues (#21761) 2024-09-16 19:11:19 +00:00
view refactor(schema)!: rename ObjectType -> StateObjectType (#21691) 2024-09-16 08:17:52 +00:00
api.go feat(schema): add API descriptors, struct, oneof & list types, and wire encoding spec (#21482) 2024-10-01 07:40:42 +00:00
CHANGELOG.md refactor(indexer/base): move to cosmossdk.io/schema (#20744) 2024-06-26 15:46:08 +00:00
decoder.go refactor(schema)!: rename ObjectType -> StateObjectType (#21691) 2024-09-16 08:17:52 +00:00
enum_test.go refactor(schema)!: rename Schema -> TypeSet and other small renamings (#21446) 2024-08-30 17:01:48 +00:00
enum.go feat(schema): add ReferenceType interface (#21692) 2024-09-16 08:17:30 +00:00
field_test.go refactor(schema)!: rename Schema -> TypeSet and other small renamings (#21446) 2024-08-30 17:01:48 +00:00
field.go feat(schema): add API descriptors, struct, oneof & list types, and wire encoding spec (#21482) 2024-10-01 07:40:42 +00:00
fields_test.go refactor(schema)!: rename Schema -> TypeSet and other small renamings (#21446) 2024-08-30 17:01:48 +00:00
fields.go refactor(schema)!: rename ObjectType -> StateObjectType (#21691) 2024-09-16 08:17:52 +00:00
go.mod refactor(indexer/base): move to cosmossdk.io/schema (#20744) 2024-06-26 15:46:08 +00:00
kind_test.go refactor(schema)!: rename IntegerStringKind and DecimalStringKind (#21694) 2024-09-14 01:45:15 +00:00
kind.go feat(schema): add API descriptors, struct, oneof & list types, and wire encoding spec (#21482) 2024-10-01 07:40:42 +00:00
module_schema_test.go refactor(schema)!: rename ObjectType -> StateObjectType (#21691) 2024-09-16 08:17:52 +00:00
module_schema.go refactor(schema)!: rename ObjectType -> StateObjectType (#21691) 2024-09-16 08:17:52 +00:00
name_test.go refactor(indexer/base): move to cosmossdk.io/schema (#20744) 2024-06-26 15:46:08 +00:00
name.go refactor(indexer/base): move to cosmossdk.io/schema (#20744) 2024-06-26 15:46:08 +00:00
oneof.go feat(schema): add API descriptors, struct, oneof & list types, and wire encoding spec (#21482) 2024-10-01 07:40:42 +00:00
README.md refactor(indexer/base): move to cosmossdk.io/schema (#20744) 2024-06-26 15:46:08 +00:00
sonar-project.properties ci: enable ci for schema (#20888) 2024-07-05 10:52:49 +00:00
state_object_test.go refactor(schema)!: rename ObjectType -> StateObjectType (#21691) 2024-09-16 08:17:52 +00:00
state_object_update_test.go refactor(schema)!: rename ObjectType -> StateObjectType (#21691) 2024-09-16 08:17:52 +00:00
state_object_update.go refactor(schema)!: rename ObjectType -> StateObjectType (#21691) 2024-09-16 08:17:52 +00:00
state_object.go feat(schema): add API descriptors, struct, oneof & list types, and wire encoding spec (#21482) 2024-10-01 07:40:42 +00:00
struct.go feat(schema): add API descriptors, struct, oneof & list types, and wire encoding spec (#21482) 2024-10-01 07:40:42 +00:00
type.go docs: fix function comments (#21814) 2024-09-19 06:53:08 +00:00

Logical State Schema Framework

The cosmossdk.io/schema base module is designed to provide a stable, zero-dependency base layer for specifying the logical representation of module state schemas and implementing state indexing. This is intended to be used primarily for indexing modules in external databases and providing a standard human-readable state representation for genesis import and export.

The schema defined in this library does not aim to be general purpose and cover all types of schemas, such as those used for defining transactions. For instance, this schema does not include many types of composite objects such as nested objects and arrays. Rather, the schema defined here aims to cover state schemas only which are implemented as key-value pairs and usually have direct mappings to relational database tables or objects in a document store.

Also, this schema does not cover physical state layout and byte-level encoding, but simply describes a common logical format.

HasModuleCodec Interface

Any module which supports logical decoding and/or encoding should implement the HasModuleCodec interface. This interface provides a way to get the codec for the module, which can be used to decode the module's state and/or apply logical updates.

State frameworks such as collections or orm should directly provide ModuleCodec implementations so that this functionality basically comes for free if a compatible framework is used. Modules that do not use one of these frameworks can choose to manually implement logical decoding and/or encoding.