]> git.puffer.fish Git - matthieu/nova.git/commitdiff
NovaCtl cluster command & control proto
authorMatthieu <matthieu@developershouse.xyz>
Sun, 26 Sep 2021 15:08:40 +0000 (19:08 +0400)
committerMatthieu <matthieu@developershouse.xyz>
Sun, 26 Sep 2021 15:08:40 +0000 (19:08 +0400)
36 files changed:
BUILD
WORKSPACE
bazel/BUILD
bazel/deps.bzl
bazel/go.bzl
bazel/patch/BUILD
cache/BUILD
cache/cargo/BUILD.bazel [deleted file]
common/BUILD.bazel
common/cargo/BUILD.bazel [deleted file]
common/rust/cargo/BUILD.bazel [deleted file]
common/rust/src/error.rs
docker-compose.yaml
gateway/BUILD
gateway/cargo/BUILD.bazel [deleted file]
gateway/src/error.rs
gateway/src/payloads/dispatch.rs
gateway/src/payloads/gateway.rs
gateway/src/shard/connection.rs
go.mod
go.sum
manager/BUILD.bazel [deleted file]
manager/main.go [deleted file]
novactl/BUILD.bazel
novactl/cmd/BUILD.bazel
novactl/cmd/init.go
novactl/cmd/version.go
novactl/lib/BUILD.bazel
novactl/lib/version_test.go [deleted file]
novactl/lib/vesion.go [deleted file]
novactl/main.go
ratelimiter/BUILD
ratelimiter/cargo/BUILD.bazel [deleted file]
ratelimiter/proto/BUILD.bazel
webhook/BUILD
webhook/cargo/BUILD.bazel [deleted file]

diff --git a/BUILD b/BUILD
index 498bd5ab9ac4addfafc272d9631db0167588a618..ec32785948ae660e4ca50a0e7a216e407781168b 100644 (file)
--- a/BUILD
+++ b/BUILD
@@ -1,69 +1,70 @@
 load("@bazel_gazelle//:def.bzl", "gazelle")
-load("@rules_pkg//:pkg.bzl", "pkg_zip", "pkg_tar")
+load("@rules_pkg//:pkg.bzl", "pkg_tar", "pkg_zip")
 load("@io_bazel_rules_docker//container:container.bzl", "container_bundle")
 load("@io_bazel_rules_docker//contrib:push-all.bzl", "container_push")
 
 # gazelle:prefix github.com/discordnova/nova
 gazelle(name = "gazelle")
 
+exports_files(["go.mod"])
+
 filegroup(
     name = "binaries",
     srcs = [
-        "//novactl",
-        "//webhook",
+        "//cache",
         "//gateway",
+        "//novactl",
         "//ratelimiter",
-        "//cache"
-    ]
+        "//webhook",
+    ],
 )
 
 container_bundle(
-  name = "container_images",
-
-  images = {
-    "$(docker_repo)/discordnova/nova/novactl:$(docker_tag)": "//novactl:image",
-    "$(docker_repo)/discordnova/nova/gateway:$(docker_tag)": "//gateway:image",
-    "$(docker_repo)/discordnova/nova/ratelimiter:$(docker_tag)": "//ratelimiter:image",
-    "$(docker_repo)/discordnova/nova/webhook:$(docker_tag)": "//webhook:image",
-    "$(docker_repo)/discordnova/nova/cache:$(docker_tag)": "//cache:image",
-  }
+    name = "container_images",
+    images = {
+        "ghcr.io/discordnova/nova/novactl:$(docker_tag)": "//novactl:image",
+        "ghcr.io/discordnova/nova/gateway:$(docker_tag)": "//gateway:image",
+        "ghcr.io/discordnova/nova/ratelimiter:$(docker_tag)": "//ratelimiter:image",
+        "ghcr.io/discordnova/nova/webhook:$(docker_tag)": "//webhook:image",
+        "ghcr.io/discordnova/nova/cache:$(docker_tag)": "//cache:image",
+    },
 )
 
 container_push(
-  name = "container_publish",
-  bundle = ":container_images",
-  format = "OCI"
+    name = "container_publish",
+    bundle = ":container_images",
+    format = "OCI",
 )
 
 test_suite(
     name = "tests",
     tests = [
+        "//gateway:tests",
         "//novactl:tests",
+        "//ratelimiter:tests",
         "//webhook:tests",
-        "//gateway:tests",
-        "//ratelimiter:tests"
     ],
 )
 
 pkg_tar(
     name = "packages_tar",
-    extension = "tar.gz",
     srcs = [
-        ":binaries"
+        ":binaries",
     ],
+    extension = "tar.gz",
 )
 
 pkg_zip(
     name = "packages_zip",
     srcs = [
-        ":binaries"
+        ":binaries",
     ],
 )
 
 filegroup(
     name = "packages",
     srcs = [
-        ":packages_zip",
         ":packages_tar",
+        ":packages_zip",
     ],
-)
\ No newline at end of file
+)
index be45e29a36601b9055bdec0a3faec841257c0e22..6a943ea16698a16993299d70b6c27344625bf70a 100644 (file)
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,14 +3,13 @@ workspace(name = "nova")
 #@unused
 load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
 
