Skip to content

Snapshot refactor #281

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

Open
wants to merge 10 commits into
base: shellscript-port
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bootstrap/check-rnode.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ async function main () {
}
}

main();
main();
7 changes: 5 additions & 2 deletions bootstrap/cli-utils/create-snapshot-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
if (!fs.existsSync(homedir + '/.rnode')) {
console.log(`Cannot snapshot: ${homedir}/.rnode does not exist`);
rl.close();
return;
return {message:"failed"};
}

//run stop node script
Expand All @@ -29,7 +29,7 @@ module.exports = {
//if stop script terminates with error, exit
if (code === 1) {
rl.close();
return;
return {message:"failed"};
}

fs.mkdirSync('snapshot', { recursive: true });
Expand All @@ -49,16 +49,19 @@ module.exports = {
await exec_shell(`cd ~ && tar czf "${target}" .rnode`);
console.log(`snapshot created: ${target}`);
rl.close();
return {message:"successful"};
} else {
console.log('Aborting...');
rl.close();
return {message:"failed"}
}
},
);
} else {
await exec_shell(`cd ~ && tar czf "${target}" .rnode`);
console.log(`snapshot created: ${target}`);
rl.close();
return {message:"successful"};
}
});

Expand Down
7 changes: 7 additions & 0 deletions src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ export const actions = {
},
filename: 'actions/transfer.rho',
},
_____________________________________: {
fields: {},
},
sequencialLooping: {
fields: {},
filename: 'actions/sequencialLooping.rho',
},
_____________________________: {
fields: {},
},
Expand Down
38 changes: 38 additions & 0 deletions src/actions/sequencialLooping.rho
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
match [] {
[] => {
new output, num, increaseByNum, increase, currentCount in {
currentCount!(0) |
contract increase(ack) = {
for(old <- currentCount) {
currentCount!(*old + 1) |
ack!(*old)
}

} |
contract increaseByNum(num, ack) = {
// output!(*num) |
match *num {
0 => {
output!("Recursion finished.") |
ack!(Nil)
}
_ => {
new kiril in {
for (k <- kiril) { ack!(Nil) } |
output!(*num) |
increase!(*num) |
increaseByNum!(*num-1, *kiril)
}
}
}
} |
new finished in {
increaseByNum!(500, *finished) |
for (_ <- finished) {
for (cc <- currentCount) {
output!({"Current count": *cc})
}
}
}
}
}