Compare commits

..
15 Commits
56 changed files with 1144 additions and 1823 deletions

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
run:
tests: false
linters:
enable-all: true
disable:
- goimports
- depguard # не используется
- gochecknoinits
- gochecknoglobals
- wsl
- gocognit
- godox # находит тудушки, не нужно
- golint # подумать, может вернуть
- stylecheck # подумать, может вернуть
linters-settings:
maligned:
suggest-new: true
lll:
line-length: 140
tab-width: 1
funlen:
lines: 80
statements: 40
prealloc:
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
# True by default.
simple: true
range-loops: true # Report preallocation suggestions on range loops, true by default
for-loops: true # Report preallocation suggestions on for loops, false by default
gocritic:
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
enabled-tags:
- diagnostic
- performance
disabled-checks:
- hugeParam # в данном проекте не нужен
+1 -1
View File
@@ -1 +1 @@
2.0.3
2.2.0
+18
View File
@@ -1,3 +1,21 @@
### v2.2.0
* migrate to go modules
* add linter, refactor
### v2.1.3
* improved logging
### v2.1.2
* leader ws client ConnectionReadLimit is now configured by WS.WsConnectionReadLimitKB config param and defaults to 4 MB
### v2.1.1
* update to new endpoint descriptor struct with extra fields introduced in isp-lib v2.1.0
### v2.1.0
* fix panic type casting in shapshot
* create empty default config now
* add method `/module/get_by_name` to fetch module object by name
### v2.0.3
* fix data race when applyCommandOnLeader in websocket handler
* update dependencies
Generated
-783
View File
@@ -1,783 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
digest = "1:d5e752c67b445baa5b6cb6f8aa706775c2aa8e41aca95a0c651520ff2c80361a"
name = "github.com/Microsoft/go-winio"
packages = [
".",
"pkg/guid",
]
pruneopts = "UT"
revision = "6c72808b55902eae4c5943626030429ff20f3b63"
version = "v0.4.14"
[[projects]]
branch = "master"
digest = "1:7a9140c806333a78122763d08ec6c0d7358c7fff1df8cfbb01881c5dc46e24e5"
name = "github.com/armon/go-metrics"
packages = ["."]
pruneopts = "UT"
revision = "ec5e00d3c878b2a97bbe0884ef45ffd1b4f669f5"
[[projects]]
digest = "1:320e7ead93de9fd2b0e59b50fd92a4d50c1f8ab455d96bc2eb083267453a9709"
name = "github.com/asaskevich/govalidator"
packages = ["."]
pruneopts = "UT"
revision = "ccb8e960c48f04d6935e72476ae4a51028f9e22f"
version = "v9"
[[projects]]
digest = "1:0f98f59e9a2f4070d66f0c9c39561f68fcd1dc837b22a852d28d0003aebd1b1e"
name = "github.com/boltdb/bolt"
packages = ["."]
pruneopts = "UT"
revision = "2f1ce7a837dcb8da3ec595b1dac9d0632f0f99e8"
version = "v1.3.1"
[[projects]]
digest = "1:652880afc6b57ce0a67173f552cb35ccda816493a1da6ca20e5074a66bcd083f"
name = "github.com/buaazp/fasthttprouter"
packages = ["."]
pruneopts = "UT"
revision = "ade4e2031af3aed7fffd241084aad80a58faf421"
version = "v0.1.1"
[[projects]]
digest = "1:c1100fc71e23b6a32b2c68a5202a848fd13811d5a10b12edb8019c3667d1cd9a"
name = "github.com/cenkalti/backoff"
packages = ["."]
pruneopts = "UT"
revision = "4b4cebaf850ec58f1bb1fec5bdebdf8501c2bc3f"
version = "v3.0.0"
[[projects]]
digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
name = "github.com/davecgh/go-spew"
packages = ["spew"]
pruneopts = "UT"
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
version = "v1.1.1"
[[projects]]
digest = "1:4ddc17aeaa82cb18c5f0a25d7c253a10682f518f4b2558a82869506eec223d76"
name = "github.com/docker/distribution"
packages = [
"digestset",
"reference",
]
pruneopts = "UT"
revision = "2461543d988979529609e8cb6fca9ca190dc48da"
version = "v2.7.1"
[[projects]]
digest = "1:c4c7064c2c67a0a00815918bae489dd62cd88d859d24c95115d69b00b3d33334"
name = "github.com/docker/docker"
packages = [
"api/types",
"api/types/blkiodev",
"api/types/container",
"api/types/events",
"api/types/filters",
"api/types/mount",
"api/types/network",
"api/types/reference",
"api/types/registry",
"api/types/strslice",
"api/types/swarm",
"api/types/time",
"api/types/versions",
"api/types/volume",
"client",
"pkg/tlsconfig",
]
pruneopts = "UT"
revision = "092cba3727bb9b4a2f0e922cd6c0f93ea270e363"
version = "v1.13.1"
[[projects]]
digest = "1:811c86996b1ca46729bad2724d4499014c4b9effd05ef8c71b852aad90deb0ce"
name = "github.com/docker/go-connections"
packages = [
"nat",
"sockets",
"tlsconfig",
]
pruneopts = "UT"
revision = "7395e3f8aa162843a74ed6d48e79627d9792ac55"
version = "v0.4.0"
[[projects]]
digest = "1:e95ef557dc3120984bb66b385ae01b4bb8ff56bcde28e7b0d1beed0cccc4d69f"
name = "github.com/docker/go-units"
packages = ["."]
pruneopts = "UT"
revision = "519db1ee28dcc9fd2474ae59fca29a810482bfb1"
version = "v0.4.0"
[[projects]]
digest = "1:abeb38ade3f32a92943e5be54f55ed6d6e3b6602761d74b4aab4c9dd45c18abd"
name = "github.com/fsnotify/fsnotify"
packages = ["."]
pruneopts = "UT"
revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
version = "v1.4.7"
[[projects]]
digest = "1:f9448bfab8ebe44e3d91e4e4475cf92d60789a614652f361df4e41972c9d5caf"
name = "github.com/go-pg/pg"
packages = [
".",
"internal",
"internal/iszero",
"internal/parser",
"internal/pool",
"internal/struct_filter",
"internal/tag",
"orm",
"types",
]
pruneopts = "UT"
revision = "1d957cb20f319c4a1e2db7d345824c12aefe5943"
version = "v8.0.6"
[[projects]]
digest = "1:07f4fafe81587b642166199f41c3edcca12929fcfcc0261b00be5dea2f968f44"
name = "github.com/golang/protobuf"
packages = [
"proto",
"ptypes",
"ptypes/any",
"ptypes/duration",
"ptypes/struct",
"ptypes/timestamp",
]
pruneopts = "UT"
revision = "6c65a5562fc06764971b7c5d05c76c75e84bdbf7"
version = "v1.3.2"
[[projects]]
digest = "1:0ade334594e69404d80d9d323445d2297ff8161637f9b2d347cc6973d2d6f05b"
name = "github.com/hashicorp/errwrap"
packages = ["."]
pruneopts = "UT"
revision = "8a6fb523712970c966eefc6b39ed2c5e74880354"
version = "v1.0.0"
[[projects]]
digest = "1:cf6b61e1b4c26b0c7526cee4a0cee6d8302b17798af4b2a56a90eedac0aef11a"
name = "github.com/hashicorp/go-hclog"
packages = ["."]
pruneopts = "UT"
revision = "5ccdce08c75b6c7b37af61159f13f6a4f5e2e928"
version = "v0.9.2"
[[projects]]
digest = "1:6e9806a06d00f4d1f90806d7b5cfb11e35dca76503390ca6e704b05ea7051bff"
name = "github.com/hashicorp/go-immutable-radix"
packages = ["."]
pruneopts = "UT"
revision = "7dd1121b595e4e1bd6dd5caa78e0f5c454740379"
version = "v1.1.0"
[[projects]]
digest = "1:5d8539af558ca2ea960a4c11afb12c75ae9e9dca3560f1103318aaa2030e37e2"
name = "github.com/hashicorp/go-msgpack"
packages = ["codec"]
pruneopts = "UT"
revision = "ad60660ecf9c5a1eae0ca32182ed72bab5807961"
version = "v0.5.5"
[[projects]]
digest = "1:f668349b83f7d779567c880550534addeca7ebadfdcf44b0b9c39be61864b4b7"
name = "github.com/hashicorp/go-multierror"
packages = ["."]
pruneopts = "UT"
revision = "886a7fbe3eb1c874d46f623bfa70af45f425b3d1"
version = "v1.0.0"
[[projects]]
digest = "1:7fae9ec96d10b2afce0da23c378c8b3389319b7f92fa092f2621bba3078cfb4b"
name = "github.com/hashicorp/golang-lru"
packages = ["simplelru"]
pruneopts = "UT"
revision = "7f827b33c0f158ec5dfbba01bb0b14a4541fd81d"
version = "v0.5.3"
[[projects]]
digest = "1:c0d19ab64b32ce9fe5cf4ddceba78d5bc9807f0016db6b1183599da3dcc24d10"
name = "github.com/hashicorp/hcl"
packages = [
".",
"hcl/ast",
"hcl/parser",
"hcl/printer",
"hcl/scanner",
"hcl/strconv",
"hcl/token",
"json/parser",
"json/scanner",
"json/token",
]
pruneopts = "UT"
revision = "8cb6e5b959231cc1119e43259c4a608f9c51a241"
version = "v1.0.0"
[[projects]]
branch = "master"
digest = "1:f932a7af1d85151d9a33c8a8917390ddf155e531f4d48e3257604507445dc4e1"
name = "github.com/hashicorp/raft"
packages = ["."]
pruneopts = "UT"
revision = "a989b09b3c0112332ac6110625f0f06538ca0083"
[[projects]]
branch = "master"
digest = "1:8bc6831553a265c699a973640ea48eee53d3878af9013208d20a0c8807fa66ec"
name = "github.com/hashicorp/raft-boltdb"
packages = ["."]
pruneopts = "UT"
revision = "4207f1bf061751378aee6cdfe697965a13ab49d7"
[[projects]]
branch = "master"
digest = "1:2cf4ff28b309c93a52b3329c7a22d5375b137249d4ed63c9d40707a1b253f7df"
name = "github.com/integration-system/bellows"
packages = ["."]
pruneopts = "UT"
revision = "244325e8836c364c86f308e3aef7e979cb007114"
[[projects]]
branch = "master"
digest = "1:c4f3970d1f30f5e9bc1751b62b7ea6127256e59fd63a3d36e166fe1121250c57"
name = "github.com/integration-system/go-cmp"
packages = [
"cmp",
"cmp/internal/diff",
"cmp/internal/function",
"cmp/internal/value",
]
pruneopts = "UT"
revision = "ac5582987a2f25e8743e0ebb7259312adda05c23"
[[projects]]
digest = "1:af0185228b5f1c08939721c26a61787c65d6d4cdd6ce5078d0bb86cb1d7a907a"
name = "github.com/integration-system/isp-etp-go"
packages = [
".",
"ack",
"bpool",
"client",
"gen",
"parser",
]
pruneopts = "UT"
revision = "aab01a1b29ac06ebeb0216b9b43708491b8d5aee"
version = "v2.0.2"
[[projects]]
digest = "1:d30832edf4ae7a45e863e216c89bb5f1d66c10ff5b3255b9e007598a048594d7"
name = "github.com/integration-system/isp-lib"
packages = [
"atomic",
"backend",
"bootstrap",
"config",
"config/schema",
"database",
"metric",
"proto/stubs",
"streaming",
"structure",
"utils",
]
pruneopts = "UT"
revision = "abfa9a9776d64e6d04d495bfe00db8ca4dcbe7fc"
version = "v2.0.1"
[[projects]]
digest = "1:1562269205ab0c6685c8b0b99511e91b9d3627e4cac3f0288378bc8930e658f1"
name = "github.com/integration-system/isp-lib-test"
packages = [
"ctx",
"docker",
"utils",
"utils/postgres",
]
pruneopts = "UT"
revision = "6da4f1fed4b0df648a9b1c4bd4098fdd405695e1"
version = "v1.4.1"
[[projects]]
branch = "master"
digest = "1:1789fb6e57949a6e4cacb74023cd30efb04b09dc6111d6ef3718241ebb23ebe9"
name = "github.com/integration-system/isp-log"
packages = [
".",
"stdcodes",
]
pruneopts = "UT"
revision = "a22bf2e0b56a9ef47db4a98756e39f700a99b688"
[[projects]]
branch = "master"
digest = "1:48f3a739fabefebf152d0196277ee89136c1fa6d88fc67fa486fc765a05b1caa"
name = "github.com/integration-system/jsonschema"
packages = ["."]
pruneopts = "UT"
revision = "5475a8b08e62e41fa886641861ac225e7f91e4e5"
[[projects]]
digest = "1:01ed62f8f4f574d8aff1d88caee113700a2b44c42351943fa73cc1808f736a50"
name = "github.com/jinzhu/inflection"
packages = ["."]
pruneopts = "UT"
revision = "f5c5f50e6090ae76a29240b61ae2a90dd810112e"
version = "v1.0.0"
[[projects]]
digest = "1:d78015a9da26d37166a2119592019e8bfe9b24bec60aff4a46db6110070fb1b2"
name = "github.com/json-iterator/go"
packages = [
".",
"extra",
]
pruneopts = "UT"
revision = "03217c3e97663914aec3faafde50d081f197a0a2"
version = "1.1.8"
[[projects]]
digest = "1:acfc228fb5fbfb82645c121e3224bd546ed68aef6dfc87f63e2d8de099a3822b"
name = "github.com/klauspost/compress"
packages = [
"flate",
"gzip",
"zlib",
]
pruneopts = "UT"
revision = "a41f1a10bd3b167958ff6df80b800fe2969dd3ca"
version = "v1.9.0"
[[projects]]
digest = "1:31e761d97c76151dde79e9d28964a812c46efc5baee4085b86f68f0c654450de"
name = "github.com/konsorten/go-windows-terminal-sequences"
packages = ["."]
pruneopts = "UT"
revision = "f55edac94c9bbba5d6182a4be46d86a2c9b5b50e"
version = "v1.0.2"
[[projects]]
digest = "1:12cb143f2148bf54bcd9fe622abac17325e85eeb1d84b8ec6caf1c80232108fd"
name = "github.com/lib/pq"
packages = [
".",
"oid",
"scram",
]
pruneopts = "UT"
revision = "3427c32cb71afc948325f299f040e53c1dd78979"
version = "v1.2.0"
[[projects]]
digest = "1:5a0ef768465592efca0412f7e838cdc0826712f8447e70e6ccc52eb441e9ab13"
name = "github.com/magiconair/properties"
packages = ["."]
pruneopts = "UT"
revision = "de8848e004dd33dc07a2947b3d76f618a7fc7ef1"
version = "v1.8.1"
[[projects]]
digest = "1:53bc4cd4914cd7cd52139990d5170d6dc99067ae31c56530621b18b35fc30318"
name = "github.com/mitchellh/mapstructure"
packages = ["."]
pruneopts = "UT"
revision = "3536a929edddb9a5b34bd6861dc4a9647cb459fe"
version = "v1.1.2"
[[projects]]
digest = "1:33422d238f147d247752996a26574ac48dcf472976eda7f5134015f06bf16563"
name = "github.com/modern-go/concurrent"
packages = ["."]
pruneopts = "UT"
revision = "bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94"
version = "1.0.3"
[[projects]]
digest = "1:e32bdbdb7c377a07a9a46378290059822efdce5c8d96fe71940d87cb4f918855"
name = "github.com/modern-go/reflect2"
packages = ["."]
pruneopts = "UT"
revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd"
version = "1.0.1"
[[projects]]
branch = "master"
digest = "1:84bd7f8a2e0bcd53ddc33c3b47c34c1fe340c8632cbe928f7f8ae10ec6ecdd62"
name = "github.com/mohae/deepcopy"
packages = ["."]
pruneopts = "UT"
revision = "c48cc78d482608239f6c4c92a4abd87eb8761c90"
[[projects]]
digest = "1:ee4d4af67d93cc7644157882329023ce9a7bcfce956a079069a9405521c7cc8d"
name = "github.com/opencontainers/go-digest"
packages = ["."]
pruneopts = "UT"
revision = "279bed98673dd5bef374d3b6e4b09e2af76183bf"
version = "v1.0.0-rc1"
[[projects]]
digest = "1:bbd3997f0121200f72b64d7a3826eb8a0b910d6a4c19894c9fe2852b9e5eaf3b"
name = "github.com/pelletier/go-toml"
packages = ["."]
pruneopts = "UT"
revision = "8fe62057ea2d46ce44254c98e84e810044dbe197"
version = "v1.5.0"
[[projects]]
digest = "1:cf31692c14422fa27c83a05292eb5cbe0fb2775972e8f1f8446a71549bd8980b"
name = "github.com/pkg/errors"
packages = ["."]
pruneopts = "UT"
revision = "ba968bfe8b2f7e042a574c888954fccecfa385b4"
version = "v0.8.1"
[[projects]]
digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
name = "github.com/pmezard/go-difflib"
packages = ["difflib"]
pruneopts = "UT"
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
version = "v1.0.0"
[[projects]]
digest = "1:7d99649602f68b73ade640ca6975ccc38735f329e159c6a507b63f00213678c0"
name = "github.com/pressly/goose"
packages = ["."]
pruneopts = "UT"
revision = "e4b98955473e91a12fc7d8816c28d06376d1d92c"
version = "v2.6.0"
[[projects]]
branch = "master"
digest = "1:5bbebe8ac19ecb6c87790a89faa20566e38ed0d6494a1d14c4f5b05d9ce2436c"
name = "github.com/rcrowley/go-metrics"
packages = ["."]
pruneopts = "UT"
revision = "cac0b30c2563378d434b5af411844adff8e32960"
[[projects]]
digest = "1:274f67cb6fed9588ea2521ecdac05a6d62a8c51c074c1fccc6a49a40ba80e925"
name = "github.com/satori/go.uuid"
packages = ["."]
pruneopts = "UT"
revision = "f58768cc1a7a7e77a3bd49e98cdd21419399b6a3"
version = "v1.2.0"
[[projects]]
digest = "1:04457f9f6f3ffc5fea48e71d62f2ca256637dee0a04d710288e27e05c8b41976"
name = "github.com/sirupsen/logrus"
packages = ["."]
pruneopts = "UT"
revision = "839c75faf7f98a33d445d181f3018b5c3409a45e"
version = "v1.4.2"
[[projects]]
digest = "1:bb495ec276ab82d3dd08504bbc0594a65de8c3b22c6f2aaa92d05b73fbf3a82e"
name = "github.com/spf13/afero"
packages = [
".",
"mem",
]
pruneopts = "UT"
revision = "588a75ec4f32903aa5e39a2619ba6a4631e28424"
version = "v1.2.2"
[[projects]]
digest = "1:08d65904057412fc0270fc4812a1c90c594186819243160dc779a402d4b6d0bc"
name = "github.com/spf13/cast"
packages = ["."]
pruneopts = "UT"
revision = "8c9545af88b134710ab1cd196795e7f2388358d7"
version = "v1.3.0"
[[projects]]
digest = "1:1b753ec16506f5864d26a28b43703c58831255059644351bbcb019b843950900"
name = "github.com/spf13/jwalterweatherman"
packages = ["."]
pruneopts = "UT"
revision = "94f6ae3ed3bceceafa716478c5fbf8d29ca601a1"
version = "v1.1.0"
[[projects]]
digest = "1:524b71991fc7d9246cc7dc2d9e0886ccb97648091c63e30eef619e6862c955dd"
name = "github.com/spf13/pflag"
packages = ["."]
pruneopts = "UT"
revision = "2e9d26c8c37aae03e3f9d4e90b7116f5accb7cab"
version = "v1.0.5"
[[projects]]
digest = "1:0b60fc944fb6a7b6c985832bd341bdb7ed8fe894fea330414e7774bb24652962"
name = "github.com/spf13/viper"
packages = ["."]
pruneopts = "UT"
revision = "72b022eb357a56469725dcd03918449e2278d02e"
version = "v1.5.0"
[[projects]]
digest = "1:8548c309c65a85933a625be5e7d52b6ac927ca30c56869fae58123b8a77a75e1"
name = "github.com/stretchr/testify"
packages = ["assert"]
pruneopts = "UT"
revision = "221dbe5ed46703ee255b1da0dec05086f5035f62"
version = "v1.4.0"
[[projects]]
digest = "1:f4b32291cad5efac2bfdba89ccde6aa04618b62ce06c1a571da2dc4f3f2677fb"
name = "github.com/subosito/gotenv"
packages = ["."]
pruneopts = "UT"
revision = "2ef7124db659d49edac6aa459693a15ae36c671a"
version = "v1.2.0"
[[projects]]
branch = "master"
digest = "1:d32b64a7a82dd36b674fb73ff767e949eb7155b6b574ff276f49d4edc8af105f"
name = "github.com/thecodeteam/goodbye"
packages = ["."]
pruneopts = "UT"
revision = "a83968bda2d37294a3541b7d2207fb6f5a3559a3"
[[projects]]
digest = "1:c468422f334a6b46a19448ad59aaffdfc0a36b08fdcc1c749a0b29b6453d7e59"
name = "github.com/valyala/bytebufferpool"
packages = ["."]
pruneopts = "UT"
revision = "e746df99fe4a3986f4d4f79e13c1e0117ce9c2f7"
version = "v1.0.0"
[[projects]]
branch = "master"
digest = "1:77f7e2f75e4c44ede24f47aca6c514f24f06c6a0ee3c47c8d7ce2b77b49ac482"
name = "github.com/valyala/fasthttp"
packages = [
".",
"fasthttputil",
"stackless",
]
pruneopts = "UT"
revision = "9bc6da12192c610a272a9289b9574eb5d8cfdfe1"
[[projects]]
branch = "master"
digest = "1:87fe9bca786484cef53d52adeec7d1c52bc2bfbee75734eddeb75fc5c7023871"
name = "github.com/xeipuuv/gojsonpointer"
packages = ["."]
pruneopts = "UT"
revision = "02993c407bfbf5f6dae44c4f4b1cf6a39b5fc5bb"
[[projects]]
branch = "master"
digest = "1:dc6a6c28ca45d38cfce9f7cb61681ee38c5b99ec1425339bfc1e1a7ba769c807"
name = "github.com/xeipuuv/gojsonreference"
packages = ["."]
pruneopts = "UT"
revision = "bd5ef7bd5415a7ac448318e64f11a24cd21e594b"
[[projects]]
digest = "1:a8a0ed98532819a3b0dc5cf3264a14e30aba5284b793ba2850d6f381ada5f987"
name = "github.com/xeipuuv/gojsonschema"
packages = ["."]
pruneopts = "UT"
revision = "82fcdeb203eb6ab2a67d0a623d9c19e5e5a64927"
version = "v1.2.0"
[[projects]]
branch = "master"
digest = "1:f92f6956e4059f6a3efc14924d2dd58ba90da25cc57fe07ae3779ef2f5e0c5f2"
name = "golang.org/x/crypto"
packages = ["pbkdf2"]
pruneopts = "UT"
revision = "87dc89f01550277dc22b74ffcf4cd89fa2f40f4c"
[[projects]]
branch = "master"
digest = "1:60dc5bc60f5ec42121f8b90de6f86bd1f708b6422114a02012395d43e377e757"
name = "golang.org/x/net"
packages = [
"context",
"context/ctxhttp",
"http/httpguts",
"http2",
"http2/hpack",
"idna",
"internal/socks",
"internal/timeseries",
"proxy",
"trace",
]
pruneopts = "UT"
revision = "ec77196f6094c3492a8b61f2c11cf937f78992ae"
[[projects]]
branch = "master"
digest = "1:de0084adc1c0b8cf6fd192d7785b098b155ba355cbeec9ee361aea55b887ab9d"
name = "golang.org/x/sys"
packages = [
"unix",
"windows",
]
pruneopts = "UT"
revision = "53bf42e6b339f7ed00535fc6915737b3959eac89"
[[projects]]
digest = "1:8d8faad6b12a3a4c819a3f9618cb6ee1fa1cfc33253abeeea8b55336721e3405"
name = "golang.org/x/text"
packages = [
"collate",
"collate/build",
"internal/colltab",
"internal/gen",
"internal/language",
"internal/language/compact",
"internal/tag",
"internal/triegen",
"internal/ucd",
"language",
"secure/bidirule",
"transform",
"unicode/bidi",
"unicode/cldr",
"unicode/norm",
"unicode/rangetable",
]
pruneopts = "UT"
revision = "342b2e1fbaa52c93f31447ad2c6abc048c63e475"
version = "v0.3.2"
[[projects]]
branch = "master"
digest = "1:a910255c3b706b4d8f2b185ed6b40c8f31b805111be240def2bdf2c62b87591b"
name = "google.golang.org/genproto"
packages = [
"googleapis/rpc/errdetails",
"googleapis/rpc/status",
]
pruneopts = "UT"
revision = "548a555dbc03994223efbaba0090152849259498"
[[projects]]
digest = "1:6cd77d0b616d2dcebd363dfecba593f27b0151fc82cdb5fbfb96c5a7cfbc95b5"
name = "google.golang.org/grpc"
packages = [
".",
"balancer",
"balancer/base",
"balancer/roundrobin",
"binarylog/grpc_binarylog_v1",
"codes",
"connectivity",
"credentials",
"credentials/internal",
"encoding",
"encoding/proto",
"grpclog",
"internal",
"internal/backoff",
"internal/balancerload",
"internal/binarylog",
"internal/channelz",
"internal/envconfig",
"internal/grpcrand",
"internal/grpcsync",
"internal/syscall",
"internal/transport",
"keepalive",
"metadata",
"naming",
"peer",
"resolver",
"resolver/dns",
"resolver/passthrough",
"serviceconfig",
"stats",
"status",
"tap",
]
pruneopts = "UT"
revision = "f6d0f9ee430895e87ef1ceb5ac8f39725bafceef"
version = "v1.24.0"
[[projects]]
digest = "1:59f10c1537d2199d9115d946927fe31165959a95190849c82ff11e05803528b0"
name = "gopkg.in/yaml.v2"
packages = ["."]
pruneopts = "UT"
revision = "f221b8435cfb71e54062f6c6e99e9ade30b124d5"
version = "v2.2.4"
[[projects]]
digest = "1:999d566ad1ae4303c456af5a155f7b42401cca4fd33552567ed9dd997b107a08"
name = "mellium.im/sasl"
packages = ["."]
pruneopts = "UT"
revision = "e58e780e1378aa4df5dc705364ff5ae9a4dd1e04"
source = "https://github.com/mellium/sasl.git"
version = "v0.2.1"
[[projects]]
digest = "1:25ea8c84118bb09a6ea1fe5d8a2e72d7ead40af714b74d1e849af821f3502414"
name = "nhooyr.io/websocket"
packages = [
".",
"internal/bpool",
"internal/wsjs",
]
pruneopts = "UT"
revision = "edda9c633d5c78c7d38fcc952b4105dd4ccfb619"
version = "v1.7.4"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
input-imports = [
"github.com/asaskevich/govalidator",
"github.com/cenkalti/backoff",
"github.com/go-pg/pg",
"github.com/hashicorp/go-hclog",
"github.com/hashicorp/raft",
"github.com/hashicorp/raft-boltdb",
"github.com/integration-system/bellows",
"github.com/integration-system/isp-etp-go",
"github.com/integration-system/isp-etp-go/client",
"github.com/integration-system/isp-lib-test/ctx",
"github.com/integration-system/isp-lib-test/docker",
"github.com/integration-system/isp-lib-test/utils",
"github.com/integration-system/isp-lib-test/utils/postgres",
"github.com/integration-system/isp-lib/atomic",
"github.com/integration-system/isp-lib/backend",
"github.com/integration-system/isp-lib/bootstrap",
"github.com/integration-system/isp-lib/config",
"github.com/integration-system/isp-lib/config/schema",
"github.com/integration-system/isp-lib/database",
"github.com/integration-system/isp-lib/structure",
"github.com/integration-system/isp-lib/utils",
"github.com/integration-system/isp-log",
"github.com/integration-system/isp-log/stdcodes",
"github.com/json-iterator/go",
"github.com/mohae/deepcopy",
"github.com/pkg/errors",
"github.com/satori/go.uuid",
"github.com/sirupsen/logrus",
"github.com/spf13/cast",
"github.com/stretchr/testify/assert",
"github.com/thecodeteam/goodbye",
"github.com/xeipuuv/gojsonschema",
"google.golang.org/grpc",
"google.golang.org/grpc/codes",
"google.golang.org/grpc/status",
]
solver-name = "gps-cdcl"
solver-version = 1
-41
View File
@@ -1,41 +0,0 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true
[prune]
go-tests = true
unused-packages = true
[[override]]
name = "mellium.im/sasl"
source = "https://github.com/mellium/sasl.git"
[[override]]
name = "github.com/valyala/fasthttp"
branch = "master"
[[override]]
name = "github.com/hashicorp/raft"
branch = "master"
+42 -27
View File
@@ -2,16 +2,17 @@ package cluster
import (
"errors"
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/utils"
"sync"
"time"
"github.com/integration-system/isp-lib/v2/structure"
"github.com/integration-system/isp-lib/v2/utils"
log "github.com/integration-system/isp-log"
jsoniter "github.com/json-iterator/go"
"isp-config-service/codes"
"isp-config-service/entity"
"isp-config-service/raft"
"isp-config-service/store/state"
"sync"
"time"
)
var (
@@ -105,6 +106,12 @@ func (client *Client) SyncApplyOnLeader(command []byte) (*ApplyLogResponse, erro
func (client *Client) listenLeader() {
for n := range client.r.LeaderCh() {
client.leaderMu.Lock()
log.WithMetadata(map[string]interface{}{
"leader_elected": n.LeaderElected,
"current_leader": n.CurrentLeaderAddress,
"is_leader": n.IsLeader,
}).Info(codes.LeaderStateChanged, "leader state changed")
if client.leaderClient != nil {
log.Debugf(0, "close previous leader ws connection %s", client.leaderState.leaderAddr)
client.leaderClient.Close()
@@ -120,29 +127,10 @@ func (client *Client) listenLeader() {
}
client.leaderClient = leaderClient
go func(declaration structure.BackendDeclaration) {
response, err := leaderClient.SendDeclaration(declaration, defaultApplyTimeout)
if err != nil {
log.Warnf(codes.SendDeclarationToLeaderError, "send declaration to leader. err: %v", err)
} else if response != utils.WsOkResponse {
log.Warnf(codes.SendDeclarationToLeaderError, "send declaration to leader. response: %s", response)
}
}(client.declaration)
log.Info(codes.SendDeclarationToLeader, "sending declaration to leader through websocket")
go client.declareMyselfToLeader(leaderClient)
} else if n.LeaderElected && n.IsLeader {
go func(declaration structure.BackendDeclaration) {
now := state.GenerateDate()
module := entity.Module{
Id: state.GenerateId(),
Name: declaration.ModuleName,
CreatedAt: now,
LastConnectedAt: now,
}
command := PrepareModuleConnectedCommand(module)
syncApplyCommand(client, command, "ModuleConnectedCommand")
declarationCommand := PrepareUpdateBackendDeclarationCommand(declaration)
syncApplyCommand(client, declarationCommand, "UpdateBackendDeclarationCommand")
}(client.declaration)
go client.declareMyselfToCluster()
}
client.leaderState = leaderState{
leaderElected: n.LeaderElected,
@@ -153,6 +141,30 @@ func (client *Client) listenLeader() {
client.leaderMu.Unlock()
}
}
func (client *Client) declareMyselfToLeader(leaderClient *SocketLeaderClient) {
response, err := leaderClient.SendDeclaration(client.declaration, defaultApplyTimeout)
if err != nil {
log.Warnf(codes.SendDeclarationToLeader, "send declaration to leader. err: %v", err)
} else if response != utils.WsOkResponse {
log.Warnf(codes.SendDeclarationToLeader, "send declaration to leader. response: %s", response)
}
}
// used when a leader need to declare himself to a cluster
func (client *Client) declareMyselfToCluster() {
now := state.GenerateDate()
module := entity.Module{
Id: state.GenerateId(),
Name: client.declaration.ModuleName,
CreatedAt: now,
LastConnectedAt: now,
}
command := PrepareModuleConnectedCommand(module)
syncApplyCommand(client, command, "ModuleConnectedCommand")
declarationCommand := PrepareUpdateBackendDeclarationCommand(client.declaration)
syncApplyCommand(client, declarationCommand, "UpdateBackendDeclarationCommand")
}
type leaderState struct {
leaderElected bool
@@ -175,7 +187,10 @@ func NewRaftClusterClient(r *raft.Raft, declaration structure.BackendDeclaration
func syncApplyCommand(clusterClient *Client, command []byte, commandName string) {
applyLogResponse, err := clusterClient.SyncApply(command)
if err != nil {
log.Warnf(codes.SyncApplyError, "announce myself. apply %s: %v", commandName, err)
log.WithMetadata(map[string]interface{}{
"command": string(command),
"commandName": commandName,
}).Warnf(codes.SyncApplyError, "announce myself. apply command: %v", err)
}
if applyLogResponse != nil && applyLogResponse.ApplyError != "" {
log.WithMetadata(map[string]interface{}{
+6 -4
View File
@@ -3,15 +3,17 @@ package cluster
import (
"bytes"
"encoding/binary"
"github.com/integration-system/isp-lib/structure"
"time"
"github.com/integration-system/isp-lib/v2/structure"
log "github.com/integration-system/isp-log"
"isp-config-service/codes"
"isp-config-service/entity"
"time"
)
const (
ApplyCommandEvent = "CONFIG_CLUSTER:APPLY_COMMAND"
CommandSizeBytes = 8
ClusterParam = "cluster"
)
@@ -54,8 +56,8 @@ func PrepareDeleteModulesCommand(ids []string) []byte {
return prepareCommand(DeleteModulesCommand, DeleteModules{Ids: ids})
}
func PrepareActivateConfigCommand(configId string, date time.Time) []byte {
return prepareCommand(ActivateConfigCommand, ActivateConfig{ConfigId: configId, Date: date})
func PrepareActivateConfigCommand(configID string, date time.Time) []byte {
return prepareCommand(ActivateConfigCommand, ActivateConfig{ConfigId: configID, Date: date})
}
func PrepareDeleteConfigsCommand(ids []string) []byte {
+22 -13
View File
@@ -3,18 +3,24 @@ package cluster
import (
"context"
"fmt"
"github.com/cenkalti/backoff"
etp "github.com/integration-system/isp-etp-go/client"
"github.com/integration-system/isp-lib/config"
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/utils"
log "github.com/integration-system/isp-log"
"isp-config-service/codes"
"isp-config-service/conf"
"net"
"net/http"
"net/url"
"time"
"github.com/cenkalti/backoff/v4"
etp "github.com/integration-system/isp-etp-go/v2/client"
"github.com/integration-system/isp-lib/v2/config"
"github.com/integration-system/isp-lib/v2/structure"
"github.com/integration-system/isp-lib/v2/utils"
log "github.com/integration-system/isp-log"
"isp-config-service/codes"
"isp-config-service/conf"
)
var (
// Set from config in main
WsConnectionReadLimit int64
)
type SocketLeaderClient struct {
@@ -63,12 +69,13 @@ func (c *SocketLeaderClient) Close() {
func NewSocketLeaderClient(address string, leaderDisconnectionCallback func()) *SocketLeaderClient {
etpConfig := etp.Config{
HttpClient: http.DefaultClient,
HttpClient: http.DefaultClient,
ConnectionReadLimit: WsConnectionReadLimit,
}
client := etp.NewClient(etpConfig)
leaderClient := &SocketLeaderClient{
client: client,
url: getUrl(address),
url: getURL(address),
}
ctx, cancel := context.WithCancel(context.Background())
leaderClient.globalCtx = ctx
@@ -77,7 +84,7 @@ func NewSocketLeaderClient(address string, leaderDisconnectionCallback func()) *
leaderClient.client.OnDisconnect(func(err error) {
log.WithMetadata(map[string]interface{}{
"leaderAddr": address,
}).Warn(codes.LeaderClientDisconnected, "leader client disconnected")
}).Warn(codes.LeaderClientDisconnected, "disconnected ws from leader")
leaderDisconnectionCallback()
})
@@ -85,12 +92,14 @@ func NewSocketLeaderClient(address string, leaderDisconnectionCallback func()) *
log.Warnf(codes.LeaderClientConnectionError, "leader client on error: %v", err)
})
leaderClient.client.OnConnect(func() {
log.Debug(0, "leader client connected")
log.WithMetadata(map[string]interface{}{
"leaderAddr": address,
}).Info(codes.LeaderClientConnected, "connected to new leader")
})
return leaderClient
}
func getUrl(address string) string {
func getURL(address string) string {
addr, err := net.ResolveTCPAddr("tcp", address)
if err != nil {
panic(err) // must never occurred
+6 -3
View File
@@ -25,9 +25,12 @@ const (
SyncApplyError = 1015
// Raft Cluster
SendDeclarationToLeaderError = 1016
LeaderClientConnectionError = 1017
LeaderClientDisconnected = 1018
SendDeclarationToLeader = 1016
LeaderClientConnectionError = 1017
LeaderClientDisconnected = 1018
LeaderClientConnected = 1023
LeaderStateChanged = 1024
LeaderManualDeleteLeader = 1025
// Services
DiscoveryServiceSendModulesError = 1019
+3 -2
View File
@@ -1,7 +1,8 @@
//nolint lll
package conf
import (
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/v2/structure"
)
type Configuration struct {
@@ -15,8 +16,8 @@ type Configuration struct {
type ClusterConfiguration struct {
InMemory bool `schema:"Хранить логи и снэпшоты только в памяти"`
DataDir string `valid:"required~Required" schema:"Пусть до директории для логов и снэпшотов рафта"`
BootstrapCluster bool `schema:"Поднимать кластер и объявлять лидером"`
DataDir string `valid:"required~Required" schema:"Пусть до директории для логов и снэпшотов рафта"`
Peers []string `valid:"required~Required" schema:"Адреса всех нод в кластере,формат address:port"`
OuterAddress string `valid:"required~Required" schema:"Внешний адрес ноды"`
ConnectTimeoutSeconds int `valid:"required~Required" schema:"Таймаут подключения"`
+41 -25
View File
@@ -2,25 +2,27 @@ package main
import (
"bytes"
"errors"
"fmt"
"github.com/integration-system/isp-lib-test/ctx"
"github.com/integration-system/isp-lib-test/docker"
"github.com/integration-system/isp-lib-test/utils"
"github.com/integration-system/isp-lib-test/utils/postgres"
"github.com/integration-system/isp-lib/backend"
"github.com/integration-system/isp-lib/structure"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"io"
"io/ioutil"
"isp-config-service/conf"
"isp-config-service/domain"
"log"
"net"
"strconv"
"strings"
"testing"
"time"
"github.com/integration-system/isp-lib-test/ctx"
"github.com/integration-system/isp-lib-test/docker"
"github.com/integration-system/isp-lib-test/utils"
"github.com/integration-system/isp-lib-test/utils/postgres"
"github.com/integration-system/isp-lib/v2/backend"
"github.com/integration-system/isp-lib/v2/structure"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"isp-config-service/conf"
"isp-config-service/domain"
)
const (
@@ -30,6 +32,7 @@ const (
configsNumber = 3
maxAwaitingTime = 25 * time.Second
attemptTimeout = 300 * time.Millisecond
deleteCommonConfigsCommand = "config/common_config/delete_config"
getRoutesCommand = "config/routing/get_routes"
@@ -109,6 +112,7 @@ func setup(testCtx *ctx.TestContext, runTest func() int) int {
cfg.Images.Module, c, nil,
docker.WithName(c.GrpcOuterAddress.IP),
docker.WithLogger(NewWriteLogger(strconv.Itoa(i)+"_config:", ioutil.Discard, "DeleteCommonConfigsCommand")),
//docker.WithLogger(NewWriteLogger(strconv.Itoa(i)+"_config:", ioutil.Discard, "Apply 10 command")),
//docker.PullImage(cfg.Registry.Username, cfg.Registry.Password),
docker.WithEnv(peersAddrsEnv),
)
@@ -169,8 +173,8 @@ func TestClusterElection(t *testing.T) {
}
func getConfigServiceAddress(num int, port string) structure.AddressConfiguration {
lastIp := pgCfg.Address
ip := net.ParseIP(lastIp).To4()
lastIP := pgCfg.Address
ip := net.ParseIP(lastIP).To4()
ip[3] = byte(int(ip[3]) + num + 1)
return structure.AddressConfiguration{
//IP: fmt.Sprintf("%s-%d", "isp-config-service", num),
@@ -233,11 +237,11 @@ func testGrpcReady(configAddr structure.AddressConfiguration, a *assert.Assertio
)
//log.Println("connect to grpc err:", err)
return nil, err
}, maxAwaitingTime)
}, maxAwaitingTime, attemptTimeout)
if !a.NoError(err) {
return nil
}
log.Println("waiting until grpc ready:", time.Now().Sub(start).Round(time.Second))
log.Println("waiting until grpc ready:", time.Since(start).Round(time.Second))
return client
}
@@ -257,27 +261,39 @@ func testRaftReady(client *backend.InternalGrpcClient, a *assert.Assertions) boo
//log.Println("send grpc request. response: ", response, "err: ", err)
return nil, err
}
_, _ = await(f, maxAwaitingTime)
log.Println("waiting until raft ready:", time.Now().Sub(start).Round(time.Second))
_, _ = await(f, maxAwaitingTime, attemptTimeout)
log.Println("waiting until raft ready:", time.Since(start).Round(time.Second))
return a.NoError(err)
}
func getRoutes(client *backend.InternalGrpcClient, a *assert.Assertions) []structure.BackendDeclaration {
var response []structure.BackendDeclaration
err := client.Invoke(
getRoutesCommand,
-1,
nil,
&response,
)
//log.Println("routes:", response)
var err error
f := func() (interface{}, error) {
err = client.Invoke(
getRoutesCommand,
-1,
nil,
&response,
)
if err != nil {
return nil, err
} else if len(response) == 0 {
return nil, errors.New("zero routes")
}
//log.Println("routes:", response)
return nil, nil
}
_, _ = await(f, time.Second, 50*time.Millisecond)
a.NoError(err)
return response
}
func await(dialer func() (interface{}, error), timeout time.Duration) (interface{}, error) {
func await(dialer func() (interface{}, error), timeout, attemptTimeout time.Duration) (interface{}, error) {
retryer := utils.NewRetryer(dialer, timeout)
retryer.AttemptTimeout = 300 * time.Millisecond
retryer.AttemptTimeout = attemptTimeout
return retryer.Do()
}
+16 -10
View File
@@ -1,7 +1,7 @@
package controller
import (
"github.com/integration-system/isp-lib/utils"
"github.com/integration-system/isp-lib/v2/utils"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"isp-config-service/cluster"
@@ -29,17 +29,23 @@ type config struct {
// @Failure 500 {object} structure.GrpcError
// @Router /config/get_active_config_by_module_name [POST]
func (c *config) GetActiveConfigByModuleName(request domain.GetByModuleNameRequest) (*entity.Config, error) {
var response *entity.Config
var (
module *entity.Module
config *entity.Config
)
c.rstore.VisitReadonlyState(func(state state.ReadonlyState) {
module := state.Modules().GetByName(request.ModuleName)
module = state.Modules().GetByName(request.ModuleName)
if module != nil {
response = state.Configs().GetActiveByModuleId(module.Id)
config = state.Configs().GetActiveByModuleId(module.Id)
}
})
if response == nil {
return nil, status.Error(codes.NotFound, utils.ValidationError)
if module == nil {
return nil, status.Errorf(codes.NotFound, "module with name '%s' not found", request.ModuleName)
}
return response, nil
if config == nil {
return nil, status.Errorf(codes.NotFound, "active config for module '%s' not found", request.ModuleName)
}
return config, nil
}
// CreateUpdateConfig godoc
@@ -71,11 +77,11 @@ func (c *config) CreateUpdateConfig(config domain.CreateUpdateConfigRequest) (*d
err := PerformSyncApplyWithError(command, "UpsertConfigCommand", &response)
if err != nil {
return nil, err
} else if response.Config != nil {
return response.Config, nil
} else {
} else if response.ErrorDetails != nil {
return nil, utils.CreateValidationErrorDetails(codes.InvalidArgument, utils.ValidationError, response.ErrorDetails)
}
return response.Config, nil
}
// MarkConfigAsActive godoc
+1 -1
View File
@@ -1,7 +1,7 @@
package controller
import (
"github.com/integration-system/isp-lib/utils"
"github.com/integration-system/isp-lib/v2/utils"
log "github.com/integration-system/isp-log"
jsoniter "github.com/json-iterator/go"
"google.golang.org/grpc/codes"
+25 -1
View File
@@ -1,13 +1,15 @@
package controller
import (
"google.golang.org/grpc/status"
"isp-config-service/cluster"
"isp-config-service/domain"
"isp-config-service/entity"
"isp-config-service/service"
"isp-config-service/store"
"isp-config-service/store/state"
"github.com/integration-system/isp-lib/utils"
"github.com/integration-system/isp-lib/v2/utils"
"google.golang.org/grpc/codes"
)
@@ -61,6 +63,28 @@ func (*module) DeleteModules(identities []string) (*domain.DeleteResponse, error
return &deleteResponse, err
}
// GetModuleByName godoc
// @Summary Метод получения модуля по имени
// @Description Модуль
// @Tags Модули
// @Accept json
// @Produce json
// @Param body body domain.GetByModuleNameRequest true "название модуля"
// @Success 200 {object} entity.Module
// @Failure 500 {object} structure.GrpcError
// @Failure 404 {object} structure.GrpcError "модуль с указанным названием не найден"
// @Router /module/get_by_name [POST]
func (c *module) GetModuleByName(req domain.GetByModuleNameRequest) (*entity.Module, error) {
var module *entity.Module
c.rstore.VisitReadonlyState(func(readonlyState state.ReadonlyState) {
module = readonlyState.Modules().GetByName(req.ModuleName)
})
if module == nil {
return nil, status.Errorf(codes.NotFound, "module with name '%s' not found", req.ModuleName)
}
return module, nil
}
func NewModule(rstore *store.Store) *module {
return &module{
rstore: rstore,
+1 -1
View File
@@ -1,7 +1,7 @@
package controller
import (
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/v2/structure"
"isp-config-service/store"
"isp-config-service/store/state"
)
+79 -142
View File
@@ -2,7 +2,8 @@ basePath: /api/config
definitions:
domain.CommonConfigLinks:
additionalProperties:
items: {}
items:
type: string
type: array
type: object
domain.CompileConfigsRequest:
@@ -12,11 +13,11 @@ definitions:
type: string
type: array
data:
additionalProperties: true
type: object
type: object
domain.CompiledConfigResponse:
additionalProperties:
type: object
additionalProperties: true
type: object
domain.ConfigIdRequest:
properties:
@@ -63,7 +64,7 @@ definitions:
type: object
endpoints:
items:
$ref: '#/definitions/structure.EndpointConfig'
$ref: '#/definitions/structure.EndpointDescriptor'
type: array
establishedAt:
type: string
@@ -204,8 +205,7 @@ definitions:
- name
type: object
entity.ConfigData:
additionalProperties:
type: object
additionalProperties: true
type: object
entity.ConfigSchema:
properties:
@@ -223,8 +223,24 @@ definitions:
version:
type: string
type: object
entity.Module:
properties:
createdAt:
type: string
id:
type: string
lastConnectedAt:
type: string
lastDisconnectedAt:
type: string
name:
type: string
required:
- name
type: object
jsonschema.Definitions:
additionalProperties: {}
additionalProperties:
$ref: '#/definitions/jsonschema.Type'
type: object
jsonschema.Schema:
properties:
@@ -243,12 +259,12 @@ definitions:
allOf:
description: section 5.22
items:
$ref: '#/definitions/jsonschema.Type'
type: integer
type: array
anyOf:
description: section 5.23
items:
$ref: '#/definitions/jsonschema.Type'
type: integer
type: array
binaryEncoding:
description: section 4.3
@@ -260,6 +276,8 @@ definitions:
$ref: '#/definitions/jsonschema.Definitions'
type: object
dependencies:
additionalProperties:
$ref: '#/definitions/jsonschema.Type'
description: section 5.19
type: object
description:
@@ -318,15 +336,19 @@ definitions:
oneOf:
description: section 5.24
items:
$ref: '#/definitions/jsonschema.Type'
type: integer
type: array
pattern:
description: section 5.8
type: string
patternProperties:
additionalProperties:
$ref: '#/definitions/jsonschema.Type'
description: section 5.17
type: object
properties:
additionalProperties:
$ref: '#/definitions/jsonschema.Type'
description: section 5.16
type: object
required:
@@ -361,12 +383,12 @@ definitions:
allOf:
description: section 5.22
items:
$ref: '#/definitions/jsonschema.Type'
type: integer
type: array
anyOf:
description: section 5.23
items:
$ref: '#/definitions/jsonschema.Type'
type: integer
type: array
binaryEncoding:
description: section 4.3
@@ -379,6 +401,8 @@ definitions:
description: section 5.26
type: object
dependencies:
additionalProperties:
$ref: '#/definitions/jsonschema.Type'
description: section 5.19
type: object
description:
@@ -437,15 +461,19 @@ definitions:
oneOf:
description: section 5.24
items:
$ref: '#/definitions/jsonschema.Type'
type: integer
type: array
pattern:
description: section 5.8
type: string
patternProperties:
additionalProperties:
$ref: '#/definitions/jsonschema.Type'
description: section 5.17
type: object
properties:
additionalProperties:
$ref: '#/definitions/jsonschema.Type'
description: section 5.16
type: object
required:
@@ -464,123 +492,7 @@ definitions:
type: boolean
type: object
schema.Schema:
properties:
$ref:
description: section 7
type: string
$schema:
description: RFC draft-wright-json-schema-00
type: string
additionalItems:
description: section 5.9
type: integer
additionalProperties:
description: section 5.18
type: string
allOf:
description: section 5.22
items:
$ref: '#/definitions/jsonschema.Type'
type: array
anyOf:
description: section 5.23
items:
$ref: '#/definitions/jsonschema.Type'
type: array
binaryEncoding:
description: section 4.3
type: string
default:
description: section 6.2
type: object
definitions:
$ref: '#/definitions/jsonschema.Definitions'
type: object
dependencies:
description: section 5.19
type: object
description:
description: section 6.1
type: string
enum:
description: section 5.20
items:
type: object
type: array
exclusiveMaximum:
description: section 5.3
type: boolean
exclusiveMinimum:
description: section 5.5
type: boolean
format:
description: section 7
type: string
items:
description: section 5.9
type: integer
maxItems:
description: section 5.10
type: integer
maxLength:
description: section 5.6
type: integer
maxProperties:
description: section 5.13
type: integer
maximum:
description: section 5.2
type: integer
media:
description: RFC draft-wright-json-schema-hyperschema-00, section 4
type: integer
minItems:
description: section 5.11
type: integer
minLength:
description: section 5.7
type: integer
minProperties:
description: section 5.14
type: integer
minimum:
description: section 5.4
type: integer
multipleOf:
description: RFC draft-wright-json-schema-validation-00, section 5
type: integer
not:
description: section 5.25
type: integer
oneOf:
description: section 5.24
items:
$ref: '#/definitions/jsonschema.Type'
type: array
pattern:
description: section 5.8
type: string
patternProperties:
description: section 5.17
type: object
properties:
description: section 5.16
type: object
required:
description: section 5.15
items:
type: string
type: array
title:
description: RFC draft-wright-json-schema-validation-00, section 6, 7
type: string
type:
description: section 5.21
type: string
uniqueItems:
description: section 5.12
type: boolean
type: object
$ref: '#/definitions/jsonschema.Schema'
structure.AddressConfiguration:
properties:
ip:
@@ -595,7 +507,7 @@ definitions:
type: object
endpoints:
items:
$ref: '#/definitions/structure.EndpointConfig'
$ref: '#/definitions/structure.EndpointDescriptor'
type: array
libVersion:
type: string
@@ -604,14 +516,17 @@ definitions:
version:
type: string
type: object
structure.EndpointConfig:
structure.EndpointDescriptor:
properties:
ignoreOnRouter:
type: boolean
extra:
additionalProperties: true
type: object
inner:
type: boolean
path:
type: string
userAuthRequired:
type: boolean
required:
- path
type: object
@@ -647,7 +562,6 @@ paths:
required: true
schema:
$ref: '#/definitions/domain.CompileConfigsRequest'
type: object
produces:
- application/json
responses:
@@ -671,7 +585,6 @@ paths:
required: true
schema:
$ref: '#/definitions/entity.CommonConfig'
type: object
produces:
- application/json
responses:
@@ -703,7 +616,6 @@ paths:
required: true
schema:
$ref: '#/definitions/domain.ConfigIdRequest'
type: object
produces:
- application/json
responses:
@@ -749,7 +661,6 @@ paths:
required: true
schema:
$ref: '#/definitions/domain.ConfigIdRequest'
type: object
produces:
- application/json
responses:
@@ -773,7 +684,6 @@ paths:
required: true
schema:
$ref: '#/definitions/domain.CreateUpdateConfigRequest'
type: object
produces:
- application/json
responses:
@@ -836,7 +746,6 @@ paths:
required: true
schema:
$ref: '#/definitions/domain.GetByModuleNameRequest'
type: object
produces:
- application/json
responses:
@@ -868,7 +777,6 @@ paths:
required: true
schema:
$ref: '#/definitions/domain.ConfigIdRequest'
type: object
produces:
- application/json
responses:
@@ -915,6 +823,36 @@ paths:
summary: Метод удаления объектов модулей по идентификаторам
tags:
- Модули
/module/get_by_name:
post:
consumes:
- application/json
description: Модуль
parameters:
- description: название модуля
in: body
name: body
required: true
schema:
$ref: '#/definitions/domain.GetByModuleNameRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/entity.Module'
"404":
description: модуль с указанным названием не найден
schema:
$ref: '#/definitions/structure.GrpcError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/structure.GrpcError'
summary: Метод получения модуля по имени
tags:
- Модули
/module/get_modules_info:
post:
consumes:
@@ -966,7 +904,6 @@ paths:
required: true
schema:
$ref: '#/definitions/domain.GetByModuleIdRequest'
type: object
produces:
- application/json
responses:
+5 -4
View File
@@ -1,10 +1,11 @@
package domain
import (
"github.com/integration-system/isp-lib/config/schema"
"github.com/integration-system/isp-lib/structure"
"isp-config-service/entity"
"time"
"github.com/integration-system/isp-lib/v2/config/schema"
"github.com/integration-system/isp-lib/v2/structure"
"isp-config-service/entity"
)
type DeleteResponse struct {
@@ -27,7 +28,7 @@ type Connection struct {
LibVersion string
Version string
Address structure.AddressConfiguration
Endpoints []structure.EndpointConfig `json:",omitempty"`
Endpoints []structure.EndpointDescriptor `json:",omitempty"`
EstablishedAt time.Time
}
+5 -1
View File
@@ -1,13 +1,15 @@
package entity
import (
"github.com/integration-system/isp-lib/config/schema"
"time"
"github.com/integration-system/isp-lib/v2/config/schema"
)
type ConfigData map[string]interface{}
type Config struct {
//nolint
tableName string `sql:"?db_schema.configs" json:"-"`
Id string `json:"id"`
Name string `json:"name" valid:"required~Required"`
@@ -22,6 +24,7 @@ type Config struct {
}
type CommonConfig struct {
//nolint
tableName string `sql:"?db_schema.common_configs" json:"-"`
Id string `json:"id"`
Name string `json:"name" valid:"required~Required"`
@@ -32,6 +35,7 @@ type CommonConfig struct {
}
type ConfigSchema struct {
//nolint
tableName string `sql:"?db_schema.config_schemas" json:"-"`
Id string `json:"id"`
Version string
+1
View File
@@ -3,6 +3,7 @@ package entity
import "time"
type Module struct {
//nolint
tableName string `sql:"?db_schema.modules" json:"-"`
Id string `json:"id"`
Name string `json:"name" valid:"required~Required"`
+25
View File
@@ -0,0 +1,25 @@
module isp-config-service
go 1.13
require (
github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f
github.com/cenkalti/backoff/v4 v4.0.0
github.com/go-pg/pg/v9 v9.1.3
github.com/hashicorp/raft v1.1.2
github.com/hashicorp/raft-boltdb v0.0.0-20191021154308-4207f1bf0617
github.com/integration-system/bellows v0.0.0-20190821124023-244325e8836c
github.com/integration-system/isp-etp-go/v2 v2.1.0
github.com/integration-system/isp-lib-test v1.5.0
github.com/integration-system/isp-lib/v2 v2.2.0
github.com/integration-system/isp-log v1.1.2
github.com/integration-system/net-mux v1.0.0
github.com/json-iterator/go v1.1.9
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/pkg/errors v0.9.1
github.com/satori/go.uuid v1.2.0
github.com/stretchr/testify v1.5.1
github.com/thecodeteam/goodbye v0.0.0-20170927022442-a83968bda2d3
github.com/xeipuuv/gojsonschema v1.2.0
google.golang.org/grpc v1.27.1
)
+427
View File
@@ -0,0 +1,427 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU=
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 h1:EFSB7Zo9Eg91v7MJPVsifUysc/wPdN+NOnVe6bWbdBM=
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg=
github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f h1:y2hSFdXeA1y5z5f0vfNO0Dg5qVY036qzlz3Pds0B92o=
github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/buaazp/fasthttprouter v0.1.1 h1:4oAnN0C3xZjylvZJdP35cxfclyn4TYkW6Y+DSvS+h8Q=
github.com/buaazp/fasthttprouter v0.1.1/go.mod h1:h/Ap5oRVLeItGKTVBb+heQPks+HdIUtGmI4H5WCYijM=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cenkalti/backoff/v4 v4.0.0 h1:6VeaLF9aI+MAUQ95106HwWzYZgJJpZ4stumjj6RFYAU=
github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/codemodus/kace v0.5.1 h1:4OCsBlE2c/rSJo375ggfnucv9eRzge/U5LrrOZd47HA=
github.com/codemodus/kace v0.5.1/go.mod h1:coddaHoX1ku1YFSe4Ip0mL9kQjJvKkzb9CfIdG1YR04=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo=
github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-pg/pg/v9 v9.0.0-beta.14/go.mod h1:T2Sr6bpTCOr2lUqOUMiXLMJqZHSUBKk1LdgSqjwhZfA=
github.com/go-pg/pg/v9 v9.0.3/go.mod h1:Tm/Q3Vt6gdQOH6TTN1H/xLlIXc+Qrka7TZ6uREtu/eA=
github.com/go-pg/pg/v9 v9.1.2/go.mod h1:AOJqkP8C4YfJgLOA5zSoV0DGHGo+M3G2nXXLeXkiyNs=
github.com/go-pg/pg/v9 v9.1.3 h1:gmE7k5ib45+NcRJBGUDPD/keJGCMqhH7TPqbd9xbdz4=
github.com/go-pg/pg/v9 v9.1.3/go.mod h1:QM13HBLkdml4zcKOfUfGLymM6hb72aKTJLrmaH8rsFg=
github.com/go-pg/urlstruct v0.1.0/go.mod h1:2Nag+BIny6G/KYCkdt++ZnqU/VinzimGapKfs4kwlN0=
github.com/go-pg/urlstruct v0.2.6/go.mod h1:dxENwVISWSOX+k87hDt0ueEJadD+gZWv3tHzwfmZPu8=
github.com/go-pg/urlstruct v0.2.8/go.mod h1:/XKyiUOUUS3onjF+LJxbfmSywYAdl6qMfVbX33Q8rgg=
github.com/go-pg/urlstruct v0.3.0 h1:ORiTb205uT7v7lvq4VUOQ4ddJ5TjFRlVRWqWsMBgek4=
github.com/go-pg/urlstruct v0.3.0/go.mod h1:/XKyiUOUUS3onjF+LJxbfmSywYAdl6qMfVbX33Q8rgg=
github.com/go-pg/zerochecker v0.1.1 h1:av77Qe7Gs+1oYGGh51k0sbZ0bUaxJEdeP0r8YE64Dco=
github.com/go-pg/zerochecker v0.1.1/go.mod h1:NJZ4wKL0NmTtz0GKCoJ8kym6Xn/EQzXRl2OnAe7MmDo=
github.com/go-redis/redis v6.15.6+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8=
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo=
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
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 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.13.0/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v0.12.0 h1:d4QkX8FRTYaKaCZBoXYY8zJX2BXjWxurN/GA2tkrmZM=
github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI=
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-uuid v1.0.0 h1:RS8zrF7PhGwyNPOtxSClXXj9HA8feRnJzgnI1RJCSnM=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/raft v1.1.0/go.mod h1:4Ak7FSPnuvmb0GV6vgIAJ4vYT4bek9bb6Q+7HVbyzqM=
github.com/hashicorp/raft v1.1.1/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8=
github.com/hashicorp/raft v1.1.2 h1:oxEL5DDeurYxLd3UbcY/hccgSPhLLpiBZ1YxtWEq59c=
github.com/hashicorp/raft v1.1.2/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8=
github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea/go.mod h1:pNv7Wc3ycL6F5oOWn+tPGo2gWD4a5X+yp/ntwdKLjRk=
github.com/hashicorp/raft-boltdb v0.0.0-20191021154308-4207f1bf0617 h1:CJDRE/2tBNFOrcoexD2nvTRbQEox3FDxl4NxIezp1b8=
github.com/hashicorp/raft-boltdb v0.0.0-20191021154308-4207f1bf0617/go.mod h1:aUF6HQr8+t3FC/ZHAC+pZreUBhTaxumuu3L+d37uRxk=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/integration-system/bellows v0.0.0-20190821124023-244325e8836c h1:yyIH4qCFf5LD5PKhXoX4BZh3wRjd59xBV4eAQTBwS6k=
github.com/integration-system/bellows v0.0.0-20190821124023-244325e8836c/go.mod h1:6cf4ZNvtzZ/KMiuc+d5Y7rSHjzlYBWEqbVyDfUDhqIE=
github.com/integration-system/go-cmp v0.0.0-20190131081942-ac5582987a2f h1:52UOJguw5yqe1y2JjmyVxGcZf3kv2BQeUodR363MkiQ=
github.com/integration-system/go-cmp v0.0.0-20190131081942-ac5582987a2f/go.mod h1:w+dmaWojuIwNujSYg6qt1wKHhSdorLOivCEl/XuLzbM=
github.com/integration-system/gowsdl v1.0.0/go.mod h1:ZwTCE+Av5aQLnPj2/3PIop6mzCs1FY7jXrcWDvSjrBA=
github.com/integration-system/isp-etp-go v2.0.2+incompatible h1:+aQiqH/aMy9pUsifIxfWU/DD8cwbMo24AAIV7Ab6aP4=
github.com/integration-system/isp-etp-go v2.0.2+incompatible/go.mod h1:NdgczkoFCer9SZOx674EVXCcKRIhFe8LYnwNwoIMDhI=
github.com/integration-system/isp-etp-go/v2 v2.1.0 h1:qRw4J04vwYxSm52OUIt6lKWpxEQE2aZjUT7kZDG/A4Q=
github.com/integration-system/isp-etp-go/v2 v2.1.0/go.mod h1:Ndq5DMM3sDJjZn4cyKKvZrVED0FMeoXMRWHZTq+2Z1o=
github.com/integration-system/isp-lib-test v1.5.0 h1:5Q2qYpesVA0zj0d0ZbWPZgBM0cS+cHf2vH6MxXvNA10=
github.com/integration-system/isp-lib-test v1.5.0/go.mod h1:GAk7oPXp9KEuNeav2oaun5E/rlh5iomM/F/b2CqEycc=
github.com/integration-system/isp-lib/v2 v2.2.0 h1:qabF1/Q66Z0ldOIlsztD/P4WEuskYICFJHjMoJhUi08=
github.com/integration-system/isp-lib/v2 v2.2.0/go.mod h1:s3UWKnmCns7uaxAX1i04Le32+FFuoDgp8QLhOZAmNZE=
github.com/integration-system/isp-log v1.0.0/go.mod h1:omfVcb7djvmc0MYWpRq32D9jxRYhyBL518IcdBL9jKY=
github.com/integration-system/isp-log v1.1.2 h1:bnWxPjDOC1Y/tEzFxa42aG+xaPRWizuJADAwXgp2i5U=
github.com/integration-system/isp-log v1.1.2/go.mod h1:VVMr3cHW+RuFurPUSeVz71KUnOGQxogxO5atV9N8ISs=
github.com/integration-system/jsonschema v1.0.0 h1:Lci4sHGhOX27qCgZo5rvJ37Bjcfm+qCwU0yvw6ImEX4=
github.com/integration-system/jsonschema v1.0.0/go.mod h1:EoqDH7RmC8Epg5EgjboIxDo7Udv3WX2exGqtIVB4hI0=
github.com/integration-system/net-mux v1.0.0 h1:UY5y9cDq4ngfYaVzwqcIZ2FDw2l0H4slVDXp1E2gopc=
github.com/integration-system/net-mux v1.0.0/go.mod h1:R2PRrXFCOQRbjYIeiJFA6y2/3CfMYEX20H6yrIN6c7g=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.8.2 h1:Bx0qjetmNjdFXASH02NSAREKpiaDwkO1DRZ3dV2KCcs=
github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w=
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU=
github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.10 h1:qxFzApOv4WsAL965uUPIsXzAKCZxN2p9UqdhFS4ZW10=
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
github.com/nats-io/nats-server/v2 v2.1.4/go.mod h1:Jw1Z28soD/QasIA2uWjXyM9El1jly3YwyFOuR8tH1rg=
github.com/nats-io/nats-streaming-server v0.17.0/go.mod h1:ewPBEsmp62Znl3dcRsYtlcfwudxHEdYMtYqUQSt4fE0=
github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=
github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/nats-io/stan.go v0.6.0/go.mod h1:eIcD5bi3pqbHT/xIIvXMwvzXYElgouBvaVRftaE+eac=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/olivere/elastic v6.2.26+incompatible/go.mod h1:J+q1zQJTgAz9woqsbVRqGeB5G1iqDKVBWLNSYW8yfJ8=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo=
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pressly/goose v2.6.0+incompatible h1:3f8zIQ8rfgP9tyI0Hmcs2YNAqUCL1c+diLe3iU8Qd/k=
github.com/pressly/goose v2.6.0+incompatible/go.mod h1:m+QHWCqxR3k8D9l7qfzuC/djtlfzxr34mozWDYEu1z8=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563 h1:dY6ETXrvDG7Sa4vE8ZQG4yqWg6UnOcbqTAahkV813vQ=
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
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/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/segmentio/encoding v0.1.8/go.mod h1:RWhr02uzMB9gQC1x+MfYxedtmBibb9cZ6Vv9VxRSSbw=
github.com/segmentio/encoding v0.1.10 h1:0b8dva47cSuNQR5ZcU3d0pfi9EnPpSK6q7y5ZGEW36Q=
github.com/segmentio/encoding v0.1.10/go.mod h1:RWhr02uzMB9gQC1x+MfYxedtmBibb9cZ6Vv9VxRSSbw=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU=
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
github.com/streadway/amqp v0.0.0-20190312223743-14f78b41ce6d/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
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 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/thecodeteam/goodbye v0.0.0-20170927022442-a83968bda2d3 h1:COy7ekr2jBEd34npP2LvMTqk9UtiLkuvkjiJFHihlTo=
github.com/thecodeteam/goodbye v0.0.0-20170927022442-a83968bda2d3/go.mod h1:ehwM4AFY4byYSorQbigh79cKUOUNL3pAOz5eCAQNlGI=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.9.0 h1:hNpmUdy/+ZXYpGy0OBfm7K0UQTzb73W0T0U4iJIVrMw=
github.com/valyala/fasthttp v1.9.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w=
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
github.com/vmihailenco/bufpool v0.1.5 h1:mEO/biwhAgiY97yPMmAdH4PvaIu63C6uGBdfSdoMo/I=
github.com/vmihailenco/bufpool v0.1.5/go.mod h1:fL9i/PRTuS7AELqAHwSU1Zf1c70xhkhGe/cD5ud9pJk=
github.com/vmihailenco/msgpack/v4 v4.3.1/go.mod h1:DuaveEe48abshDmz5UBKyZ+yDugvaeFk5ayfrewUOaw=
github.com/vmihailenco/msgpack/v4 v4.3.5/go.mod h1:DuaveEe48abshDmz5UBKyZ+yDugvaeFk5ayfrewUOaw=
github.com/vmihailenco/msgpack/v4 v4.3.7 h1:Aj4eMY2qXTRfWRwHKJ2n/CWKVy15pCYN327QMJ/OUVs=
github.com/vmihailenco/msgpack/v4 v4.3.7/go.mod h1:Ii+PksJlvFT5ZRcB/4YLAInMIp6a0WOCm0L3BU0aNG4=
github.com/vmihailenco/tagparser v0.1.0/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY=
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20191128160524-b544559bb6d1/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200206161412-a0c6ece9d31a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d h1:1ZiEyfaQIg3Qh0EoqpwAakHVhecoE5wlSg5GjnafJGw=
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190420063019-afa5a82059c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200222033325-078779b8f2d8 h1:4l6HGmcZuPkox4Zl1b7SZQfYo8KIKvPe+5VG6ibuUEg=
golang.org/x/net v0.0.0-20200222033325-078779b8f2d8/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
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=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4 h1:sfkvUWPNGwSV+8/fNqctR5lS2AqCSqYwXdrjCxp/dXo=
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
google.golang.org/genproto v0.0.0-20200211111953-2dc5924e3898 h1:bKX1IGaSj2XD9yfWNts9HKRdQRH0lOZ0S7Nb8meQSlY=
google.golang.org/genproto v0.0.0-20200211111953-2dc5924e3898/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s=
google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk=
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
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=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
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 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
mellium.im/sasl v0.2.1 h1:nspKSRg7/SyO0cRGY71OkfHab8tf9kCts6a6oTDut0w=
mellium.im/sasl v0.2.1/go.mod h1:ROaEDLQNuf9vjKqE1SrAfnsobm2YKXT1gnN1uDp1PjQ=
nhooyr.io/websocket v1.7.4 h1:w/LGB2sZT0RV8lZYR7nfyaYz4PUbYZ5oF7NBon2M0NY=
nhooyr.io/websocket v1.7.4/go.mod h1:PxYxCwFdFYQ0yRvtQz3s/dC+VEm7CSuC/4b9t8MQQxw=
+8 -6
View File
@@ -1,7 +1,8 @@
//nolint lll
package helper
import (
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/v2/structure"
"isp-config-service/controller"
"isp-config-service/domain"
"isp-config-service/entity"
@@ -9,9 +10,9 @@ import (
type Handlers struct {
// ===== MODULE =====
DeleteModules func(identities []string) (*domain.DeleteResponse, error) `method:"delete_module" group:"module" inner:"true"`
GetModulesInfo func() ([]domain.ModuleInfo, error) `method:"get_modules_info" group:"module" inner:"true"`
DeleteModules func(identities []string) (*domain.DeleteResponse, error) `method:"delete_module" group:"module" inner:"true"`
GetModulesInfo func() ([]domain.ModuleInfo, error) `method:"get_modules_info" group:"module" inner:"true"`
GetModuleByName func(req domain.GetByModuleNameRequest) (*entity.Module, error) `method:"get_by_name" group:"module" inner:"true"`
// ===== CONFIG =====
GetActiveConfigByModuleName func(request domain.GetByModuleNameRequest) (*entity.Config, error) `method:"get_active_config_by_module_name" group:"config" inner:"true"`
CreateUpdateConfig func(config domain.CreateUpdateConfigRequest) (*domain.ConfigModuleInfo, error) `method:"create_update_config" group:"config" inner:"true"`
@@ -34,8 +35,9 @@ type Handlers struct {
func GetHandlers() *Handlers {
return &Handlers{
DeleteModules: controller.Module.DeleteModules,
GetModulesInfo: controller.Module.GetModulesAggregatedInfo,
DeleteModules: controller.Module.DeleteModules,
GetModulesInfo: controller.Module.GetModulesAggregatedInfo,
GetModuleByName: controller.Module.GetModuleByName,
GetActiveConfigByModuleName: controller.Config.GetActiveConfigByModuleName,
CreateUpdateConfig: controller.Config.CreateUpdateConfig,
+4 -3
View File
@@ -1,13 +1,14 @@
package holder
import (
etp "github.com/integration-system/isp-etp-go"
"isp-config-service/cluster"
"net/http"
etp "github.com/integration-system/isp-etp-go/v2"
"isp-config-service/cluster"
)
var (
ClusterClient *cluster.Client
EtpServer etp.Server
HttpServer *http.Server
HTTPServer *http.Server
)
+31 -24
View File
@@ -3,13 +3,18 @@ package main
import (
"context"
"fmt"
"github.com/integration-system/isp-etp-go"
"github.com/integration-system/isp-lib/backend"
"github.com/integration-system/isp-lib/bootstrap"
"github.com/integration-system/isp-lib/config"
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/utils"
"net"
"net/http"
"os"
"github.com/integration-system/isp-etp-go/v2"
"github.com/integration-system/isp-lib/v2/backend"
"github.com/integration-system/isp-lib/v2/bootstrap"
"github.com/integration-system/isp-lib/v2/config"
"github.com/integration-system/isp-lib/v2/structure"
"github.com/integration-system/isp-lib/v2/utils"
log "github.com/integration-system/isp-log"
mux "github.com/integration-system/net-mux"
"github.com/thecodeteam/goodbye"
"isp-config-service/cluster"
"isp-config-service/codes"
@@ -18,15 +23,11 @@ import (
"isp-config-service/helper"
"isp-config-service/holder"
"isp-config-service/model"
"isp-config-service/mux"
"isp-config-service/raft"
"isp-config-service/service"
"isp-config-service/store"
"isp-config-service/store/state"
"isp-config-service/subs"
"net"
"net/http"
"os"
)
const (
@@ -36,7 +37,6 @@ const (
var (
version = "0.1.0"
date = "undefined"
shutdownChan = make(chan struct{})
muxer mux.Mux
@@ -57,6 +57,9 @@ func init() {
// @host localhost:9003
// @BasePath /api/config
//go:generate swag init --parseVendor
//go:generate rm -f docs/docs.go docs/swagger.json
func main() {
ctx := context.Background()
cfg := config.Get().(*conf.Configuration)
@@ -64,7 +67,7 @@ func main() {
endpoints := backend.GetEndpoints(cfg.ModuleName, handlers)
address := cfg.GrpcOuterAddress
if address.IP == "" {
ip, err := getOutboundIp()
ip, err := getOutboundIP()
if err != nil {
panic(err)
}
@@ -78,6 +81,13 @@ func main() {
Address: address,
}
connectionReadLimit := defaultWsConnectionReadLimit
if cfg.WS.WsConnectionReadLimitKB > 0 {
//nolint gomnd
connectionReadLimit = cfg.WS.WsConnectionReadLimitKB << 10
}
cluster.WsConnectionReadLimit = connectionReadLimit
model.DbClient.ReceiveConfiguration(cfg.Database)
httpListener, raftListener, err := initMultiplexer(cfg.WS.Rest)
@@ -86,7 +96,7 @@ func main() {
}
_, raftStore := initRaft(raftListener, cfg.Cluster, declaration)
initWebsocket(ctx, cfg.WS.WsConnectionReadLimitKB, httpListener, raftStore)
initWebsocket(ctx, connectionReadLimit, httpListener, raftStore)
initGrpc(cfg.WS.Grpc, raftStore)
defer goodbye.Exit(ctx, -1)
@@ -118,11 +128,7 @@ func initMultiplexer(addressConfiguration structure.AddressConfiguration) (net.L
return httpListener, raftListener, nil
}
func initWebsocket(ctx context.Context, wsConnectionReadLimitKB int64, listener net.Listener, raftStore *store.Store) {
connectionReadLimit := defaultWsConnectionReadLimit
if wsConnectionReadLimitKB > 0 {
connectionReadLimit = wsConnectionReadLimitKB << 10
}
func initWebsocket(ctx context.Context, connectionReadLimit int64, listener net.Listener, raftStore *store.Store) {
etpConfig := etp.ServerConfig{
InsecureSkipVerify: true,
ConnectionReadLimit: connectionReadLimit,
@@ -139,10 +145,11 @@ func initWebsocket(ctx context.Context, wsConnectionReadLimitKB int64, listener
}
}()
holder.EtpServer = etpServer
holder.HttpServer = httpServer
holder.HTTPServer = httpServer
}
func initRaft(listener net.Listener, clusterCfg conf.ClusterConfiguration, declaration structure.BackendDeclaration) (*cluster.Client, *store.Store) {
func initRaft(listener net.Listener, clusterCfg conf.ClusterConfiguration,
declaration structure.BackendDeclaration) (*cluster.Client, *store.Store) {
raftState, err := store.NewStateFromRepository()
if err != nil {
log.Fatal(codes.RestoreFromRepositoryError, err)
@@ -159,13 +166,13 @@ func initRaft(listener net.Listener, clusterCfg conf.ClusterConfiguration, decla
cfg := config.Get().(*conf.Configuration)
addr, err := net.ResolveTCPAddr("tcp", address)
if err != nil {
panic(err) // must never occured
panic(err) // must never occurred
}
port := cfg.GrpcOuterAddress.Port
addressConfiguration := structure.AddressConfiguration{Port: port, IP: addr.IP.String()}
back := structure.BackendDeclaration{ModuleName: cfg.ModuleName, Address: addressConfiguration}
log.WithMetadata(map[string]interface{}{"declaration": back}).
Debugf(0, "delete disconnected leader's declaration")
Infof(codes.LeaderManualDeleteLeader, "manually delete disconnected leader's declaration")
service.ClusterMeshService.HandleDeleteBackendDeclarationCommand(back, s)
})
})
@@ -196,7 +203,7 @@ func onShutdown(ctx context.Context, _ os.Signal) {
backend.StopGrpcServer()
holder.EtpServer.Close()
if err := holder.HttpServer.Shutdown(ctx); err != nil {
if err := holder.HTTPServer.Shutdown(ctx); err != nil {
log.Warnf(codes.ShutdownHttpServerError, "http server shutdown err: %v", err)
} else {
log.Info(codes.ShutdownHttpServerInfo, "http server shutdown success")
@@ -211,7 +218,7 @@ func onShutdown(ctx context.Context, _ os.Signal) {
_ = muxer.Close()
}
func getOutboundIp() (string, error) {
func getOutboundIP() (string, error) {
conn, err := net.Dial("udp", "9.9.9.9:80")
if err != nil {
return "", err
+1 -1
View File
@@ -1,7 +1,7 @@
package model
import (
"github.com/integration-system/isp-lib/database"
"github.com/integration-system/isp-lib/v2/database"
log "github.com/integration-system/isp-log"
"github.com/integration-system/isp-log/stdcodes"
)
+3 -2
View File
@@ -1,8 +1,9 @@
//nolint dupl
package model
import (
"github.com/go-pg/pg"
"github.com/integration-system/isp-lib/database"
"github.com/go-pg/pg/v9"
"github.com/integration-system/isp-lib/v2/database"
"isp-config-service/entity"
)
+3 -2
View File
@@ -1,8 +1,9 @@
//nolint dupl
package model
import (
"github.com/go-pg/pg"
"github.com/integration-system/isp-lib/database"
"github.com/go-pg/pg/v9"
"github.com/integration-system/isp-lib/v2/database"
"isp-config-service/entity"
)
+3 -2
View File
@@ -1,8 +1,9 @@
//nolint dupl
package model
import (
"github.com/go-pg/pg"
"github.com/integration-system/isp-lib/database"
"github.com/go-pg/pg/v9"
"github.com/integration-system/isp-lib/v2/database"
"isp-config-service/entity"
)
+3 -2
View File
@@ -1,8 +1,9 @@
//nolint dupl
package model
import (
"github.com/go-pg/pg"
"github.com/integration-system/isp-lib/database"
"github.com/go-pg/pg/v9"
"github.com/integration-system/isp-lib/v2/database"
"isp-config-service/entity"
)
-44
View File
@@ -1,44 +0,0 @@
package mux
import (
"bytes"
)
type Matcher func([]byte) bool
// Any is a Matcher that matches any connection.
func Any() Matcher {
return func(_ []byte) bool {
return true
}
}
var httpMethods = map[string]struct{}{
"OPTIONS": {},
"HEAD": {},
"GET": {},
"POST": {},
"PUT": {},
"PATCH": {},
"DELETE": {},
"TRACE": {},
"CONNECT": {},
}
// HTTP1 only matches the methods in the HTTP request.
func HTTP1() Matcher {
return func(data []byte) bool {
// max length of method
l := 7
if len(data) < l {
l = len(data)
}
methodB := data[:l]
words := bytes.Split(methodB, []byte(" "))
if len(words) == 0 {
return false
}
_, ok := httpMethods[string(words[0])]
return ok
}
}
-186
View File
@@ -1,186 +0,0 @@
package mux
import (
"errors"
"github.com/integration-system/isp-lib/atomic"
"net"
"sync"
)
var (
ErrListenerClosed = errors.New("mux: listener closed")
ErrNotMatched = errors.New("mux: connection not matched by a matcher")
)
type Mux interface {
Match(Matcher) net.Listener
Serve() error
OnError(func(error))
Close() error
}
type matchersListener struct {
matcher Matcher
listener *muxListener
}
type mux struct {
listener net.Listener
ml []matchersListener
connBufLen int
doneCh chan struct{}
errHandler func(error)
}
func (m *mux) Match(matcher Matcher) net.Listener {
ml := newMuxListener(m.listener, m.connBufLen)
m.ml = append(m.ml, matchersListener{matcher: matcher, listener: ml})
return ml
}
func (m *mux) Serve() error {
var wg sync.WaitGroup
defer func() {
close(m.doneCh)
wg.Wait()
for _, sl := range m.ml {
_ = sl.listener.Close()
for c := range sl.listener.connCh {
_ = c.Close()
}
close(sl.listener.connCh)
}
}()
for {
c, err := m.listener.Accept()
if err != nil {
if ne, ok := err.(net.Error); ok && ne.Temporary() {
continue
}
return err
}
wg.Add(1)
go m.serve(c, &wg)
}
}
func (m *mux) Close() error {
return m.listener.Close()
}
func (m *mux) OnError(f func(error)) {
m.errHandler = f
}
func (m *mux) serve(c net.Conn, wg *sync.WaitGroup) {
defer wg.Done()
buf := getBuffer()
n, err := c.Read(buf)
data := buf[:n]
for _, matcher := range m.ml {
matched := matcher.matcher(data)
if matched {
if matcher.listener.closed.Get() {
break
}
muc := newMuxConn(c, data, err)
select {
case matcher.listener.connCh <- muc:
case <-m.doneCh:
putBuffer(buf)
_ = c.Close()
}
return
}
}
putBuffer(buf)
_ = c.Close()
if m.errHandler != nil {
m.errHandler(ErrNotMatched)
}
}
func (m *mux) handleErr(err error) bool {
if ne, ok := err.(net.Error); ok {
return ne.Temporary()
}
return false
}
func New(l net.Listener) Mux {
return &mux{
listener: l,
connBufLen: 1024,
doneCh: make(chan struct{}),
}
}
type muxListener struct {
root net.Listener
connCh chan net.Conn
closed *atomic.AtomicBool
}
func (l *muxListener) Accept() (net.Conn, error) {
if l.closed.Get() {
return nil, ErrListenerClosed
}
c, ok := <-l.connCh
if !ok || l.closed.Get() {
return nil, ErrListenerClosed
}
return c, nil
}
// Close stops listening on address.
// Already Accepted connections are not closed.
func (l *muxListener) Close() error {
l.closed.Set(true)
return nil
}
func (l *muxListener) Addr() net.Addr {
return l.root.Addr()
}
func newMuxListener(root net.Listener, connBufLen int) *muxListener {
return &muxListener{
root: root,
connCh: make(chan net.Conn, connBufLen),
closed: atomic.NewAtomicBool(false),
}
}
type muxConn struct {
net.Conn
buf []byte
lastErr error
}
func newMuxConn(c net.Conn, buf []byte, lastErr error) *muxConn {
return &muxConn{
Conn: c,
buf: buf,
lastErr: lastErr,
}
}
func (m *muxConn) Read(p []byte) (int, error) {
if m.buf != nil {
n := copy(p, m.buf)
if len(m.buf) == n {
putBuffer(m.buf)
m.buf = nil
} else {
m.buf = m.buf[n:]
}
return n, m.lastErr
}
return m.Conn.Read(p)
}
-118
View File
@@ -1,118 +0,0 @@
package mux
import (
"fmt"
"github.com/stretchr/testify/assert"
"io/ioutil"
"log"
"net"
"net/http"
"net/http/httptest"
"testing"
"time"
)
func TestHTTP1(t *testing.T) {
a := assert.New(t)
path := "/test/"
method := "GET"
mockResData := []byte("948 res")
var responseData []byte
rootListener := newLocalListener()
mux := New(rootListener)
httpListener := mux.Match(HTTP1())
mux.OnError(func(err error) {
a.Fail("connection not matched by a http matcher")
})
go func() {
err := mux.Serve()
log.Println(err)
}()
handler := func(writer http.ResponseWriter, request *http.Request) {
var err error
a.Equal(method, request.Method)
n, err := writer.Write(mockResData)
a.NoError(err)
a.Len(mockResData, n)
}
httpMux := http.NewServeMux()
httpMux.HandleFunc(path, handler)
httpServer := httptest.NewUnstartedServer(httpMux)
httpServer.Listener = httpListener
httpServer.Start()
url := httpServer.URL + path
httpClient := httpServer.Client()
req, _ := http.NewRequest(method, url, nil)
res, err := httpClient.Do(req)
a.NoError(err)
if a.NotNil(res) {
a.Equal(200, res.StatusCode)
responseData, err = ioutil.ReadAll(res.Body)
}
time.Sleep(10 * time.Millisecond)
a.Equal(mockResData, responseData)
}
func TestAny(t *testing.T) {
a := assert.New(t)
mockReqData := []byte("1 somre")
requestData := make([]byte, len(mockReqData))
rootListener := newLocalListener()
mux := New(rootListener)
httpListener := mux.Match(HTTP1())
tcpListener := mux.Match(Any())
go func() {
err := mux.Serve()
log.Println(err)
}()
handler := func(writer http.ResponseWriter, request *http.Request) {
a.Fail("matched http handler")
}
httpMux := http.NewServeMux()
httpMux.HandleFunc("/", handler)
httpServer := httptest.NewUnstartedServer(httpMux)
httpServer.Listener = httpListener
httpServer.Start()
hadTcpConn := false
go func() {
for {
conn, err := tcpListener.Accept()
if hadTcpConn {
a.Fail("more than one tcp conn")
return
}
hadTcpConn = true
a.NoError(err)
_, err = conn.Read(requestData)
a.NoError(err)
a.Equal(mockReqData, requestData)
}
}()
tcpAddr := tcpListener.Addr().String()
conn, err := net.Dial("tcp", tcpAddr)
a.NoError(err)
n, err := conn.Write(mockReqData)
a.Len(mockReqData, n)
a.NoError(err)
time.Sleep(10 * time.Millisecond)
a.Equal(mockReqData, requestData)
a.True(hadTcpConn)
}
func newLocalListener() net.Listener {
l, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
panic(fmt.Sprintf("failed to listen on a port: %v", err))
}
return l
}
-22
View File
@@ -1,22 +0,0 @@
package mux
import (
"sync"
)
// could be increased if needed for new matchers
const bufferSize = 10
var pool sync.Pool
func getBuffer() []byte {
b, ok := pool.Get().([]byte)
if !ok {
b = make([]byte, bufferSize)
}
return b
}
func putBuffer(b []byte) {
pool.Put(b[:cap(b)])
}
-105
View File
@@ -1,105 +0,0 @@
package raft
import (
"fmt"
"github.com/hashicorp/go-hclog"
isplog "github.com/integration-system/isp-log"
"github.com/sirupsen/logrus"
"github.com/spf13/cast"
"io"
"isp-config-service/codes"
"log"
)
type LoggerAdapter struct {
name string
}
func (l *LoggerAdapter) Log(level logrus.Level, msg string, args ...interface{}) {
if l.name != "" {
msg = fmt.Sprintf("%s:%s", l.name, msg)
}
if len(args) != 0 {
metadata := make(map[string]interface{}, len(args)/2)
for i := 0; i < len(args)-1; i += 2 {
k := cast.ToString(args[i])
metadata[k] = args[i+1]
}
isplog.WithMetadata(metadata).Log(level, codes.RaftLoggerCode, msg)
} else {
isplog.Log(level, codes.RaftLoggerCode, msg)
}
}
func (l *LoggerAdapter) Trace(msg string, args ...interface{}) {
l.Log(logrus.TraceLevel, msg, args...)
}
func (l *LoggerAdapter) Debug(msg string, args ...interface{}) {
l.Log(logrus.DebugLevel, msg, args...)
}
func (l *LoggerAdapter) Info(msg string, args ...interface{}) {
l.Log(logrus.InfoLevel, msg, args...)
}
func (l *LoggerAdapter) Warn(msg string, args ...interface{}) {
l.Log(logrus.WarnLevel, msg, args...)
}
func (l *LoggerAdapter) Error(msg string, args ...interface{}) {
l.Log(logrus.ErrorLevel, msg, args...)
}
func (l *LoggerAdapter) IsTrace() bool {
return isplog.IsLevelEnabled(logrus.TraceLevel)
}
func (l *LoggerAdapter) IsDebug() bool {
return isplog.IsLevelEnabled(logrus.DebugLevel)
}
func (l *LoggerAdapter) IsInfo() bool {
return isplog.IsLevelEnabled(logrus.InfoLevel)
}
func (l *LoggerAdapter) IsWarn() bool {
return isplog.IsLevelEnabled(logrus.WarnLevel)
}
func (l *LoggerAdapter) IsError() bool {
return isplog.IsLevelEnabled(logrus.ErrorLevel)
}
// No need to implement that as Raft doesn't use this method.
func (l *LoggerAdapter) With(args ...interface{}) hclog.Logger {
return l
}
func (l *LoggerAdapter) Named(name string) hclog.Logger {
sl := *l
if sl.name != "" {
sl.name = sl.name + "." + name
} else {
sl.name = name
}
return &sl
}
func (l *LoggerAdapter) ResetNamed(name string) hclog.Logger {
sl := *l
sl.name = name
return &sl
}
// Skip
func (l *LoggerAdapter) SetLevel(level hclog.Level) {
}
func (l *LoggerAdapter) StandardLogger(opts *hclog.StandardLoggerOptions) *log.Logger {
return log.New(isplog.GetOutput(), "", 0)
}
func (l *LoggerAdapter) StandardWriter(opts *hclog.StandardLoggerOptions) io.Writer {
return isplog.GetOutput()
}
+19 -11
View File
@@ -1,24 +1,28 @@
package raft
import (
"github.com/hashicorp/raft"
raftboltdb "github.com/hashicorp/raft-boltdb"
"github.com/pkg/errors"
"isp-config-service/conf"
"net"
"os"
"path/filepath"
"time"
"github.com/hashicorp/raft"
raftboltdb "github.com/hashicorp/raft-boltdb"
"github.com/integration-system/isp-log/adapter"
"github.com/pkg/errors"
"isp-config-service/codes"
"isp-config-service/conf"
)
const (
defaultSyncTimeout = 3 * time.Second
dbFile = "raft_db"
defaultSyncTimeout = 3 * time.Second
leaderNotificationChBuffer = 10
dbFile = "raft_db"
)
type ChangeLeaderNotification struct {
IsLeader bool
CurrentLeaderAddress string
IsLeader bool
LeaderElected bool
}
@@ -55,11 +59,13 @@ func (r *Raft) LeaderCh() <-chan ChangeLeaderNotification {
func (r *Raft) GracefulShutdown() error {
r.r.DeregisterObserver(r.leaderObs)
close(r.closer)
close(r.changeLeaderCh)
close(r.leaderObsCh)
return r.r.Shutdown().Error()
}
func (r *Raft) listenLeader() {
defer close(r.changeLeaderCh)
for {
select {
case _, ok := <-r.leaderObsCh:
@@ -73,6 +79,8 @@ func (r *Raft) listenLeader() {
CurrentLeaderAddress: string(currentLeader),
LeaderElected: currentLeader != "",
}:
case <-r.closer:
return
default:
continue
}
@@ -88,7 +96,7 @@ func NewRaft(tcpListener net.Listener, configuration conf.ClusterConfiguration,
return nil, err
}
netLogger := &LoggerAdapter{name: "RAFT-NET"}
netLogger := adapter.NewHcLogger("RAFT-NET", codes.RaftLoggerCode)
streamLayer := &StreamLayer{Listener: tcpListener}
timeout := time.Duration(configuration.ConnectTimeoutSeconds) * time.Second
config := &raft.NetworkTransportConfig{
@@ -101,7 +109,7 @@ func NewRaft(tcpListener net.Listener, configuration conf.ClusterConfiguration,
trans := raft.NewNetworkTransportWithConfig(config)
cfg := raft.DefaultConfig()
cfg.Logger = &LoggerAdapter{name: "RAFT"}
cfg.Logger = adapter.NewHcLogger("RAFT", codes.RaftLoggerCode)
cfg.NoSnapshotRestoreOnStart = true
cfg.LocalID = raft.ServerID(configuration.OuterAddress)
r, err := raft.NewRaft(cfg, state, logStore, store, snapshotStore, trans)
@@ -116,7 +124,7 @@ func NewRaft(tcpListener net.Listener, configuration conf.ClusterConfiguration,
cfg: configuration,
leaderObs: leaderObs,
leaderObsCh: leaderObsCh,
changeLeaderCh: make(chan ChangeLeaderNotification, 10),
changeLeaderCh: make(chan ChangeLeaderNotification, leaderNotificationChBuffer),
closer: make(chan struct{}),
}
go raft.listenLeader()
+1 -1
View File
@@ -1,7 +1,7 @@
package service
import (
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/v2/structure"
"isp-config-service/store/state"
)
+14 -13
View File
@@ -17,7 +17,8 @@ var (
type commonConfigService struct{}
func (s commonConfigService) HandleDeleteConfigsCommand(deleteCommonConfig cluster.DeleteCommonConfig, state state.WritableState) cluster.ResponseWithError {
func (s commonConfigService) HandleDeleteConfigsCommand(
deleteCommonConfig cluster.DeleteCommonConfig, state state.WritableState) cluster.ResponseWithError {
links := s.GetCommonConfigLinks(deleteCommonConfig.Id, state)
if len(links) > 0 {
return cluster.NewResponse(domain.DeleteCommonConfigResponse{Deleted: false, Links: links})
@@ -36,12 +37,14 @@ func (s commonConfigService) HandleDeleteConfigsCommand(deleteCommonConfig clust
return cluster.NewResponse(domain.DeleteCommonConfigResponse{Deleted: deleted > 0})
}
func (s commonConfigService) HandleUpsertConfigCommand(upsertConfig cluster.UpsertCommonConfig, state state.WritableState) cluster.ResponseWithError {
func (s commonConfigService) HandleUpsertConfigCommand(
upsertConfig cluster.UpsertCommonConfig, state state.WritableState) cluster.ResponseWithError {
config := upsertConfig.Config
configsByName := state.CommonConfigs().GetByName(config.Name)
if upsertConfig.Create {
if len(configsByName) > 0 {
return cluster.NewResponseErrorf(codes2.AlreadyExists, "common config with name %s already exists", upsertConfig.Config.Name)
return cluster.NewResponseErrorf(codes2.AlreadyExists,
"common config with name %s already exists", upsertConfig.Config.Name)
}
config = state.WritableCommonConfigs().Create(config)
} else {
@@ -51,7 +54,8 @@ func (s commonConfigService) HandleUpsertConfigCommand(upsertConfig cluster.Upse
return cluster.NewResponseErrorf(codes2.NotFound, "common config with id %s not found", config.Id)
}
if len(configsByName) > 0 && configs[0].Id != configsByName[0].Id {
return cluster.NewResponseErrorf(codes2.AlreadyExists, "common config with name %s already exists", upsertConfig.Config.Name)
return cluster.NewResponseErrorf(codes2.AlreadyExists,
"common config with name %s already exists", upsertConfig.Config.Name)
}
config.CreatedAt = configs[0].CreatedAt
state.WritableCommonConfigs().UpdateById(config)
@@ -73,18 +77,15 @@ func (s commonConfigService) HandleUpsertConfigCommand(upsertConfig cluster.Upse
return cluster.NewResponse(config)
}
func (s commonConfigService) GetCommonConfigLinks(commonConfigId string, state state.ReadonlyState) domain.CommonConfigLinks {
configs := state.Configs().FilterByCommonConfigs([]string{commonConfigId})
func (s commonConfigService) GetCommonConfigLinks(commonConfigID string, state state.ReadonlyState) domain.CommonConfigLinks {
configs := state.Configs().FilterByCommonConfigs([]string{commonConfigID})
result := make(domain.CommonConfigLinks)
for _, c := range configs {
module := state.Modules().GetById(c.ModuleId)
for i := range configs {
module := state.Modules().GetById(configs[i].ModuleId)
if module != nil {
if configs, ok := result[module.Name]; ok {
result[module.Name] = append(configs, c.Name)
} else {
result[module.Name] = []string{c.Name}
}
result[module.Name] = append(result[module.Name], configs[i].Name)
}
}
return result
}
+19 -15
View File
@@ -3,8 +3,9 @@ package service
import (
"encoding/json"
"fmt"
"github.com/integration-system/bellows"
"github.com/integration-system/isp-lib/utils"
"github.com/integration-system/isp-lib/v2/utils"
log "github.com/integration-system/isp-log"
"github.com/pkg/errors"
"github.com/xeipuuv/gojsonschema"
@@ -51,7 +52,8 @@ func (cs configService) GetCompiledConfig(moduleName string, state state.Readonl
return cs.CompileConfig(config.Data, state, config.CommonConfigs...), nil
}
func (configService) CompileConfig(data map[string]interface{}, state state.ReadonlyState, commonConfigsIds ...string) map[string]interface{} {
func (configService) CompileConfig(
data map[string]interface{}, state state.ReadonlyState, commonConfigsIds ...string) map[string]interface{} {
commonConfigs := state.CommonConfigs().GetByIds(commonConfigsIds)
configsToMerge := make([]map[string]interface{}, 0, len(commonConfigs))
for _, common := range commonConfigs {
@@ -62,7 +64,8 @@ func (configService) CompileConfig(data map[string]interface{}, state state.Read
return mergeNestedMaps(configsToMerge...)
}
func (configService) HandleActivateConfigCommand(activateConfig cluster.ActivateConfig, state state.WritableState) cluster.ResponseWithError {
func (configService) HandleActivateConfigCommand(
activateConfig cluster.ActivateConfig, state state.WritableState) cluster.ResponseWithError {
configs := state.Configs().GetByIds([]string{activateConfig.ConfigId})
if len(configs) == 0 {
return cluster.NewResponseErrorf(codes2.NotFound, "config with id %s not found", activateConfig.ConfigId)
@@ -70,9 +73,9 @@ func (configService) HandleActivateConfigCommand(activateConfig cluster.Activate
config := configs[0]
affected := state.WritableConfigs().Activate(config, activateConfig.Date)
if holder.ClusterClient.IsLeader() {
for _, c := range affected {
for i := range affected {
// TODO handle db errors
_, err := model.ConfigRep.Upsert(c)
_, err := model.ConfigRep.Upsert(affected[i])
if err != nil {
log.WithMetadata(map[string]interface{}{
"config": config,
@@ -157,9 +160,9 @@ func (cs configService) HandleUpsertConfigCommand(upsertConfig cluster.UpsertCon
}
func (cs configService) BroadcastNewConfig(state state.ReadonlyState, configs ...entity.Config) {
for _, cfg := range configs {
moduleId := cfg.ModuleId
module := state.Modules().GetById(moduleId)
for i := range configs {
moduleID := configs[i].ModuleId
module := state.Modules().GetById(moduleID)
moduleName := module.Name
room := moduleName + ConfigWatchersRoomSuffix
@@ -187,17 +190,18 @@ func (cs configService) broadcast(room, event string, data []byte) {
func (configService) validateSchema(schema entity.ConfigSchema, data map[string]interface{}) (bool, error) {
schemaLoader := gojsonschema.NewGoLoader(schema.Schema)
documentLoader := gojsonschema.NewGoLoader(data)
if result, err := gojsonschema.Validate(schemaLoader, documentLoader); err != nil {
result, err := gojsonschema.Validate(schemaLoader, documentLoader)
if err != nil {
return false, err
} else if result.Valid() {
return true, nil
} else {
desc := make(map[string]string)
for _, value := range result.Errors() {
desc[value.Field()] = value.Description()
}
return false, validationSchemaError{Description: desc}
}
desc := make(map[string]string)
for _, value := range result.Errors() {
desc[value.Field()] = value.Description()
}
return false, validationSchemaError{Description: desc}
}
func mergeNestedMaps(maps ...map[string]interface{}) map[string]interface{} {
+31 -25
View File
@@ -3,16 +3,22 @@ package service
import (
"context"
"encoding/json"
"github.com/cenkalti/backoff"
etp "github.com/integration-system/isp-etp-go"
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/utils"
"sync"
"time"
"github.com/cenkalti/backoff/v4"
etp "github.com/integration-system/isp-etp-go/v2"
"github.com/integration-system/isp-lib/v2/structure"
"github.com/integration-system/isp-lib/v2/utils"
log "github.com/integration-system/isp-log"
"isp-config-service/codes"
"isp-config-service/holder"
"isp-config-service/store/state"
"sync"
"time"
)
const (
messagesBackoffInterval = 100 * time.Millisecond
messagesBackoffMaxRetries = 3
)
var (
@@ -24,12 +30,12 @@ type discoveryService struct {
lock sync.RWMutex
}
func (ds *discoveryService) HandleDisconnect(connId string) {
func (ds *discoveryService) HandleDisconnect(connID string) {
ds.lock.Lock()
defer ds.lock.Unlock()
if events, ok := ds.subs[connId]; ok {
holder.EtpServer.Rooms().LeaveByConnId(connId, events...)
delete(ds.subs, connId)
if events, ok := ds.subs[connID]; ok {
holder.EtpServer.Rooms().LeaveByConnId(connID, events...)
delete(ds.subs, connID)
}
}
@@ -76,28 +82,28 @@ func (ds *discoveryService) BroadcastModuleAddresses(moduleName string, mesh sta
}
func (ds *discoveryService) broadcastAddrList(room string, event string, addressList []structure.AddressConfiguration) error {
if bytes, err := json.Marshal(addressList); err != nil {
bytes, err := json.Marshal(addressList)
if err != nil {
return err
}
err = holder.EtpServer.BroadcastToRoom(room, event, bytes)
if err != nil {
return err
} else {
err = holder.EtpServer.BroadcastToRoom(room, event, bytes)
if err != nil {
return err
}
}
return nil
}
func (ds *discoveryService) sendAddrList(conn etp.Conn, event string, addressList []structure.AddressConfiguration) error {
if bytes, err := json.Marshal(addressList); err != nil {
bytes, err := json.Marshal(addressList)
if err != nil {
return err
}
bf := backoff.WithMaxRetries(backoff.NewConstantBackOff(messagesBackoffInterval), messagesBackoffMaxRetries)
err = backoff.Retry(func() error {
return conn.Emit(context.Background(), event, bytes)
}, bf)
if err != nil {
return err
} else {
bf := backoff.WithMaxRetries(backoff.NewConstantBackOff(100*time.Millisecond), 3)
err := backoff.Retry(func() error {
return conn.Emit(context.Background(), event, bytes)
}, bf)
if err != nil {
return err
}
}
return nil
}
+11 -10
View File
@@ -1,7 +1,9 @@
package service
import (
"github.com/integration-system/isp-lib/structure"
"sort"
"github.com/integration-system/isp-lib/v2/structure"
log "github.com/integration-system/isp-log"
"isp-config-service/cluster"
"isp-config-service/codes"
@@ -10,7 +12,6 @@ import (
"isp-config-service/holder"
"isp-config-service/model"
"isp-config-service/store/state"
"sort"
)
var (
@@ -67,8 +68,8 @@ func (moduleRegistryService) HandleDeleteModulesCommand(deleteModules cluster.De
configsToDelete := state.WritableConfigs().GetByModuleIds(ids)
confIds := make([]string, 0, len(configsToDelete))
for _, conf := range configsToDelete {
confIds = append(confIds, conf.Id)
for i := range configsToDelete {
confIds = append(confIds, configsToDelete[i].Id)
}
state.WritableConfigs().DeleteByIds(confIds)
@@ -124,14 +125,14 @@ func (moduleRegistryService) GetAggregatedModuleInfo(state state.ReadonlyState)
}
configs := state.Configs().GetByModuleIds(idList)
for _, cfg := range configs {
info := resMap[cfg.ModuleId]
for i := range configs {
info := resMap[configs[i].ModuleId]
info.Configs = append(info.Configs, domain.ConfigModuleInfo{
Config: cfg,
Config: configs[i],
Valid: false,
})
resMap[cfg.ModuleId] = info
resMap[configs[i].ModuleId] = info
}
schemas := state.Schemas().GetByModuleIds(idList)
for _, s := range schemas {
@@ -139,8 +140,8 @@ func (moduleRegistryService) GetAggregatedModuleInfo(state state.ReadonlyState)
schema := s.Schema
info.ConfigSchema = &schema
for i, config := range info.Configs {
dataForValidate := ConfigService.CompileConfig(config.Data, state, config.CommonConfigs...)
for i := range info.Configs {
dataForValidate := ConfigService.CompileConfig(info.Configs[i].Data, state, info.Configs[i].CommonConfigs...)
info.Configs[i].Valid, _ = ConfigService.validateSchema(s, dataForValidate)
}
+14 -14
View File
@@ -3,15 +3,15 @@ package service
import (
"context"
"encoding/json"
"github.com/cenkalti/backoff"
etp "github.com/integration-system/isp-etp-go"
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/utils"
"github.com/cenkalti/backoff/v4"
etp "github.com/integration-system/isp-etp-go/v2"
"github.com/integration-system/isp-lib/v2/structure"
"github.com/integration-system/isp-lib/v2/utils"
log "github.com/integration-system/isp-log"
"isp-config-service/codes"
"isp-config-service/holder"
"isp-config-service/store/state"
"time"
)
const (
@@ -22,8 +22,8 @@ var RoutesService routesService
type routesService struct{}
func (rs *routesService) HandleDisconnect(connId string) {
holder.EtpServer.Rooms().LeaveByConnId(connId, RoutesSubscribersRoom)
func (rs *routesService) HandleDisconnect(connID string) {
holder.EtpServer.Rooms().LeaveByConnId(connID, RoutesSubscribersRoom)
}
func (rs *routesService) SubscribeRoutes(conn etp.Conn, mesh state.ReadonlyMesh) {
@@ -48,13 +48,13 @@ func (rs *routesService) BroadcastRoutes(mesh state.ReadonlyMesh) {
}
func (rs *routesService) broadcastRoutes(event string, routes structure.RoutingConfig) error {
if bytes, err := json.Marshal(routes); err != nil {
bytes, err := json.Marshal(routes)
if err != nil {
return err
}
err = holder.EtpServer.BroadcastToRoom(RoutesSubscribersRoom, event, bytes)
if err != nil {
return err
} else {
err = holder.EtpServer.BroadcastToRoom(RoutesSubscribersRoom, event, bytes)
if err != nil {
return err
}
}
return nil
}
@@ -63,7 +63,7 @@ func (rs *routesService) sendRoutes(conn etp.Conn, event string, routes structur
if bytes, err := json.Marshal(routes); err != nil {
return err
} else {
bf := backoff.WithMaxRetries(backoff.NewConstantBackOff(100*time.Millisecond), 3)
bf := backoff.WithMaxRetries(backoff.NewConstantBackOff(messagesBackoffInterval), messagesBackoffMaxRetries)
err := backoff.Retry(func() error {
return conn.Emit(context.Background(), event, bytes)
}, bf)
+1 -1
View File
@@ -1,7 +1,7 @@
package store
import (
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/v2/structure"
"github.com/pkg/errors"
"isp-config-service/cluster"
"isp-config-service/domain"
+5 -5
View File
@@ -6,22 +6,22 @@ import (
"isp-config-service/store/state"
)
func NewStateFromRepository() (state.State, error) {
func NewStateFromRepository() (*state.State, error) {
configs, err := model.ConfigRep.Snapshot()
if err != nil {
return state.State{}, errors.WithMessage(err, "restore configs")
return nil, errors.WithMessage(err, "restore configs")
}
schemas, err := model.SchemaRep.Snapshot()
if err != nil {
return state.State{}, errors.WithMessage(err, "load config schemas")
return nil, errors.WithMessage(err, "load config schemas")
}
modules, err := model.ModuleRep.Snapshot()
if err != nil {
return state.State{}, errors.WithMessage(err, "load modules registry")
return nil, errors.WithMessage(err, "load modules registry")
}
commonConfigs, err := model.CommonConfigRep.Snapshot()
if err != nil {
return state.State{}, errors.WithMessage(err, "load common configs")
return nil, errors.WithMessage(err, "load common configs")
}
st := state.NewStateFromSnapshot(configs, schemas, modules, commonConfigs)
+14 -14
View File
@@ -18,13 +18,13 @@ type ReadonlyCommonConfigStore interface {
}
type CommonConfigStore struct {
configs []entity.CommonConfig
Configs []entity.CommonConfig
}
func (cs CommonConfigStore) GetByIds(ids []string) []entity.CommonConfig {
idsMap := StringsToMap(ids)
configs := make([]entity.CommonConfig, 0, len(ids))
for _, config := range cs.configs {
for _, config := range cs.Configs {
if _, found := idsMap[config.Id]; found {
configs = append(configs, config)
}
@@ -34,7 +34,7 @@ func (cs CommonConfigStore) GetByIds(ids []string) []entity.CommonConfig {
func (cs CommonConfigStore) GetByName(name string) []entity.CommonConfig {
configs := make([]entity.CommonConfig, 0)
for _, config := range cs.configs {
for _, config := range cs.Configs {
if config.Name == name {
configs = append(configs, config)
}
@@ -49,14 +49,14 @@ func (cs *CommonConfigStore) Create(config entity.CommonConfig) entity.CommonCon
if config.Data == nil {
config.Data = make(entity.ConfigData)
}
cs.configs = append(cs.configs, config)
cs.Configs = append(cs.Configs, config)
return config
}
func (cs *CommonConfigStore) UpdateById(config entity.CommonConfig) {
for i := range cs.configs {
if cs.configs[i].Id == config.Id {
cs.configs[i] = config
for i := range cs.Configs {
if cs.Configs[i].Id == config.Id {
cs.Configs[i] = config
break
}
}
@@ -65,12 +65,12 @@ func (cs *CommonConfigStore) UpdateById(config entity.CommonConfig) {
func (cs *CommonConfigStore) DeleteByIds(ids []string) int {
idsMap := StringsToMap(ids)
var deleted int
for i := 0; i < len(cs.configs); i++ {
id := cs.configs[i].Id
for i := 0; i < len(cs.Configs); i++ {
id := cs.Configs[i].Id
if _, ok := idsMap[id]; ok {
// change configs ordering
cs.configs[i] = cs.configs[len(cs.configs)-1]
cs.configs = cs.configs[:len(cs.configs)-1]
cs.Configs[i] = cs.Configs[len(cs.Configs)-1]
cs.Configs = cs.Configs[:len(cs.Configs)-1]
deleted++
}
}
@@ -78,11 +78,11 @@ func (cs *CommonConfigStore) DeleteByIds(ids []string) int {
}
func (cs *CommonConfigStore) GetAll() []entity.CommonConfig {
response := make([]entity.CommonConfig, len(cs.configs))
copy(response, cs.configs)
response := make([]entity.CommonConfig, len(cs.Configs))
copy(response, cs.Configs)
return response
}
func NewCommonConfigStore() *CommonConfigStore {
return &CommonConfigStore{configs: make([]entity.CommonConfig, 0)}
return &CommonConfigStore{Configs: make([]entity.CommonConfig, 0)}
}
+33 -31
View File
@@ -1,8 +1,9 @@
package state
import (
"isp-config-service/entity"
"time"
"isp-config-service/entity"
)
const (
@@ -25,12 +26,13 @@ type ReadonlyConfigStore interface {
}
type ConfigStore struct {
configs []entity.Config
Configs []entity.Config
}
func (cs ConfigStore) GetActiveByModuleId(moduleId string) *entity.Config {
for _, conf := range cs.configs {
if conf.ModuleId == moduleId && conf.Active {
for i := range cs.Configs {
if cs.Configs[i].ModuleId == moduleId && cs.Configs[i].Active {
conf := cs.Configs[i]
return &conf
}
}
@@ -40,9 +42,9 @@ func (cs ConfigStore) GetActiveByModuleId(moduleId string) *entity.Config {
func (cs ConfigStore) GetByIds(ids []string) []entity.Config {
idsMap := StringsToMap(ids)
result := make([]entity.Config, 0, len(ids))
for _, conf := range cs.configs {
if _, ok := idsMap[conf.Id]; ok {
result = append(result, conf)
for i := range cs.Configs {
if _, ok := idsMap[cs.Configs[i].Id]; ok {
result = append(result, cs.Configs[i])
}
}
return result
@@ -51,9 +53,9 @@ func (cs ConfigStore) GetByIds(ids []string) []entity.Config {
func (cs ConfigStore) GetByModuleIds(ids []string) []entity.Config {
idsMap := StringsToMap(ids)
result := make([]entity.Config, 0, len(ids))
for _, conf := range cs.configs {
if _, ok := idsMap[conf.ModuleId]; ok {
result = append(result, conf)
for i := range cs.Configs {
if _, ok := idsMap[cs.Configs[i].ModuleId]; ok {
result = append(result, cs.Configs[i])
}
}
return result
@@ -73,14 +75,14 @@ func (cs *ConfigStore) Create(config entity.Config) entity.Config {
if config.CommonConfigs == nil {
config.CommonConfigs = make([]string, 0)
}
cs.configs = append(cs.configs, config)
cs.Configs = append(cs.Configs, config)
return config
}
func (cs *ConfigStore) UpdateById(config entity.Config) {
for i := range cs.configs {
if cs.configs[i].Id == config.Id {
cs.configs[i] = config
for i := range cs.Configs {
if cs.Configs[i].Id == config.Id {
cs.Configs[i] = config
break
}
}
@@ -88,10 +90,10 @@ func (cs *ConfigStore) UpdateById(config entity.Config) {
func (cs *ConfigStore) calcNewVersion(moduleId string) int32 {
var maxVersion int32 = 0
for i := range cs.configs {
if cs.configs[i].ModuleId == moduleId {
if cs.configs[i].Version > maxVersion {
maxVersion = cs.configs[i].Version
for i := range cs.Configs {
if cs.Configs[i].ModuleId == moduleId {
if cs.Configs[i].Version > maxVersion {
maxVersion = cs.Configs[i].Version
}
}
}
@@ -101,12 +103,12 @@ func (cs *ConfigStore) calcNewVersion(moduleId string) int32 {
func (cs *ConfigStore) DeleteByIds(ids []string) int {
idsMap := StringsToMap(ids)
var deleted int
for i := 0; i < len(cs.configs); i++ {
id := cs.configs[i].Id
for i := 0; i < len(cs.Configs); i++ {
id := cs.Configs[i].Id
if _, ok := idsMap[id]; ok {
// change configs ordering
cs.configs[i] = cs.configs[len(cs.configs)-1]
cs.configs = cs.configs[:len(cs.configs)-1]
cs.Configs[i] = cs.Configs[len(cs.Configs)-1]
cs.Configs = cs.Configs[:len(cs.Configs)-1]
deleted++
}
}
@@ -124,11 +126,11 @@ func (cs *ConfigStore) Activate(config entity.Config, date time.Time) []entity.C
func (cs *ConfigStore) deactivate(moduleId string, date time.Time) []entity.Config {
affected := make([]entity.Config, 0)
for i := range cs.configs {
if cs.configs[i].ModuleId == moduleId && cs.configs[i].Active {
cs.configs[i].Active = false
cs.configs[i].UpdatedAt = date
affected = append(affected, cs.configs[i])
for i := range cs.Configs {
if cs.Configs[i].ModuleId == moduleId && cs.Configs[i].Active {
cs.Configs[i].Active = false
cs.Configs[i].UpdatedAt = date
affected = append(affected, cs.Configs[i])
}
}
return affected
@@ -137,10 +139,10 @@ func (cs *ConfigStore) deactivate(moduleId string, date time.Time) []entity.Conf
func (cs *ConfigStore) FilterByCommonConfigs(commonIds []string) []entity.Config {
idsMap := StringsToMap(commonIds)
result := make([]entity.Config, 0)
for _, cfg := range cs.configs {
for _, commonId := range cfg.CommonConfigs {
for i := range cs.Configs {
for _, commonId := range cs.Configs[i].CommonConfigs {
if _, ok := idsMap[commonId]; ok {
result = append(result, cfg)
result = append(result, cs.Configs[i])
break
}
}
@@ -149,5 +151,5 @@ func (cs *ConfigStore) FilterByCommonConfigs(commonIds []string) []entity.Config
}
func NewConfigStore() *ConfigStore {
return &ConfigStore{configs: make([]entity.Config, 0)}
return &ConfigStore{Configs: make([]entity.Config, 0)}
}
+12 -12
View File
@@ -1,7 +1,7 @@
package state
import (
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/v2/structure"
)
type WriteableMesh interface {
@@ -22,12 +22,12 @@ type NodesMap map[string]structure.BackendDeclaration
type Mesh struct {
// { "ModuleName": { "address": BackendDeclaration, ...}, ... }
modulesMap map[string]NodesMap
ModulesMap map[string]NodesMap
}
func (m Mesh) BackendExist(backend structure.BackendDeclaration) (exist bool) {
address := backend.Address.GetAddress()
if nodes, ok := m.modulesMap[backend.ModuleName]; ok {
if nodes, ok := m.ModulesMap[backend.ModuleName]; ok {
if _, ok := nodes[address]; ok {
exist = true
}
@@ -37,7 +37,7 @@ func (m Mesh) BackendExist(backend structure.BackendDeclaration) (exist bool) {
func (m Mesh) GetBackends(module string) []structure.BackendDeclaration {
declarations := make([]structure.BackendDeclaration, 0)
if nodes, ok := m.modulesMap[module]; ok {
if nodes, ok := m.ModulesMap[module]; ok {
for _, backend := range nodes {
declarations = append(declarations, backend)
}
@@ -47,7 +47,7 @@ func (m Mesh) GetBackends(module string) []structure.BackendDeclaration {
func (m Mesh) GetModuleAddresses(moduleName string) []structure.AddressConfiguration {
addressList := make([]structure.AddressConfiguration, 0)
if nodes, ok := m.modulesMap[moduleName]; ok {
if nodes, ok := m.ModulesMap[moduleName]; ok {
for _, backend := range nodes {
addressList = append(addressList, backend.Address)
}
@@ -57,7 +57,7 @@ func (m Mesh) GetModuleAddresses(moduleName string) []structure.AddressConfigura
func (m Mesh) GetRoutes() structure.RoutingConfig {
routes := structure.RoutingConfig{}
for _, node := range m.modulesMap {
for _, node := range m.ModulesMap {
for _, backend := range node {
routes = append(routes, backend)
}
@@ -67,7 +67,7 @@ func (m Mesh) GetRoutes() structure.RoutingConfig {
func (m Mesh) CheckBackendChanged(backend structure.BackendDeclaration) (changed bool) {
address := backend.Address.GetAddress()
if nodes, ok := m.modulesMap[backend.ModuleName]; ok {
if nodes, ok := m.ModulesMap[backend.ModuleName]; ok {
if oldBackend, ok := nodes[address]; ok {
if oldBackend.Version != backend.Version || !oldBackend.IsPathsEqual(backend.Endpoints) || oldBackend.LibVersion != backend.LibVersion {
changed = true
@@ -83,7 +83,7 @@ func (m Mesh) CheckBackendChanged(backend structure.BackendDeclaration) (changed
func (m *Mesh) UpsertBackend(backend structure.BackendDeclaration) (changed bool) {
address := backend.Address.GetAddress()
if nodes, ok := m.modulesMap[backend.ModuleName]; ok {
if nodes, ok := m.ModulesMap[backend.ModuleName]; ok {
if oldBackend, ok := nodes[address]; ok {
if oldBackend.Version != backend.Version || !oldBackend.IsPathsEqual(backend.Endpoints) || oldBackend.LibVersion != backend.LibVersion {
nodes[address] = backend
@@ -94,7 +94,7 @@ func (m *Mesh) UpsertBackend(backend structure.BackendDeclaration) (changed bool
changed = true
}
} else {
m.modulesMap[backend.ModuleName] = NodesMap{address: backend}
m.ModulesMap[backend.ModuleName] = NodesMap{address: backend}
changed = true
}
return
@@ -102,18 +102,18 @@ func (m *Mesh) UpsertBackend(backend structure.BackendDeclaration) (changed bool
func (m *Mesh) DeleteBackend(backend structure.BackendDeclaration) (deleted bool) {
address := backend.Address.GetAddress()
if nodes, ok := m.modulesMap[backend.ModuleName]; ok {
if nodes, ok := m.ModulesMap[backend.ModuleName]; ok {
if _, ok := nodes[address]; ok {
delete(nodes, address)
deleted = true
}
if len(nodes) == 0 {
delete(m.modulesMap, backend.ModuleName)
delete(m.ModulesMap, backend.ModuleName)
}
}
return
}
func NewMesh() *Mesh {
return &Mesh{modulesMap: make(map[string]NodesMap)}
return &Mesh{ModulesMap: make(map[string]NodesMap)}
}
+15 -15
View File
@@ -18,11 +18,11 @@ type ReadonlyModuleStore interface {
}
type ModuleStore struct {
modules []entity.Module
Modules []entity.Module
}
func (ms ModuleStore) GetByName(name string) *entity.Module {
for _, module := range ms.modules {
for _, module := range ms.Modules {
if module.Name == name {
return &module
}
@@ -31,7 +31,7 @@ func (ms ModuleStore) GetByName(name string) *entity.Module {
}
func (ms ModuleStore) GetById(id string) *entity.Module {
for _, module := range ms.modules {
for _, module := range ms.Modules {
if module.Id == id {
return &module
}
@@ -40,39 +40,39 @@ func (ms ModuleStore) GetById(id string) *entity.Module {
}
func (ms *ModuleStore) UpdateByName(module entity.Module) {
for i := range ms.modules {
if ms.modules[i].Name == module.Name {
ms.modules[i] = module
for i := range ms.Modules {
if ms.Modules[i].Name == module.Name {
ms.Modules[i] = module
return
}
}
}
func (ms *ModuleStore) Create(module entity.Module) {
ms.modules = append(ms.modules, module)
ms.Modules = append(ms.Modules, module)
}
func (ms *ModuleStore) DeleteByIds(ids []string) []entity.Module {
idsMap := StringsToMap(ids)
var deleted []entity.Module
for i := 0; i < len(ms.modules); i++ {
id := ms.modules[i].Id
for i := 0; i < len(ms.Modules); i++ {
id := ms.Modules[i].Id
if _, ok := idsMap[id]; ok {
// change modules ordering
deleted = append(deleted, ms.modules[i])
ms.modules[i] = ms.modules[len(ms.modules)-1]
ms.modules = ms.modules[:len(ms.modules)-1]
deleted = append(deleted, ms.Modules[i])
ms.Modules[i] = ms.Modules[len(ms.Modules)-1]
ms.Modules = ms.Modules[:len(ms.Modules)-1]
}
}
return deleted
}
func (ms *ModuleStore) GetAll() []entity.Module {
response := make([]entity.Module, len(ms.modules))
copy(response, ms.modules)
response := make([]entity.Module, len(ms.Modules))
copy(response, ms.Modules)
return response
}
func NewModuleStore() *ModuleStore {
return &ModuleStore{modules: make([]entity.Module, 0)}
return &ModuleStore{Modules: make([]entity.Module, 0)}
}
+10 -10
View File
@@ -15,13 +15,13 @@ type ReadonlySchemaStore interface {
}
type SchemaStore struct {
schemas []entity.ConfigSchema
Schemas []entity.ConfigSchema
}
func (ss SchemaStore) GetByModuleIds(ids []string) []entity.ConfigSchema {
idsMap := StringsToMap(ids)
result := make([]entity.ConfigSchema, 0, len(ids))
for _, schema := range ss.schemas {
for _, schema := range ss.Schemas {
if _, ok := idsMap[schema.ModuleId]; ok {
result = append(result, schema)
}
@@ -32,12 +32,12 @@ func (ss SchemaStore) GetByModuleIds(ids []string) []entity.ConfigSchema {
func (ss *SchemaStore) DeleteByIds(ids []string) int {
idsMap := StringsToMap(ids)
var deleted int
for i := 0; i < len(ss.schemas); i++ {
id := ss.schemas[i].Id
for i := 0; i < len(ss.Schemas); i++ {
id := ss.Schemas[i].Id
if _, ok := idsMap[id]; ok {
// change schemas ordering
ss.schemas[i] = ss.schemas[len(ss.schemas)-1]
ss.schemas = ss.schemas[:len(ss.schemas)-1]
ss.Schemas[i] = ss.Schemas[len(ss.Schemas)-1]
ss.Schemas = ss.Schemas[:len(ss.Schemas)-1]
deleted++
}
}
@@ -45,18 +45,18 @@ func (ss *SchemaStore) DeleteByIds(ids []string) int {
}
func (ss *SchemaStore) Upsert(schema entity.ConfigSchema) entity.ConfigSchema {
for key, value := range ss.schemas {
for key, value := range ss.Schemas {
if value.ModuleId == schema.ModuleId {
schema.Id = value.Id
schema.CreatedAt = value.CreatedAt
ss.schemas[key] = schema
ss.Schemas[key] = schema
return schema
}
}
ss.schemas = append(ss.schemas, schema)
ss.Schemas = append(ss.Schemas, schema)
return schema
}
func NewSchemaStore() *SchemaStore {
return &SchemaStore{schemas: make([]entity.ConfigSchema, 0)}
return &SchemaStore{Schemas: make([]entity.ConfigSchema, 0)}
}
+30 -29
View File
@@ -5,51 +5,51 @@ import (
)
type State struct {
mesh *Mesh
configs *ConfigStore
schemas *SchemaStore
modules *ModuleStore
commonConfigs *CommonConfigStore
MeshStore *Mesh
ConfigsStore *ConfigStore
SchemasStore *SchemaStore
ModulesStore *ModuleStore
CommonConfigsStore *CommonConfigStore
}
func (s State) Mesh() ReadonlyMesh {
return s.mesh
return s.MeshStore
}
func (s State) Configs() ReadonlyConfigStore {
return s.configs
return s.ConfigsStore
}
func (s State) Schemas() ReadonlySchemaStore {
return s.schemas
return s.SchemasStore
}
func (s State) Modules() ReadonlyModuleStore {
return s.modules
return s.ModulesStore
}
func (s State) CommonConfigs() ReadonlyCommonConfigStore {
return s.commonConfigs
return s.CommonConfigsStore
}
func (s *State) WritableMesh() WriteableMesh {
return s.mesh
return s.MeshStore
}
func (s *State) WritableConfigs() WriteableConfigStore {
return s.configs
return s.ConfigsStore
}
func (s *State) WritableSchemas() WriteableSchemaStore {
return s.schemas
return s.SchemasStore
}
func (s *State) WritableModules() WriteableModuleStore {
return s.modules
return s.ModulesStore
}
func (s *State) WritableCommonConfigs() WriteableCommonConfigStore {
return s.commonConfigs
return s.CommonConfigsStore
}
type WritableState interface {
@@ -69,22 +69,23 @@ type ReadonlyState interface {
CommonConfigs() ReadonlyCommonConfigStore
}
func NewState() State {
return State{
mesh: NewMesh(),
configs: NewConfigStore(),
schemas: NewSchemaStore(),
modules: NewModuleStore(),
commonConfigs: NewCommonConfigStore(),
func NewState() *State {
return &State{
MeshStore: NewMesh(),
ConfigsStore: NewConfigStore(),
SchemasStore: NewSchemaStore(),
ModulesStore: NewModuleStore(),
CommonConfigsStore: NewCommonConfigStore(),
}
}
func NewStateFromSnapshot(configs []entity.Config, schemas []entity.ConfigSchema, modules []entity.Module, commConfigs []entity.CommonConfig) State {
return State{
mesh: NewMesh(),
configs: &ConfigStore{configs: configs},
schemas: &SchemaStore{schemas: schemas},
modules: &ModuleStore{modules: modules},
commonConfigs: &CommonConfigStore{configs: commConfigs},
func NewStateFromSnapshot(configs []entity.Config, schemas []entity.ConfigSchema,
modules []entity.Module, commConfigs []entity.CommonConfig) *State {
return &State{
MeshStore: NewMesh(),
ConfigsStore: &ConfigStore{Configs: configs},
SchemasStore: &SchemaStore{Schemas: schemas},
ModulesStore: &ModuleStore{Modules: modules},
CommonConfigsStore: &CommonConfigStore{Configs: commConfigs},
}
}
+8 -7
View File
@@ -3,16 +3,17 @@ package store
import (
"encoding/binary"
"fmt"
"io"
"sync"
"github.com/hashicorp/raft"
log "github.com/integration-system/isp-log"
jsoniter "github.com/json-iterator/go"
"github.com/mohae/deepcopy"
"github.com/pkg/errors"
"io"
"isp-config-service/cluster"
"isp-config-service/codes"
"isp-config-service/store/state"
"sync"
)
var (
@@ -29,7 +30,7 @@ func (s *Store) Apply(l *raft.Log) interface{} {
s.lock.Lock()
defer s.lock.Unlock()
if len(l.Data) < 8 {
if len(l.Data) < cluster.CommandSizeBytes {
log.Errorf(codes.ApplyLogCommandError, "invalid log data command: %s", l.Data)
}
command := binary.BigEndian.Uint64(l.Data[:8])
@@ -63,7 +64,7 @@ func (s *Store) Apply(l *raft.Log) interface{} {
func (s *Store) Snapshot() (raft.FSMSnapshot, error) {
s.lock.Lock()
copied := deepcopy.Copy(s.state).(state.State)
copied := deepcopy.Copy(s.state).(*state.State)
s.lock.Unlock()
return &fsmSnapshot{copied}, nil
}
@@ -91,7 +92,7 @@ func (s *Store) VisitState(f func(writableState state.WritableState)) {
}
type fsmSnapshot struct {
state state.State
state *state.State
}
func (f *fsmSnapshot) Persist(sink raft.SnapshotSink) error {
@@ -114,9 +115,9 @@ func (f *fsmSnapshot) Persist(sink raft.SnapshotSink) error {
func (f *fsmSnapshot) Release() {}
func NewStateStore(st state.State) *Store {
func NewStateStore(st *state.State) *Store {
store := &Store{
state: &st,
state: st,
}
store.handlers = map[uint64]func([]byte) (interface{}, error){
cluster.UpdateBackendDeclarationCommand: store.applyUpdateBackendDeclarationCommand,
+51
View File
@@ -0,0 +1,51 @@
package store
import (
"bytes"
"github.com/stretchr/testify/assert"
"isp-config-service/entity"
state2 "isp-config-service/store/state"
"testing"
"time"
)
type mockSnapshotSink struct {
bytes.Buffer
}
func (d mockSnapshotSink) Close() error {
return nil
}
func (d mockSnapshotSink) ID() string {
panic("implement me")
}
func (d mockSnapshotSink) Cancel() error {
panic("implement me")
}
func TestStore_SnapshotRestore(t *testing.T) {
state := state2.NewState()
state.WritableModules().Create(entity.Module{
Id: state2.GenerateId(),
Name: "name1",
CreatedAt: time.Now().Round(time.Millisecond),
LastConnectedAt: time.Now().Round(time.Millisecond),
LastDisconnectedAt: time.Now().Round(time.Millisecond),
})
store := NewStateStore(state)
snapshot, err := store.Snapshot()
assert.NoError(t, err)
sink := mockSnapshotSink{}
err = snapshot.Persist(&sink)
assert.NoError(t, err)
newState := state2.NewState()
store.state = newState
err = store.Restore(&sink)
assert.NoError(t, err)
assert.Equal(t, state, store.state)
}
+13 -13
View File
@@ -2,12 +2,13 @@ package subs
import (
"fmt"
"github.com/asaskevich/govalidator"
etp "github.com/integration-system/isp-etp-go"
"github.com/integration-system/isp-lib/bootstrap"
schema2 "github.com/integration-system/isp-lib/config/schema"
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/utils"
etp "github.com/integration-system/isp-etp-go/v2"
"github.com/integration-system/isp-lib/v2/bootstrap"
schema2 "github.com/integration-system/isp-lib/v2/config/schema"
"github.com/integration-system/isp-lib/v2/structure"
"github.com/integration-system/isp-lib/v2/utils"
log "github.com/integration-system/isp-log"
"isp-config-service/cluster"
"isp-config-service/entity"
@@ -15,7 +16,7 @@ import (
"isp-config-service/store/state"
)
func (h *socketEventHandler) handleModuleReady(conn etp.Conn, data []byte) []byte {
func (h *SocketEventHandler) handleModuleReady(conn etp.Conn, data []byte) []byte {
moduleName, _ := Parameters(conn) // REMOVE
log.Debugf(0, "handleModuleReady moduleName: %s", moduleName) // REMOVE
declaration := structure.BackendDeclaration{}
@@ -37,7 +38,7 @@ func (h *socketEventHandler) handleModuleReady(conn etp.Conn, data []byte) []byt
return []byte(utils.WsOkResponse)
}
func (h *socketEventHandler) handleModuleRequirements(conn etp.Conn, data []byte) []byte {
func (h *SocketEventHandler) handleModuleRequirements(conn etp.Conn, data []byte) []byte {
moduleName, err := Parameters(conn)
log.Debugf(0, "handleModuleRequirements moduleName: %s", moduleName) // REMOVE
if err != nil {
@@ -59,7 +60,7 @@ func (h *socketEventHandler) handleModuleRequirements(conn etp.Conn, data []byte
return []byte(utils.WsOkResponse)
}
func (h *socketEventHandler) handleConfigSchema(conn etp.Conn, data []byte) []byte {
func (h *SocketEventHandler) handleConfigSchema(conn etp.Conn, data []byte) []byte {
moduleName, err := Parameters(conn)
log.Debugf(0, "handleConfigSchema moduleName: %s", moduleName) // REMOVE
if err != nil {
@@ -95,7 +96,10 @@ func (h *socketEventHandler) handleConfigSchema(conn etp.Conn, data []byte) []by
h.store.VisitReadonlyState(func(readState state.ReadonlyState) {
configs = readState.Configs().GetByModuleIds([]string{module.Id})
})
if len(configs) == 0 && len(configSchema.DefaultConfig) > 0 {
if len(configs) == 0 { //create empty default config
if configSchema.DefaultConfig == nil {
configSchema.DefaultConfig = make(map[string]interface{})
}
config := entity.Config{
Id: state.GenerateId(),
Name: module.Name,
@@ -115,7 +119,3 @@ func (h *socketEventHandler) handleConfigSchema(conn etp.Conn, data []byte) []by
}
return []byte(utils.WsOkResponse)
}
func (h *socketEventHandler) handleRequestConfig(conn etp.Conn, data []byte) []byte {
panic("not implemented")
}
+4 -4
View File
@@ -1,27 +1,27 @@
package subs
import (
etp "github.com/integration-system/isp-etp-go"
etp "github.com/integration-system/isp-etp-go/v2"
log "github.com/integration-system/isp-log"
"isp-config-service/cluster"
"isp-config-service/codes"
"isp-config-service/holder"
)
func (h *socketEventHandler) applyCommandOnLeader(_ etp.Conn, cmd []byte) []byte {
func (h *SocketEventHandler) applyCommandOnLeader(_ etp.Conn, cmd []byte) (data []byte) {
cmdCopy := make([]byte, len(cmd))
copy(cmdCopy, cmd)
obj, err := holder.ClusterClient.SyncApplyOnLeader(cmdCopy)
if err != nil {
var logResponse cluster.ApplyLogResponse
logResponse.ApplyError = err.Error()
data, err := json.Marshal(obj)
data, err = json.Marshal(obj)
if err != nil {
log.Fatalf(codes.SyncApplyError, "marshaling ApplyLogResponse: %v", err)
}
return data
}
data, err := json.Marshal(obj)
data, err = json.Marshal(obj)
if err != nil {
log.Fatalf(codes.SyncApplyError, "marshaling ApplyLogResponse: %v", err)
}
+3 -4
View File
@@ -1,9 +1,9 @@
package subs
import (
etp "github.com/integration-system/isp-etp-go"
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/utils"
etp "github.com/integration-system/isp-etp-go/v2"
"github.com/integration-system/isp-lib/v2/structure"
"github.com/integration-system/isp-lib/v2/utils"
"isp-config-service/cluster"
)
@@ -14,7 +14,6 @@ type connectionState struct {
func IsConfigClusterNode(conn etp.Conn) bool {
isCluster := conn.URL().Query().Get(cluster.ClusterParam)
return isCluster == "true"
}
func Parameters(conn etp.Conn) (moduleName string, err error) {
+6 -2
View File
@@ -3,7 +3,8 @@ package subs
import (
"context"
"errors"
etp "github.com/integration-system/isp-etp-go"
etp "github.com/integration-system/isp-etp-go/v2"
log "github.com/integration-system/isp-log"
"isp-config-service/codes"
"isp-config-service/holder"
@@ -21,7 +22,10 @@ func EmitConn(conn etp.Conn, event string, body []byte) {
func SyncApplyCommand(command []byte, commandName string) (interface{}, error) {
applyLogResponse, err := holder.ClusterClient.SyncApply(command)
if err != nil {
log.Warnf(codes.SyncApplyError, "apply %s: %v", commandName, err)
log.WithMetadata(map[string]interface{}{
"command": string(command),
"commandName": commandName,
}).Warnf(codes.SyncApplyError, "apply command: %v", err)
return nil, err
}
if applyLogResponse != nil && applyLogResponse.ApplyError != "" {
+11 -11
View File
@@ -1,8 +1,8 @@
package subs
import (
etp "github.com/integration-system/isp-etp-go"
"github.com/integration-system/isp-lib/utils"
etp "github.com/integration-system/isp-etp-go/v2"
"github.com/integration-system/isp-lib/v2/utils"
log "github.com/integration-system/isp-log"
jsoniter "github.com/json-iterator/go"
"isp-config-service/cluster"
@@ -18,12 +18,12 @@ var (
json = jsoniter.ConfigFastest
)
type socketEventHandler struct {
type SocketEventHandler struct {
server etp.Server
store *store.Store
}
func (h *socketEventHandler) SubscribeAll() {
func (h *SocketEventHandler) SubscribeAll() {
h.server.
OnConnect(h.handleConnect).
OnDisconnect(h.handleDisconnect).
@@ -34,10 +34,10 @@ func (h *socketEventHandler) SubscribeAll() {
OnWithAck(utils.ModuleSendConfigSchema, h.handleConfigSchema)
}
func (h *socketEventHandler) handleConnect(conn etp.Conn) {
func (h *SocketEventHandler) handleConnect(conn etp.Conn) {
isClusterNode := IsConfigClusterNode(conn)
moduleName, err := Parameters(conn)
log.Debugf(0, "handleConnect: %s", moduleName) // REMOVE
log.Debugf(0, "handleConnect from %s", moduleName) // REMOVE
if err != nil {
EmitConn(conn, utils.ErrorConnection, FormatErrorConnection(err))
_ = conn.Close()
@@ -79,9 +79,9 @@ func (h *socketEventHandler) handleConnect(conn etp.Conn) {
EmitConn(conn, utils.ConfigSendConfigWhenConnected, data)
}
func (h *socketEventHandler) handleDisconnect(conn etp.Conn, disconnectErr error) {
func (h *SocketEventHandler) handleDisconnect(conn etp.Conn, disconnectErr error) {
moduleName, _ := Parameters(conn)
log.Debugf(0, "handleDisconnect: %s", moduleName) // REMOVE
log.Debugf(0, "handleDisconnect from %s", moduleName) // REMOVE
if moduleName != "" {
holder.EtpServer.Rooms().Leave(conn, moduleName+service.ConfigWatchersRoomSuffix)
now := state.GenerateDate()
@@ -105,12 +105,12 @@ func (h *socketEventHandler) handleDisconnect(conn etp.Conn, disconnectErr error
}
}
func (h *socketEventHandler) handleError(_ etp.Conn, err error) {
func (h *SocketEventHandler) handleError(_ etp.Conn, err error) {
log.Warnf(codes.WebsocketError, "isp-etp: %v", err)
}
func NewSocketEventHandler(server etp.Server, store *store.Store) *socketEventHandler {
return &socketEventHandler{
func NewSocketEventHandler(server etp.Server, store *store.Store) *SocketEventHandler {
return &SocketEventHandler{
server: server,
store: store,
}