-
 http_archive(
     name = "com_google_protobuf",
-    sha256 = "d0f5f605d0d656007ce6c8b5a82df3037e1d8fe8b121ed42e536f569dec16113",
-    strip_prefix = "protobuf-3.14.0",
+    sha256 = "14e8042b5da37652c92ef6a2759e7d2979d295f60afd7767825e3de68c856c54",
+    strip_prefix = "protobuf-3.18.0",
     urls = [
-        "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz",
-        "https://github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz",
+        "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.18.0.tar.gz",
+        "https://github.com/protocolbuffers/protobuf/archive/v3.18.0.tar.gz",
     ],
 )
 
@@ -35,10 +34,9 @@ http_archive(
 
 http_archive(
     name = "io_bazel_rules_go",
-    sha256 = "8e968b5fcea1d2d64071872b12737bbb5514524ee5f0a4f54f5920266c261acb",
+    sha256 = "e26c54a224f705feee511b24a0c0a11eb8e7ecbbae1fa2a1b7ba3e50a0820c36",
     urls = [
-        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip",
-        "https://github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip",
+        "https://github.com/csstaub/gopackagesdriver-repro/blob/main/external/rules_go-70b8365a.tar.gz?raw=true",
     ],
 )
 
index dac72c2556bfbd338afabd19d738920010c7aaa9..f5516f9e2e966cd891d93eff12b02cc3a7ea0058 100644 (file)
@@ -1,2 +1,3 @@
 load("//bazel:docker.bzl", "images")
-images()
\ No newline at end of file
+
+images()
index cc5dbd078a2a228b1425fc112f948a736bf9fba4..53b85bdf5d8540064e0f02f009c1d064f11f2436 100644 (file)
@@ -103,6 +103,12 @@ def go_dependencies():
         sum = "h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=",
         version = "v0.1.0",
     )
