Skip to content

Commit 142fd5c

Browse files
authored
refactor(schema)!: remove unimplemented stubs (#24441)
1 parent 6b2861f commit 142fd5c

File tree

8 files changed

+6
-266
lines changed

8 files changed

+6
-266
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ jobs:
374374
- uses: actions/checkout@v4
375375
- uses: actions/setup-go@v5
376376
with:
377-
go-version: "1.12"
377+
go-version: "1.16"
378378
cache: true
379379
cache-dependency-path: schema/go.sum
380380
- uses: technote-space/[email protected]

schema/field.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,6 @@ type Field struct {
1717

1818
// ReferencedType is the referenced type name when Kind is EnumKind, StructKind or OneOfKind.
1919
ReferencedType string `json:"referenced_type,omitempty"`
20-
21-
// ElementKind is the element type when Kind is ListKind.
22-
// Support for this is currently UNIMPLEMENTED, this notice will be removed when it is added.
23-
ElementKind Kind `json:"element_kind,omitempty"`
24-
25-
// Size specifies the size or max-size of a field.
26-
// Support for this is currently UNIMPLEMENTED, this notice will be removed when it is added.
27-
// Its specific meaning may vary depending on the field kind.
28-
// For IntNKind and UintNKind fields, it specifies the bit width of the field.
29-
// For StringKind, BytesKind, AddressKind, and JSONKind, fields it specifies the maximum length rather than a fixed length.
30-
// If it is 0, such fields have no maximum length.
31-
// It is invalid to have a non-zero Size for other kinds.
32-
Size uint32 `json:"size,omitempty"`
3320
}
3421

3522
// Validate validates the field.

schema/go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ module cosmossdk.io/schema
44
// with all known production releases of the Cosmos SDK. This is to ensure that all historical
55
// apps could be patched to support indexing if desired.
66

7-
go 1.12
7+
go 1.16
8+
9+
retract v1.0.0

schema/indexer/config.go

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,4 @@ type Config struct {
1414

1515
// Config are the indexer specific config options specified by the user.
1616
Config interface{} `mapstructure:"config" toml:"config" json:"config,omitempty" comment:"Indexer specific configuration options."`
17-
18-
// Filter is the filter configuration for the indexer.
19-
Filter *FilterConfig `mapstructure:"filter" toml:"filter" json:"filter,omitempty" comment:"Filter configuration for the indexer. Currently UNSUPPORTED!"`
20-
}
21-
22-
// FilterConfig specifies the configuration for filtering the data stream
23-
type FilterConfig struct {
24-
// ExcludeState specifies that the indexer will not receive state updates.
25-
ExcludeState bool `mapstructure:"exclude_state" toml:"exclude_state" json:"exclude_state" comment:"Exclude all state updates."`
26-
27-
// ExcludeEvents specifies that the indexer will not receive events.
28-
ExcludeEvents bool `mapstructure:"exclude_events" toml:"exclude_events" json:"exclude_events" comment:"Exclude all events."`
29-
30-
// ExcludeTxs specifies that the indexer will not receive transaction's.
31-
ExcludeTxs bool `mapstructure:"exclude_txs" toml:"exclude_txs" json:"exclude_txs" comment:"Exclude all transactions."`
32-
33-
// ExcludeBlockHeaders specifies that the indexer will not receive block headers,
34-
// although it will still receive StartBlock and Commit callbacks, just without
35-
// the header data.
36-
ExcludeBlockHeaders bool `mapstructure:"exclude_block_headers" toml:"exclude_block_headers" json:"exclude_block_headers" comment:"Exclude all block headers."`
37-
38-
Modules *ModuleFilterConfig `mapstructure:"modules" toml:"modules" json:"modules,omitempty" comment:"Module filter configuration."`
39-
}
40-
41-
// ModuleFilterConfig specifies the configuration for filtering modules.
42-
type ModuleFilterConfig struct {
43-
// Include specifies a list of modules whose state the indexer will
44-
// receive state updates for.
45-
// Only one of include or exclude modules should be specified.
46-
Include []string `mapstructure:"include" toml:"include" json:"include" comment:"List of modules to include. Only one of include or exclude should be specified."`
47-
48-
// Exclude specifies a list of modules whose state the indexer will not
49-
// receive state updates for.
50-
// Only one of include or exclude modules should be specified.
51-
Exclude []string `mapstructure:"exclude" toml:"exclude" json:"exclude" comment:"List of modules to exclude. Only one of include or exclude should be specified."`
5217
}

schema/indexer/start.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ type IndexingTarget struct {
6565
// It will do all processing in the background so updates should be sent synchronously.
6666
Listener appdata.Listener
6767

68-
// ModuleFilter returns the root module filter which an app can use to exclude modules at the storage level,
69-
// if such a filter is set.
70-
ModuleFilter *ModuleFilterConfig
71-
7268
IndexerInfos map[string]IndexerInfo
7369
}
7470

@@ -109,10 +105,6 @@ func StartIndexing(opts IndexingOptions) (IndexingTarget, error) {
109105

110106
logger.Info("Starting indexer", "target_name", targetName, "type", targetCfg.Type)
111107

112-
if targetCfg.Filter != nil {
113-
return IndexingTarget{}, fmt.Errorf("indexer filter options are not supported yet")
114-
}
115-
116108
childLogger := logger
117109
if scopeableLogger, ok := logger.(logutil.ScopeableLogger); ok {
118110
childLogger = scopeableLogger.WithContext("indexer", targetName).(logutil.Logger)

schema/kind.go

Lines changed: 2 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,12 @@ import (
99
)
1010

1111
// Kind represents the basic type of a field in an object.
12-
// Each kind defines the following encodings:
12+
// Each kind defines the following encoding:
1313
//
1414
// - Go Encoding: the golang type which should be accepted by listeners and
1515
// generated by decoders when providing entity updates.
16-
// - JSON Encoding: the JSON encoding which should be used when encoding the field to JSON.
17-
// - Key Binary Encoding: the encoding which should be used when encoding the field
18-
// as a key in binary messages. Some encodings specify a terminal and non-terminal form
19-
// depending on whether or not the field is the last field in the key.
20-
// - Value Binary Encoding: the encoding which should be used when encoding the field
21-
// as a value in binary messages.
2216
//
23-
// When there is some non-determinism in an encoding, kinds should specify what
24-
// values they accept and also what is the canonical, deterministic encoding which
25-
// should be preferably emitted by serializers.
26-
//
27-
// Binary encodings were chosen based on what is likely to be the most convenient default binary encoding
28-
// for state management implementations. This encoding allows for sorted keys whenever it is possible for a kind
29-
// and is deterministic.
30-
// Modules that use the specified encoding natively will have a trivial decoder implementation because the
31-
// encoding is already in the correct format after any initial prefix bytes are stripped.
17+
// More encodings such as JSON or binary may be specified in the future.
3218
type Kind int
3319

3420
const (
@@ -37,110 +23,56 @@ const (
3723

3824
// StringKind is a string type.
3925
// Go Encoding: UTF-8 string with no null characters.
40-
// JSON Encoding: string
41-
// Key Binary Encoding:
42-
// non-terminal: UTF-8 string with no null characters suffixed with a null character
43-
// terminal: UTF-8 string with no null characters
44-
// Value Binary Encoding: the same value binary encoding as BytesKind.
4526
StringKind
4627

4728
// BytesKind represents a byte array.
4829
// Go Encoding: []byte
49-
// JSON Encoding: base64 encoded string, canonical values should be encoded with standard encoding and padding.
50-
// Either standard or URL encoding with or without padding should be accepted.
51-
// Key Binary Encoding:
52-
// non-terminal: length prefixed bytes where the width of the length prefix is 1, 2, 3 or 4 bytes depending on
53-
// the field's MaxLength (defaulting to 4 bytes).
54-
// Length prefixes should be big-endian encoded.
55-
// Values larger than 2^32 bytes are not supported (likely key-value stores impose a lower limit).
56-
// terminal: raw bytes with no length prefix
57-
// Value Binary Encoding: two 32-bit unsigned little-endian integers, the first one representing the offset of the
58-
// value in the buffer and the second one representing the length of the value.
5930
BytesKind
6031

6132
// Int8Kind represents an 8-bit signed integer.
6233
// Go Encoding: int8
63-
// JSON Encoding: number
64-
// Key Binary Encoding: 1-byte two's complement encoding, with the first bit inverted for sorting.
65-
// Value Binary Encoding: 1-byte two's complement encoding.
6634
Int8Kind
6735

6836
// Uint8Kind represents an 8-bit unsigned integer.
6937
// Go Encoding: uint8
70-
// JSON Encoding: number
71-
// Key Binary Encoding: 1-byte unsigned encoding.
72-
// Value Binary Encoding: 1-byte unsigned encoding.
7338
Uint8Kind
7439

7540
// Int16Kind represents a 16-bit signed integer.
7641
// Go Encoding: int16
77-
// JSON Encoding: number
78-
// Key Binary Encoding: 2-byte two's complement big-endian encoding, with the first bit inverted for sorting.
79-
// Value Binary Encoding: 2 byte two's complement little-endian encoding.
8042
Int16Kind
8143

8244
// Uint16Kind represents a 16-bit unsigned integer.
8345
// Go Encoding: uint16
84-
// JSON Encoding: number
85-
// Key Binary Encoding: 2-byte unsigned big-endian encoding.
86-
// Value Binary Encoding: 2-byte unsigned little-endian encoding.
8746
Uint16Kind
8847

8948
// Int32Kind represents a 32-bit signed integer.
9049
// Go Encoding: int32
91-
// JSON Encoding: number
92-
// Key Binary Encoding: 4-byte two's complement big-endian encoding, with the first bit inverted for sorting.
93-
// Value Binary Encoding: 4-byte two's complement little-endian encoding.
9450
Int32Kind
9551

9652
// Uint32Kind represents a 32-bit unsigned integer.
9753
// Go Encoding: uint32
98-
// JSON Encoding: number
99-
// Key Binary Encoding: 4-byte unsigned big-endian encoding.
100-
// Value Binary Encoding: 4-byte unsigned little-endian encoding.
10154
Uint32Kind
10255

10356
// Int64Kind represents a 64-bit signed integer.
10457
// Go Encoding: int64
105-
// JSON Encoding: base10 integer string which matches the IntegerFormat regex
106-
// The canonical encoding should include no leading zeros.
107-
// Key Binary Encoding: 8-byte two's complement big-endian encoding, with the first bit inverted for sorting.
108-
// Value Binary Encoding: 8-byte two's complement little-endian encoding.
10958
Int64Kind
11059

11160
// Uint64Kind represents a 64-bit unsigned integer.
11261
// Go Encoding: uint64
113-
// JSON Encoding: base10 integer string which matches the IntegerFormat regex
114-
// Canonically encoded values should include no leading zeros.
115-
// Key Binary Encoding: 8-byte unsigned big-endian encoding.
116-
// Value Binary Encoding: 8-byte unsigned little-endian encoding.
11762
Uint64Kind
11863

11964
// IntegerKind represents an arbitrary precision integer number.
12065
// Support for expressing the maximum bit precision of values will be added in the future.
12166
// Go Encoding: string which matches the IntegerFormat regex (unstable, subject to change).
122-
// JSON Encoding: base10 integer string
123-
// Canonically encoded values should include no leading zeros.
124-
// Equality comparison with integers should be done using numerical equality rather
125-
// than string equality.
12667
IntegerKind
12768

12869
// DecimalKind represents an arbitrary precision decimal or integer number.
12970
// Support for optionally limiting the precision may be added in the future.
13071
// Go Encoding: string which matches the DecimalFormat regex
131-
// JSON Encoding: base10 decimal string
132-
// Canonically encoded values should include no leading zeros or trailing zeros,
133-
// and exponential notation with a lowercase 'e' should be used for any numbers
134-
// with an absolute value less than or equal to 1e-6 or greater than or equal to 1e6.
135-
// Equality comparison with decimals should be done using numerical equality rather
136-
// than string equality.
13772
DecimalKind
13873

13974
// BoolKind represents a boolean true or false value.
14075
// Go Encoding: bool
141-
// JSON Encoding: boolean
142-
// Key Binary Encoding: 1-byte encoding where 0 is false and 1 is true.
143-
// Value Binary Encoding: 1-byte encoding where 0 is false and 1 is true.
14476
BoolKind
14577

14678
// TimeKind represents a nanosecond precision UNIX time value (with zero representing January 1, 1970 UTC).
@@ -157,106 +89,32 @@ const (
15789
// DurationKind represents the elapsed time between two nanosecond precision time values.
15890
// Its valid range is +/- 2^63 (the range of a 64-bit signed integer).
15991
// Go Encoding: time.Duration
160-
// JSON Encoding: the number of seconds as a decimal string with no trailing zeros followed by
161-
// a lowercase 's' character to represent seconds.
162-
// Key Binary Encoding: 8-byte two's complement big-endian encoding, with the first bit inverted for sorting.
163-
// Value Binary Encoding: 8-byte two's complement little-endian encoding.
16492
DurationKind
16593

16694
// Float32Kind represents an IEEE-754 32-bit floating point number.
16795
// Go Encoding: float32
168-
// JSON Encoding: number
169-
// Key Binary Encoding: 4-byte IEEE-754 encoding.
170-
// Value Binary Encoding: 4-byte IEEE-754 encoding.
17196
Float32Kind
17297

17398
// Float64Kind represents an IEEE-754 64-bit floating point number.
17499
// Go Encoding: float64
175-
// JSON Encoding: number
176-
// Key Binary Encoding: 8-byte IEEE-754 encoding.
177-
// Value Binary Encoding: 8-byte IEEE-754 encoding.
178100
Float64Kind
179101

180102
// AddressKind represents an account address which is represented by a variable length array of bytes.
181103
// Addresses usually have a human-readable rendering, such as bech32, and tooling should provide
182104
// a way for apps to define a string encoder for friendly user-facing display. Addresses have a maximum
183105
// supported length of 63 bytes.
184106
// Go Encoding: []byte
185-
// JSON Encoding: addresses should be encoded as strings using the human-readable address renderer
186-
// provided to the JSON encoder.
187-
// Key Binary Encoding:
188-
// non-terminal: bytes prefixed with 1-byte length prefix
189-
// terminal: raw bytes with no length prefix
190-
// Value Binary Encoding: bytes prefixed with 1-byte length prefix.
191107
AddressKind
192108

193109
// EnumKind represents a value of an enum type.
194110
// Fields of this type are expected to set the EnumType field in the field definition to the enum
195111
// definition.
196112
// Go Encoding: string
197-
// JSON Encoding: string
198-
// Key Binary Encoding: the same binary encoding as the EnumType's numeric kind.
199-
// Value Binary Encoding: the same binary encoding as the EnumType's numeric kind.
200113
EnumKind
201114

202115
// JSONKind represents arbitrary JSON data.
203116
// Go Encoding: json.RawMessage
204-
// JSON Encoding: any valid JSON value
205-
// Key Binary Encoding: string encoding
206-
// Value Binary Encoding: string encoding
207117
JSONKind
208-
209-
// UIntNKind represents a signed integer type with a width in bits specified by the Size field in the
210-
// field definition.
211-
// Support for this is currently UNIMPLEMENTED, this notice will be removed when it is added.
212-
// N must be a multiple of 8, and it is invalid for N to equal 8, 16, 32, 64 as there are more specific
213-
// types for these widths.
214-
// Go Encoding: []byte where len([]byte) == Size / 8, little-endian encoded.
215-
// JSON Encoding: base10 integer string matching the IntegerFormat regex, canonically with no leading zeros.
216-
// Key Binary Encoding: N / 8 bytes big-endian encoded
217-
// Value Binary Encoding: N / 8 bytes little-endian encoded
218-
UIntNKind
219-
220-
// IntNKind represents an unsigned integer type with a width in bits specified by the Size field in the
221-
// field definition. N must be a multiple of 8.
222-
// Support for this is currently UNIMPLEMENTED, this notice will be removed when it is added.
223-
// N must be a multiple of 8, and it is invalid for N to equal 8, 16, 32, 64 as there are more specific
224-
// types for these widths.
225-
// Go Encoding: []byte where len([]byte) == Size / 8, two's complement little-endian encoded.
226-
// JSON Encoding: base10 integer string matching the IntegerFormat regex, canonically with no leading zeros.
227-
// Key Binary Encoding: N / 8 bytes big-endian two's complement encoded with the first bit inverted for sorting.
228-
// Value Binary Encoding: N / 8 bytes little-endian two's complement encoded.
229-
IntNKind
230-
231-
// StructKind represents a struct object.
232-
// Support for this is currently UNIMPLEMENTED, this notice will be removed when it is added.
233-
// Go Encoding: an array of type []interface{} where each element is of the respective field's kind type.
234-
// JSON Encoding: an object where each key is the field name and the value is the field value.
235-
// Canonically, keys are in alphabetical order with no extra whitespace.
236-
// Key Binary Encoding: not valid as a key field.
237-
// Value Binary Encoding: 32-bit unsigned little-endian length prefix,
238-
// followed by the value binary encoding of each field in order.
239-
StructKind
240-
241-
// OneOfKind represents a field that can be one of a set of types.
242-
// Support for this is currently UNIMPLEMENTED, this notice will be removed when it is added.
243-
// Go Encoding: the anonymous struct { Case string; Value interface{} }, aliased as OneOfValue.
244-
// JSON Encoding: same as the case's struct encoding with "@type" set to the case name.
245-
// Key Binary Encoding: not valid as a key field.
246-
// Value Binary Encoding: the oneof's discriminant numeric value encoded as its discriminant kind
247-
// followed by the encoded value.
248-
OneOfKind
249-
250-
// ListKind represents a list of elements.
251-
// Support for this is currently UNIMPLEMENTED, this notice will be removed when it is added.
252-
// Go Encoding: an array of type []interface{} where each element is of the respective field's kind type.
253-
// JSON Encoding: an array of values where each element is the field value.
254-
// Canonically, there is no extra whitespace.
255-
// Key Binary Encoding: not valid as a key field.
256-
// Value Binary Encoding: 32-bit unsigned little-endian size prefix indicating the size of the encoded data in bytes,
257-
// followed by a 32-bit unsigned little-endian count of the number of elements in the list,
258-
// followed by each element encoded with value binary encoding.
259-
ListKind
260118
)
261119

262120
// MAX_VALID_KIND is the maximum valid kind value.

schema/oneof.go

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)