After experimenting a bit, i realized that some of Storm v2’s features may not be a good fit for the next version and that i should rethink whether we should keep some of them or not.
Codecs are one of them. Let’s experiment a design without them.
Writes
To write something in a bucket, we need a Schema. It describes all the fields and their respective types for a specific bucket. Schemas are not tied to a specific data structure, they can be generated from a struct and used with a map and the other way around.
Using a Schema we can reason in terms of table and store each field separately.
Since the Schema is typed, we can encode each field using the right method:
Writes
type Schema map[string]*Field
type Field struct {
Name string
Type FieldType // ex: "enum" of all the supported types?
}
key: rowID + '-' + fieldName
value: byte representation of the field value
// example (pseudo data)
1-Name: "john"
1-Age: 2
2-Name: "jack"
2-Age: 29
...
Reads
type Table interface {
Next() (Row, error)
Schema() (*Schema, error)
}