+    go_repository(
+        name = "com_github_buraksezer_consistent",
+        importpath = "github.com/buraksezer/consistent",
+        sum = "h1:Zfs6bX62wbP3QlbPGKUhqDw7SmNkOzY5bHZIYXYpR5g=",
+        version = "v0.9.0",
+    )
     go_repository(
         name = "com_github_burntsushi_toml",
         importpath = "github.com/BurntSushi/toml",
@@ -1318,8 +1324,8 @@ def go_dependencies():
     go_repository(
         name = "org_golang_google_protobuf",
         importpath = "google.golang.org/protobuf",
-        sum = "h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=",
-        version = "v1.27.1",
+        sum = "h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=",
+        version = "v1.26.0",
     )
     go_repository(
         name = "org_golang_x_crypto",
index 62c984384a4aaffd0490f5c71e55b89f27a70dcd..b5616beb04b55673d1498641c43397fcc24657e7 100644 (file)
@@ -17,11 +17,10 @@ def load_golang_toolchains():
     go_dependencies()
     gazelle_dependencies()
 
-    # Fixes a bug with the protobuf generation
     go_repository(
         name = "org_golang_google_grpc",
         build_file_proto_mode = "disable",
         importpath = "google.golang.org/grpc",
-        sum = "h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg=",
-        version = "v1.26.0",
-    )
+        sum = "h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E=",
+        version = "v1.41.0",
+    )
\ No newline at end of file
index 8bef599d0332b146080f238097ad09fdfe5a9235..a46a9954df4f9b86660fb85c688f75f1078ef57e 100644 (file)
@@ -1 +1 @@
-exports_files(["libsodium_sys_build_script_script_.rs"])
\ No newline at end of file
+exports_files(["libsodium_sys_build_script_script_.rs"])
index 3b11f74d4c707d68b4431fa69c44a654c8d36559..bfe042b5b0edfe27b6eca31dc5f5e4c46b567bfa 100644 (file)
@@ -7,18 +7,18 @@ test_suite(name = "tests")
 rust_binary(
     name = "cache",
     srcs = glob(["src/**"]),
-    deps = all_crate_deps() + ["//common/rust:common"],
     visibility = ["//visibility:public"],
+    deps = all_crate_deps() + ["//common/rust:common"],
 )
 
 rust_test(
     name = "cache_test",
-    crate = ":webhook"
+    crate = ":cache",
 )
 
 rust_image(
     name = "image",
+    base = "//bazel:base",
     binary = ":cache",
     visibility = ["//visibility:public"],
-    base = "//bazel:base",
 )
diff --git a/cache/cargo/BUILD.bazel b/cache/cargo/BUILD.bazel
deleted file mode 100644 (file)
index 1543954..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-"""
-@generated
-cargo-raze generated Bazel file.
-
-DO NOT EDIT! Replaced on runs of cargo-raze
-"""
-
-package(default_visibility = ["//visibility:public"])
-
-licenses([
-    "notice",  # See individual crates for specific licenses
-])
-
-# Aliased targets
-alias(
-    name = "log",
-    actual = "@raze__log__0_4_14//:log",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "nats",
-    actual = "@raze__nats__0_15_2//:nats",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "redis",
-    actual = "@raze__redis__0_21_2//:redis",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "serde",
-    actual = "@raze__serde__1_0_130//:serde",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "serde_json",
-    actual = "@raze__serde_json__1_0_67//:serde_json",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
index d424afe11fcaa97b079cb659df797dff968a9357..a8d06e1bdb34b0b7b08966640b581dab43e24cfb 100644 (file)
@@ -1,16 +1,27 @@
 load("@io_bazel_rules_go//go:def.bzl", "go_library")
+load("//bazel/lib:expand_template.bzl", "expand_template")
+
+expand_template(
+    name = "version_template",
+    out = "version.go",
+    substitutions = {
+        "$VERSION": "0.0.10",
+    },
+    template = "version.go.in",
+)
 
 go_library(
     name = "common",
     srcs = [
         "logger.go",
         "prometheus.go",
+        "version.go",
     ],
     importpath = "github.com/discordnova/nova/common",
     visibility = ["//visibility:public"],
     deps = [
-        "@com_github_prometheus_client_golang//prometheus/promhttp",
-        "@com_github_rs_zerolog//:zerolog",
-        "@com_github_rs_zerolog//log",
+        "@com_github_prometheus_client_golang//prometheus/promhttp:go_default_library",
+        "@com_github_rs_zerolog//:go_default_library",
+        "@com_github_rs_zerolog//log:go_default_library",
     ],
 )
diff --git a/common/cargo/BUILD.bazel b/common/cargo/BUILD.bazel
deleted file mode 100644 (file)
index 35f9c72..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-"""
-@generated
-cargo-raze generated Bazel file.
-
-DO NOT EDIT! Replaced on runs of cargo-raze
-"""
-
-package(default_visibility = ["//visibility:public"])
-
-licenses([
-    "notice",  # See individual crates for specific licenses
-])
-
-# Aliased targets
-alias(
-    name = "config",
-    actual = "@raze__config__0_11_0//:config",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "log",
-    actual = "@raze__log__0_4_14//:log",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "pretty_env_logger",
-    actual = "@raze__pretty_env_logger__0_4_0//:pretty_env_logger",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "serde",
-    actual = "@raze__serde__1_0_130//:serde",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
diff --git a/common/rust/cargo/BUILD.bazel b/common/rust/cargo/BUILD.bazel
deleted file mode 100644 (file)
index f92a2e9..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-"""
-@generated
-cargo-raze generated Bazel file.
-
-DO NOT EDIT! Replaced on runs of cargo-raze
-"""
-
-package(default_visibility = ["//visibility:public"])
-
-licenses([
-    "notice",  # See individual crates for specific licenses
-])
-
-# Aliased targets
-alias(
-    name = "config",
-    actual = "@raze__config__0_11_0//:config",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "hyper",
-    actual = "@raze__hyper__0_14_12//:hyper",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "log",
-    actual = "@raze__log__0_4_14//:log",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "nats",
-    actual = "@raze__nats__0_15_2//:nats",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "pretty_env_logger",
-    actual = "@raze__pretty_env_logger__0_4_0//:pretty_env_logger",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "prometheus",
-    actual = "@raze__prometheus__0_12_0//:prometheus",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "serde",
-    actual = "@raze__serde__1_0_130//:serde",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "tokio",
-    actual = "@raze__tokio__1_11_0//:tokio",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
index b602940b24168b741f694d8d7cb016c11ea857e9..be1607ae40dcfa2bfd85b062ffc3fcd761e45b36 100644 (file)
@@ -7,6 +7,6 @@ pub struct NovaError {
 
 impl fmt::Display for NovaError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "An error occured wihind the nova system: {}", self.message) // user-facing output
+        write!(f, "An error occurred within the nova system: {}", self.message) // user-facing output
     }
 }
index 790c5b02b82b29694a97818e85a5c7dce93522f4..3fe92e0e31f0aacdbb5cc527ebea3e27022c33e9 100644 (file)
@@ -3,8 +3,8 @@ services:
   nats:
       image: 'nats'
       expose:
-        - "4222"
+        - "4222:422"
       ports:
         - "8222:8222"
         - "4222:4222"
-      hostname: nats-server
\ No newline at end of file
+      hostname: nats-server
index 542b496903217193a2ac26a396577030ec2752cb..d65c913b3251893c6dc6287fc8ed52c499662b25 100644 (file)
@@ -7,14 +7,17 @@ test_suite(name = "tests")
 rust_binary(
     name = "gateway",
     srcs = glob(["src/**/*.rs"]),
-    proc_macro_deps = crate_deps(["serde_repr", "num-derive"]),
-    deps = all_crate_deps() + ["//common/rust:common"],
+    proc_macro_deps = crate_deps([
+        "serde_repr",
+        "num-derive",
+    ]),
     visibility = ["//visibility:public"],
+    deps = all_crate_deps() + ["//common/rust:common"],
 )
 
 rust_image(
     name = "image",
+    base = "//bazel:base",
     binary = ":gateway",
     visibility = ["//visibility:public"],
-    base = "//bazel:base",
 )
diff --git a/gateway/cargo/BUILD.bazel b/gateway/cargo/BUILD.bazel
deleted file mode 100644 (file)
index e85683f..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-"""
-@generated
-cargo-raze generated Bazel file.
-
-DO NOT EDIT! Replaced on runs of cargo-raze
-"""
-
-package(default_visibility = ["//visibility:public"])
-
-licenses([
-    "notice",  # See individual crates for specific licenses
-])
-
-# Aliased targets
-alias(
-    name = "enumflags2",
-    actual = "@raze__enumflags2__0_7_1//:enumflags2",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "futures",
-    actual = "@raze__futures__0_3_17//:futures",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "futures_util",
-    actual = "@raze__futures_util__0_3_17//:futures_util",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "log",
-    actual = "@raze__log__0_4_14//:log",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "num",
-    actual = "@raze__num__0_4_0//:num",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "num_derive",
-    actual = "@raze__num_derive__0_3_3//:num_derive",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "num_traits",
-    actual = "@raze__num_traits__0_2_14//:num_traits",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "serde",
-    actual = "@raze__serde__1_0_130//:serde",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "serde_json",
-    actual = "@raze__serde_json__1_0_67//:serde_json",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "serde_repr",
-    actual = "@raze__serde_repr__0_1_7//:serde_repr",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "tokio",
-    actual = "@raze__tokio__1_11_0//:tokio",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "tokio_tungstenite",
-    actual = "@raze__tokio_tungstenite__0_15_0//:tokio_tungstenite",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "url",
-    actual = "@raze__url__2_2_2//:url",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
index 603caabcf1723c2f90623bdb8972967fdd830c70..eb3a245d92bf843b22cbec2f166ade4d87d01cf2 100644 (file)
@@ -16,9 +16,7 @@ impl From<tokio_tungstenite::tungstenite::Error> for GatewayError {
 impl From<String> for GatewayError {
     fn from(e: String) -> Self {
         GatewayError {
-            0: NovaError {
-                message: e,
-            },
+            0: NovaError { message: e },
         }
     }
 }
index be5f2376bec33e1da043f53a6702aafd3e21e8f5..9eca9c5f04a98a17cb00d91a17d9da60b141de69 100644 (file)
@@ -1,5 +1,3 @@
-use futures::io::Read;
-use log::info;
 use serde::{Deserialize, Deserializer, Serialize};
 
 use serde_json::Value;
index 6ec228500c190958c280bcedd6cdc2950e9401e4..fe77e7cfcc4c1a5d892ce2cbc8d20ec6d46e2939 100644 (file)
@@ -36,7 +36,7 @@ impl<'de> serde::Deserialize<'de> for Message {
                     let sequence = value.get("s").unwrap().as_u64();
 
                     // we need to find a better solution than clone
-                    match serde_json::from_value(value) {
+                    match Dispatch::deserialize(value) {
                         Ok(data) => {
                             Ok(Message::Dispatch(BaseMessage {
                                 op,
index a0fa98aac719b047483fe7d46a90f3849cf163ba..f31a89b3a088895574bd909655db2bf989e62870 100644 (file)
@@ -185,7 +185,9 @@ impl Shard {
                     session_id: ready.session_id.clone(),
                 });
             }
-            Dispatch::Other(data) => {            }
+            Dispatch::Other(_data) => {
+                // todo: build dispatch & forward to nats
+            }
         }
     }
 }
diff --git a/go.mod b/go.mod
index 758aa03678f41fba73accc9756996d91be2e56a2..b687c90ca668a7453baf12c674e80bcfd6248b8c 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -10,5 +10,5 @@ require (
        github.com/rs/zerolog v1.23.0
        github.com/spf13/cobra v0.0.3
        golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
-       google.golang.org/protobuf v1.27.1 // indirect
+       google.golang.org/grpc v1.26.0 // indirect
 )
diff --git a/go.sum b/go.sum
index fa8777dfe8a331bbd97f806be28efd1c477c94a8..b0290cd578cf7b56aca8b664a3ed07df9b81c07d 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -31,6 +31,7 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2c
 github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
 github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
 github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
+github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
 github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
 github.com/apache/thrift v0.13.0 h1:5hryIiq9gtn+MiLVn0wP37kb/uTeRZgN08WoCsAhIhI=
 github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
@@ -68,6 +69,9 @@ github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec h1:EdRZT3IeKQmfCSrgo
 github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE=
 github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=
 github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
+github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
+github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
 github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa h1:OaNxuTZr7kxeODyLWsRMC+OD03aFUH+mW6r2d+MWa5Y=
 github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
 github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w=
@@ -103,8 +107,12 @@ github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaB
 github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
 github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
 github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
+github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
 github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473 h1:4cmBvAEBNJaGARUEs3/suWRyfyBfhf7I60WBZq+bv2w=
 github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
+github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
+github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
 github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=
 github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
 github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
@@ -160,11 +168,13 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb
 github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
 github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
 github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
 github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
 github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
 github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
+github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
 github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
 github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
 github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
@@ -179,6 +189,7 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a
 github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
 github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
@@ -187,6 +198,7 @@ github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA
 github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
 github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA=
 github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
 github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
 github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8=
@@ -202,6 +214,7 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92Bcuy
 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
 github.com/grpc-ecosystem/grpc-gateway v1.9.5 h1:UImYN5qQ8tuGpGE16ZmjvcTtTw24zw1QAp/SlnNrZhI=
 github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
+github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
 github.com/hashicorp/consul/api v1.3.0 h1:HXNYlRkkM/t+Y/Yhxtwcy02dlYwIaoxzvxPnS+cqy78=
 github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
 github.com/hashicorp/consul/sdk v0.3.0 h1:UOxjlb4xVNF93jak1mzzoBatyFju9nrkxpVwIp/QqxQ=
@@ -423,6 +436,7 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhD
 github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
 github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af h1:gu+uRPtBe88sKxUCEXRoeCvVG90TJmwhiqRpvdhQFng=
 github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
+github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
 github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk=
 github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
 github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc=
@@ -469,6 +483,7 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
 github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
 github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
 github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8 h1:ndzgwNDnKIqyCvHTXaCqh9KlOWKvBry6nuXMJmonVsE=
@@ -490,6 +505,7 @@ go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
 go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
 go.opencensus.io v0.22.2 h1:75k/FF0Q2YM8QYo07VPddOLBslDt1MZOdEslOHvmzAs=
 go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
+go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
 go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
 go.uber.org/atomic v1.5.0 h1:OI5t8sDa1Or+q8AeE+yKeB/SDYioSHAgcVljj9JIETY=
 go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
@@ -541,6 +557,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL
 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
+golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
 golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
 golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
 golang.org/x/net v0.0.0-20210326060303-6b1517762897 h1:KrsHThm5nFk34YtATK1LsThyGhGbGe1olrte/HInHvs=
@@ -548,6 +565,7 @@ golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5o
 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421 h1:Wo7BWFiOk0QRFMLYMqJGFMd9CgUAcGx7V+qEg/h5IBI=
 golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
 golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -629,6 +647,9 @@ google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRn
 google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s=
 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
+google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=
+google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
 google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
 google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
 google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
@@ -637,18 +658,26 @@ google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ij
 google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
 google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
 google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
 google.golang.org/grpc v1.26.0 h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg=
 google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
+google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
+google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E=
+google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=
 google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
 google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
 google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
 google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
 google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
+google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
 google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
-google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
-google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
 gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
 gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
@@ -674,6 +703,7 @@ gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRN
 gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
 gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
diff --git a/manager/BUILD.bazel b/manager/BUILD.bazel
deleted file mode 100644 (file)
index 6588d89..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
-
-go_library(
-    name = "manager_lib",
-    srcs = ["main.go"],
-    importpath = "github.com/discordnova/nova/manager",
-    visibility = ["//visibility:private"],
-)
-
-go_binary(
-    name = "manager",
-    embed = [":manager_lib"],
-    visibility = ["//visibility:public"],
-)
diff --git a/manager/main.go b/manager/main.go
deleted file mode 100644 (file)
index 0507461..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-package main
-
-import "fmt"
-
-func main() {
-       fmt.Println("Hi! I am the nova manager :)")
-}
\ No newline at end of file
index 5c5a33c867211f9195f7196e3c69d14ce01e7688..9519b4ff62b80c730b38a27c400046db3c42d483 100644 (file)
@@ -10,7 +10,9 @@ go_library(
     visibility = ["//visibility:private"],
     deps = [
         "//novactl/cmd",
-        "@com_github_spf13_cobra//:cobra",
+        "@com_github_rs_zerolog//:go_default_library",
+        "@com_github_rs_zerolog//log:go_default_library",
+        "@com_github_spf13_cobra//:go_default_library",
     ],
 )
 
index eb6837b70e3f952945e60572bcd55ed9e018fc89..2c5412950a82cef0a5d90a9c48a2079438f84ebf 100644 (file)
@@ -3,15 +3,21 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
 go_library(
     name = "cmd",
     srcs = [
+        "cluster.go",
         "init.go",
         "version.go",
     ],
     importpath = "github.com/discordnova/nova/novactl/cmd",
     visibility = ["//visibility:public"],
     deps = [
+        "//common",
+        "//common/management",
         "//novactl/lib",
-        "@com_github_go_git_go_git_v5//:go-git",
-        "@com_github_spf13_cobra//:cobra",
-        "@com_github_twinproduction_go_color//:go-color",
+        "@com_github_go_git_go_git_v5//:go_default_library",
+        "@com_github_go_git_go_git_v5//config:go_default_library",
+        "@com_github_olekukonko_tablewriter//:go_default_library",
+        "@com_github_rs_zerolog//log:go_default_library",
+        "@com_github_spf13_cobra//:go_default_library",
+        "@com_github_twinproduction_go_color//:go_default_library",
     ],
 )
index 47a5559599b2c802df6ea002a46b9ef20dd96ad4..084c2daa0ce9f948b216699ca63f5ba86fcf57f0 100644 (file)
-package cmd\r
-\r
-import (\r
-       "fmt"\r
-       "io/fs"\r
-       "io/ioutil"\r
-       "os"\r
-       "path/filepath"\r
-       "strings"\r
-\r
-       "github.com/TwinProduction/go-color"\r
-       "github.com/go-git/go-git/v5"\r
-       "github.com/spf13/cobra"\r
-)\r
-\r
-var (\r
-       InitializeCommand = &cobra.Command{\r
-               Use:   "init",\r
-               Short: "Initialize a new nova based project",\r
-               Run:   initNovaRepo,\r
-       }\r
-)\r
-\r
-func initNovaRepo(cmd *cobra.Command, args []string) {\r
-       url := "https://github.com/libgit2/git2go.git"\r
-       path := ""\r
-       name := "test"\r
-\r
-       if name == "" {\r
-               fmt.Print(\r
-                       color.Ize(color.Red, "A name must be specified"),\r
-               )\r
-               return\r
-       }\r
-\r
-       if path == "" {\r
-               path = fmt.Sprintf("./%s", name)\r
-       }\r
-       cw, err := os.Getwd()\r
-       if err != nil {\r
-               return\r
-       }\r
-       path = filepath.Join(cw, path)\r
-\r
-       fmt.Println(\r
-               color.Ize(color.Green, fmt.Sprintf("Initializing a new nova project at %s", path)),\r
-       )\r
-       fmt.Println(\r
-               color.Ize(color.Gray, fmt.Sprintf("Using the %s template", url)),\r
-       )\r
-\r
-       // clone the repo\r
-       _, err = git.PlainClone(path, false, &git.CloneOptions{\r
-               URL:      url,\r
-               Progress: os.Stdout,\r
-       })\r
-\r
-       if err != nil {\r
-               fmt.Println(\r
-                       color.Ize(color.Red, fmt.Sprintf("Failed to initialize the repository: %s", err.Error())),\r
-               )\r
-               return\r
-       }\r
-\r
-       fmt.Println(\r
-               color.Ize(color.Green, "Cloned the repository..."),\r
-       )\r
-\r
-       filepath.WalkDir(path, func(path string, d fs.DirEntry, err error) error {\r
-               if d.IsDir() || err != nil {\r
-                       return nil\r
-               }\r
-\r
-               read, err := ioutil.ReadFile(path)\r
-               if err != nil {\r
-\r
-               }\r
-               content := strings.ReplaceAll(string(read), "%PROJECT%", name)\r
-\r
-               err = ioutil.WriteFile(path, []byte(content), 0)\r
-\r
-               if err != nil {\r
-                       return err\r
-               }\r
-               return nil\r
-       })\r
-\r
-       err = os.RemoveAll(filepath.Join(path, ".git"))\r
-}\r
+package cmd
+
+import (
+       "fmt"
+       "github.com/go-git/go-git/v5/config"
+       "github.com/rs/zerolog/log"
+       "io/fs"
+       "io/ioutil"
+       "os"
+       "path/filepath"
+       "strings"
+
+       "github.com/go-git/go-git/v5"
+       "github.com/spf13/cobra"
+)
+
+var (
+       InitializeCommand         = createInitCommand()
+       Flavour           *string = nil
+       Name              *string = nil
+)
+
+func createInitCommand() *cobra.Command {
+       command := cobra.Command{
+               Use:   "init [path]",
+               Short: "Initialize a new nova based project",
+               Run:   initNovaRepo,
+       }
+
+       Flavour = command.Flags().String("flavour", "javascript", "the flavour of template to use")
+       Name = command.Flags().String("name", "", "the name of the project")
+
+       return &command
+}
+
+func determineTemplate() string {
+       if strings.HasPrefix(*Flavour, "http") || strings.HasPrefix(*Flavour, "ssh") {
+               return *Flavour
+       } else {
+               return fmt.Sprintf("https://github.com/discordnova/template-%s.git", *Flavour)
+       }
+}
+
+func initNovaRepo(cmd *cobra.Command, args []string) {
+
+       url := determineTemplate()
+       if len(args) == 0 {
+               log.Error().Msg("A path must be specified")
+               os.Exit(1)
+       }
+
+       path := strings.Join(args, " ")
+       name := path
+
+       // if the user specified a name different from the folder name
+       if *Name != "" {
+               name = *Name
+       }
+
+       cw, err := os.Getwd()
+       if err != nil {
+               return
+       }
+       // we get the absolute path of the folder
+       path = filepath.Join(cw, path)
+       log.Info().Msgf("Initializing a %s at %s using template %s", name, path, url)
+
+       // clone the repo
+       _, err = git.PlainClone(path, false, &git.CloneOptions{
+               URL: url,
+       })
+
+       if err != nil {
+               log.Err(err).Msg("Failed to initialize the repository")
+               os.Exit(1)
+       }
+
+       log.Info().Msg("Successfully cloned the template")
+
+       // replace all the instances of "%PROJECT%" with the project name
+       err = filepath.WalkDir(path, func(path string, d fs.DirEntry, err error) error {
+               if d.IsDir() || err != nil {
+                       return nil
+               }
+
+               read, err := ioutil.ReadFile(path)
+               if err != nil {
+
+               }
+               content := strings.ReplaceAll(string(read), "%PROJECT%", name)
+
+               err = ioutil.WriteFile(path, []byte(content), 0)
+
+               if err != nil {
+                       return err
+               }
+               return nil
+       })
+
+       if err != nil {
+               log.Err(err).Msgf("Failed to bootstrap the project")
+               // we try to remove the folder
+               _ = os.Remove(path)
+               os.Exit(1)
+       }
+       // we remove the git folder
+       err = os.RemoveAll(filepath.Join(path, ".git"))
+
+       repo, err := git.PlainInit(path, false)
+       if err != nil {
+               log.Err(err).Msgf("Failed to initialize the git repository")
+               os.Exit(1)
+       }
+
+       err = repo.CreateBranch(&config.Branch{
+               Name: "main",
+       })
+       if err != nil {
+               log.Err(err).Msgf("Failed to create the main branch")
+               os.Exit(1)
+       }
+
+       tree, err := repo.Worktree()
+       if err != nil {
+               log.Err(err).Msgf("Failed to get worktree")
+               os.Exit(1)
+       }
+       _, err = tree.Add(".")
+       if err != nil {
+               log.Err(err).Msgf("Failed to index the files")
+               os.Exit(1)
+       }
+       _, err = tree.Commit("first commit", &git.CommitOptions{})
+       if err != nil {
+               log.Err(err).Msgf("Failed to index the first commit")
+               os.Exit(1)
+       }
+
+       log.Info().Msgf("Created a new repository at %", path)
+}
index cea4f1b403fe60db9778c33791226d6f034b90e1..425cd89fc529e7268908c214589017d50f94120d 100644 (file)
@@ -1,20 +1,20 @@
-package cmd\r
-\r
-import (\r
-       "fmt"\r
-\r
-       "github.com/discordnova/nova/novactl/lib"\r
-       "github.com/spf13/cobra"\r
-)\r
-\r
-var (\r
-       VersionCommand = &cobra.Command{\r
-               Use:   "version",\r
-               Short: "Returns the version of the CLI",\r
-               Run:   version,\r
-       }\r
-)\r
-\r
-func version(cmd *cobra.Command, args []string) {\r
-       fmt.Println(fmt.Sprintf("Nova version: %s", lib.VERSION))\r
-}\r
+package cmd
+
+import (
+       "fmt"
+
+       "github.com/discordnova/nova/common"
+       "github.com/spf13/cobra"
+)
+
+var (
+       VersionCommand = &cobra.Command{
+               Use:   "version",
+               Short: "Returns the version of the CLI",
+               Run:   version,
+       }
+)
+
+func version(cmd *cobra.Command, args []string) {
+       fmt.Println(fmt.Sprintf("Nova version: %s", common.VERSION))
+}
index 1dd62b77fd9099b4c64411a304f30be8db8dfaa1..55da5079ff69e8eb138508b8045d09f7f7d21d5b 100644 (file)
@@ -1,14 +1,12 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
 
 go_library(
     name = "lib",
-    srcs = ["vesion.go"],
+    srcs = ["conn.go"],
     importpath = "github.com/discordnova/nova/novactl/lib",
     visibility = ["//visibility:public"],
-)
-
-go_test(
-    name = "lib_test",
-    srcs = ["version_test.go"],
-    deps = [":lib"],
+    deps = [
+        "//common/management",
+        "@org_golang_google_grpc//:go_default_library",
+    ],
 )
diff --git a/novactl/lib/version_test.go b/novactl/lib/version_test.go
deleted file mode 100644 (file)
index 665780f..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-package lib_test\r
-\r
-import (\r
-       "testing"\r
-\r
-       "github.com/discordnova/nova/novactl/lib"\r
-)\r
-\r
-func TestVersion(t *testing.T) {\r
-       if lib.VERSION != "0.0.1" {\r
-               t.Fatalf("Version number do not match %s", lib.VERSION)\r
-       }\r
-}\r
diff --git a/novactl/lib/vesion.go b/novactl/lib/vesion.go
deleted file mode 100644 (file)
index 2d18ea9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package lib\r
-\r
-const (\r
-       VERSION = "0.0.1"\r
-)\r
index 7261b68612efdc364b51d0c5beefdabba80d777e..0939961cd368be44251352ac29911cd9da7f70f5 100644 (file)
@@ -1,13 +1,23 @@
-package main\r
-\r
-import (\r
-       "github.com/discordnova/nova/novactl/cmd"\r
-       "github.com/spf13/cobra"\r
-)\r
-\r
-func main() {\r
-       rootCommand := &cobra.Command{Use: "app"}\r
-       rootCommand.AddCommand(cmd.VersionCommand)\r
-       rootCommand.AddCommand(cmd.InitializeCommand)\r
-       rootCommand.Execute()\r
-}\r
+package main
+
+import (
+       "github.com/discordnova/nova/novactl/cmd"
+       "github.com/rs/zerolog"
+       "github.com/rs/zerolog/log"
+       "github.com/spf13/cobra"
+       "os"
+)
+
+func main() {
+       log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
+
+       rootCommand := &cobra.Command{
+               Use: "novactl",
+               Short: "A tool to interact with a nova cluster",
+               TraverseChildren: true,
+       }
+       rootCommand.AddCommand(cmd.VersionCommand)
+       rootCommand.AddCommand(cmd.InitializeCommand)
+       rootCommand.AddCommand(cmd.ClusterCommand)
+       _ = rootCommand.Execute()
+}
index 4a122e152967386876c9a36adb4615042de01bb3..9e0e823b9e29743affb105fd111e40ef08c0bd9e 100644 (file)
@@ -23,14 +23,14 @@ cargo_build_script(
 rust_binary(
     name = "ratelimiter",
     srcs = ["src/main.rs"],
-    deps = all_crate_deps() + [":build_script"],
     visibility = ["//visibility:public"],
+    deps = all_crate_deps() + [":build_script"],
 )
 
 rust_image(
     name = "image",
     srcs = ["src/main.rs"],
-    deps = all_crate_deps() + [":build_script"],
-    visibility = ["//visibility:public"],
     base = "//bazel:base",
-)
\ No newline at end of file
+    visibility = ["//visibility:public"],
+    deps = all_crate_deps() + [":build_script"],
+)
diff --git a/ratelimiter/cargo/BUILD.bazel b/ratelimiter/cargo/BUILD.bazel
deleted file mode 100644 (file)
index ab46977..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-"""
-@generated
-cargo-raze generated Bazel file.
-
-DO NOT EDIT! Replaced on runs of cargo-raze
-"""
-
-package(default_visibility = ["//visibility:public"])
-
-licenses([
-    "notice",  # See individual crates for specific licenses
-])
-
-# Aliased targets
-alias(
-    name = "prost",
-    actual = "@raze__prost__0_8_0//:prost",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "tokio",
-    actual = "@raze__tokio__1_11_0//:tokio",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "tonic",
-    actual = "@raze__tonic__0_5_2//:tonic",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "tonic_build",
-    actual = "@raze__tonic_build__0_5_2//:tonic_build",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
index 247554e803fcd9f259640142117537f3e128aa24..ffb258d534f66138e3f599c587b60e63f0a8086f 100644 (file)
@@ -1 +1,26 @@
+load("@rules_proto//proto:defs.bzl", "proto_library")
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+
 exports_files(["nova.ratelimit.v1.proto"])
+
+proto_library(
+    name = "nova_ratelimit_v1_proto",
+    srcs = ["nova.ratelimit.v1.proto"],
+    visibility = ["//visibility:public"],
+)
+
+go_proto_library(
+    name = "nova_ratelimit_v1_go_proto",
+    compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+    importpath = "github.com/discordnova/nova/ratelimiter/proto",
+    proto = ":nova_ratelimit_v1_proto",
+    visibility = ["//visibility:public"],
+)
+
+go_library(
+    name = "proto",
+    embed = [":nova_ratelimit_v1_go_proto"],
+    importpath = "github.com/discordnova/nova/ratelimiter/proto",
+    visibility = ["//visibility:public"],
+)
index f29da5f4f552c32389d789240f0757a1b237d754..4340909fd956084695d68d75712d5b375cfc94af 100644 (file)
@@ -7,18 +7,18 @@ test_suite(name = "tests")
 rust_binary(
     name = "webhook",
     srcs = glob(["src/**"]),
-    deps = all_crate_deps() + ["//common/rust:common"],
     visibility = ["//visibility:public"],
+    deps = all_crate_deps() + ["//common/rust:common"],
 )
 
 rust_test(
     name = "webhook_test",
-    crate = ":webhook"
+    crate = ":webhook",
 )
 
 rust_image(
     name = "image",
+    base = "//bazel:base",
     binary = ":webhook",
     visibility = ["//visibility:public"],
-    base = "//bazel:base",
 )
diff --git a/webhook/cargo/BUILD.bazel b/webhook/cargo/BUILD.bazel
deleted file mode 100644 (file)
index e035ab6..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-"""
-@generated
-cargo-raze generated Bazel file.
-
-DO NOT EDIT! Replaced on runs of cargo-raze
-"""
-
-package(default_visibility = ["//visibility:public"])
-
-licenses([
-    "notice",  # See individual crates for specific licenses
-])
-
-# Aliased targets
-alias(
-    name = "config",
-    actual = "@raze__config__0_11_0//:config",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "hex",
-    actual = "@raze__hex__0_4_3//:hex",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "hyper",
-    actual = "@raze__hyper__0_14_12//:hyper",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "libsodium_sys",
-    actual = "@raze__libsodium_sys__0_2_7//:libsodium_sys",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "log",
-    actual = "@raze__log__0_4_14//:log",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "nats",
-    actual = "@raze__nats__0_15_2//:nats",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "serde",
-    actual = "@raze__serde__1_0_130//:serde",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "serde_json",
-    actual = "@raze__serde_json__1_0_67//:serde_json",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)
-
-alias(
-    name = "tokio",
-    actual = "@raze__tokio__1_11_0//:tokio",
-    tags = [
-        "cargo-raze",
-        "manual",
-    ],
-)