This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setup: | |
| - !Ubuntu trusty | |
| - !NpmInstall | |
| - babel | |
| - babel-cli | |
| - babel-preset-es2015 | |
| - webpack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > vagga | |
| Available commands: | |
| doc Build documentation | |
| make Compile javascripts with webpack | |
| make-test-page Compile test page | |
| serve Serve test pages | |
| test Run automated tests | |
| watch Build and watch javascripts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh -ex | |
| CONTRIBUTOR="Roman Rader <antigluk@gmail.com>" | |
| OVERLAYFS_PATCH="http:\\/\\/people.canonical.com\\/~apw\\/lp1377025-utopic\\/0001-UBUNTU-SAUCE-Overlayfs-allow-unprivileged-mounts.patch" | |
| sed -i.bak "s/# CONFIG_USER_NS is not set/CONFIG_USER_NS=y/" config | |
| sed -i.bak "s/# CONFIG_USER_NS is not set/CONFIG_USER_NS=y/" config.x86_64 | |
| sed -i.bak "/source=/,/)/s/)$/\n$OVERLAYFS_PATCH)/" PKGBUILD | |
| sed -i "s/\# add upstream patch/\# add upstream patch\n patch \-p1 \-i \"\$\{srcdir\}\/`basename $OVERLAYFS_PATCH`\"/" PKGBUILD | |
| sed -i 's/^pkgbase=linux.*$/pkgbase=linux-user-ns-enabled/' PKGBUILD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pub fn new(mut sock: S, seed: P::Seed, scope: &mut Scope<C>) | |
| -> Result<Self, Box<Error>> | |
| { | |
| try!(scope.register(&sock, | |
| EventSet::readable() | EventSet::writable(), PollOpt::edge())); | |
| // ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| impl<M: Sized, N:Sized> Response<M, N> { | |
| pub fn ok(machine: M) -> Response<M, N>; | |
| pub fn spawn(machine: M, result: N) -> Response<M, N>; | |
| pub fn done() -> Response<M, N>; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Most rotor_stream::Protocol actions: | |
| enum Expectation { Bytes(usize), Delimiter(&str) } | |
| Option<(Machine, Expectation, Deadline)> | |
| // rotor_http::Server actions: | |
| enum Mode { Buffered, Progressive } | |
| fn headers_received(..) -> Option<(Machine, Mode, Deadline)>; | |
| fn request_received(..) -> Option<Machine>; | |
| fn request_chunk(..) -> Option<Machine>; | |
| fn timeout(..) -> Option<(Machine, Deadline)>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Function signature is simplified a bit | |
| fn bytes_received(self, buf, ..) -> Response<..> { | |
| match self { | |
| PacketStart => (PacketLength, Bytes(4), next_timeout()) | |
| PacketLength => { | |
| let len = buf.read_u32(); | |
| (PacketEnd, Bytes(len), next_timeout()) | |
| } | |
| Packet => { | |
| parse_packet(&buf[..]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rotor_compose!(enum Composed/Seed <Context> { | |
| Http(HttpMachine), | |
| Dns(DnsMachine), | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| ) | |
| func handler(w http.ResponseWriter, r *http.Request) { | |
| fmt.Fprintf(w, "Hello World") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pub trait Machine<C>: Sized { | |
| type Seed: Any+Sized; | |
| fn create(seed: Self::Seed, scope: &mut Scope<C>) | |
| -> Result<Self, Box<Error>>; | |
| fn ready(self, events: EventSet, scope: &mut Scope<C>) | |
| -> Response<Self, Self::Seed>; | |
| fn spawned(self, scope: &mut Scope<C>) | |
| -> Response<Self, Self::Seed>; | |
| fn spawn_error(self, _scope: &mut Scope<C>, error: Box<Error>) | |
| -> Option<Self>; |