-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/deployable #311
Feature/deployable #311
Conversation
docs/release-notes/change-log.md
Outdated
optional bytes schema = 1 [ (sf.substreams.v1.options).load_from_file = true ];` | ||
optional bytes extra_config_files = 2 [ (sf.substreams.v1.options).zip_from_folder = true ];` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's showcase the message ...
part as it's not clear like that where those are used. Would probably use a "complete" message.
manifest/sink.go
Outdated
isBytes := fd.GetType() == descriptorpb.FieldDescriptorProto_TYPE_BYTES | ||
if opts := fd.GetFieldOptions(); opts != nil { | ||
opts.ProtoReflect().Range(func(desc protoreflect.FieldDescriptor, val protoreflect.Value) bool { | ||
if desc.TextName() != "[sf.substreams.v1.options]" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The literal is repeated, let's extract it (can we even extract from the Message directly).
manifest/sink.go
Outdated
if err != nil { | ||
return err | ||
} | ||
path = strings.Replace(strings.TrimPrefix(strings.TrimPrefix(path, basePath), string(filepath.Separator)), "\\", "/", -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really hard to read and reason about
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the very minimum, a quick comment is required.
proto/sf/substreams/v1/options.proto
Outdated
import "google/protobuf/descriptor.proto"; | ||
|
||
message FieldOptions { | ||
// this flag informs the `substreams pack` command that it should treat the corresponding manifest value as a path to a file, putting its content as bytes in this field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// this flag informs the `substreams pack` command that it should treat the corresponding manifest value as a path to a file, putting its content as bytes in this field. | |
// This option informs the `substreams pack` command that it should treat the corresponding manifest value as a path to a file, putting its content as bytes in this field. |
proto/sf/substreams/v1/options.proto
Outdated
// must be applied to a `bytes` or `string` field | ||
bool load_from_file = 1; | ||
|
||
// this flag informs the `substreams pack` command that it should treat the corresponding manifest value as a path to a folder, zipping its content and putting the zip content as bytes in this field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// this flag informs the `substreams pack` command that it should treat the corresponding manifest value as a path to a folder, zipping its content and putting the zip content as bytes in this field. | |
// This option informs the `substreams pack` command that it should treat the corresponding manifest value as a path to a folder, zipping its content and putting the zip content as bytes in this field. |
proto/sf/substreams/v1/options.proto
Outdated
} | ||
|
||
extend google.protobuf.FieldOptions { | ||
optional FieldOptions options = 2200; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is a central repo that list used/unsued value here, did you see something about that?
manifest/sink.go
Outdated
return nil | ||
} | ||
|
||
func SinkConfigAsString(pkg *pbsubstreams.Package, dumpBytesToDisk bool) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dislike the fact that converting to string also dumps to file. In fact more reading lead me to think that this function is weirdly named.
It also deals with representational aspect, the output being a new-line separated string. The function should return a []string
and let the caller decide what to do.
I also think the path where to write things should be pass in by the caller. Inferring tmp
seems unecessary, the caller should deal with this decision.
…nfig * allow `substreams info` to read sinkconfig, add output-sinkconfig-files-path flag * changelog
cb77740
to
19ae185
Compare
Added
Sink configs can now use protobuf annotations (aka Field Options) to determine how the field will be interpreted in
substreams.yaml:
load_from_file
will put the content of the file directly in the field (string and bytes contents are supported).zip_from_folder
will create a zip archive and put its content in the field (field type must be bytes).Example:
substreams info
command now properly displays the sink configs, optionally writing the bytes fields to disk with--dump-sinkconfig-bytes-to-disk
flagRemoved
@path/to/textfile
and@@path/to/binaryfile
notations under sink_configs in substreams.yaml are now DEPRECATED (they will still work but with a warning).