Skip to content
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(transform funcs): stepped transform functions, protected execution #2

Merged
merged 2 commits into from
Jun 4, 2018

Conversation

b5
Copy link
Member

@b5 b5 commented Jun 4, 2018

after a chat with @dustmop we came to the conclusion that we need more control over what kind of things the user can do and when they can do them in the context of a transformation. The first example we could think of is preventing a transform script that lists a peers datasets & posting them to a random server with the http module.

To solve this we're restructuring the execution of transform steps, based on the init, main pattern from go/c-type programs, or the setup, draw pattern from various video game engines. In all cases users can optionally declare as a set of functions with standard names & signatures that the user can declare, and qri will call them. The stipulation is the output of each of these functions can only be data. Each of these opt-in "steps" execute in a predeclared order, with the result of the previous step being the input to the next step. The input to the initial step is any provided dataset data.

Current steps:
download, transform

What I'm excited about here is we can later add steps like map and reduce, and execute those in parallel environments.

after a chat with @dustmop we came to the conclusion that we need more control over what kind of things the user can do and when they can do them in the context of a transformation. The first example we could think of is preventing a transform script that lists a peers datasets & posting them to a random server with the http module.

To solve this we're restructuring the execution of transform steps as a set of functions with standard names that the user can declare, and we will call. The stipulation is the output of each of these fuctions can only be data. Each of these opt-in "steps" execute in a predeclared order, with the result of the previous step being the input to the next step. The input to the initial step is any provided dataset data.
lib/qri/qri.go Outdated

// Load creates a skylark module from a module instance
func (m *Module) Load() (skylark.StringDict, error) {
func NewModule(ds *dataset.Dataset, secrets map[string]interface{}) (skylark.StringDict, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is no longer returning a Module, how about renaming to NewEnvironment?

after some thought & conversation, we've decided to go a different route with transform functions. Instead of using load methods & protectors, we'll provide each transform func with an "environment object" that comes loaded with the things they can do within the context of that transform function. We think this'll make it easier to reason about what can happen when.
@b5 b5 force-pushed the dont_call_us_we_call_u branch from b01ab44 to 6bea3cb Compare June 4, 2018 20:47
@b5 b5 changed the title feat(Protector): stepped transform functions, protected execution feat(transform funcs): stepped transform functions, protected execution Jun 4, 2018
@b5 b5 merged commit 48d3b01 into master Jun 4, 2018
@b5 b5 deleted the dont_call_us_we_call_u branch June 4, 2018 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants