Merge pull request #474 from LnL7/lapin

lapin amqp implementation
This commit is contained in:
Cole Helbling 2020-04-29 15:26:33 -07:00 committed by GitHub
commit b56a432946
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 5290 additions and 783 deletions

1031
Cargo.lock generated

File diff suppressed because it is too large Load diff

645
Cargo.nix
View file

@ -105,82 +105,88 @@ rec {
# end
# ofborg-0.1.8
# ofborg-0.1.9
crates.ofborg."0.1.8" = deps: { features?(features_.ofborg."0.1.8" deps {}) }: buildRustCrate {
crates.ofborg."0.1.9" = deps: { features?(features_.ofborg."0.1.9" deps {}) }: buildRustCrate {
crateName = "ofborg";
version = "0.1.8";
version = "0.1.9";
authors = [ "Graham Christensen <graham@grahamc.com>" ];
edition = "2018";
src = include [ "Cargo.toml" "ofborg" ] ./.;
workspace_member = "ofborg";
build = "build.rs";
dependencies = mapFeatures features ([
(crates."amqp"."${deps."ofborg"."0.1.8"."amqp"}" deps)
(cratesIO.crates."chrono"."${deps."ofborg"."0.1.8"."chrono"}" deps)
(cratesIO.crates."either"."${deps."ofborg"."0.1.8"."either"}" deps)
(cratesIO.crates."env_logger"."${deps."ofborg"."0.1.8"."env_logger"}" deps)
(cratesIO.crates."fs2"."${deps."ofborg"."0.1.8"."fs2"}" deps)
(crates."hubcaps"."${deps."ofborg"."0.1.8"."hubcaps"}" deps)
(cratesIO.crates."hyper"."${deps."ofborg"."0.1.8"."hyper"}" deps)
(cratesIO.crates."hyper_native_tls"."${deps."ofborg"."0.1.8"."hyper_native_tls"}" deps)
(cratesIO.crates."log"."${deps."ofborg"."0.1.8"."log"}" deps)
(cratesIO.crates."lru_cache"."${deps."ofborg"."0.1.8"."lru_cache"}" deps)
(cratesIO.crates."md5"."${deps."ofborg"."0.1.8"."md5"}" deps)
(cratesIO.crates."nom"."${deps."ofborg"."0.1.8"."nom"}" deps)
(cratesIO.crates."separator"."${deps."ofborg"."0.1.8"."separator"}" deps)
(cratesIO.crates."serde"."${deps."ofborg"."0.1.8"."serde"}" deps)
(cratesIO.crates."serde_derive"."${deps."ofborg"."0.1.8"."serde_derive"}" deps)
(cratesIO.crates."serde_json"."${deps."ofborg"."0.1.8"."serde_json"}" deps)
(cratesIO.crates."sys_info"."${deps."ofborg"."0.1.8"."sys_info"}" deps)
(cratesIO.crates."tempfile"."${deps."ofborg"."0.1.8"."tempfile"}" deps)
(cratesIO.crates."uuid"."${deps."ofborg"."0.1.8"."uuid"}" deps)
(crates."amqp"."${deps."ofborg"."0.1.9"."amqp"}" deps)
(cratesIO.crates."async_std"."${deps."ofborg"."0.1.9"."async_std"}" deps)
(cratesIO.crates."chrono"."${deps."ofborg"."0.1.9"."chrono"}" deps)
(cratesIO.crates."either"."${deps."ofborg"."0.1.9"."either"}" deps)
(cratesIO.crates."env_logger"."${deps."ofborg"."0.1.9"."env_logger"}" deps)
(cratesIO.crates."fs2"."${deps."ofborg"."0.1.9"."fs2"}" deps)
(crates."hubcaps"."${deps."ofborg"."0.1.9"."hubcaps"}" deps)
(cratesIO.crates."hyper"."${deps."ofborg"."0.1.9"."hyper"}" deps)
(cratesIO.crates."hyper_native_tls"."${deps."ofborg"."0.1.9"."hyper_native_tls"}" deps)
(cratesIO.crates."lapin"."${deps."ofborg"."0.1.9"."lapin"}" deps)
(cratesIO.crates."log"."${deps."ofborg"."0.1.9"."log"}" deps)
(cratesIO.crates."lru_cache"."${deps."ofborg"."0.1.9"."lru_cache"}" deps)
(cratesIO.crates."md5"."${deps."ofborg"."0.1.9"."md5"}" deps)
(cratesIO.crates."nom"."${deps."ofborg"."0.1.9"."nom"}" deps)
(cratesIO.crates."separator"."${deps."ofborg"."0.1.9"."separator"}" deps)
(cratesIO.crates."serde"."${deps."ofborg"."0.1.9"."serde"}" deps)
(cratesIO.crates."serde_derive"."${deps."ofborg"."0.1.9"."serde_derive"}" deps)
(cratesIO.crates."serde_json"."${deps."ofborg"."0.1.9"."serde_json"}" deps)
(cratesIO.crates."sys_info"."${deps."ofborg"."0.1.9"."sys_info"}" deps)
(cratesIO.crates."tempfile"."${deps."ofborg"."0.1.9"."tempfile"}" deps)
(cratesIO.crates."uuid"."${deps."ofborg"."0.1.9"."uuid"}" deps)
]);
};
features_.ofborg."0.1.8" = deps: f: updateFeatures f (rec {
amqp."${deps.ofborg."0.1.8".amqp}".default = true;
chrono."${deps.ofborg."0.1.8".chrono}".default = true;
either."${deps.ofborg."0.1.8".either}".default = true;
env_logger."${deps.ofborg."0.1.8".env_logger}".default = true;
fs2."${deps.ofborg."0.1.8".fs2}".default = true;
hubcaps."${deps.ofborg."0.1.8".hubcaps}".default = true;
hyper."${deps.ofborg."0.1.8".hyper}".default = true;
hyper_native_tls."${deps.ofborg."0.1.8".hyper_native_tls}".default = true;
log."${deps.ofborg."0.1.8".log}".default = true;
lru_cache."${deps.ofborg."0.1.8".lru_cache}".default = true;
md5."${deps.ofborg."0.1.8".md5}".default = true;
nom."${deps.ofborg."0.1.8".nom}".default = true;
ofborg."0.1.8".default = (f.ofborg."0.1.8".default or true);
separator."${deps.ofborg."0.1.8".separator}".default = true;
serde."${deps.ofborg."0.1.8".serde}".default = true;
serde_derive."${deps.ofborg."0.1.8".serde_derive}".default = true;
serde_json."${deps.ofborg."0.1.8".serde_json}".default = true;
sys_info."${deps.ofborg."0.1.8".sys_info}".default = true;
tempfile."${deps.ofborg."0.1.8".tempfile}".default = true;
features_.ofborg."0.1.9" = deps: f: updateFeatures f (rec {
amqp."${deps.ofborg."0.1.9".amqp}".default = true;
async_std."${deps.ofborg."0.1.9".async_std}".default = true;
chrono."${deps.ofborg."0.1.9".chrono}".default = true;
either."${deps.ofborg."0.1.9".either}".default = true;
env_logger."${deps.ofborg."0.1.9".env_logger}".default = true;
fs2."${deps.ofborg."0.1.9".fs2}".default = true;
hubcaps."${deps.ofborg."0.1.9".hubcaps}".default = true;
hyper."${deps.ofborg."0.1.9".hyper}".default = true;
hyper_native_tls."${deps.ofborg."0.1.9".hyper_native_tls}".default = true;
lapin."${deps.ofborg."0.1.9".lapin}".default = true;
log."${deps.ofborg."0.1.9".log}".default = true;
lru_cache."${deps.ofborg."0.1.9".lru_cache}".default = true;
md5."${deps.ofborg."0.1.9".md5}".default = true;
nom."${deps.ofborg."0.1.9".nom}".default = true;
ofborg."0.1.9".default = (f.ofborg."0.1.9".default or true);
separator."${deps.ofborg."0.1.9".separator}".default = true;
serde."${deps.ofborg."0.1.9".serde}".default = true;
serde_derive."${deps.ofborg."0.1.9".serde_derive}".default = true;
serde_json."${deps.ofborg."0.1.9".serde_json}".default = true;
sys_info."${deps.ofborg."0.1.9".sys_info}".default = true;
tempfile."${deps.ofborg."0.1.9".tempfile}".default = true;
uuid = fold recursiveUpdate {} [
{ "${deps.ofborg."0.1.8".uuid}"."v4" = true; }
{ "${deps.ofborg."0.1.8".uuid}".default = true; }
{ "${deps.ofborg."0.1.9".uuid}"."v4" = true; }
{ "${deps.ofborg."0.1.9".uuid}".default = true; }
];
}) [
(features_.amqp."${deps."ofborg"."0.1.8"."amqp"}" deps)
(cratesIO.features_.chrono."${deps."ofborg"."0.1.8"."chrono"}" deps)
(cratesIO.features_.either."${deps."ofborg"."0.1.8"."either"}" deps)
(cratesIO.features_.env_logger."${deps."ofborg"."0.1.8"."env_logger"}" deps)
(cratesIO.features_.fs2."${deps."ofborg"."0.1.8"."fs2"}" deps)
(features_.hubcaps."${deps."ofborg"."0.1.8"."hubcaps"}" deps)
(cratesIO.features_.hyper."${deps."ofborg"."0.1.8"."hyper"}" deps)
(cratesIO.features_.hyper_native_tls."${deps."ofborg"."0.1.8"."hyper_native_tls"}" deps)
(cratesIO.features_.log."${deps."ofborg"."0.1.8"."log"}" deps)
(cratesIO.features_.lru_cache."${deps."ofborg"."0.1.8"."lru_cache"}" deps)
(cratesIO.features_.md5."${deps."ofborg"."0.1.8"."md5"}" deps)
(cratesIO.features_.nom."${deps."ofborg"."0.1.8"."nom"}" deps)
(cratesIO.features_.separator."${deps."ofborg"."0.1.8"."separator"}" deps)
(cratesIO.features_.serde."${deps."ofborg"."0.1.8"."serde"}" deps)
(cratesIO.features_.serde_derive."${deps."ofborg"."0.1.8"."serde_derive"}" deps)
(cratesIO.features_.serde_json."${deps."ofborg"."0.1.8"."serde_json"}" deps)
(cratesIO.features_.sys_info."${deps."ofborg"."0.1.8"."sys_info"}" deps)
(cratesIO.features_.tempfile."${deps."ofborg"."0.1.8"."tempfile"}" deps)
(cratesIO.features_.uuid."${deps."ofborg"."0.1.8"."uuid"}" deps)
(features_.amqp."${deps."ofborg"."0.1.9"."amqp"}" deps)
(cratesIO.features_.async_std."${deps."ofborg"."0.1.9"."async_std"}" deps)
(cratesIO.features_.chrono."${deps."ofborg"."0.1.9"."chrono"}" deps)
(cratesIO.features_.either."${deps."ofborg"."0.1.9"."either"}" deps)
(cratesIO.features_.env_logger."${deps."ofborg"."0.1.9"."env_logger"}" deps)
(cratesIO.features_.fs2."${deps."ofborg"."0.1.9"."fs2"}" deps)
(features_.hubcaps."${deps."ofborg"."0.1.9"."hubcaps"}" deps)
(cratesIO.features_.hyper."${deps."ofborg"."0.1.9"."hyper"}" deps)
(cratesIO.features_.hyper_native_tls."${deps."ofborg"."0.1.9"."hyper_native_tls"}" deps)
(cratesIO.features_.lapin."${deps."ofborg"."0.1.9"."lapin"}" deps)
(cratesIO.features_.log."${deps."ofborg"."0.1.9"."log"}" deps)
(cratesIO.features_.lru_cache."${deps."ofborg"."0.1.9"."lru_cache"}" deps)
(cratesIO.features_.md5."${deps."ofborg"."0.1.9"."md5"}" deps)
(cratesIO.features_.nom."${deps."ofborg"."0.1.9"."nom"}" deps)
(cratesIO.features_.separator."${deps."ofborg"."0.1.9"."separator"}" deps)
(cratesIO.features_.serde."${deps."ofborg"."0.1.9"."serde"}" deps)
(cratesIO.features_.serde_derive."${deps."ofborg"."0.1.9"."serde_derive"}" deps)
(cratesIO.features_.serde_json."${deps."ofborg"."0.1.9"."serde_json"}" deps)
(cratesIO.features_.sys_info."${deps."ofborg"."0.1.9"."sys_info"}" deps)
(cratesIO.features_.tempfile."${deps."ofborg"."0.1.9"."tempfile"}" deps)
(cratesIO.features_.uuid."${deps."ofborg"."0.1.9"."uuid"}" deps)
];
@ -213,14 +219,14 @@ rec {
};
ofborg = crates.crates.ofborg."0.1.8" deps;
ofborg = crates.crates.ofborg."0.1.9" deps;
ofborg_simple_build = crates.crates.ofborg_simple_build."0.1.0" deps;
__all = [ (ofborg {}) (ofborg_simple_build {}) ];
deps.aho_corasick."0.5.3" = {
memchr = "0.1.11";
};
deps.aho_corasick."0.6.9" = {
memchr = "2.1.2";
memchr = "2.3.3";
};
deps.amq_proto."0.1.0" = {
bit_vec = "0.4.4";
@ -230,6 +236,35 @@ rec {
error_chain = "0.10.0";
log = "0.3.8";
};
deps.amq_protocol."6.0.0-rc2" = {
amq_protocol_tcp = "6.0.0-rc2";
amq_protocol_types = "6.0.0-rc2";
amq_protocol_uri = "6.0.0-rc2";
cookie_factory = "0.3.1";
nom = "6.0.0-alpha1";
amq_protocol_codegen = "6.0.0-rc2";
};
deps.amq_protocol_codegen."6.0.0-rc2" = {
amq_protocol_types = "6.0.0-rc2";
handlebars = "3.0.1";
serde = "1.0.106";
serde_json = "1.0.52";
};
deps.amq_protocol_tcp."6.0.0-rc2" = {
amq_protocol_uri = "6.0.0-rc2";
log = "0.4.8";
tcp_stream = "0.15.0";
};
deps.amq_protocol_types."6.0.0-rc2" = {
cookie_factory = "0.3.1";
nom = "6.0.0-alpha1";
serde = "1.0.106";
serde_json = "1.0.52";
};
deps.amq_protocol_uri."6.0.0-rc2" = {
percent_encoding = "2.1.0";
url = "2.1.1";
};
deps.amqp."0.1.0" = {
amq_proto = "0.1.0";
env_logger = "0.3.5";
@ -239,17 +274,43 @@ rec {
url = "1.7.2";
};
deps.antidote."1.0.0" = {};
deps.arrayvec."0.5.1" = {};
deps.async_std."1.5.0" = {
async_task = "1.3.1";
crossbeam_channel = "0.4.2";
crossbeam_deque = "0.7.3";
crossbeam_utils = "0.7.2";
futures_core = "0.3.4";
futures_io = "0.3.4";
futures_timer = "2.0.2";
kv_log_macro = "1.0.4";
log = "0.4.8";
memchr = "2.3.3";
mio = "0.6.21";
mio_uds = "0.6.7";
num_cpus = "1.13.0";
once_cell = "1.3.1";
pin_project_lite = "0.1.4";
pin_utils = "0.1.0";
slab = "0.4.2";
};
deps.async_task."1.3.1" = {
libc = "0.2.69";
winapi = "0.3.8";
};
deps.async_task."3.0.0" = {};
deps.autocfg."0.1.1" = {};
deps.autocfg."1.0.0" = {};
deps.backtrace."0.3.13" = {
cfg_if = "0.1.6";
cfg_if = "0.1.10";
rustc_demangle = "0.1.13";
autocfg = "0.1.1";
backtrace_sys = "0.1.28";
libc = "0.2.46";
winapi = "0.3.6";
libc = "0.2.69";
winapi = "0.3.8";
};
deps.backtrace_sys."0.1.28" = {
libc = "0.2.46";
libc = "0.2.69";
cc = "1.0.28";
};
deps.base64."0.9.3" = {
@ -261,23 +322,69 @@ rec {
};
deps.bit_vec."0.4.4" = {};
deps.bitflags."0.9.1" = {};
deps.bitflags."1.0.4" = {};
deps.bitflags."1.2.1" = {};
deps.block_buffer."0.7.3" = {
block_padding = "0.1.5";
byte_tools = "0.3.1";
byteorder = "1.2.7";
generic_array = "0.12.3";
};
deps.block_padding."0.1.5" = {
byte_tools = "0.3.1";
};
deps.byte_tools."0.3.1" = {};
deps.byteorder."0.5.3" = {};
deps.byteorder."1.2.7" = {};
deps.cc."1.0.28" = {};
deps.cfg_if."0.1.6" = {};
deps.cfg_if."0.1.10" = {};
deps.chrono."0.4.6" = {
num_integer = "0.1.39";
num_traits = "0.2.6";
time = "0.1.41";
};
deps.cloudabi."0.0.3" = {
bitflags = "1.2.1";
};
deps.cookie_factory."0.3.1" = {};
deps.core_foundation."0.2.3" = {
core_foundation_sys = "0.2.3";
libc = "0.2.46";
libc = "0.2.69";
};
deps.core_foundation."0.7.0" = {
core_foundation_sys = "0.7.0";
libc = "0.2.69";
};
deps.core_foundation_sys."0.2.3" = {
libc = "0.2.46";
libc = "0.2.69";
};
deps.core_foundation_sys."0.7.0" = {};
deps.crossbeam_channel."0.4.2" = {
crossbeam_utils = "0.7.2";
maybe_uninit = "2.0.0";
};
deps.crossbeam_deque."0.7.3" = {
crossbeam_epoch = "0.8.2";
crossbeam_utils = "0.7.2";
maybe_uninit = "2.0.0";
};
deps.crossbeam_epoch."0.8.2" = {
cfg_if = "0.1.10";
crossbeam_utils = "0.7.2";
lazy_static = "1.4.0";
maybe_uninit = "2.0.0";
memoffset = "0.5.4";
scopeguard = "1.1.0";
autocfg = "1.0.0";
};
deps.crossbeam_utils."0.7.2" = {
cfg_if = "0.1.10";
lazy_static = "1.4.0";
autocfg = "1.0.0";
};
deps.digest."0.8.1" = {
generic_array = "0.12.3";
};
deps.doc_comment."0.3.3" = {};
deps.either."1.5.0" = {};
deps.enum_primitive."0.1.1" = {
num_traits = "0.1.43";
@ -293,34 +400,57 @@ rec {
deps.error_chain."0.10.0" = {
backtrace = "0.3.13";
};
deps.fake_simd."0.1.2" = {};
deps.foreign_types."0.3.2" = {
foreign_types_shared = "0.1.1";
};
deps.foreign_types_shared."0.1.1" = {};
deps.frank_jwt."3.1.0" = {
base64 = "0.10.0";
openssl = "0.10.16";
serde = "1.0.84";
serde_json = "1.0.34";
openssl = "0.10.29";
serde = "1.0.106";
serde_json = "1.0.52";
};
deps.fs2."0.4.3" = {
libc = "0.2.46";
winapi = "0.3.6";
libc = "0.2.69";
winapi = "0.3.8";
};
deps.fuchsia_zircon."0.3.3" = {
bitflags = "1.0.4";
bitflags = "1.2.1";
fuchsia_zircon_sys = "0.3.3";
};
deps.fuchsia_zircon_sys."0.3.3" = {};
deps.futures_core."0.3.4" = {};
deps.futures_io."0.3.4" = {};
deps.futures_timer."2.0.2" = {};
deps.generic_array."0.12.3" = {
typenum = "1.12.0";
};
deps.getrandom."0.1.14" = {
cfg_if = "0.1.10";
wasi = "0.9.0+wasi-snapshot-preview1";
libc = "0.2.69";
};
deps.handlebars."3.0.1" = {
log = "0.4.8";
pest = "2.1.3";
pest_derive = "2.1.0";
quick_error = "1.2.3";
serde = "1.0.106";
serde_json = "1.0.52";
};
deps.hermit_abi."0.1.12" = {
libc = "0.2.69";
};
deps.httparse."1.3.3" = {};
deps.hubcaps."0.3.16" = {
error_chain = "0.10.0";
frank_jwt = "3.1.0";
hyper = "0.10.15";
log = "0.3.8";
serde = "1.0.84";
serde_derive = "1.0.84";
serde_json = "1.0.34";
serde = "1.0.106";
serde_derive = "1.0.106";
serde_json = "1.0.52";
url = "1.7.2";
};
deps.hyper."0.10.15" = {
@ -329,7 +459,7 @@ rec {
language_tags = "0.2.2";
log = "0.3.8";
mime = "0.2.6";
num_cpus = "1.9.0";
num_cpus = "1.13.0";
time = "0.1.41";
traitobject = "0.1.0";
typeable = "0.1.2";
@ -346,44 +476,142 @@ rec {
unicode_bidi = "0.3.4";
unicode_normalization = "0.1.7";
};
deps.idna."0.2.0" = {
matches = "0.1.8";
unicode_bidi = "0.3.4";
unicode_normalization = "0.1.7";
};
deps.iovec."0.1.4" = {
libc = "0.2.69";
};
deps.itoa."0.4.3" = {};
deps.kernel32_sys."0.2.2" = {
winapi = "0.2.8";
winapi_build = "0.1.1";
};
deps.kv_log_macro."1.0.4" = {
log = "0.4.8";
};
deps.language_tags."0.2.2" = {};
deps.lapin."1.0.0-beta3" = {
amq_protocol = "6.0.0-rc2";
async_task = "3.0.0";
crossbeam_channel = "0.4.2";
futures_core = "0.3.4";
log = "0.4.8";
mio = "0.7.0";
parking_lot = "0.10.2";
pinky_swear = "4.0.0";
amq_protocol_codegen = "6.0.0-rc2";
serde_json = "1.0.52";
};
deps.lazy_static."0.2.11" = {};
deps.lazy_static."1.2.0" = {};
deps.libc."0.2.46" = {};
deps.lazy_static."1.4.0" = {};
deps.lexical_core."0.7.4" = {
arrayvec = "0.5.1";
bitflags = "1.2.1";
cfg_if = "0.1.10";
ryu = "1.0.4";
static_assertions = "1.1.0";
};
deps.libc."0.2.69" = {};
deps.linked_hash_map."0.4.2" = {};
deps.lock_api."0.3.4" = {
scopeguard = "1.1.0";
};
deps.log."0.3.8" = {};
deps.log."0.4.8" = {
cfg_if = "0.1.10";
};
deps.lru_cache."0.1.1" = {
linked_hash_map = "0.4.2";
};
deps.maplit."1.0.2" = {};
deps.matches."0.1.8" = {};
deps.maybe_uninit."2.0.0" = {};
deps.md5."0.3.8" = {};
deps.memchr."0.1.11" = {
libc = "0.2.46";
libc = "0.2.69";
};
deps.memchr."2.1.2" = {
cfg_if = "0.1.6";
libc = "0.2.46";
version_check = "0.1.5";
deps.memchr."2.3.3" = {};
deps.memoffset."0.5.4" = {
autocfg = "1.0.0";
};
deps.mime."0.2.6" = {
log = "0.3.8";
};
deps.mio."0.6.21" = {
cfg_if = "0.1.10";
iovec = "0.1.4";
log = "0.4.8";
net2 = "0.2.33";
slab = "0.4.2";
fuchsia_zircon = "0.3.3";
fuchsia_zircon_sys = "0.3.3";
libc = "0.2.69";
kernel32_sys = "0.2.2";
miow = "0.2.1";
winapi = "0.2.8";
};
deps.mio."0.7.0" = {
log = "0.4.8";
libc = "0.2.69";
lazy_static = "1.4.0";
miow = "0.3.3";
ntapi = "0.3.3";
winapi = "0.3.8";
};
deps.mio_uds."0.6.7" = {
iovec = "0.1.4";
libc = "0.2.69";
mio = "0.6.21";
};
deps.miow."0.2.1" = {
kernel32_sys = "0.2.2";
net2 = "0.2.33";
winapi = "0.2.8";
ws2_32_sys = "0.2.1";
};
deps.miow."0.3.3" = {
socket2 = "0.3.12";
winapi = "0.3.8";
};
deps.native_tls."0.1.5" = {
lazy_static = "0.2.11";
libc = "0.2.46";
libc = "0.2.69";
security_framework = "0.1.16";
security_framework_sys = "0.1.16";
tempdir = "0.3.7";
openssl = "0.9.24";
schannel = "0.1.14";
schannel = "0.1.18";
};
deps.native_tls."0.2.4" = {
lazy_static = "1.4.0";
libc = "0.2.69";
security_framework = "0.4.3";
security_framework_sys = "0.4.3";
tempfile = "3.1.0";
log = "0.4.8";
openssl = "0.10.29";
openssl_probe = "0.1.2";
openssl_sys = "0.9.55";
schannel = "0.1.18";
};
deps.net2."0.2.33" = {
cfg_if = "0.1.10";
libc = "0.2.69";
winapi = "0.3.8";
};
deps.nom."4.1.1" = {
memchr = "2.1.2";
memchr = "2.3.3";
};
deps.nom."6.0.0-alpha1" = {
lexical_core = "0.7.4";
memchr = "2.3.3";
version_check = "0.9.1";
};
deps.ntapi."0.3.3" = {
winapi = "0.3.8";
};
deps.num_integer."0.1.39" = {
num_traits = "0.2.6";
@ -392,11 +620,13 @@ rec {
num_traits = "0.2.6";
};
deps.num_traits."0.2.6" = {};
deps.num_cpus."1.9.0" = {
libc = "0.2.46";
deps.num_cpus."1.13.0" = {
libc = "0.2.69";
hermit_abi = "0.1.12";
};
deps.ofborg."0.1.8" = {
deps.ofborg."0.1.9" = {
amqp = "0.1.0";
async_std = "1.5.0";
chrono = "0.4.6";
either = "1.5.0";
env_logger = "0.4.3";
@ -404,59 +634,121 @@ rec {
hubcaps = "0.3.16";
hyper = "0.10.15";
hyper_native_tls = "0.2.4";
lapin = "1.0.0-beta3";
log = "0.3.8";
lru_cache = "0.1.1";
md5 = "0.3.8";
nom = "4.1.1";
separator = "0.4.1";
serde = "1.0.84";
serde_derive = "1.0.84";
serde_json = "1.0.34";
serde = "1.0.106";
serde_derive = "1.0.106";
serde_json = "1.0.52";
sys_info = "0.5.6";
tempfile = "2.2.0";
uuid = "0.4.0";
};
deps.ofborg_simple_build."0.1.0" = {
log = "0.3.8";
ofborg = "0.1.8";
ofborg = "0.1.9";
};
deps.once_cell."1.3.1" = {};
deps.opaque_debug."0.2.3" = {};
deps.openssl."0.9.24" = {
bitflags = "0.9.1";
foreign_types = "0.3.2";
lazy_static = "1.2.0";
libc = "0.2.46";
openssl_sys = "0.9.40";
lazy_static = "1.4.0";
libc = "0.2.69";
openssl_sys = "0.9.55";
};
deps.openssl."0.10.16" = {
bitflags = "1.0.4";
cfg_if = "0.1.6";
deps.openssl."0.10.29" = {
bitflags = "1.2.1";
cfg_if = "0.1.10";
foreign_types = "0.3.2";
lazy_static = "1.2.0";
libc = "0.2.46";
openssl_sys = "0.9.40";
lazy_static = "1.4.0";
libc = "0.2.69";
openssl_sys = "0.9.55";
};
deps.openssl_sys."0.9.40" = {
libc = "0.2.46";
deps.openssl_probe."0.1.2" = {};
deps.openssl_sys."0.9.55" = {
libc = "0.2.69";
autocfg = "1.0.0";
cc = "1.0.28";
pkg_config = "0.3.14";
};
deps.percent_encoding."1.0.1" = {};
deps.pkg_config."0.3.14" = {};
deps.proc_macro2."0.4.24" = {
unicode_xid = "0.1.0";
deps.parking_lot."0.10.2" = {
lock_api = "0.3.4";
parking_lot_core = "0.7.2";
};
deps.quote."0.6.10" = {
proc_macro2 = "0.4.24";
deps.parking_lot_core."0.7.2" = {
cfg_if = "0.1.10";
smallvec = "1.4.0";
cloudabi = "0.0.3";
redox_syscall = "0.1.50";
libc = "0.2.69";
winapi = "0.3.8";
};
deps.percent_encoding."1.0.1" = {};
deps.percent_encoding."2.1.0" = {};
deps.pest."2.1.3" = {
ucd_trie = "0.1.3";
};
deps.pest_derive."2.1.0" = {
pest = "2.1.3";
pest_generator = "2.1.3";
};
deps.pest_generator."2.1.3" = {
pest = "2.1.3";
pest_meta = "2.1.3";
proc_macro2 = "1.0.10";
quote = "1.0.3";
syn = "1.0.18";
};
deps.pest_meta."2.1.3" = {
maplit = "1.0.2";
pest = "2.1.3";
sha_1 = "0.8.2";
};
deps.pin_project_lite."0.1.4" = {};
deps.pin_utils."0.1.0" = {};
deps.pinky_swear."4.0.0" = {
doc_comment = "0.3.3";
log = "0.4.8";
parking_lot = "0.10.2";
};
deps.pkg_config."0.3.14" = {};
deps.ppv_lite86."0.2.6" = {};
deps.proc_macro2."1.0.10" = {
unicode_xid = "0.2.0";
};
deps.quick_error."1.2.3" = {};
deps.quote."1.0.3" = {
proc_macro2 = "1.0.10";
};
deps.rand."0.3.22" = {
libc = "0.2.46";
libc = "0.2.69";
rand = "0.4.3";
fuchsia_zircon = "0.3.3";
};
deps.rand."0.4.3" = {
fuchsia_zircon = "0.3.3";
libc = "0.2.46";
winapi = "0.3.6";
libc = "0.2.69";
winapi = "0.3.8";
};
deps.rand."0.7.3" = {
rand_core = "0.5.1";
rand_chacha = "0.2.2";
rand_hc = "0.2.0";
libc = "0.2.69";
};
deps.rand_chacha."0.2.2" = {
ppv_lite86 = "0.2.6";
rand_core = "0.5.1";
};
deps.rand_core."0.5.1" = {
getrandom = "0.1.14";
};
deps.rand_hc."0.2.0" = {
rand_core = "0.5.1";
};
deps.redox_syscall."0.1.50" = {};
deps.regex."0.1.80" = {
@ -468,7 +760,7 @@ rec {
};
deps.regex."0.2.11" = {
aho_corasick = "0.6.9";
memchr = "2.1.2";
memchr = "2.3.3";
regex_syntax = "0.5.6";
thread_local = "0.3.6";
utf8_ranges = "1.0.2";
@ -478,46 +770,80 @@ rec {
ucd_util = "0.1.3";
};
deps.remove_dir_all."0.5.1" = {
winapi = "0.3.6";
winapi = "0.3.8";
};
deps.rustc_demangle."0.1.13" = {};
deps.ryu."0.2.7" = {};
deps.ryu."1.0.4" = {};
deps.safemem."0.3.0" = {};
deps.schannel."0.1.14" = {
lazy_static = "1.2.0";
winapi = "0.3.6";
deps.schannel."0.1.18" = {
lazy_static = "1.4.0";
winapi = "0.3.8";
};
deps.scopeguard."1.1.0" = {};
deps.security_framework."0.1.16" = {
core_foundation = "0.2.3";
core_foundation_sys = "0.2.3";
libc = "0.2.46";
libc = "0.2.69";
security_framework_sys = "0.1.16";
};
deps.security_framework."0.4.3" = {
bitflags = "1.2.1";
core_foundation = "0.7.0";
core_foundation_sys = "0.7.0";
libc = "0.2.69";
security_framework_sys = "0.4.3";
};
deps.security_framework_sys."0.1.16" = {
core_foundation_sys = "0.2.3";
libc = "0.2.46";
libc = "0.2.69";
};
deps.security_framework_sys."0.4.3" = {
core_foundation_sys = "0.7.0";
libc = "0.2.69";
};
deps.separator."0.4.1" = {};
deps.serde."1.0.84" = {};
deps.serde_derive."1.0.84" = {
proc_macro2 = "0.4.24";
quote = "0.6.10";
syn = "0.15.23";
deps.serde."1.0.106" = {
serde_derive = "1.0.106";
};
deps.serde_json."1.0.34" = {
deps.serde_derive."1.0.106" = {
proc_macro2 = "1.0.10";
quote = "1.0.3";
syn = "1.0.18";
};
deps.serde_json."1.0.52" = {
itoa = "0.4.3";
ryu = "0.2.7";
serde = "1.0.84";
ryu = "1.0.4";
serde = "1.0.106";
};
deps.syn."0.15.23" = {
proc_macro2 = "0.4.24";
quote = "0.6.10";
unicode_xid = "0.1.0";
deps.sha_1."0.8.2" = {
block_buffer = "0.7.3";
digest = "0.8.1";
fake_simd = "0.1.2";
opaque_debug = "0.2.3";
};
deps.slab."0.4.2" = {};
deps.smallvec."1.4.0" = {};
deps.socket2."0.3.12" = {
cfg_if = "0.1.10";
libc = "0.2.69";
redox_syscall = "0.1.50";
winapi = "0.3.8";
};
deps.static_assertions."1.1.0" = {};
deps.syn."1.0.18" = {
proc_macro2 = "1.0.10";
quote = "1.0.3";
unicode_xid = "0.2.0";
};
deps.sys_info."0.5.6" = {
libc = "0.2.46";
libc = "0.2.69";
cc = "1.0.28";
};
deps.tcp_stream."0.15.0" = {
cfg_if = "0.1.10";
mio = "0.7.0";
native_tls = "0.2.4";
};
deps.tempdir."0.3.7" = {
rand = "0.4.3";
remove_dir_all = "0.5.1";
@ -525,27 +851,37 @@ rec {
deps.tempfile."2.2.0" = {
rand = "0.3.22";
redox_syscall = "0.1.50";
libc = "0.2.46";
libc = "0.2.69";
kernel32_sys = "0.2.2";
winapi = "0.2.8";
};
deps.tempfile."3.1.0" = {
cfg_if = "0.1.10";
rand = "0.7.3";
remove_dir_all = "0.5.1";
redox_syscall = "0.1.50";
libc = "0.2.69";
winapi = "0.3.8";
};
deps.thread_id."2.0.0" = {
kernel32_sys = "0.2.2";
libc = "0.2.46";
libc = "0.2.69";
};
deps.thread_local."0.2.7" = {
thread_id = "2.0.0";
};
deps.thread_local."0.3.6" = {
lazy_static = "1.2.0";
lazy_static = "1.4.0";
};
deps.time."0.1.41" = {
libc = "0.2.46";
libc = "0.2.69";
redox_syscall = "0.1.50";
winapi = "0.3.6";
winapi = "0.3.8";
};
deps.traitobject."0.1.0" = {};
deps.typeable."0.1.2" = {};
deps.typenum."1.12.0" = {};
deps.ucd_trie."0.1.3" = {};
deps.ucd_util."0.1.3" = {};
deps.unicase."1.4.2" = {
version_check = "0.1.5";
@ -554,25 +890,36 @@ rec {
matches = "0.1.8";
};
deps.unicode_normalization."0.1.7" = {};
deps.unicode_xid."0.1.0" = {};
deps.unicode_xid."0.2.0" = {};
deps.url."1.7.2" = {
idna = "0.1.5";
matches = "0.1.8";
percent_encoding = "1.0.1";
};
deps.url."2.1.1" = {
idna = "0.2.0";
matches = "0.1.8";
percent_encoding = "2.1.0";
};
deps.utf8_ranges."0.1.3" = {};
deps.utf8_ranges."1.0.2" = {};
deps.uuid."0.4.0" = {
rand = "0.3.22";
};
deps.vcpkg."0.2.6" = {};
deps.vcpkg."0.2.8" = {};
deps.version_check."0.1.5" = {};
deps.version_check."0.9.1" = {};
deps.wasi."0.9.0+wasi-snapshot-preview1" = {};
deps.winapi."0.2.8" = {};
deps.winapi."0.3.6" = {
deps.winapi."0.3.8" = {
winapi_i686_pc_windows_gnu = "0.4.0";
winapi_x86_64_pc_windows_gnu = "0.4.0";
};
deps.winapi_build."0.1.1" = {};
deps.winapi_i686_pc_windows_gnu."0.4.0" = {};
deps.winapi_x86_64_pc_windows_gnu."0.4.0" = {};
deps.ws2_32_sys."0.2.1" = {
winapi = "0.2.8";
winapi_build = "0.1.1";
};
}

View file

@ -1,66 +1,135 @@
aho-corasick-0.5.3
aho-corasick-0.6.9
amq-proto-0.1.0
amq-protocol-6.0.0-rc2
amq-protocol-codegen-6.0.0-rc2
amq-protocol-tcp-6.0.0-rc2
amq-protocol-types-6.0.0-rc2
amq-protocol-uri-6.0.0-rc2
antidote-1.0.0
arrayvec-0.5.1
async-std-1.5.0
async-task-1.3.1
async-task-3.0.0
autocfg-0.1.1
autocfg-1.0.0
backtrace-0.3.13
backtrace-sys-0.1.28
base64-0.9.3
base64-0.10.0
bit-vec-0.4.4
bitflags-0.9.1
bitflags-1.0.4
bitflags-1.2.1
block-buffer-0.7.3
block-padding-0.1.5
byte-tools-0.3.1
byteorder-0.5.3
byteorder-1.2.7
cc-1.0.28
cfg-if-0.1.6
cfg-if-0.1.10
chrono-0.4.6
cloudabi-0.0.3
cookie-factory-0.3.1
core-foundation-0.2.3
core-foundation-0.7.0
core-foundation-sys-0.2.3
core-foundation-sys-0.7.0
crossbeam-channel-0.4.2
crossbeam-deque-0.7.3
crossbeam-epoch-0.8.2
crossbeam-utils-0.7.2
digest-0.8.1
doc-comment-0.3.3
either-1.5.0
enum_primitive-0.1.1
env_logger-0.3.5
env_logger-0.4.3
error-chain-0.10.0
fake-simd-0.1.2
foreign-types-0.3.2
foreign-types-shared-0.1.1
frank_jwt-3.1.0
fs2-0.4.3
fuchsia-zircon-0.3.3
fuchsia-zircon-sys-0.3.3
futures-core-0.3.4
futures-io-0.3.4
futures-timer-2.0.2
generic-array-0.12.3
getrandom-0.1.14
handlebars-3.0.1
hermit-abi-0.1.12
httparse-1.3.3
hyper-0.10.15
hyper-native-tls-0.2.4
idna-0.1.5
idna-0.2.0
iovec-0.1.4
itoa-0.4.3
kernel32-sys-0.2.2
kv-log-macro-1.0.4
language-tags-0.2.2
lapin-1.0.0-beta3
lazy_static-0.2.11
lazy_static-1.2.0
libc-0.2.46
lazy_static-1.4.0
lexical-core-0.7.4
libc-0.2.69
linked-hash-map-0.4.2
lock_api-0.3.4
log-0.3.8
log-0.4.8
lru-cache-0.1.1
maplit-1.0.2
matches-0.1.8
maybe-uninit-2.0.0
md5-0.3.8
memchr-0.1.11
memchr-2.1.2
memchr-2.3.3
memoffset-0.5.4
mime-0.2.6
mio-0.6.21
mio-0.7.0
mio-uds-0.6.7
miow-0.2.1
miow-0.3.3
native-tls-0.1.5
native-tls-0.2.4
net2-0.2.33
nom-4.1.1
nom-6.0.0-alpha1
ntapi-0.3.3
num-integer-0.1.39
num-traits-0.1.43
num-traits-0.2.6
num_cpus-1.9.0
num_cpus-1.13.0
once_cell-1.3.1
opaque-debug-0.2.3
openssl-0.9.24
openssl-0.10.16
openssl-sys-0.9.40
openssl-0.10.29
openssl-probe-0.1.2
openssl-sys-0.9.55
parking_lot-0.10.2
parking_lot_core-0.7.2
percent-encoding-1.0.1
percent-encoding-2.1.0
pest-2.1.3
pest_derive-2.1.0
pest_generator-2.1.3
pest_meta-2.1.3
pin-project-lite-0.1.4
pin-utils-0.1.0
pinky-swear-4.0.0
pkg-config-0.3.14
proc-macro2-0.4.24
quote-0.6.10
ppv-lite86-0.2.6
proc-macro2-1.0.10
quick-error-1.2.3
quote-1.0.3
rand-0.3.22
rand-0.4.3
rand-0.7.3
rand_chacha-0.2.2
rand_core-0.5.1
rand_hc-0.2.0
redox_syscall-0.1.50
regex-0.1.80
regex-0.2.11
@ -68,38 +137,54 @@ regex-syntax-0.3.9
regex-syntax-0.5.6
remove_dir_all-0.5.1
rustc-demangle-0.1.13
ryu-0.2.7
ryu-1.0.4
safemem-0.3.0
schannel-0.1.14
schannel-0.1.18
scopeguard-1.1.0
security-framework-0.1.16
security-framework-0.4.3
security-framework-sys-0.1.16
security-framework-sys-0.4.3
separator-0.4.1
serde-1.0.84
serde_derive-1.0.84
serde_json-1.0.34
syn-0.15.23
serde-1.0.106
serde_derive-1.0.106
serde_json-1.0.52
sha-1-0.8.2
slab-0.4.2
smallvec-1.4.0
socket2-0.3.12
static_assertions-1.1.0
syn-1.0.18
sys-info-0.5.6
tcp-stream-0.15.0
tempdir-0.3.7
tempfile-2.2.0
tempfile-3.1.0
thread-id-2.0.0
thread_local-0.2.7
thread_local-0.3.6
time-0.1.41
traitobject-0.1.0
typeable-0.1.2
typenum-1.12.0
ucd-trie-0.1.3
ucd-util-0.1.3
unicase-1.4.2
unicode-bidi-0.3.4
unicode-normalization-0.1.7
unicode-xid-0.1.0
unicode-xid-0.2.0
url-1.7.2
url-2.1.1
utf8-ranges-0.1.3
utf8-ranges-1.0.2
uuid-0.4.0
vcpkg-0.2.6
vcpkg-0.2.8
version_check-0.1.5
version_check-0.9.1
wasi-0.9.0+wasi-snapshot-preview1
winapi-0.2.8
winapi-0.3.6
winapi-0.3.8
winapi-build-0.1.1
winapi-i686-pc-windows-gnu-0.4.0
winapi-x86_64-pc-windows-gnu-0.4.0
ws2_32-sys-0.2.1

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,20 @@
(self: super:
{
carnix = super.carnix.overrideDerivation (drv: {
patches = super.patches or [] ++ [
(super.fetchurl {
name = "carnix-cfg.patch";
url = "https://gist.githubusercontent.com/LnL7/27a567cd2b3162a21cbd0499c6fa0f71/raw/32d3055b6ce105c2c64e8cdfe0204d6c90f6d214/carnix-cfg.patch";
sha256 = "1nc5dlxqrhgh989dfzhjqw46hk3aii0rcz1qr3cvqbrwc7wzcj6w";
})
(super.fetchurl {
name = "carnix-workspaces.patch";
url = "https://gist.githubusercontent.com/LnL7/27a567cd2b3162a21cbd0499c6fa0f71/raw/d6395cfc06dff2a3555b0068e477274f9560fbae/carnix-workspace.patch";
sha256 = "1kvfing0s968pknsrpc98yjii8idsqmy00dsvwkyfbqx9frn7kjg";
})
];
});
defaultCrateOverrides = super.defaultCrateOverrides // {
ofborg = attrs: {
buildInputs = with self.darwin.apple_sdk.frameworks;

View file

@ -1,6 +1,6 @@
[package]
name = "ofborg"
version = "0.1.8"
version = "0.1.9"
authors = ["Graham Christensen <graham@grahamc.com>"]
include = ["Cargo.toml", "ofborg"] # TODO remove when carnix is fixed
build = "build.rs"
@ -28,3 +28,6 @@ nom = "4.0.0-beta3"
sys-info = "0.5.6"
chrono = "0.4.6"
separator = "0.4.1"
async-std = "1.5.0"
lapin = "1.0.0-beta3"

View file

@ -1,19 +1,20 @@
use amqp::Basic;
use log::{info, log, warn};
use ofborg::checkout;
use ofborg::config;
use ofborg::easyamqp::{self, ChannelExt, ConsumerExt};
use ofborg::notifyworker;
use ofborg::tasks;
use std::env;
use std::error::Error;
use std::path::Path;
fn main() {
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
use async_std::task;
use log::{info, log, warn};
use ofborg::easyamqp::{self, ChannelExt, ConsumerExt};
use ofborg::easylapin;
use ofborg::{checkout, config, tasks};
fn main() -> Result<(), Box<dyn Error>> {
ofborg::setup_log();
let arg = env::args().nth(1).expect("usage: builder <config>");
let cfg = config::load(arg.as_ref());
let cloner = checkout::cached_cloner(Path::new(&cfg.checkout.root));
let nix = cfg.nix();
@ -27,11 +28,10 @@ fn main() {
panic!();
};
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
let mut channel = session.open_channel(1).unwrap();
channel.basic_prefetch(1).unwrap();
channel
.declare_exchange(easyamqp::ExchangeConfig {
let conn = easylapin::from_config(&cfg.rabbitmq)?;
let mut chan = task::block_on(conn.create_channel())?;
chan.declare_exchange(easyamqp::ExchangeConfig {
exchange: "build-jobs".to_owned(),
exchange_type: easyamqp::ExchangeType::Fanout,
passive: false,
@ -39,56 +39,48 @@ fn main() {
auto_delete: false,
no_wait: false,
internal: false,
})
.unwrap();
})?;
let queue_name = if cfg.runner.build_all_jobs != Some(true) {
let queue_name = format!("build-inputs-{}", cfg.nix.system.clone());
channel
.declare_queue(easyamqp::QueueConfig {
chan.declare_queue(easyamqp::QueueConfig {
queue: queue_name.clone(),
passive: false,
durable: true,
exclusive: false,
auto_delete: false,
no_wait: false,
})
.unwrap();
})?;
queue_name
} else {
warn!("Building all jobs, please don't use this unless you're");
warn!("developing and have Graham's permission!");
let queue_name = "".to_owned();
channel
.declare_queue(easyamqp::QueueConfig {
chan.declare_queue(easyamqp::QueueConfig {
queue: queue_name.clone(),
passive: false,
durable: false,
exclusive: true,
auto_delete: true,
no_wait: false,
})
.unwrap();
})?;
queue_name
};
channel
.bind_queue(easyamqp::BindQueueConfig {
chan.bind_queue(easyamqp::BindQueueConfig {
queue: queue_name.clone(),
exchange: "build-jobs".to_owned(),
routing_key: None,
no_wait: false,
})
.unwrap();
})?;
channel
.consume(
notifyworker::new(tasks::build::BuildWorker::new(
let handle = easylapin::NotifyChannel(chan).consume(
tasks::build::BuildWorker::new(
cloner,
nix,
cfg.nix.system.clone(),
cfg.runner.identity.clone(),
)),
),
easyamqp::ConsumeConfig {
queue: queue_name.clone(),
consumer_tag: format!("{}-builder", cfg.whoami()),
@ -97,13 +89,12 @@ fn main() {
no_wait: false,
exclusive: false,
},
)
.unwrap();
)?;
info!("Fetching jobs from {}", &queue_name);
channel.start_consuming();
channel.close(200, "Bye").unwrap();
info!("Closed the channel");
session.close(200, "Good Bye");
task::block_on(handle);
drop(conn); // Close connection.
info!("Closed the session... EOF");
Ok(())
}

View file

@ -62,7 +62,7 @@ fn main() {
.unwrap();
channel.basic_prefetch(1).unwrap();
channel
let mut channel = channel
.consume(
worker::new(tasks::evaluationfilter::EvaluationFilterWorker::new(
cfg.acl(),

View file

@ -62,7 +62,7 @@ fn main() {
.unwrap();
channel.basic_prefetch(1).unwrap();
channel
let mut channel = channel
.consume(
worker::new(tasks::githubcommentfilter::GitHubCommentWorker::new(
cfg.acl(),

View file

@ -47,7 +47,7 @@ fn main() {
.unwrap();
channel.basic_prefetch(1).unwrap();
channel
let mut channel = channel
.consume(
worker::new(tasks::githubcommentposter::GitHubCommentPoster::new(
cfg.github_app_vendingmachine(),

View file

@ -49,7 +49,7 @@ fn main() {
})
.unwrap();
channel
let mut channel = channel
.consume(
worker::new(tasks::log_message_collector::LogMessageCollector::new(
PathBuf::from(cfg.log_storage.clone().unwrap().path),

View file

@ -65,7 +65,7 @@ fn main() {
.unwrap();
channel.basic_prefetch(1).unwrap();
channel
let mut channel = channel
.consume(
worker::new(mrw),
easyamqp::ConsumeConfig {

View file

@ -59,7 +59,7 @@ fn main() {
.unwrap();
channel.basic_prefetch(1).unwrap();
channel
let mut channel = channel
.consume(
worker::new(collector),
easyamqp::ConsumeConfig {

View file

@ -303,9 +303,10 @@ pub trait ChannelExt {
fn bind_queue(&mut self, config: BindQueueConfig) -> Result<(), Self::Error>;
}
pub trait ConsumerExt<T> {
pub trait ConsumerExt<C> {
type Error;
fn consume(&mut self, callback: T, config: ConsumeConfig) -> Result<(), Self::Error>;
type Handle;
fn consume(self, callback: C, config: ConsumeConfig) -> Result<Self::Handle, Self::Error>;
}
impl ChannelExt for amqp::Channel {
@ -350,10 +351,11 @@ impl ChannelExt for amqp::Channel {
}
}
impl<T: amqp::Consumer + 'static> ConsumerExt<T> for amqp::Channel {
impl<C: amqp::Consumer + 'static> ConsumerExt<C> for amqp::Channel {
type Error = amqp::AMQPError;
type Handle = Self;
fn consume(&mut self, callback: T, config: ConsumeConfig) -> Result<(), Self::Error> {
fn consume(mut self, callback: C, config: ConsumeConfig) -> Result<Self::Handle, Self::Error> {
self.basic_consume(
callback,
config.queue,
@ -364,6 +366,6 @@ impl<T: amqp::Consumer + 'static> ConsumerExt<T> for amqp::Channel {
config.no_wait,
amqp::Table::new(),
)?;
Ok(())
Ok(self)
}
}

206
ofborg/src/easylapin.rs Normal file
View file

@ -0,0 +1,206 @@
use std::pin::Pin;
use crate::config::RabbitMQConfig;
use crate::easyamqp::{
BindQueueConfig, ChannelExt, ConsumeConfig, ConsumerExt, ExchangeConfig, ExchangeType,
QueueConfig,
};
use crate::notifyworker::{NotificationReceiver, SimpleNotifyWorker};
use crate::ofborg;
use crate::worker::{Action, SimpleWorker};
use async_std::future::Future;
use async_std::stream::StreamExt;
use async_std::task;
use lapin::message::Delivery;
use lapin::options::{
BasicAckOptions, BasicConsumeOptions, BasicNackOptions, BasicPublishOptions,
ExchangeDeclareOptions, QueueBindOptions, QueueDeclareOptions,
};
use lapin::types::{AMQPValue, FieldTable};
use lapin::{
BasicProperties, Channel, CloseOnDrop, Connection, ConnectionProperties, ExchangeKind,
};
pub fn from_config(cfg: &RabbitMQConfig) -> Result<CloseOnDrop<Connection>, lapin::Error> {
let mut props = FieldTable::default();
props.insert(
"ofborg_version".into(),
AMQPValue::LongString(ofborg::VERSION.into()),
);
let mut opts = ConnectionProperties::default();
opts.client_properties = props;
task::block_on(Connection::connect(&cfg.as_uri(), opts))
}
impl ChannelExt for CloseOnDrop<Channel> {
type Error = lapin::Error;
fn declare_exchange(&mut self, config: ExchangeConfig) -> Result<(), Self::Error> {
let mut opts = ExchangeDeclareOptions::default();
opts.passive = config.passive;
opts.durable = config.durable;
opts.auto_delete = config.auto_delete;
opts.internal = config.internal;
opts.nowait = config.no_wait;
let kind = match config.exchange_type {
ExchangeType::Topic => ExchangeKind::Topic,
ExchangeType::Fanout => ExchangeKind::Fanout,
_ => panic!("exchange kind"),
};
task::block_on(self.exchange_declare(&config.exchange, kind, opts, FieldTable::default()))?;
Ok(())
}
fn declare_queue(&mut self, config: QueueConfig) -> Result<(), Self::Error> {
let mut opts = QueueDeclareOptions::default();
opts.passive = config.passive;
opts.durable = config.durable;
opts.exclusive = config.exclusive;
opts.auto_delete = config.auto_delete;
opts.nowait = config.no_wait;
task::block_on(self.queue_declare(&config.queue, opts, FieldTable::default()))?;
Ok(())
}
fn bind_queue(&mut self, config: BindQueueConfig) -> Result<(), Self::Error> {
let mut opts = QueueBindOptions::default();
opts.nowait = config.no_wait;
task::block_on(self.queue_bind(
&config.queue,
&config.exchange,
&config.routing_key.unwrap_or_else(|| "".into()),
opts,
FieldTable::default(),
))?;
Ok(())
}
}
impl<W: SimpleWorker + 'static> ConsumerExt<W> for CloseOnDrop<Channel> {
type Error = lapin::Error;
type Handle = Pin<Box<dyn Future<Output = ()> + 'static>>;
fn consume(self, mut worker: W, config: ConsumeConfig) -> Result<Self::Handle, Self::Error> {
let mut consumer = task::block_on(self.basic_consume(
&config.queue,
&config.consumer_tag,
BasicConsumeOptions::default(),
FieldTable::default(),
))?;
Ok(Box::pin(async move {
while let Some(Ok(deliver)) = consumer.next().await {
let content_type = deliver.properties.content_type();
let job = worker
.msg_to_job(
deliver.routing_key.as_str(),
&content_type.as_ref().map(|s| s.to_string()),
&deliver.data,
)
.expect("worker unexpected message consumed");
for action in worker.consumer(&job) {
action_deliver(&self, &deliver, action)
.await
.expect("action deliver failure");
}
}
}))
}
}
struct ChannelNotificationReceiver<'a> {
channel: &'a mut CloseOnDrop<lapin::Channel>,
deliver: &'a Delivery,
}
impl<'a> NotificationReceiver for ChannelNotificationReceiver<'a> {
fn tell(&mut self, action: Action) {
task::block_on(action_deliver(self.channel, self.deliver, action))
.expect("action deliver failure");
}
}
// FIXME the consumer trait for SimpleWorker and SimpleNotifyWorker conflict,
// but one could probably be implemented in terms of the other instead.
pub struct NotifyChannel(pub CloseOnDrop<Channel>);
impl<W: SimpleNotifyWorker + 'static> ConsumerExt<W> for NotifyChannel {
type Error = lapin::Error;
type Handle = Pin<Box<dyn Future<Output = ()> + 'static>>;
fn consume(self, worker: W, config: ConsumeConfig) -> Result<Self::Handle, Self::Error> {
let mut consumer = task::block_on(self.0.basic_consume(
&config.queue,
&config.consumer_tag,
BasicConsumeOptions::default(),
FieldTable::default(),
))?;
let mut chan = self.0;
Ok(Box::pin(async move {
while let Some(Ok(deliver)) = consumer.next().await {
log::debug!("delivery {}", deliver.delivery_tag);
let mut receiver = ChannelNotificationReceiver {
channel: &mut chan,
deliver: &deliver,
};
let content_type = deliver.properties.content_type();
let job = worker
.msg_to_job(
deliver.routing_key.as_str(),
&content_type.as_ref().map(|s| s.to_string()),
&deliver.data,
)
.expect("worker unexpected message consumed");
worker.consumer(&job, &mut receiver);
}
}))
}
}
async fn action_deliver(
chan: &CloseOnDrop<Channel>,
deliver: &Delivery,
action: Action,
) -> Result<(), lapin::Error> {
match action {
Action::Ack => {
log::debug!("action ack");
chan.basic_ack(deliver.delivery_tag, BasicAckOptions::default())
.await
}
Action::NackRequeue => {
log::debug!("action nack requeue");
let mut opts = BasicNackOptions::default();
opts.requeue = true;
chan.basic_nack(deliver.delivery_tag, opts).await
}
Action::NackDump => {
log::debug!("action nack dump");
chan.basic_nack(deliver.delivery_tag, BasicNackOptions::default())
.await
}
Action::Publish(mut msg) => {
let exch = msg.exchange.take().unwrap_or_else(|| "".to_owned());
let key = msg.routing_key.take().unwrap_or_else(|| "".to_owned());
log::debug!("action publish {}", exch);
let _confirmaton = chan
.basic_publish(
&exch,
&key,
BasicPublishOptions::default(),
msg.content,
BasicProperties::default(),
)
.await?
.await?;
Ok(())
}
}
}

View file

@ -24,6 +24,7 @@ pub mod commentparser;
pub mod commitstatus;
pub mod config;
pub mod easyamqp;
pub mod easylapin;
pub mod evalchecker;
pub mod files;
pub mod ghevent;

View file

@ -1,7 +1,7 @@
use crate::worker::Action;
use amqp::protocol::basic::{BasicProperties, Deliver};
use amqp::{Basic, Channel, Consumer};
use amqp::Basic;
use std::marker::Send;
@ -16,8 +16,8 @@ pub trait SimpleNotifyWorker {
fn msg_to_job(
&self,
method: &Deliver,
headers: &BasicProperties,
routing_key: &str,
content_type: &Option<String>,
body: &[u8],
) -> Result<Self::J, String>;
}
@ -44,12 +44,15 @@ impl NotificationReceiver for DummyNotificationReceiver {
}
pub struct ChannelNotificationReceiver<'a> {
channel: &'a mut Channel,
channel: &'a mut amqp::Channel,
delivery_tag: u64,
}
impl<'a> ChannelNotificationReceiver<'a> {
pub fn new(channel: &'a mut Channel, delivery_tag: u64) -> ChannelNotificationReceiver<'a> {
pub fn new(
channel: &'a mut amqp::Channel,
delivery_tag: u64,
) -> ChannelNotificationReceiver<'a> {
ChannelNotificationReceiver {
channel,
delivery_tag,
@ -77,9 +80,10 @@ impl<'a> NotificationReceiver for ChannelNotificationReceiver<'a> {
let exch = msg.exchange.take().unwrap_or_else(|| "".to_owned());
let key = msg.routing_key.take().unwrap_or_else(|| "".to_owned());
let props = msg.properties.take().unwrap_or(BasicProperties {
let props = BasicProperties {
content_type: msg.content_type,
..Default::default()
});
};
self.channel
.basic_publish(exch, key, msg.mandatory, msg.immediate, props, msg.content)
.unwrap();
@ -92,17 +96,20 @@ pub fn new<T: SimpleNotifyWorker>(worker: T) -> NotifyWorker<T> {
NotifyWorker { internal: worker }
}
impl<T: SimpleNotifyWorker + Send> Consumer for NotifyWorker<T> {
impl<T: SimpleNotifyWorker + Send> amqp::Consumer for NotifyWorker<T> {
fn handle_delivery(
&mut self,
channel: &mut Channel,
channel: &mut amqp::Channel,
method: Deliver,
headers: BasicProperties,
body: Vec<u8>,
) {
let mut receiver = ChannelNotificationReceiver::new(channel, method.delivery_tag);
let job = self.internal.msg_to_job(&method, &headers, &body).unwrap();
let job = self
.internal
.msg_to_job(&method.routing_key, &headers.content_type, &body)
.unwrap();
self.internal.consumer(&job, &mut receiver);
}
}

View file

@ -6,7 +6,6 @@ use crate::nix;
use crate::notifyworker;
use crate::worker;
use amqp::protocol::basic::{BasicProperties, Deliver};
use uuid::Uuid;
use std::collections::VecDeque;
@ -260,7 +259,7 @@ impl<'a, 'b> JobActions<'a, 'b> {
impl notifyworker::SimpleNotifyWorker for BuildWorker {
type J = buildjob::BuildJob;
fn msg_to_job(&self, _: &Deliver, _: &BasicProperties, body: &[u8]) -> Result<Self::J, String> {
fn msg_to_job(&self, _: &str, _: &Option<String>, body: &[u8]) -> Result<Self::J, String> {
info!("lmao I got a job?");
match buildjob::from(body) {
Ok(e) => Ok(e),

View file

@ -11,7 +11,6 @@ use crate::systems;
use crate::tasks::eval;
use crate::worker;
use amqp::protocol::basic::{BasicProperties, Deliver};
use hubcaps::checks::CheckRunOptions;
use hubcaps::gists::Gists;
use hubcaps::issues::Issue;
@ -60,12 +59,7 @@ impl<E: stats::SysEvents> EvaluationWorker<E> {
impl<E: stats::SysEvents + 'static> worker::SimpleWorker for EvaluationWorker<E> {
type J = evaluationjob::EvaluationJob;
fn msg_to_job(
&mut self,
_: &Deliver,
_: &BasicProperties,
body: &[u8],
) -> Result<Self::J, String> {
fn msg_to_job(&mut self, _: &str, _: &Option<String>, body: &[u8]) -> Result<Self::J, String> {
self.events.notify(Event::JobReceived);
match evaluationjob::from(body) {
Ok(e) => {

View file

@ -3,8 +3,6 @@ use crate::ghevent;
use crate::message::{evaluationjob, Pr, Repo};
use crate::worker;
use amqp::protocol::basic::{BasicProperties, Deliver};
pub struct EvaluationFilterWorker {
acl: acl::ACL,
}
@ -18,12 +16,7 @@ impl EvaluationFilterWorker {
impl worker::SimpleWorker for EvaluationFilterWorker {
type J = ghevent::PullRequestEvent;
fn msg_to_job(
&mut self,
_: &Deliver,
_: &BasicProperties,
body: &[u8],
) -> Result<Self::J, String> {
fn msg_to_job(&mut self, _: &str, _: &Option<String>, body: &[u8]) -> Result<Self::J, String> {
match serde_json::from_slice(body) {
Ok(e) => Ok(e),
Err(e) => Err(format!(

View file

@ -4,7 +4,6 @@ use crate::ghevent;
use crate::message::{buildjob, evaluationjob, Pr, Repo};
use crate::worker;
use amqp::protocol::basic::{BasicProperties, Deliver};
use uuid::Uuid;
pub struct GitHubCommentWorker {
@ -21,12 +20,7 @@ impl GitHubCommentWorker {
impl worker::SimpleWorker for GitHubCommentWorker {
type J = ghevent::IssueComment;
fn msg_to_job(
&mut self,
_: &Deliver,
_: &BasicProperties,
body: &[u8],
) -> Result<Self::J, String> {
fn msg_to_job(&mut self, _: &str, _: &Option<String>, body: &[u8]) -> Result<Self::J, String> {
match serde_json::from_slice(body) {
Ok(e) => Ok(e),
Err(e) => {

View file

@ -4,7 +4,6 @@ use crate::message::buildresult::{BuildResult, BuildStatus, LegacyBuildResult};
use crate::message::Repo;
use crate::worker;
use amqp::protocol::basic::{BasicProperties, Deliver};
use chrono::{DateTime, Utc};
use hubcaps::checks::{CheckRunOptions, CheckRunState, Conclusion, Output};
@ -42,12 +41,7 @@ impl PostableEvent {
impl worker::SimpleWorker for GitHubCommentPoster {
type J = PostableEvent;
fn msg_to_job(
&mut self,
_: &Deliver,
_: &BasicProperties,
body: &[u8],
) -> Result<Self::J, String> {
fn msg_to_job(&mut self, _: &str, _: &Option<String>, body: &[u8]) -> Result<Self::J, String> {
PostableEvent::from(body)
}

View file

@ -3,7 +3,6 @@ use crate::message::buildresult::BuildResult;
use crate::worker;
use crate::writetoline::LineWriter;
use amqp::protocol::basic::{BasicProperties, Deliver};
use lru_cache::LruCache;
use std::fs::{self, File, OpenOptions};
@ -174,8 +173,8 @@ impl worker::SimpleWorker for LogMessageCollector {
fn msg_to_job(
&mut self,
deliver: &Deliver,
_: &BasicProperties,
routing_key: &str,
_: &Option<String>,
body: &[u8],
) -> Result<Self::J, String> {
let message: MsgType;
@ -203,7 +202,7 @@ impl worker::SimpleWorker for LogMessageCollector {
Ok(LogMessage {
from: LogFrom {
routing_key: deliver.routing_key.clone(),
routing_key: routing_key.to_string(),
attempt_id,
},
message,

View file

@ -1,8 +1,6 @@
use crate::stats;
use crate::worker;
use amqp::protocol::basic::{BasicProperties, Deliver};
pub struct StatCollectorWorker<E> {
events: E,
collector: stats::MetricCollector,
@ -17,12 +15,7 @@ impl<E: stats::SysEvents + 'static> StatCollectorWorker<E> {
impl<E: stats::SysEvents + 'static> worker::SimpleWorker for StatCollectorWorker<E> {
type J = stats::EventMessage;
fn msg_to_job(
&mut self,
_: &Deliver,
_: &BasicProperties,
body: &[u8],
) -> Result<Self::J, String> {
fn msg_to_job(&mut self, _: &str, _: &Option<String>, body: &[u8]) -> Result<Self::J, String> {
match serde_json::from_slice(body) {
Ok(e) => Ok(e),
Err(_) => {

View file

@ -1,5 +1,5 @@
use amqp::protocol::basic::{BasicProperties, Deliver};
use amqp::{Basic, Channel, Consumer};
use amqp::Basic;
use serde::Serialize;
use std::marker::Send;
@ -26,7 +26,7 @@ pub struct QueueMsg {
pub routing_key: Option<String>,
pub mandatory: bool,
pub immediate: bool,
pub properties: Option<BasicProperties>,
pub content_type: Option<String>,
pub content: Vec<u8>,
}
@ -38,30 +38,25 @@ pub fn publish_serde_action<T: ?Sized>(
where
T: Serialize,
{
let props = BasicProperties {
content_type: Some("application/json".to_owned()),
..Default::default()
};
Action::Publish(Box::new(QueueMsg {
exchange,
routing_key,
mandatory: false,
immediate: false,
properties: Some(props),
content_type: Some("application/json".to_owned()),
content: serde_json::to_string(&msg).unwrap().into_bytes(),
}))
}
pub trait SimpleWorker: Send + 'static {
pub trait SimpleWorker: Send {
type J: Send;
fn consumer(&mut self, job: &Self::J) -> Actions;
fn msg_to_job(
&mut self,
method: &Deliver,
headers: &BasicProperties,
method: &str,
headers: &Option<String>,
body: &[u8],
) -> Result<Self::J, String>;
}
@ -70,15 +65,17 @@ pub fn new<T: SimpleWorker>(worker: T) -> Worker<T> {
Worker { internal: worker }
}
impl<T: SimpleWorker + Send> Consumer for Worker<T> {
impl<T: SimpleWorker + Send> amqp::Consumer for Worker<T> {
fn handle_delivery(
&mut self,
channel: &mut Channel,
channel: &mut amqp::Channel,
method: Deliver,
headers: BasicProperties,
body: Vec<u8>,
) {
let job = self.internal.msg_to_job(&method, &headers, &body);
let job = self
.internal
.msg_to_job(&method.routing_key, &headers.content_type, &body);
if let Err(e) = job {
error!("Error decoding job: {:?}", e);
@ -105,9 +102,10 @@ impl<T: SimpleWorker + Send> Consumer for Worker<T> {
let exch = msg.exchange.take().unwrap_or_else(|| "".to_owned());
let key = msg.routing_key.take().unwrap_or_else(|| "".to_owned());
let props = msg.properties.take().unwrap_or(BasicProperties {
let props = BasicProperties {
content_type: msg.content_type,
..Default::default()
});
};
channel
.basic_publish(exch, key, msg.mandatory, msg.immediate, props, msg.content)
.unwrap();

View file

@ -1,5 +1,6 @@
{ pkgs ? import ./nix {
overlays = [
(import ./nix/overlay.nix)
(import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz))
];
} }: