-
Notifications
You must be signed in to change notification settings - Fork 375
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
feat(gnorkle): Add periodic feed #2847
base: master
Are you sure you want to change the base?
Conversation
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.
Nice job. I think this is a great start. One question I have is -- is this supposed to be used as a feed for a VRF? I think that this is fine for a generic implementation for a periodic feed and a multistream ingester, but to me is seems that a VRF would have something more similar to what could be described as a continuous feed. There would be no "periods" defined by the feed and no "committing" of values by the ingester; instead each call to retrieve a value would perform an aggregation on the data in the ingester's store buffer, producing a pseudo-random string or integer value. Right now it is just joining strings together for each period, so each value obtained would remain the same for each period. A continuous feed would make it possible to produce a different value at every block, or even produce different values within the same block depending on the transactions in the block and their contents.
// Value returns the feed's latest value, it's data type, and whether or not it can | ||
// be safely consumed. In this case it can be consumed because it's a periodic feed. | ||
func (f Feed) Value() (feed.Value, string, bool) { | ||
return f.storage.GetLatest(), f.valueDataType, false |
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 boolean value being returned here is indicative of whether or not this data can be safely consumed. I think this should be true in most cases. Perhaps the only case this is return false is when no values have yet been committed to storage for this feed, so when GetLatest
returns feed.Value{}
.
|
||
// MarshalJSON marshals the components of the feed that are needed for | ||
// an agent to execute tasks and send values for ingestion. | ||
func (f Feed) MarshalJSON() ([]byte, 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.
It seems like the MarshalJSON
implementation may be the same for most kinds of feeds that are defined. Perhaps this can be defined as a common function somewhere with a signature like func MarshalFeedJSON(feed Feed)
.
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description