Skip to content

Commit

Permalink
refactor(echo,prometheus,build): Remove our dependency on the httpz l…
Browse files Browse the repository at this point in the history
…ibrary (#520)

* Remove httpz from echo

* Remove httpz from prometheus

* Remove httpz dependency

* Remove unused import

* Remove redundant waitgroup from echo server

* Remove redundant code

* Associate the connection task struct and functions

* Add TODO about propagating correct shred version
  • Loading branch information
InKryption authored Jan 27, 2025
1 parent 16280b0 commit 8345545
Show file tree
Hide file tree
Showing 7 changed files with 324 additions and 234 deletions.
8 changes: 0 additions & 8 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ pub fn build(b: *Build) void {
const zig_cli_dep = b.dependency("zig-cli", dep_opts);
const zig_cli_module = zig_cli_dep.module("zig-cli");

const httpz_dep = b.dependency("httpz", dep_opts);
const httpz_mod = httpz_dep.module("httpz");

const zstd_dep = b.dependency("zstd", dep_opts);
const zstd_mod = zstd_dep.module("zstd");

Expand Down Expand Up @@ -78,7 +75,6 @@ pub fn build(b: *Build) void {
sig_mod.addImport("zig-network", zig_network_module);
sig_mod.addImport("base58-zig", base58_module);
sig_mod.addImport("zig-cli", zig_cli_module);
sig_mod.addImport("httpz", httpz_mod);
sig_mod.addImport("zstd", zstd_mod);
switch (blockstore_db) {
.rocksdb => sig_mod.addImport("rocksdb", rocksdb_mod),
Expand All @@ -105,7 +101,6 @@ pub fn build(b: *Build) void {
sig_exe.root_module.addOptions("build-options", build_options);

sig_exe.root_module.addImport("base58-zig", base58_module);
sig_exe.root_module.addImport("httpz", httpz_mod);
sig_exe.root_module.addImport("zig-cli", zig_cli_module);
sig_exe.root_module.addImport("zig-network", zig_network_module);
sig_exe.root_module.addImport("zstd", zstd_mod);
Expand Down Expand Up @@ -144,7 +139,6 @@ pub fn build(b: *Build) void {
unit_tests_exe.root_module.addOptions("build-options", build_options);

unit_tests_exe.root_module.addImport("base58-zig", base58_module);
unit_tests_exe.root_module.addImport("httpz", httpz_mod);
unit_tests_exe.root_module.addImport("zig-network", zig_network_module);
unit_tests_exe.root_module.addImport("zstd", zstd_mod);
switch (blockstore_db) {
Expand Down Expand Up @@ -179,7 +173,6 @@ pub fn build(b: *Build) void {

fuzz_exe.root_module.addImport("base58-zig", base58_module);
fuzz_exe.root_module.addImport("zig-network", zig_network_module);
fuzz_exe.root_module.addImport("httpz", httpz_mod);
fuzz_exe.root_module.addImport("zstd", zstd_mod);
switch (blockstore_db) {
.rocksdb => fuzz_exe.root_module.addImport("rocksdb", rocksdb_mod),
Expand Down Expand Up @@ -214,7 +207,6 @@ pub fn build(b: *Build) void {

benchmark_exe.root_module.addImport("base58-zig", base58_module);
benchmark_exe.root_module.addImport("zig-network", zig_network_module);
benchmark_exe.root_module.addImport("httpz", httpz_mod);
benchmark_exe.root_module.addImport("zstd", zstd_mod);
benchmark_exe.root_module.addImport("prettytable", pretty_table_mod);
switch (blockstore_db) {
Expand Down
4 changes: 0 additions & 4 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
.url = "https://github.com/sam701/zig-cli/archive/8c7a798c0f7fa0358d7ab41106fc872fca4cd995.tar.gz",
.hash = "1220c008492d9460c3be2b209600a948181e6efb3bf0d79a1633def499632e708f4b",
},
.httpz = .{
.url = "https://github.com/karlseguin/http.zig/archive/79dad0f0cc652830cd8e49bf3e73aa77155ad4b2.tar.gz",
.hash = "1220b8a918dfcee4fc8326ec337776e2ffd3029511c35f6b96d10aa7be98ca2faf99",
},
.zstd = .{
.url = "git+https://github.com/Syndica/zstd.zig#5095f011c1183aa67d696172795440d6a33732c9",
.hash = "122030ebe280b73693963a67ed656226a67b7f00a0a05665155da00c9fcdee90de88",
Expand Down
8 changes: 1 addition & 7 deletions src/cmd.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1304,8 +1304,6 @@ const AppBase = struct {
exit: std.atomic.Value(bool) = std.atomic.Value(bool).init(false),
closed: bool,

const Self = @This();

fn init(allocator: std.mem.Allocator) !AppBase {
const logger = (try spawnLogger(allocator)).withScope(LOG_SCOPE);
errdefer logger.deinit();
Expand All @@ -1319,11 +1317,7 @@ const AppBase = struct {

const entrypoints = try current_config.gossip.getEntrypointAddrs(allocator);

const echo_data = try getShredAndIPFromEchoServer(
logger.unscoped(),
allocator,
entrypoints,
);
const echo_data = try getShredAndIPFromEchoServer(logger.unscoped(), entrypoints);

// zig fmt: off
const my_shred_version = current_config.shred_version
Expand Down
6 changes: 1 addition & 5 deletions src/gossip/helpers.zig
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ pub fn initGossipFromCluster(
}

// create contact info
const echo_data = try getShredAndIPFromEchoServer(
logger.unscoped(),
allocator,
entrypoints.items,
);
const echo_data = try getShredAndIPFromEchoServer(logger.unscoped(), entrypoints.items);
const my_shred_version = echo_data.shred_version orelse 0;
const my_ip = echo_data.ip orelse IpAddr.newIpv4(127, 0, 0, 1);

Expand Down
Loading

0 comments on commit 8345545

Please sign in to comment.