Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
882228558d | ||
|
|
51360e802f | ||
|
|
7a06660597 | ||
|
|
4553cd0261 | ||
|
|
2bbc426bef | ||
|
|
b22a22cac9 | ||
|
|
cc7b931e0a | ||
|
|
d4a44b0d72 | ||
|
|
284a9bb444 | ||
|
|
ef4dc0e972 | ||
|
|
def031958b | ||
|
|
00c1936683 | ||
|
|
cc3aab1e7b | ||
|
|
c14de6d198 | ||
|
|
f9f8186451 | ||
|
|
0259cf84ce | ||
|
|
04ceb5f4fa | ||
|
|
6efcbe7c70 | ||
|
|
e0ce92a9f3 | ||
|
|
28e08e108a | ||
|
|
4e68903251 | ||
|
|
73515e5179 | ||
|
|
f752770788 | ||
|
|
6eb6efe844 | ||
|
|
837b8755a0 | ||
|
|
e3b5e867b1 | ||
|
|
362efd9546 | ||
|
|
a958874731 | ||
|
|
0d5094cfb5 | ||
|
|
74b32e064e | ||
|
|
3ad5dfe030 | ||
|
|
95242965da | ||
|
|
8c15105087 | ||
|
|
db68505cca | ||
|
|
795aee86d1 | ||
|
|
33621ff523 | ||
|
|
415a694228 | ||
|
|
1fe8b7f78d | ||
|
|
c2fc3c54da | ||
|
|
652c2d95b8 | ||
|
|
da1b6caf67 | ||
|
|
deafdfb7ab | ||
|
|
f9feaeab0b | ||
|
|
330c160122 | ||
|
|
238c7b3a44 | ||
|
|
1317696cb7 | ||
|
|
23108f2224 | ||
|
|
6b14252577 | ||
|
|
8386cd7503 | ||
|
|
c6225eeb3a | ||
|
|
a12c2fd120 | ||
|
|
9e503ab31f | ||
|
|
c31abb84c9 | ||
|
|
b1a0bc252f | ||
|
|
599b1639e7 | ||
|
|
1199f9ae8e | ||
|
|
cb8ae318c4 | ||
|
|
fec8a759bc | ||
|
|
5d4b54c39c | ||
|
|
4ebab3a967 | ||
|
|
73315e6671 | ||
|
|
db03a888fb | ||
|
|
7d4a5c4c6c | ||
|
|
94397ea4c7 | ||
|
|
e05319432e | ||
|
|
f1bce695fb | ||
|
|
7aad2697f7 | ||
|
|
848a2d74d6 | ||
|
|
a2a470ad93 | ||
|
|
78150b2661 | ||
|
|
ed2e1a0936 | ||
|
|
445389b7d8 | ||
|
|
1bb8cbf3ab | ||
|
|
ca6fe7b86e | ||
|
|
0b351ea3a2 | ||
|
|
05c5db53bd | ||
|
|
7632e07f4e | ||
|
|
1ddbe43618 | ||
|
|
79f83e245c | ||
|
|
d678f28909 | ||
|
|
c3e95fa98c | ||
|
|
e32e55df15 | ||
|
|
48eaf48797 | ||
|
|
ead505d40c | ||
|
|
a39a53561e | ||
|
|
ebf715c368 | ||
|
|
87f2c360c5 | ||
|
|
b0584b4ead | ||
|
|
1575a4cc34 | ||
|
|
1bc12d7a33 | ||
|
|
89707ff412 | ||
|
|
33b9e220d3 | ||
|
|
d3e39f66a2 | ||
|
|
48a991e11b | ||
|
|
3ef79e51ca | ||
|
|
d945add7a0 | ||
|
|
2e0e25de42 | ||
|
|
334043947a | ||
|
|
e5e8f2b962 | ||
|
|
a16ecbc8a9 | ||
|
|
3c6e9c75a9 | ||
|
|
980bcb2eb5 | ||
|
|
3b73722bca | ||
|
|
15f7a970b1 | ||
|
|
e6083dbe81 | ||
|
|
54a77441fd | ||
|
|
353cf671da | ||
|
|
02c280009b | ||
|
|
379db84504 | ||
|
|
bd56df8ed8 |
No files matched your search
@@ -1,60 +0,0 @@
|
||||
name: Create and publish a Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
APP_NAME: ${{ github.event.repository.name }}
|
||||
|
||||
jobs:
|
||||
build-and-push-image:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
attestations: write
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Get version from tag
|
||||
id: version_reader
|
||||
run: |
|
||||
VERSION=${GITHUB_REF_NAME#v}
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
driver: docker-container
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push Docker image
|
||||
id: push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version_reader.outputs.version }}
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
labels: |
|
||||
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
|
||||
org.opencontainers.image.version=${{ steps.version_reader.outputs.version }}
|
||||
build-args: |
|
||||
app_name=${{ env.APP_NAME }}
|
||||
version=${{ steps.version_reader.outputs.version }}
|
||||
- name: Generate artifact attestation
|
||||
uses: actions/attest-build-provenance@v2
|
||||
with:
|
||||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
|
||||
subject-digest: ${{ steps.push.outputs.digest }}
|
||||
push-to-registry: true
|
||||
+2
-6
@@ -9,8 +9,8 @@
|
||||
.idea/**/tasks.xml
|
||||
.idea/dictionaries
|
||||
*.iml
|
||||
convert_service
|
||||
convert-service
|
||||
config_service
|
||||
config-service
|
||||
|
||||
# Sensitive or high-churn files:
|
||||
.idea/**/dataSources/
|
||||
@@ -69,7 +69,3 @@ fabric.properties
|
||||
|
||||
/node_modules/
|
||||
/vendor/
|
||||
package.json
|
||||
yarn.lock
|
||||
|
||||
conf/config_dev.yml
|
||||
@@ -1,23 +0,0 @@
|
||||
docker-build:
|
||||
image: docker:20.10.16
|
||||
stage: build
|
||||
services:
|
||||
- docker:20.10.16-dind
|
||||
before_script:
|
||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||
- export VERSION=`cat .version `
|
||||
- echo $VERSION
|
||||
- echo $CI_DOCKER_FILE
|
||||
- echo $CI_REGISTRY
|
||||
script:
|
||||
- set
|
||||
- mkdir -p migrations
|
||||
- docker build -f Dockerfile.dit --force-rm --build-arg="version=$VERSION" --build-arg="app_name=$CI_PROJECT_NAME" --pull -t "$CI_REGISTRY/$CI_PROJECT_NAME:$VERSION" .
|
||||
- |
|
||||
docker tag "$CI_REGISTRY/$CI_PROJECT_NAME:$VERSION" "$CI_REGISTRY/$CI_PROJECT_NAME:latest"
|
||||
docker push "$CI_REGISTRY/$CI_PROJECT_NAME:$VERSION"
|
||||
docker push "$CI_REGISTRY/$CI_PROJECT_NAME:latest"
|
||||
docker rmi -f "$CI_REGISTRY/$CI_PROJECT_NAME:$VERSION"
|
||||
docker rmi -f "$CI_REGISTRY/$CI_PROJECT_NAME:latest"
|
||||
- docker logout $CI_REGISTRY
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
version: "2"
|
||||
run:
|
||||
allow-parallel-runners: true
|
||||
linters:
|
||||
default: all
|
||||
disable:
|
||||
- contextcheck # не имеет смысла
|
||||
- depguard # не всегда имеет смысл
|
||||
- dupword # не имеет смысла
|
||||
- exhaustruct # не имеет смысла
|
||||
- godot # не актуально для swagger
|
||||
- godox # не позволяет оставлять todo
|
||||
- gomoddirectives
|
||||
- musttag # у нас собственное правило: не используем теги, если работаем с пакетом isp-kit/json и с внутренними структурами(между нашими сервисами), при этом теги обязательный для всех внешних для нас структур
|
||||
- nlreturn # не всегда имеет смысл
|
||||
- nolintlint # Goland все равно форматирует с отступом
|
||||
- perfsprint # мнимая производительность в угоду читаемости
|
||||
- tagalign # не всегда имеет смысл
|
||||
- varnamelen # очень индивидуально (db)
|
||||
- wsl # расставление пробелов очень индивидуально
|
||||
- wsl_v5
|
||||
settings:
|
||||
cyclop:
|
||||
max-complexity: 15 # по умолчанию 10 мало
|
||||
funlen:
|
||||
lines: 80
|
||||
lll:
|
||||
line-length: 150
|
||||
revive:
|
||||
rules:
|
||||
- name: var-naming # отключаем Id -> ID
|
||||
disabled: true
|
||||
staticcheck:
|
||||
checks: # отключаем Id -> ID
|
||||
- -ST1000
|
||||
- -ST1016
|
||||
- -ST1020
|
||||
- -ST1021
|
||||
- -ST1022
|
||||
testifylint:
|
||||
disable:
|
||||
- compares
|
||||
- equal-values
|
||||
exclusions:
|
||||
generated: lax
|
||||
presets:
|
||||
- comments
|
||||
- common-false-positives
|
||||
- legacy
|
||||
- std-error-handling
|
||||
rules:
|
||||
- linters:
|
||||
- wrapcheck
|
||||
path: controller # достаточное кол-во контекста на уровне контроллеров
|
||||
- linters:
|
||||
- wrapcheck
|
||||
path: transaction # транзакции прозрачны
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
formatters:
|
||||
enable:
|
||||
- gofmt
|
||||
exclusions:
|
||||
generated: lax
|
||||
paths:
|
||||
- third_party$
|
||||
- builtin$
|
||||
- examples$
|
||||
@@ -0,0 +1,11 @@
|
||||
### v2.0.1
|
||||
* fix nil pointer dereference in repositories
|
||||
* increase default websocket ConnectionReadLimit to 4 MB, add to configuration
|
||||
|
||||
### v2.0.0
|
||||
* full rewrite to support cluster mode
|
||||
* change websocket protocol from socketio to etp
|
||||
|
||||
### v1.1.0
|
||||
* update libs
|
||||
* default config handling
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
FROM golang:1.25-alpine as builder
|
||||
WORKDIR /build
|
||||
ARG version
|
||||
ENV version_env=$version
|
||||
ARG app_name
|
||||
ENV app_name_env=$app_name
|
||||
COPY . .
|
||||
RUN apk update && apk upgrade && apk add --no-cache gcc musl-dev
|
||||
RUN go build -ldflags="-X 'main.version=$version_env'" -o /main .
|
||||
WORKDIR cmd/migrate
|
||||
RUN CGO_ENABLED=1 go build -o /migrate .
|
||||
|
||||
FROM alpine:3.22
|
||||
|
||||
RUN apk add --no-cache tzdata
|
||||
RUN cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
|
||||
RUN echo "Europe/Moscow" > /etc/timezone
|
||||
|
||||
COPY --from=builder migrate /migrate/migrate
|
||||
COPY cmd/migrate/config.yml /migrate/config.yml
|
||||
RUN chmod 666 /migrate/config.yml
|
||||
|
||||
ARG UID=10001
|
||||
RUN adduser \
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home "/nonexistent" \
|
||||
--shell "/sbin/nologin" \
|
||||
--no-create-home \
|
||||
--uid "${UID}" \
|
||||
appuser
|
||||
|
||||
USER appuser
|
||||
|
||||
WORKDIR /app
|
||||
ARG app_name
|
||||
ENV app_name_env=$app_name
|
||||
COPY --from=builder main /app/$app_name_env
|
||||
COPY /conf/config.yml /app/config.yml
|
||||
COPY /conf/default_remote_config.json* /app/default_remote_config.json
|
||||
COPY /migrations /app/migrations
|
||||
ENTRYPOINT /app/$app_name_env
|
||||
@@ -1,52 +0,0 @@
|
||||
FROM dockerhub.mos.ru/mosos/arbat:15.5 as builder
|
||||
RUN zypper --no-gpg-checks update -y && zypper --no-gpg-checks install -y go1.25 git
|
||||
WORKDIR /build
|
||||
ARG version
|
||||
ENV version_env=$version
|
||||
ARG app_name
|
||||
ENV app_name_env=$app_name
|
||||
COPY . .
|
||||
ENV GOPROXY=https://repo-mirror.mos.ru/repository/go-public
|
||||
RUN go build -ldflags="-X 'main.version=$version_env'" -o /main .
|
||||
WORKDIR cmd/migrate
|
||||
RUN CGO_ENABLED=1 go build -o /migrate .
|
||||
|
||||
FROM dockerhub.mos.ru/mosos/arbat:15.5
|
||||
|
||||
RUN cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
|
||||
RUN echo "Europe/Moscow" > /etc/timezone
|
||||
|
||||
COPY --from=builder migrate /migrate/migrate
|
||||
COPY cmd/migrate/config.yml /migrate/config.yml
|
||||
RUN chmod 666 /migrate/config.yml
|
||||
|
||||
ARG UID=10001
|
||||
RUN useradd \
|
||||
--home "/nonexistent" \
|
||||
--shell "/sbin/nologin" \
|
||||
--no-create-home \
|
||||
--uid "${UID}" \
|
||||
--user-group \
|
||||
appuser
|
||||
|
||||
RUN mkdir -p /app/data
|
||||
RUN chown appuser:appuser /app/data
|
||||
VOLUME /app/data
|
||||
|
||||
USER appuser
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ARG app_name
|
||||
ENV app_name_env=$app_name
|
||||
COPY --from=builder main /app/$app_name_env
|
||||
COPY /conf/config.yml /app/config.yml
|
||||
COPY /conf/default_remote_config.json* /app/default_remote_config.json
|
||||
COPY /migrations /app/migrations
|
||||
ENTRYPOINT /app/$app_name_env
|
||||
|
||||
COPY /conf/config.yml /app/config.yml
|
||||
COPY /conf/default_remote_config.json* /app/default_remote_config.json
|
||||
COPY /migrations /app/migrations
|
||||
|
||||
ENTRYPOINT /app/$app_name_env
|
||||
Generated
+783
@@ -0,0 +1,783 @@
|
||||
# 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:4a70938660ae196961d0285062fa7ae5b8abcf1c800f4c750803c06c2150a716"
|
||||
name = "github.com/integration-system/isp-etp-go"
|
||||
packages = [
|
||||
".",
|
||||
"ack",
|
||||
"bpool",
|
||||
"client",
|
||||
"gen",
|
||||
"parser",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "6e92a3dda2cf7c6ec82fc1a1ae922248754e49d9"
|
||||
version = "v2.0.0"
|
||||
|
||||
[[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
@@ -0,0 +1,41 @@
|
||||
# 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"
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -1,214 +0,0 @@
|
||||
package assembly
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"isp-config-service/conf"
|
||||
"isp-config-service/service/module/backend"
|
||||
"isp-config-service/service/variable"
|
||||
|
||||
httpEndpoint "github.com/txix-open/isp-kit/http/endpoint"
|
||||
"github.com/txix-open/isp-kit/http/endpoint/httplog"
|
||||
|
||||
"isp-config-service/controller"
|
||||
"isp-config-service/controller/api"
|
||||
"isp-config-service/repository"
|
||||
"isp-config-service/routes"
|
||||
apisvs "isp-config-service/service/api"
|
||||
"isp-config-service/service/event"
|
||||
"isp-config-service/service/metrics"
|
||||
"isp-config-service/service/module"
|
||||
"isp-config-service/service/rqlite/db"
|
||||
"isp-config-service/service/subscription"
|
||||
|
||||
"github.com/txix-open/etp/v4"
|
||||
"github.com/txix-open/isp-kit/grpc"
|
||||
"github.com/txix-open/isp-kit/grpc/endpoint"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
"github.com/txix-open/isp-kit/worker"
|
||||
)
|
||||
|
||||
const (
|
||||
wsReadLimit = 4 * 1024 * 1024
|
||||
handleEventsInterval = 500 * time.Millisecond
|
||||
cleanEventInterval = 60 * time.Second
|
||||
cleanPhantomBackendsInterval = 5 * time.Minute
|
||||
eventTtl = 60 * time.Second
|
||||
)
|
||||
|
||||
type LocalConfig struct {
|
||||
Local conf.Local
|
||||
RqliteAddress string
|
||||
}
|
||||
|
||||
type Locator struct {
|
||||
db db.DB
|
||||
cfg LocalConfig
|
||||
leaderChecker LeaderChecker
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
type LeaderChecker interface {
|
||||
IsLeader() bool
|
||||
}
|
||||
|
||||
type OwnBackendsCleaner interface {
|
||||
DeleteOwnBackends(ctx context.Context)
|
||||
}
|
||||
|
||||
func NewLocator(
|
||||
db db.DB,
|
||||
leaderChecker LeaderChecker,
|
||||
cfg LocalConfig,
|
||||
logger log.Logger,
|
||||
) Locator {
|
||||
return Locator{
|
||||
db: db,
|
||||
leaderChecker: leaderChecker,
|
||||
cfg: cfg,
|
||||
logger: logger,
|
||||
}
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
GrpcMux *grpc.Mux
|
||||
HttpMux http.Handler
|
||||
MetricsAdHandler http.Handler
|
||||
EtpSrv *etp.Server
|
||||
HandleEventWorker *worker.Worker
|
||||
CleanEventWorker *worker.Worker
|
||||
CleanPhantomBackendWorker *worker.Worker
|
||||
CleanBackupsWorker *worker.Worker
|
||||
OwnBackendsCleaner OwnBackendsCleaner
|
||||
}
|
||||
|
||||
//nolint:funlen
|
||||
func (l Locator) Config() *Config {
|
||||
moduleRepo := repository.NewModule(l.db)
|
||||
backendRepo := repository.NewBackend(l.db)
|
||||
eventRepo := repository.NewEvent(l.db)
|
||||
configRepo := repository.NewConfig(l.db)
|
||||
configSchemaRepo := repository.NewConfigSchema(l.db)
|
||||
configHistoryRepo := repository.NewConfigHistory(l.db)
|
||||
variableRepo := repository.NewVariable(l.db)
|
||||
|
||||
variableService := variable.NewService(variableRepo, configRepo, eventRepo)
|
||||
variableController := api.NewVariable(variableService)
|
||||
|
||||
etpSrv := etp.NewServer(
|
||||
etp.WithServerReadLimit(wsReadLimit),
|
||||
etp.WithServerAcceptOptions(&etp.AcceptOptions{
|
||||
InsecureSkipVerify: true,
|
||||
}),
|
||||
)
|
||||
emitter := module.NewEmitter(l.logger)
|
||||
subscriptionService := subscription.NewService(
|
||||
moduleRepo,
|
||||
backendRepo,
|
||||
configRepo,
|
||||
etpSrv.Rooms(),
|
||||
emitter,
|
||||
variableService,
|
||||
l.logger,
|
||||
)
|
||||
|
||||
backendService := backend.NewBackend(
|
||||
backendRepo,
|
||||
eventRepo,
|
||||
l.cfg.Local.Rqlite.NodeId,
|
||||
etpSrv.Rooms(),
|
||||
l.logger,
|
||||
)
|
||||
cleanPhantomBackendJob := backend.NewCleaner(backendService, l.logger)
|
||||
cleanPhantomBackendWorker := worker.New(cleanPhantomBackendJob, worker.WithInterval(cleanPhantomBackendsInterval))
|
||||
|
||||
moduleService := module.NewService(
|
||||
moduleRepo,
|
||||
backendService,
|
||||
configRepo,
|
||||
configSchemaRepo,
|
||||
subscriptionService,
|
||||
emitter,
|
||||
variableService,
|
||||
l.logger,
|
||||
)
|
||||
moduleController := controller.NewModule(moduleService, l.logger)
|
||||
|
||||
configHistoryApiService := apisvs.NewConfigHistory(configRepo, moduleRepo, configHistoryRepo,
|
||||
l.cfg.Local.KeepConfigVersions, l.logger)
|
||||
configHistoryController := api.NewConfigHistory(configHistoryApiService)
|
||||
|
||||
moduleApiService := apisvs.NewModule(moduleRepo, backendRepo, configSchemaRepo)
|
||||
moduleApiController := api.NewModule(moduleApiService)
|
||||
|
||||
configApiService := apisvs.NewConfig(
|
||||
configRepo,
|
||||
moduleRepo,
|
||||
configSchemaRepo,
|
||||
eventRepo,
|
||||
configHistoryApiService,
|
||||
variableService,
|
||||
l.logger,
|
||||
)
|
||||
configApiController := api.NewConfig(configApiService)
|
||||
|
||||
configSchemaApiService := apisvs.NewConfigSchema(configSchemaRepo, moduleRepo)
|
||||
configSchemaController := api.NewConfigSchema(configSchemaApiService)
|
||||
|
||||
controllers := routes.Controllers{
|
||||
Module: moduleController,
|
||||
ModuleApi: moduleApiController,
|
||||
ConfigApi: configApiController,
|
||||
ConfigHistoryApi: configHistoryController,
|
||||
ConfigSchemaApi: configSchemaController,
|
||||
VariableApi: variableController,
|
||||
}
|
||||
mapper := endpoint.DefaultWrapper(l.logger)
|
||||
grpcMux := routes.GrpcHandler(mapper, controllers)
|
||||
|
||||
routes.BindEtp(etpSrv, controllers, l.logger)
|
||||
|
||||
rqliteUrl, err := url.Parse(l.cfg.RqliteAddress)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
rqliteProxy := httputil.NewSingleHostReverseProxy(rqliteUrl)
|
||||
|
||||
rqliteBackupUrl, err := url.Parse(l.cfg.RqliteAddress + "/db/backup")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
rqliteBackupProxy := httputil.NewSingleHostReverseProxy(rqliteBackupUrl)
|
||||
|
||||
httpMux := routes.HttpHandler(etpSrv, l.cfg.Local, rqliteProxy, rqliteBackupProxy)
|
||||
|
||||
eventHandler := event.NewHandler(subscriptionService, l.logger)
|
||||
handleEventJob := event.NewWorker(eventRepo, eventHandler, l.logger)
|
||||
handleEventWorker := worker.New(handleEventJob, worker.WithInterval(handleEventsInterval))
|
||||
|
||||
cleanerJob := event.NewCleaner(eventRepo, l.leaderChecker, eventTtl, l.logger)
|
||||
cleanEventWorker := worker.New(cleanerJob, worker.WithInterval(cleanEventInterval))
|
||||
|
||||
cleanBackupsJob := event.NewBackupCleaner(l.leaderChecker, l.cfg.Local.Backup, l.logger)
|
||||
cleanBackupsWorker := worker.New(cleanBackupsJob, worker.WithInterval(l.cfg.Local.Backup.ClearInterval))
|
||||
|
||||
metricsSvc := metrics.New(backendRepo)
|
||||
metricsController := controller.NewMetrics(metricsSvc)
|
||||
httpWrapper := httpEndpoint.DefaultWrapper(l.logger, httplog.Log(l.logger, false))
|
||||
|
||||
return &Config{
|
||||
GrpcMux: grpcMux,
|
||||
EtpSrv: etpSrv,
|
||||
HttpMux: httpMux,
|
||||
MetricsAdHandler: httpWrapper.Endpoint(metricsController.Autodiscovery),
|
||||
HandleEventWorker: handleEventWorker,
|
||||
CleanEventWorker: cleanEventWorker,
|
||||
CleanPhantomBackendWorker: cleanPhantomBackendWorker,
|
||||
CleanBackupsWorker: cleanBackupsWorker,
|
||||
OwnBackendsCleaner: backendService,
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
### v3.8.1
|
||||
* исправлена миграция для `config-history`
|
||||
### v3.8.0
|
||||
* Добавлен новый endpoint `config/schema/update_by_module_name` для обновления схемы модуля по его названию
|
||||
## v3.7.0
|
||||
* добавлены rqlite-автобэкапы и прокси-эндпоинт `/backup` для создания резервных копий
|
||||
* изменен таймаут ожидания лидера с 30 до 180 секунд
|
||||
* исправлены потенциальные race conditions
|
||||
* добавлен параметр периодической оптимизации sqlite `AutoOptimizeInterval: 23h`
|
||||
* обновлены зависимости
|
||||
## v3.6.0
|
||||
* добавлен новый эндпоинт `config/config/purge_versions` для удаления старых версий всех конфигураций модуля, за исключением n последних
|
||||
* обновлены зависимости
|
||||
## v3.5.0
|
||||
* обновлены зависимости
|
||||
## v3.4.1
|
||||
* исправлена проблема при которой не отвязывалась единственная переменная от конфигурации
|
||||
* исправлена проблема при которой версия конфига сохраняется с некорректным временем (бралось текущее время, а не время обновления конфига)
|
||||
* обновлены зависимости
|
||||
## v3.4.0
|
||||
* добавлено поле `metrics_autodiscovery` в таблицу `isp_config_service__backend`
|
||||
* реализован внутренний метод `/internal/metrics/autodiscovery`, формирующий конфигурацию для `HTTP-based service discovery` механизма `Prometheus`
|
||||
* обновлены зависимости
|
||||
## v3.3.1
|
||||
* добавлен скрипт для сборки и публикации образа в `GitHub Contaier Registry`
|
||||
* обновлены зависимости
|
||||
## v3.3.0
|
||||
* обновлены зависимости
|
||||
* добавлен новый эндпоинт `config/config/update_config_name` для изменения названия конфигурации без повышения версии и рассылки события
|
||||
* теперь эндпоинт `config/config/get_all_version` первым элементом возвращает актуальную версию конфигурации
|
||||
* добавлен новый эндпоинт `/config/config/sync` для синхронизации актуальной конфигурации пришедшего модуля
|
||||
* добавлена оптимизация в `config/config/create_update_config`: если в запросе `data` и `name` не отличаются от текущей версии конфигурации, то событие логируется на уровне `info` без обновления конфигурации; возвращается текущая версия конфигурации
|
||||
## v3.2.0
|
||||
* добавлена поддержка переменных в конфигурациях
|
||||
## v3.1.2
|
||||
* возвращена поддержка rqlite.DiscoMode `dns` и `dns-srv`
|
||||
* добавлена поддержка работы в `kubernetes` c autodiscovery
|
||||
## v3.1.1
|
||||
* инструмент миграции перенесен внутрь контейнера
|
||||
## v3.1.0
|
||||
* добавлено возможность анонсировать несколько бекендов с одинаковыми адресами
|
||||
* реализован механизм поиска и очистки фантомных бекендов (те который отключились, но остались висеть в таблице маршрутизации)
|
||||
* добавлена очистка таблицы маршрутизации в момент отключения самого модуля
|
||||
## v3.0.2
|
||||
* Новая реализация модуля на базе rqlite
|
||||
@@ -0,0 +1,187 @@
|
||||
package cluster
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/integration-system/isp-lib/structure"
|
||||
"github.com/integration-system/isp-lib/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 (
|
||||
ErrNoLeader = errors.New("no leader in cluster")
|
||||
ErrLeaderClientNotInitialized = errors.New("leader client not initialized")
|
||||
ErrNotLeader = errors.New("node is not a leader")
|
||||
json = jsoniter.ConfigFastest
|
||||
)
|
||||
|
||||
const (
|
||||
leaderConnectionTimeout = 3 * time.Second
|
||||
defaultApplyTimeout = 3 * time.Second
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
r *raft.Raft
|
||||
|
||||
leaderMu sync.RWMutex
|
||||
leaderState leaderState
|
||||
leaderClient *SocketLeaderClient
|
||||
declaration structure.BackendDeclaration
|
||||
onClientDisconnect func(string)
|
||||
}
|
||||
|
||||
func (client *Client) Shutdown() error {
|
||||
client.leaderMu.Lock()
|
||||
defer client.leaderMu.Unlock()
|
||||
|
||||
if client.leaderClient != nil {
|
||||
client.leaderClient.Close()
|
||||
client.leaderClient = nil
|
||||
}
|
||||
|
||||
return client.r.GracefulShutdown()
|
||||
}
|
||||
|
||||
func (client *Client) IsLeader() bool {
|
||||
client.leaderMu.RLock()
|
||||
defer client.leaderMu.RUnlock()
|
||||
|
||||
return client.leaderState.isLeader
|
||||
}
|
||||
|
||||
func (client *Client) SyncApply(command []byte) (*ApplyLogResponse, error) {
|
||||
client.leaderMu.RLock()
|
||||
defer client.leaderMu.RUnlock()
|
||||
|
||||
if !client.leaderState.leaderElected {
|
||||
return nil, ErrNoLeader
|
||||
}
|
||||
|
||||
if client.leaderState.isLeader {
|
||||
apply, err := client.r.SyncApply(command)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
logResponse := apply.(ApplyLogResponse)
|
||||
return &logResponse, err
|
||||
} else {
|
||||
if client.leaderClient == nil {
|
||||
return nil, ErrLeaderClientNotInitialized
|
||||
}
|
||||
response, err := client.leaderClient.Ack(command, defaultApplyTimeout)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var logResponse ApplyLogResponse
|
||||
err = json.Unmarshal(response, &logResponse)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &logResponse, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (client *Client) SyncApplyOnLeader(command []byte) (*ApplyLogResponse, error) {
|
||||
client.leaderMu.RLock()
|
||||
defer client.leaderMu.RUnlock()
|
||||
|
||||
if !client.leaderState.isLeader {
|
||||
return nil, ErrNotLeader
|
||||
}
|
||||
apply, err := client.r.SyncApply(command)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
logResponse := apply.(ApplyLogResponse)
|
||||
return &logResponse, err
|
||||
}
|
||||
|
||||
func (client *Client) listenLeader() {
|
||||
for n := range client.r.LeaderCh() {
|
||||
client.leaderMu.Lock()
|
||||
if client.leaderClient != nil {
|
||||
log.Debugf(0, "close previous leader ws connection %s", client.leaderState.leaderAddr)
|
||||
client.leaderClient.Close()
|
||||
client.leaderClient = nil
|
||||
}
|
||||
if n.LeaderElected && !n.IsLeader {
|
||||
leaderClient := NewSocketLeaderClient(n.CurrentLeaderAddress, func() {
|
||||
client.onClientDisconnect(client.leaderState.leaderAddr)
|
||||
})
|
||||
if err := leaderClient.Dial(leaderConnectionTimeout); err != nil {
|
||||
log.Fatalf(codes.LeaderClientConnectionError, "could not connect to leader: %v", err)
|
||||
continue
|
||||
}
|
||||
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)
|
||||
} 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)
|
||||
}
|
||||
client.leaderState = leaderState{
|
||||
leaderElected: n.LeaderElected,
|
||||
isLeader: n.IsLeader,
|
||||
leaderAddr: n.CurrentLeaderAddress,
|
||||
}
|
||||
|
||||
client.leaderMu.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
type leaderState struct {
|
||||
leaderElected bool
|
||||
isLeader bool
|
||||
leaderAddr string
|
||||
}
|
||||
|
||||
func NewRaftClusterClient(r *raft.Raft, declaration structure.BackendDeclaration, onLeaderDisconnect func(string)) *Client {
|
||||
client := &Client{
|
||||
r: r,
|
||||
declaration: declaration,
|
||||
leaderState: leaderState{},
|
||||
onClientDisconnect: onLeaderDisconnect,
|
||||
}
|
||||
go client.listenLeader()
|
||||
|
||||
return client
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
if applyLogResponse != nil && applyLogResponse.ApplyError != "" {
|
||||
log.WithMetadata(map[string]interface{}{
|
||||
"result": string(applyLogResponse.Result),
|
||||
"applyError": applyLogResponse.ApplyError,
|
||||
"commandName": commandName,
|
||||
}).Warnf(codes.SyncApplyError, "announce myself. apply command")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package cluster
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"github.com/integration-system/isp-lib/structure"
|
||||
log "github.com/integration-system/isp-log"
|
||||
"isp-config-service/codes"
|
||||
"isp-config-service/entity"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
ApplyCommandEvent = "CONFIG_CLUSTER:APPLY_COMMAND"
|
||||
|
||||
ClusterParam = "cluster"
|
||||
)
|
||||
const (
|
||||
_ = iota
|
||||
UpdateBackendDeclarationCommand
|
||||
DeleteBackendDeclarationCommand
|
||||
|
||||
UpdateConfigSchemaCommand
|
||||
|
||||
ModuleConnectedCommand
|
||||
ModuleDisconnectedCommand
|
||||
DeleteModulesCommand
|
||||
|
||||
ActivateConfigCommand
|
||||
DeleteConfigsCommand
|
||||
UpsertConfigCommand
|
||||
|
||||
DeleteCommonConfigsCommand
|
||||
UpsertCommonConfigCommand
|
||||
)
|
||||
|
||||
func PrepareUpdateBackendDeclarationCommand(backend structure.BackendDeclaration) []byte {
|
||||
return prepareCommand(UpdateBackendDeclarationCommand, backend)
|
||||
}
|
||||
|
||||
func PrepareDeleteBackendDeclarationCommand(backend structure.BackendDeclaration) []byte {
|
||||
return prepareCommand(DeleteBackendDeclarationCommand, backend)
|
||||
}
|
||||
|
||||
func PrepareModuleConnectedCommand(module entity.Module) []byte {
|
||||
return prepareCommand(ModuleConnectedCommand, module)
|
||||
}
|
||||
|
||||
func PrepareModuleDisconnectedCommand(module entity.Module) []byte {
|
||||
return prepareCommand(ModuleDisconnectedCommand, module)
|
||||
}
|
||||
|
||||
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 PrepareDeleteConfigsCommand(ids []string) []byte {
|
||||
return prepareCommand(DeleteConfigsCommand, DeleteModules{Ids: ids})
|
||||
}
|
||||
|
||||
func PrepareUpsertConfigCommand(config UpsertConfig) []byte {
|
||||
return prepareCommand(UpsertConfigCommand, config)
|
||||
}
|
||||
|
||||
func PrepareUpdateConfigSchemaCommand(schema entity.ConfigSchema) []byte {
|
||||
return prepareCommand(UpdateConfigSchemaCommand, schema)
|
||||
}
|
||||
|
||||
func PrepareDeleteCommonConfigsCommand(id string) []byte {
|
||||
return prepareCommand(DeleteCommonConfigsCommand, DeleteCommonConfig{Id: id})
|
||||
}
|
||||
|
||||
func PrepareUpsertCommonConfigCommand(config UpsertCommonConfig) []byte {
|
||||
return prepareCommand(UpsertCommonConfigCommand, config)
|
||||
}
|
||||
|
||||
func prepareCommand(command uint64, payload interface{}) []byte {
|
||||
cmd := make([]byte, 8)
|
||||
binary.BigEndian.PutUint64(cmd, command)
|
||||
buf := bytes.NewBuffer(cmd)
|
||||
err := json.NewEncoder(buf).Encode(payload)
|
||||
if err != nil {
|
||||
log.Fatalf(codes.PrepareLogCommandError, "prepare log command: %v", err)
|
||||
}
|
||||
return buf.Bytes()
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package cluster
|
||||
|
||||
import (
|
||||
json2 "encoding/json"
|
||||
"fmt"
|
||||
"google.golang.org/grpc/codes"
|
||||
"isp-config-service/entity"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ApplyLogResponse struct {
|
||||
ApplyError string
|
||||
Result json2.RawMessage
|
||||
}
|
||||
|
||||
func (a ApplyLogResponse) Error() string {
|
||||
return a.ApplyError
|
||||
}
|
||||
|
||||
type DeleteModules struct {
|
||||
Ids []string
|
||||
}
|
||||
|
||||
type ActivateConfig struct {
|
||||
ConfigId string
|
||||
Date time.Time
|
||||
}
|
||||
|
||||
type UpsertConfig struct {
|
||||
Config entity.Config
|
||||
Create bool
|
||||
Unsafe bool
|
||||
}
|
||||
|
||||
type DeleteConfigs struct {
|
||||
Ids []string
|
||||
}
|
||||
|
||||
type DeleteCommonConfig struct {
|
||||
Id string
|
||||
}
|
||||
|
||||
type UpsertCommonConfig struct {
|
||||
Config entity.CommonConfig
|
||||
Create bool
|
||||
}
|
||||
|
||||
type ResponseWithError struct {
|
||||
Response interface{}
|
||||
Error string
|
||||
ErrorCode codes.Code
|
||||
}
|
||||
|
||||
func NewResponseErrorf(code codes.Code, format string, args ...interface{}) ResponseWithError {
|
||||
return ResponseWithError{
|
||||
Error: fmt.Sprintf(format, args...),
|
||||
ErrorCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
func NewResponse(value interface{}) ResponseWithError {
|
||||
return ResponseWithError{
|
||||
Response: value,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
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"
|
||||
)
|
||||
|
||||
type SocketLeaderClient struct {
|
||||
client etp.Client
|
||||
url string
|
||||
globalCtx context.Context
|
||||
cancel context.CancelFunc
|
||||
}
|
||||
|
||||
func (c *SocketLeaderClient) Ack(data []byte, timeout time.Duration) ([]byte, error) {
|
||||
ctx, _ := context.WithTimeout(c.globalCtx, timeout)
|
||||
response, err := c.client.EmitWithAck(ctx, ApplyCommandEvent, data)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func (c *SocketLeaderClient) SendDeclaration(backend structure.BackendDeclaration, timeout time.Duration) (string, error) {
|
||||
data, err := json.Marshal(backend)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
ctx, _ := context.WithTimeout(c.globalCtx, timeout)
|
||||
response, err := c.client.EmitWithAck(ctx, utils.ModuleReady, data)
|
||||
return string(response), err
|
||||
}
|
||||
|
||||
func (c *SocketLeaderClient) Dial(timeout time.Duration) error {
|
||||
backOff := backoff.NewExponentialBackOff()
|
||||
backOff.MaxElapsedTime = timeout
|
||||
bf := backoff.WithContext(backOff, c.globalCtx)
|
||||
dial := func() error {
|
||||
return c.client.Dial(c.globalCtx, c.url)
|
||||
}
|
||||
return backoff.Retry(dial, bf)
|
||||
}
|
||||
|
||||
func (c *SocketLeaderClient) Close() {
|
||||
c.cancel()
|
||||
err := c.client.Close()
|
||||
if err != nil {
|
||||
log.Warnf(codes.LeaderClientConnectionError, "leader client close err: %v", err)
|
||||
}
|
||||
log.Debug(0, "leader client connection closed")
|
||||
}
|
||||
|
||||
func NewSocketLeaderClient(address string, leaderDisconnectionCallback func()) *SocketLeaderClient {
|
||||
etpConfig := etp.Config{
|
||||
HttpClient: http.DefaultClient,
|
||||
}
|
||||
client := etp.NewClient(etpConfig)
|
||||
leaderClient := &SocketLeaderClient{
|
||||
client: client,
|
||||
url: getUrl(address),
|
||||
}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
leaderClient.globalCtx = ctx
|
||||
leaderClient.cancel = cancel
|
||||
|
||||
leaderClient.client.OnDisconnect(func(err error) {
|
||||
log.WithMetadata(map[string]interface{}{
|
||||
"leaderAddr": address,
|
||||
}).Warn(codes.LeaderClientDisconnected, "leader client disconnected")
|
||||
leaderDisconnectionCallback()
|
||||
})
|
||||
|
||||
leaderClient.client.OnError(func(err error) {
|
||||
log.Warnf(codes.LeaderClientConnectionError, "leader client on error: %v", err)
|
||||
})
|
||||
leaderClient.client.OnConnect(func() {
|
||||
log.Debug(0, "leader client connected")
|
||||
})
|
||||
return leaderClient
|
||||
}
|
||||
|
||||
func getUrl(address string) string {
|
||||
addr, err := net.ResolveTCPAddr("tcp", address)
|
||||
if err != nil {
|
||||
panic(err) // must never occurred
|
||||
}
|
||||
cfg := config.Get().(*conf.Configuration)
|
||||
|
||||
params := url.Values{}
|
||||
params.Add(ClusterParam, "true")
|
||||
// TODO выпилить instance_uuid ?
|
||||
params.Add(utils.ModuleNameGetParamKey, cfg.ModuleName)
|
||||
params.Add(utils.InstanceUuidGetParamKey, "9d89354b-c728-4b48-b002-a7d3b229f151")
|
||||
return fmt.Sprintf("ws://%s:%d/isp-etp/?%s", addr.IP.String(), addr.Port, params.Encode())
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
db:
|
||||
host: 127.0.0.1
|
||||
port: 5432
|
||||
database: test
|
||||
username: test
|
||||
password: test
|
||||
schema: config_service
|
||||
|
||||
newConfigService:
|
||||
address: http://127.0.0.1:9001/
|
||||
username: default
|
||||
password: test
|
||||
@@ -1,43 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
)
|
||||
|
||||
type Module struct {
|
||||
Id string
|
||||
Name string
|
||||
LastConnectedAt *time.Time
|
||||
LastDisconnectedAt *time.Time
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Id string
|
||||
ModuleId string
|
||||
Name string
|
||||
Version int
|
||||
Active bool
|
||||
Data json.RawMessage
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
type ConfigHistory struct {
|
||||
Id string
|
||||
ConfigId string
|
||||
ConfigVersion int
|
||||
Data json.RawMessage
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type ConfigSchema struct {
|
||||
Id string
|
||||
ModuleId string
|
||||
Version string
|
||||
Schema json.RawMessage
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
module isp-config-service/migrate
|
||||
|
||||
go 1.25.0
|
||||
|
||||
replace isp-config-service => ../..
|
||||
|
||||
require (
|
||||
github.com/jmoiron/sqlx v1.4.0
|
||||
github.com/mattn/go-sqlite3 v1.14.32
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pressly/goose/v3 v3.26.0
|
||||
github.com/txix-open/isp-kit v1.63.3
|
||||
isp-config-service v0.0.0-00010101000000-000000000000
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/Masterminds/squirrel v1.5.4 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/coder/websocket v1.8.14 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.11 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
|
||||
github.com/iancoleman/strcase v0.3.0 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
||||
github.com/jackc/pgx/v5 v5.7.6 // indirect
|
||||
github.com/jackc/puddle/v2 v2.2.2 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
|
||||
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mfridman/interpolate v0.0.2 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/prometheus/client_golang v1.23.2 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/common v0.67.3 // indirect
|
||||
github.com/prometheus/procfs v0.19.2 // indirect
|
||||
github.com/sethvargo/go-retry v0.3.0 // indirect
|
||||
github.com/tidwall/gjson v1.18.0 // indirect
|
||||
github.com/tidwall/match v1.2.0 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/txix-open/bellows v1.2.0 // indirect
|
||||
github.com/txix-open/etp/v4 v4.0.1 // indirect
|
||||
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 // indirect
|
||||
go.opentelemetry.io/otel v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.38.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.1 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.3 // indirect
|
||||
golang.org/x/crypto v0.45.0 // indirect
|
||||
golang.org/x/net v0.47.0 // indirect
|
||||
golang.org/x/sync v0.18.0 // indirect
|
||||
golang.org/x/sys v0.38.0 // indirect
|
||||
golang.org/x/text v0.31.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846 // indirect
|
||||
google.golang.org/grpc v1.77.0 // indirect
|
||||
google.golang.org/protobuf v1.36.10 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
@@ -1,221 +0,0 @@
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM=
|
||||
github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
|
||||
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
|
||||
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/coder/websocket v1.8.14 h1:9L0p0iKiNOibykf283eHkKUHHrpG7f65OE3BhhO7v9g=
|
||||
github.com/coder/websocket v1.8.14/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/gabriel-vasile/mimetype v1.4.11 h1:AQvxbp830wPhHTqc1u7nzoLT+ZFxGY7emj5DR5DYFik=
|
||||
github.com/gabriel-vasile/mimetype v1.4.11/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/getsentry/sentry-go v0.38.0 h1:S8Xui7gLeAvXINVLMOaX94HnsDf1GexnfXGSNC4+KQs=
|
||||
github.com/getsentry/sentry-go v0.38.0/go.mod h1:eRXCoh3uvmjQLY6qu63BjUZnaBu5L5WhMV1RwYO8W5s=
|
||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
|
||||
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
|
||||
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
||||
github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo=
|
||||
github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 h1:NmZ1PKzSTQbuGHw9DGPFomqkkLWMC+vZCkfs+FHv1Vg=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3/go.mod h1:zQrxl1YP88HQlA6i9c63DSVPFklWpGX4OWAc9bFuaH4=
|
||||
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
|
||||
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
|
||||
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
|
||||
github.com/jackc/pgx/v5 v5.7.6 h1:rWQc5FwZSPX58r1OQmkuaNicxdmExaEz5A2DO2hUuTk=
|
||||
github.com/jackc/pgx/v5 v5.7.6/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M=
|
||||
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
|
||||
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
|
||||
github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o=
|
||||
github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
|
||||
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
||||
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
||||
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw=
|
||||
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o=
|
||||
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk=
|
||||
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
|
||||
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
|
||||
github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY=
|
||||
github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
||||
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||
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/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pressly/goose/v3 v3.26.0 h1:KJakav68jdH0WDvoAcj8+n61WqOIaPGgH0bJWS6jpmM=
|
||||
github.com/pressly/goose/v3 v3.26.0/go.mod h1:4hC1KrritdCxtuFsqgs1R4AU5bWtTAf+cnWvfhf2DNY=
|
||||
github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
|
||||
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
|
||||
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
|
||||
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
|
||||
github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q=
|
||||
github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI=
|
||||
github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws=
|
||||
github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE=
|
||||
github.com/sethvargo/go-retry v0.3.0/go.mod h1:mNX17F0C/HguQMyMyJxcnU471gOZGxCLyYaFyAZraas=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
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.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
|
||||
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM=
|
||||
github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
|
||||
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgjeY=
|
||||
github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o=
|
||||
github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA=
|
||||
github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8=
|
||||
github.com/txix-open/isp-kit v1.63.3 h1:UJLgR4z8sYXUX6r1sl6Ww1aijPx6b7ieMeB+elZoViM=
|
||||
github.com/txix-open/isp-kit v1.63.3/go.mod h1:rwqKqB3PyZxaoep6iH1PKL89LS9nzRklA6+S4II72M4=
|
||||
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0=
|
||||
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb/go.mod h1:0biAFE0bgbcKeBBAwgEDhbZz6uT1vuSETCrFQlv2RiA=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 h1:2pn7OzMewmYRiNtv1doZnLo3gONcnMHlFnmOR8Vgt+8=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0/go.mod h1:rjbQTDEPQymPE0YnRQp9/NuPwwtL0sesz/fnqRW/v84=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg=
|
||||
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
|
||||
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 h1:aTL7F04bJHUlztTsNGJ2l+6he8c+y/b//eR0jjjemT4=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0/go.mod h1:kldtb7jDTeol0l3ewcmd8SDvx3EmIE7lyvqbasU3QC4=
|
||||
go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA=
|
||||
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI=
|
||||
go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E=
|
||||
go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA=
|
||||
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
|
||||
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
|
||||
go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A=
|
||||
go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc=
|
||||
go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
|
||||
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
|
||||
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
|
||||
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=
|
||||
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o=
|
||||
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8=
|
||||
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
|
||||
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
|
||||
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
|
||||
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
|
||||
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
|
||||
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
|
||||
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
|
||||
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba h1:B14OtaXuMaCQsl2deSvNkyPKIzq3BjfxQp8d00QyWx4=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba/go.mod h1:G5IanEx8/PgI9w6CFcYQf7jMtHQhZruvfM1i3qOqk5U=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846 h1:Wgl1rcDNThT+Zn47YyCXOXyX/COgMTIdhJ717F0l4xk=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
|
||||
google.golang.org/grpc v1.77.0 h1:wVVY6/8cGA6vvffn+wWK5ToddbgdU3d8MNENr4evgXM=
|
||||
google.golang.org/grpc v1.77.0/go.mod h1:z0BY1iVj0q8E1uSQCjL9cppRj+gnZjzDnzV0dHhrNig=
|
||||
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
|
||||
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
modernc.org/libc v1.66.3 h1:cfCbjTUcdsKyyZZfEUKfoHcP3S0Wkvz3jgSzByEWVCQ=
|
||||
modernc.org/libc v1.66.3/go.mod h1:XD9zO8kt59cANKvHPXpx7yS2ELPheAey0vjIuZOhOU8=
|
||||
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
|
||||
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
|
||||
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
|
||||
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
|
||||
modernc.org/sqlite v1.38.2 h1:Aclu7+tgjgcQVShZqim41Bbw9Cho0y/7WzYptXqkEek=
|
||||
modernc.org/sqlite v1.38.2/go.mod h1:cPTJYSlgg3Sfg046yBShXENNtPrWrDX8bsbAQBzgQ5E=
|
||||
@@ -1,204 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/pressly/goose/v3"
|
||||
"github.com/txix-open/isp-kit/config"
|
||||
"github.com/txix-open/isp-kit/dbx"
|
||||
"github.com/txix-open/isp-kit/http/httpcli"
|
||||
"github.com/txix-open/isp-kit/http/httpclix"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
"github.com/txix-open/isp-kit/validator"
|
||||
"isp-config-service/service/rqlite/goose_store"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/app"
|
||||
"github.com/txix-open/isp-kit/db"
|
||||
"isp-config-service/entity"
|
||||
"isp-config-service/entity/xtypes"
|
||||
"isp-config-service/migrate/migration"
|
||||
"isp-config-service/migrations"
|
||||
"isp-config-service/repository"
|
||||
)
|
||||
|
||||
type Cfg struct {
|
||||
Db dbx.Config
|
||||
NewConfigService struct {
|
||||
Address string
|
||||
Username string
|
||||
Password string
|
||||
}
|
||||
}
|
||||
|
||||
type dbClient struct {
|
||||
*db.Client
|
||||
}
|
||||
|
||||
func (d dbClient) ExecTransaction(ctx context.Context, requests [][]any) ([]sql.Result, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func main() {
|
||||
app, err := app.New(app.WithConfigOptions(
|
||||
config.WithValidator(validator.Default),
|
||||
config.WithExtraSource(config.NewYamlConfig("config.yml")),
|
||||
))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
logger := app.Logger()
|
||||
logger.SetLevel(log.DebugLevel)
|
||||
ctx := app.Context()
|
||||
cfg := Cfg{}
|
||||
err = app.Config().Read(&cfg)
|
||||
if err != nil {
|
||||
panic(errors.WithMessage(err, "read config"))
|
||||
}
|
||||
|
||||
pgDb, err := dbx.Open(ctx, cfg.Db, dbx.WithQueryTracer(dbx.NewLogTracer(logger)))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer pgDb.Close()
|
||||
|
||||
fileName := fmt.Sprintf("db_%d.sqlite", time.Now().Unix())
|
||||
dbClient := dbClient{&db.Client{}}
|
||||
dbClient.DB, err = sqlx.Open("sqlite3", fileName)
|
||||
dbClient.DB.MapperFunc(db.ToSnakeCase)
|
||||
if err != nil {
|
||||
panic(errors.WithMessage(err, "err opening db"))
|
||||
}
|
||||
defer dbClient.Close()
|
||||
|
||||
migrationStore := goose_store.NewStore(dbClient.DB.DB)
|
||||
mr := migration.NewRunner("", migrations.Migrations, logger)
|
||||
err = mr.Run(ctx, dbClient.DB.DB, goose.WithStore(migrationStore))
|
||||
if err != nil {
|
||||
panic(errors.WithMessage(err, "err connecting to db"))
|
||||
}
|
||||
|
||||
moduleRepo := repository.NewModule(dbClient)
|
||||
configRepo := repository.NewConfig(dbClient)
|
||||
configSchemaRepo := repository.NewConfigSchema(dbClient)
|
||||
configHistoryRepo := repository.NewConfigHistory(dbClient)
|
||||
|
||||
logger.Info(ctx, "start modules migration")
|
||||
modules := make([]Module, 0)
|
||||
err = pgDb.Select(ctx, &modules, "select * from modules")
|
||||
if err != nil {
|
||||
panic(errors.WithMessage(err, "err selecting modules"))
|
||||
}
|
||||
for _, module := range modules {
|
||||
result := entity.Module{
|
||||
Id: module.Id,
|
||||
Name: module.Name,
|
||||
CreatedAt: xtypes.Time(module.CreatedAt),
|
||||
}
|
||||
_, _ = moduleRepo.Upsert(ctx, result)
|
||||
}
|
||||
logger.Info(ctx, "modules migrated")
|
||||
|
||||
logger.Info(ctx, "start configs migration")
|
||||
configs := make([]Config, 0)
|
||||
err = pgDb.Select(ctx, &configs, "select id, module_id, version, active, created_at, updated_at, data, name from configs")
|
||||
if err != nil {
|
||||
panic(errors.WithMessage(err, "err selecting configs"))
|
||||
}
|
||||
for _, config := range configs {
|
||||
result := entity.Config{
|
||||
Id: config.Id,
|
||||
Name: config.Name,
|
||||
ModuleId: config.ModuleId,
|
||||
Data: config.Data,
|
||||
Version: config.Version,
|
||||
Active: xtypes.Bool(config.Active),
|
||||
AdminId: 0,
|
||||
CreatedAt: xtypes.Time(config.CreatedAt),
|
||||
UpdatedAt: xtypes.Time(config.UpdatedAt),
|
||||
}
|
||||
err := configRepo.Insert(ctx, result)
|
||||
if err != nil {
|
||||
panic(errors.WithMessagef(err, "err inserting config: %s", config.Id))
|
||||
}
|
||||
}
|
||||
logger.Info(ctx, "configs migrated")
|
||||
|
||||
logger.Info(ctx, "start config schemas migration")
|
||||
schemas := make([]ConfigSchema, 0)
|
||||
err = pgDb.Select(ctx, &schemas, "select * from config_schemas")
|
||||
if err != nil {
|
||||
panic(errors.WithMessage(err, "err selecting schemas"))
|
||||
}
|
||||
for _, schema := range schemas {
|
||||
result := entity.ConfigSchema{
|
||||
Id: schema.Id,
|
||||
ModuleId: schema.ModuleId,
|
||||
Data: schema.Schema,
|
||||
ModuleVersion: schema.Version,
|
||||
CreatedAt: xtypes.Time(schema.CreatedAt),
|
||||
UpdatedAt: xtypes.Time(schema.UpdatedAt),
|
||||
}
|
||||
err := configSchemaRepo.Upsert(ctx, result)
|
||||
if err != nil {
|
||||
panic(errors.WithMessagef(err, "err upserting config_schema: %s", schema.Id))
|
||||
}
|
||||
}
|
||||
logger.Info(ctx, "config schemas migrated")
|
||||
|
||||
logger.Info(ctx, "start config history migration")
|
||||
configHistories := make([]ConfigHistory, 0)
|
||||
err = pgDb.Select(ctx, &configHistories, "select * from version_config")
|
||||
if err != nil {
|
||||
panic(errors.WithMessage(err, "err selecting configs"))
|
||||
}
|
||||
for _, history := range configHistories {
|
||||
result := entity.ConfigHistory{
|
||||
Id: history.Id,
|
||||
ConfigId: history.ConfigId,
|
||||
Data: history.Data,
|
||||
Version: history.ConfigVersion,
|
||||
AdminId: 0,
|
||||
CreatedAt: xtypes.Time(history.CreatedAt),
|
||||
}
|
||||
err := configHistoryRepo.InsertV2(ctx, result)
|
||||
if err != nil {
|
||||
panic(errors.WithMessagef(err, "err inserting config_history: %s", history.Id))
|
||||
}
|
||||
}
|
||||
logger.Info(ctx, "config history migrated")
|
||||
|
||||
logger.Info(ctx, "close sqlite db")
|
||||
_ = dbClient.Close()
|
||||
|
||||
logger.Info(ctx, "loading db to isp-config-service")
|
||||
sqliteFile, err := os.ReadFile(fileName)
|
||||
if err != nil {
|
||||
panic(errors.WithMessage(err, "err opening sqlite file"))
|
||||
}
|
||||
|
||||
cli := httpcli.New(httpcli.WithMiddlewares(httpclix.Log(logger)))
|
||||
cli.GlobalRequestConfig().BaseUrl = cfg.NewConfigService.Address
|
||||
cli.GlobalRequestConfig().BasicAuth = &httpcli.BasicAuth{
|
||||
Username: cfg.NewConfigService.Username,
|
||||
Password: cfg.NewConfigService.Password,
|
||||
}
|
||||
ctx = httpclix.LogConfigToContext(ctx, false, true)
|
||||
err = cli.Post("/db/load").
|
||||
Header("Content-Type", "application/octet-stream").
|
||||
RequestBody(sqliteFile).
|
||||
StatusCodeToError().
|
||||
Timeout(120 * time.Second).
|
||||
DoWithoutResponse(ctx)
|
||||
if err != nil {
|
||||
panic(errors.WithMessage(err, "load sqlite file"))
|
||||
}
|
||||
|
||||
logger.Info(ctx, "done!")
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package migration
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/pressly/goose/v3"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
)
|
||||
|
||||
const (
|
||||
DialectPostgreSQL = goose.DialectPostgres
|
||||
DialectSqlite3 = goose.DialectSQLite3
|
||||
DialectClickhouse = goose.DialectClickHouse
|
||||
)
|
||||
|
||||
type Runner struct {
|
||||
dialect goose.Dialect
|
||||
fs fs.FS
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
func NewRunner(
|
||||
dialect goose.Dialect,
|
||||
fs fs.FS,
|
||||
logger log.Logger,
|
||||
) Runner {
|
||||
return Runner{
|
||||
dialect: dialect,
|
||||
fs: fs,
|
||||
logger: logger,
|
||||
}
|
||||
}
|
||||
|
||||
func (r Runner) Run(ctx context.Context, db *sql.DB, gooseOpts ...goose.ProviderOption) error {
|
||||
ctx = log.ToContext(ctx, log.String("worker", "goose_db_migration"))
|
||||
|
||||
provider, err := goose.NewProvider(r.dialect, db, r.fs, gooseOpts...)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "get goose provider")
|
||||
}
|
||||
|
||||
dbVersion, err := provider.GetDBVersion(ctx)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "get db version")
|
||||
}
|
||||
r.logger.Info(ctx, fmt.Sprintf("current db version: %d", dbVersion))
|
||||
|
||||
migrations, err := provider.Status(ctx)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "get status migrations")
|
||||
}
|
||||
r.logger.Info(ctx, "print migration list")
|
||||
if len(migrations) == 0 {
|
||||
r.logger.Info(ctx, "no migrations")
|
||||
}
|
||||
for _, migration := range migrations {
|
||||
appliedAt := "Pending"
|
||||
if !migration.AppliedAt.IsZero() {
|
||||
appliedAt = migration.AppliedAt.Format(time.RFC3339)
|
||||
}
|
||||
msg := fmt.Sprintf(
|
||||
"migration: %s %s %s",
|
||||
filepath.Base(migration.Source.Path),
|
||||
strings.ToUpper(string(migration.State)),
|
||||
appliedAt,
|
||||
)
|
||||
r.logger.Info(ctx, msg)
|
||||
}
|
||||
|
||||
result, err := provider.Up(ctx)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "apply pending migrations")
|
||||
}
|
||||
for _, migrationResult := range result {
|
||||
r.logger.Info(ctx, fmt.Sprintf("applied migration: %s", migrationResult.String()))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package codes
|
||||
|
||||
const (
|
||||
// Common
|
||||
StartHttpServerError = 1001
|
||||
ShutdownHttpServerError = 1002
|
||||
ShutdownHttpServerInfo = 1003
|
||||
|
||||
WebsocketError = 1004
|
||||
WebsocketEmitError = 1005
|
||||
|
||||
DatabaseOperationError = 1006
|
||||
|
||||
// Raft
|
||||
InitRaftError = 1007
|
||||
RestoreFromRepositoryError = 1008
|
||||
RaftLoggerCode = 1009
|
||||
BootstrapClusterError = 1010
|
||||
RaftShutdownError = 1011
|
||||
RaftShutdownInfo = 1012
|
||||
|
||||
// Raft Log
|
||||
ApplyLogCommandError = 1013
|
||||
PrepareLogCommandError = 1014
|
||||
SyncApplyError = 1015
|
||||
|
||||
// Raft Cluster
|
||||
SendDeclarationToLeaderError = 1016
|
||||
LeaderClientConnectionError = 1017
|
||||
LeaderClientDisconnected = 1018
|
||||
|
||||
// Services
|
||||
DiscoveryServiceSendModulesError = 1019
|
||||
RoutesServiceSendRoutesError = 1020
|
||||
ConfigServiceBroadcastConfigError = 1021
|
||||
|
||||
// Mux
|
||||
InitMuxError = 1022
|
||||
)
|
||||
+34
-46
@@ -1,51 +1,39 @@
|
||||
configServiceAddress:
|
||||
ip: localhost
|
||||
port: 9001
|
||||
database:
|
||||
address: "127.0.0.1"
|
||||
schema: "config_service"
|
||||
database: "test"
|
||||
port: "5432"
|
||||
username: "test"
|
||||
password: "password"
|
||||
createSchema: true
|
||||
|
||||
moduleName: "config"
|
||||
grpcOuterAddress:
|
||||
ip: isp-config-service
|
||||
ip: ""
|
||||
port: 9002
|
||||
grpcInnerAddress:
|
||||
ip: 0.0.0.0
|
||||
port: 9002
|
||||
moduleName: isp-config-service
|
||||
|
||||
infraServerPort: 9006
|
||||
ws:
|
||||
rest:
|
||||
port: "9001"
|
||||
ip: "0.0.0.0"
|
||||
grpc:
|
||||
port: "9002"
|
||||
ip: "0.0.0.0"
|
||||
|
||||
logLevel: debug
|
||||
metrics:
|
||||
gc: true
|
||||
memory: true
|
||||
address:
|
||||
addressConfiguration:
|
||||
ip: "0.0.0.0"
|
||||
port: "9551"
|
||||
path: "/metrics"
|
||||
|
||||
maintenanceMode: false
|
||||
|
||||
keepConfigVersions: 64
|
||||
|
||||
credentials:
|
||||
- username: default
|
||||
password: 38kPk0upqI5j
|
||||
perms: ["all"]
|
||||
- username: monitor
|
||||
password: monitor
|
||||
perms: ["ready"]
|
||||
|
||||
internalClientCredential: default
|
||||
|
||||
rqlite:
|
||||
DataPath: "data"
|
||||
NodeID: 1
|
||||
BootstrapExpect: 1
|
||||
RaftAddr: "127.0.0.1:9008"
|
||||
JoinAddrs: "127.0.0.1:9008"
|
||||
FKConstraints: true
|
||||
AutoVacInterval: 12h
|
||||
AutoOptimizeInterval: 23h
|
||||
JoinAs: default
|
||||
|
||||
backup:
|
||||
Enable: true
|
||||
Amount: 5
|
||||
Interval: "24h"
|
||||
ClearInterval: "168h"
|
||||
Sub:
|
||||
Dir: "/app/data/backups/rqlite"
|
||||
Name: "backup.sqlite.gz"
|
||||
|
||||
metricsAutodiscovery:
|
||||
enable: true
|
||||
cluster:
|
||||
dataDir: ./data
|
||||
inMemory: true
|
||||
outerAddress: 127.0.0.1:9001
|
||||
connectTimeoutSeconds: 5
|
||||
bootstrapCluster: true
|
||||
peers:
|
||||
- 127.0.0.1:9001
|
||||
@@ -0,0 +1,10 @@
|
||||
moduleName: config
|
||||
instanceUuid: bf482806-0c3d-4e0d-b9d4-12c037b12d70
|
||||
|
||||
registry:
|
||||
host: nexus.msp.mobi
|
||||
username: mp3deployer
|
||||
password: ScjKLQuvqfAXu2bs8ysLAvRt
|
||||
|
||||
images:
|
||||
module: nexus.msp.mobi/msp2/dev/isp-config-service:latest
|
||||
@@ -0,0 +1,29 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"github.com/integration-system/isp-lib/structure"
|
||||
)
|
||||
|
||||
type Configuration struct {
|
||||
Database structure.DBConfiguration `valid:"required~Required" schema:"База данных,настройка параметров подключения к базе данных"`
|
||||
GrpcOuterAddress structure.AddressConfiguration `valid:"required~Required" json:"grpcOuterAddress"`
|
||||
ModuleName string `valid:"required~Required"`
|
||||
WS WebService `valid:"required~Required" schema:"Конфигурация веб сервиса"`
|
||||
Metrics structure.MetricConfiguration
|
||||
Cluster ClusterConfiguration `valid:"required~Required"`
|
||||
}
|
||||
|
||||
type ClusterConfiguration struct {
|
||||
InMemory bool `schema:"Хранить логи и снэпшоты только в памяти"`
|
||||
DataDir string `valid:"required~Required" schema:"Пусть до директории для логов и снэпшотов рафта"`
|
||||
BootstrapCluster bool `schema:"Поднимать кластер и объявлять лидером"`
|
||||
Peers []string `valid:"required~Required" schema:"Адреса всех нод в кластере,формат address:port"`
|
||||
OuterAddress string `valid:"required~Required" schema:"Внешний адрес ноды"`
|
||||
ConnectTimeoutSeconds int `valid:"required~Required" schema:"Таймаут подключения"`
|
||||
}
|
||||
|
||||
type WebService struct {
|
||||
Rest structure.AddressConfiguration `valid:"required~Required"`
|
||||
Grpc structure.AddressConfiguration `valid:"required~Required"`
|
||||
WsConnectionReadLimitKB int64 `schema:"Максимальное количество килобайт на чтение по вебсокету,при превышении соединение закрывается с ошибкой"`
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{}
|
||||
@@ -1,22 +0,0 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"isp-config-service/service/rqlite"
|
||||
|
||||
"github.com/rqlite/rqlite/v9/auth"
|
||||
"github.com/txix-open/isp-kit/bootstrap"
|
||||
)
|
||||
|
||||
type Local struct {
|
||||
ConfigServiceAddress bootstrap.ConfigServiceAddr
|
||||
MaintenanceMode bool
|
||||
Credentials []auth.Credential
|
||||
KeepConfigVersions int `validate:"required"`
|
||||
InternalClientCredential string `validate:"required"`
|
||||
Rqlite Rqlite
|
||||
Backup rqlite.Backup
|
||||
}
|
||||
|
||||
type Rqlite struct {
|
||||
NodeId string `validate:"required"`
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package conf
|
||||
|
||||
type Remote struct {
|
||||
}
|
||||
@@ -0,0 +1,319 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"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"
|
||||
)
|
||||
|
||||
const (
|
||||
configServiceHttpPort = "9001"
|
||||
configServiceGrpcPort = "9002"
|
||||
configServiceSchema = "config_service"
|
||||
|
||||
configsNumber = 3
|
||||
maxAwaitingTime = 25 * time.Second
|
||||
|
||||
deleteCommonConfigsCommand = "config/common_config/delete_config"
|
||||
getRoutesCommand = "config/routing/get_routes"
|
||||
)
|
||||
|
||||
var (
|
||||
pgCfg structure.DBConfiguration
|
||||
|
||||
configsHttpAddrs = make([]structure.AddressConfiguration, configsNumber)
|
||||
configsGrpcAddrs = make([]structure.AddressConfiguration, configsNumber)
|
||||
configsCtxs = make([]*docker.ContainerContext, configsNumber)
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
cfg := ctx.BaseTestConfiguration{}
|
||||
test, err := ctx.NewIntegrationTest(m, &cfg, setup)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
test.PrepareAndRun()
|
||||
}
|
||||
|
||||
func setup(testCtx *ctx.TestContext, runTest func() int) int {
|
||||
cfg := testCtx.BaseConfiguration()
|
||||
|
||||
cli, err := docker.NewClient()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer cli.Close()
|
||||
env := docker.NewTestEnvironment(testCtx, cli)
|
||||
defer env.Cleanup()
|
||||
|
||||
_, pgCfg = env.RunPGContainer()
|
||||
_, err = postgres.Wait(pgCfg, 10*time.Second)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
pgCfg.Schema = configServiceSchema
|
||||
|
||||
configs := make([]conf.Configuration, configsNumber)
|
||||
peersAddrs := make([]string, configsNumber)
|
||||
|
||||
for i := 0; i < configsNumber; i++ {
|
||||
httpAddr := getConfigServiceAddress(i, configServiceHttpPort)
|
||||
grpcAddr := getConfigServiceAddress(i, configServiceGrpcPort)
|
||||
cfg := conf.Configuration{
|
||||
Database: pgCfg,
|
||||
ModuleName: moduleName,
|
||||
GrpcOuterAddress: grpcAddr,
|
||||
WS: conf.WebService{
|
||||
Rest: httpAddr,
|
||||
Grpc: grpcAddr,
|
||||
},
|
||||
Cluster: conf.ClusterConfiguration{
|
||||
InMemory: false,
|
||||
DataDir: "./data",
|
||||
Peers: nil,
|
||||
OuterAddress: httpAddr.GetAddress(),
|
||||
ConnectTimeoutSeconds: 10,
|
||||
BootstrapCluster: false,
|
||||
},
|
||||
}
|
||||
configsGrpcAddrs[i] = grpcAddr
|
||||
configsHttpAddrs[i] = httpAddr
|
||||
configs[i] = cfg
|
||||
peersAddrs[i] = httpAddr.GetAddress()
|
||||
}
|
||||
|
||||
configs[0].Cluster.BootstrapCluster = true
|
||||
|
||||
for i := 0; i < configsNumber; i++ {
|
||||
c := configs[i]
|
||||
peersAddrsEnv := generatePeersConfigEnv(peersAddrs)
|
||||
peersAddrsEnv["LOG_LEVEL"] = "debug"
|
||||
ctx := env.RunAppContainer(
|
||||
cfg.Images.Module, c, nil,
|
||||
docker.WithName(c.GrpcOuterAddress.IP),
|
||||
docker.WithLogger(NewWriteLogger(strconv.Itoa(i)+"_config:", ioutil.Discard, "DeleteCommonConfigsCommand")),
|
||||
//docker.PullImage(cfg.Registry.Username, cfg.Registry.Password),
|
||||
docker.WithEnv(peersAddrsEnv),
|
||||
)
|
||||
grpcAddr := configsGrpcAddrs[i]
|
||||
grpcAddr.IP = ctx.GetIPAddress()
|
||||
configsGrpcAddrs[i] = grpcAddr
|
||||
|
||||
httpAddr := configsHttpAddrs[i]
|
||||
httpAddr.IP = ctx.GetIPAddress()
|
||||
configsHttpAddrs[i] = httpAddr
|
||||
|
||||
configsCtxs[i] = ctx
|
||||
}
|
||||
|
||||
//time.Sleep(3 * time.Second)
|
||||
return runTest()
|
||||
}
|
||||
|
||||
func TestClusterElection(t *testing.T) {
|
||||
defer func() {
|
||||
err := recover()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}()
|
||||
a := assert.New(t)
|
||||
var ready bool
|
||||
|
||||
ready = testClusterReady(a, -1)
|
||||
if !ready {
|
||||
return
|
||||
}
|
||||
|
||||
for i := 0; i < configsNumber; i++ {
|
||||
fmt.Print("\n\n\n")
|
||||
log.Printf("stopping %d container\n", i)
|
||||
a.NoError(configsCtxs[i].StopContainer(20 * time.Second))
|
||||
|
||||
time.Sleep(5 * time.Second)
|
||||
fmt.Print("\n\n\n")
|
||||
log.Printf("checking cluster except %d\n", i)
|
||||
ready = testClusterReady(a, i)
|
||||
if !ready {
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Print("\n\n\n")
|
||||
log.Printf("starting %d container\n", i)
|
||||
a.NoError(configsCtxs[i].StartContainer())
|
||||
|
||||
log.Printf("checking cluster, iteration %d\n", i+1)
|
||||
ready = testClusterReady(a, -1)
|
||||
if !ready {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func getConfigServiceAddress(num int, port string) structure.AddressConfiguration {
|
||||
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),
|
||||
IP: ip.String(),
|
||||
Port: port,
|
||||
}
|
||||
}
|
||||
|
||||
func testClusterReady(a *assert.Assertions, except int) bool {
|
||||
var clients []*backend.InternalGrpcClient
|
||||
defer func() {
|
||||
for _, client := range clients {
|
||||
client.CloseQuietly()
|
||||
}
|
||||
}()
|
||||
|
||||
for j := 0; j < configsNumber; j++ {
|
||||
if j == except {
|
||||
continue
|
||||
}
|
||||
configAddr := configsGrpcAddrs[j]
|
||||
client := testGrpcReady(configAddr, a)
|
||||
if client == nil {
|
||||
a.Fail(fmt.Sprintf("unable to connect to %d config", j))
|
||||
return false
|
||||
}
|
||||
clients = append(clients, client)
|
||||
ready := testRaftReady(client, a)
|
||||
if !ready {
|
||||
return ready
|
||||
}
|
||||
}
|
||||
|
||||
prevRoutes := getRoutes(clients[0], a)
|
||||
routesLen := len(clients)
|
||||
for i := 1; i < len(clients); i++ {
|
||||
routes := getRoutes(clients[i], a)
|
||||
t := a.Len(routes, routesLen, "invalid length")
|
||||
if !t {
|
||||
return t
|
||||
}
|
||||
match := a.ElementsMatch(prevRoutes, routes, "different backend declarations")
|
||||
if !match {
|
||||
return match
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func testGrpcReady(configAddr structure.AddressConfiguration, a *assert.Assertions) *backend.InternalGrpcClient {
|
||||
start := time.Now()
|
||||
var client *backend.InternalGrpcClient
|
||||
var err error
|
||||
_, _ = await(func() (interface{}, error) {
|
||||
client, err = backend.NewGrpcClient(
|
||||
configAddr.GetAddress(),
|
||||
grpc.WithBlock(),
|
||||
grpc.WithInsecure(),
|
||||
)
|
||||
//log.Println("connect to grpc err:", err)
|
||||
return nil, err
|
||||
}, maxAwaitingTime)
|
||||
if !a.NoError(err) {
|
||||
return nil
|
||||
}
|
||||
log.Println("waiting until grpc ready:", time.Now().Sub(start).Round(time.Second))
|
||||
return client
|
||||
}
|
||||
|
||||
func testRaftReady(client *backend.InternalGrpcClient, a *assert.Assertions) bool {
|
||||
var err error
|
||||
req := new(domain.ConfigIdRequest)
|
||||
req.Id = "33"
|
||||
response := new(structure.GrpcError)
|
||||
start := time.Now()
|
||||
f := func() (interface{}, error) {
|
||||
err = client.Invoke(
|
||||
deleteCommonConfigsCommand,
|
||||
-1,
|
||||
req,
|
||||
response,
|
||||
)
|
||||
//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))
|
||||
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)
|
||||
a.NoError(err)
|
||||
return response
|
||||
}
|
||||
|
||||
func await(dialer func() (interface{}, error), timeout time.Duration) (interface{}, error) {
|
||||
retryer := utils.NewRetryer(dialer, timeout)
|
||||
retryer.AttemptTimeout = 300 * time.Millisecond
|
||||
return retryer.Do()
|
||||
}
|
||||
|
||||
func generatePeersConfigEnv(peers []string) map[string]string {
|
||||
key := "LC_ISP_CLUSTER.PEERS"
|
||||
val := strings.Join(peers, ",")
|
||||
return map[string]string{
|
||||
key: val,
|
||||
}
|
||||
}
|
||||
|
||||
type writeLogger struct {
|
||||
prefix string
|
||||
w io.Writer
|
||||
filter string
|
||||
}
|
||||
|
||||
func (l *writeLogger) Write(p []byte) (int, error) {
|
||||
lines := bytes.SplitAfter(p, []byte("\n"))
|
||||
for _, line := range lines {
|
||||
s := string(line)
|
||||
if l.filter != "" && strings.Contains(s, l.filter) || strings.TrimSpace(s) == "" {
|
||||
continue
|
||||
}
|
||||
_, err := l.w.Write(p)
|
||||
if err != nil {
|
||||
fmt.Printf("%s %s: %v", l.prefix, s, err)
|
||||
} else {
|
||||
fmt.Printf("%s %s", l.prefix, s)
|
||||
}
|
||||
}
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
// NewWriteLogger returns a writer that behaves like w except
|
||||
// that it logs (using fmt.Printf) each write to standard error,
|
||||
// printing the prefix and the string data written.
|
||||
func NewWriteLogger(prefix string, w io.Writer, filter string) io.Writer {
|
||||
return &writeLogger{prefix, w, filter}
|
||||
}
|
||||
@@ -1,292 +0,0 @@
|
||||
//nolint:lll
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/grpc"
|
||||
"github.com/txix-open/isp-kit/grpc/apierrors"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"isp-config-service/domain"
|
||||
"isp-config-service/entity"
|
||||
)
|
||||
|
||||
type ConfigService interface {
|
||||
GetActiveConfigByModuleName(ctx context.Context, moduleName string) (*domain.Config, error)
|
||||
GetConfigsByModuleId(ctx context.Context, moduleId string) ([]domain.Config, error)
|
||||
CreateUpdateConfig(ctx context.Context, adminId int, req domain.CreateUpdateConfigRequest) (*domain.CreateUpdateConfigResponse, error)
|
||||
GetConfigById(ctx context.Context, configId string) (*domain.Config, error)
|
||||
MarkConfigAsActive(ctx context.Context, configId string) error
|
||||
DeleteConfig(ctx context.Context, id string) error
|
||||
UpdateConfigName(ctx context.Context, req domain.UpdateConfigNameRequest) error
|
||||
SyncConfig(ctx context.Context, moduleName string) error
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
service ConfigService
|
||||
}
|
||||
|
||||
func NewConfig(service ConfigService) Config {
|
||||
return Config{
|
||||
service: service,
|
||||
}
|
||||
}
|
||||
|
||||
// GetActiveConfigByModuleName
|
||||
// @Summary Метод получения объекта конфигурации по названию модуля
|
||||
// @Description Возвращает активную конфиграцию по названию модуля
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.GetByModuleNameRequest true "название модуля"
|
||||
// @Success 200 {object} domain.Config
|
||||
// @Failure 400 {object} apierrors.Error "`errorCode: 2001` - модуль не найден<br/>`errorCode: 2002` - конфиг не найден"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /config/get_active_config_by_module_name [POST]
|
||||
func (c Config) GetActiveConfigByModuleName(ctx context.Context, req domain.GetByModuleNameRequest) (*domain.Config, error) {
|
||||
config, err := c.service.GetActiveConfigByModuleName(ctx, req.ModuleName)
|
||||
switch {
|
||||
case errors.Is(err, entity.ErrModuleNotFound):
|
||||
return nil, apierrors.NewBusinessError(
|
||||
domain.ErrorCodeModuleNotFound,
|
||||
"module not found",
|
||||
err,
|
||||
)
|
||||
case errors.Is(err, entity.ErrConfigNotFound):
|
||||
return nil, apierrors.NewBusinessError(
|
||||
domain.ErrorCodeConfigNotFound,
|
||||
"active config not found",
|
||||
err,
|
||||
)
|
||||
case err != nil:
|
||||
return nil, apierrors.NewInternalServiceError(err)
|
||||
default:
|
||||
return config, nil
|
||||
}
|
||||
}
|
||||
|
||||
// GetConfigsByModuleId
|
||||
// @Summary Метод получения списка конфигураций по ID модуля
|
||||
// @Description Возвращает список конфиграции по ID модуля
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.GetByModuleIdRequest true "ID модуля"
|
||||
// @Success 200 {array} domain.Config
|
||||
// @Failure 400 {object} apierrors.Error "если идентификатор не указан"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /config/get_configs_by_module_id [POST]
|
||||
func (c Config) GetConfigsByModuleId(ctx context.Context, req domain.GetByModuleIdRequest) ([]domain.Config, error) {
|
||||
configs, err := c.service.GetConfigsByModuleId(ctx, req.ModuleId)
|
||||
switch {
|
||||
case err != nil:
|
||||
return nil, apierrors.NewInternalServiceError(err)
|
||||
default:
|
||||
return configs, nil
|
||||
}
|
||||
}
|
||||
|
||||
// CreateUpdateConfig
|
||||
// @Summary Метод обновления конфигурации
|
||||
// @Description Если конфиг с таким id существует, то обновляет данные, если нет, то добавляет данные в базу
|
||||
// @Description В случае обновления рассылает всем подключенным модулям актуальную конфигурацию
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.CreateUpdateConfigRequest true "объект для сохранения"
|
||||
// @Success 200 {object} domain.CreateUpdateConfigResponse
|
||||
// @Failure 400 {object} apierrors.Error "`errorCode: 2003` - конфиг не соотвествует текущей схеме<br/>`errorCode: 2002` - указанного id не сущесвует<br/>`errorCode: 2004` - кто-то уже обновил конфигурацию<br/>`errorCode: 2005` - схема конфигурации не найдена<br/>"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /config/create_update_config [POST]
|
||||
func (c Config) CreateUpdateConfig(
|
||||
ctx context.Context,
|
||||
authData grpc.AuthData,
|
||||
req domain.CreateUpdateConfigRequest,
|
||||
) (*domain.CreateUpdateConfigResponse, error) {
|
||||
adminIdValue, _ := grpc.StringFromMd("x-admin-id", metadata.MD(authData))
|
||||
var adminId int
|
||||
if adminIdValue != "" {
|
||||
adminId, _ = strconv.Atoi(adminIdValue)
|
||||
}
|
||||
|
||||
resp, err := c.service.CreateUpdateConfig(ctx, adminId, req)
|
||||
|
||||
var validationError domain.ConfigValidationError
|
||||
switch {
|
||||
case errors.As(err, &validationError):
|
||||
details := map[string]any{}
|
||||
for key, value := range validationError.Details {
|
||||
details[key] = value
|
||||
}
|
||||
return nil, apierrors.NewBusinessError(
|
||||
domain.ErrorCodeInvalidConfig,
|
||||
"invalid config",
|
||||
err,
|
||||
).WithDetails(details)
|
||||
case errors.Is(err, entity.ErrConfigNotFound):
|
||||
return nil, apierrors.NewBusinessError(
|
||||
domain.ErrorCodeConfigNotFound,
|
||||
"config not found",
|
||||
err,
|
||||
)
|
||||
case errors.Is(err, entity.ErrConfigConflictUpdate):
|
||||
return nil, apierrors.NewBusinessError(
|
||||
domain.ErrorCodeConfigVersionConflict,
|
||||
"someone has updated the config",
|
||||
err,
|
||||
)
|
||||
case errors.Is(err, entity.ErrSchemaNotFound):
|
||||
return nil, apierrors.NewBusinessError(
|
||||
domain.ErrorCodeSchemaNotFound,
|
||||
"config schema not found",
|
||||
err,
|
||||
)
|
||||
case err != nil:
|
||||
return nil, apierrors.NewInternalServiceError(err)
|
||||
default:
|
||||
return resp, nil
|
||||
}
|
||||
}
|
||||
|
||||
// GetConfigById
|
||||
// @Summary Метод получение конфигурации по id
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.IdRequest true "id конфигурации"
|
||||
// @Success 200 {object} domain.Config
|
||||
// @Failure 400 {object} apierrors.Error "`errorCode: 2002` - конфиг не найден<br/>"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /config/get_config_by_id [POST]
|
||||
func (c Config) GetConfigById(ctx context.Context, req domain.IdRequest) (*domain.Config, error) {
|
||||
config, err := c.service.GetConfigById(ctx, req.Id)
|
||||
switch {
|
||||
case errors.Is(err, entity.ErrConfigNotFound):
|
||||
return nil, apierrors.NewBusinessError(
|
||||
domain.ErrorCodeConfigNotFound,
|
||||
"config not found",
|
||||
err,
|
||||
)
|
||||
case err != nil:
|
||||
return nil, apierrors.NewInternalServiceError(err)
|
||||
default:
|
||||
return config, nil
|
||||
}
|
||||
}
|
||||
|
||||
// MarkConfigAsActive
|
||||
// @Summary Метод активации конфигурации для модуля
|
||||
// @Description Активирует указанную конфигурацию и деактивирует остальные, возвращает активированную конфигурацию
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.IdRequest true "id конфигурации для изменения"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} apierrors.Error "`errorCode: 2002` - конфиг не найден<br/>"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /config/mark_config_as_active [POST]
|
||||
func (c Config) MarkConfigAsActive(ctx context.Context, identity domain.IdRequest) error {
|
||||
err := c.service.MarkConfigAsActive(ctx, identity.Id)
|
||||
switch {
|
||||
case errors.Is(err, entity.ErrConfigNotFound):
|
||||
return apierrors.NewBusinessError(
|
||||
domain.ErrorCodeConfigNotFound,
|
||||
"config not found",
|
||||
err,
|
||||
)
|
||||
case err != nil:
|
||||
return apierrors.NewInternalServiceError(err)
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteConfigs
|
||||
// @Summary Метод удаления объектов конфигурации по идентификаторам
|
||||
// @Description Возвращает количество удаленных модулей
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []string true "массив идентификаторов конфигураций"
|
||||
// @Success 200 {object} domain.DeleteResponse
|
||||
// @Failure 400 {object} apierrors.Error "если не указан массив идентификаторов"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /config/delete_config [POST]
|
||||
func (c Config) DeleteConfigs(ctx context.Context, identities []string) (*domain.DeleteResponse, error) {
|
||||
configId, err := getSingleId(identities)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = c.service.DeleteConfig(ctx, configId)
|
||||
switch {
|
||||
case errors.Is(err, entity.ErrConfigNotFoundOrActive):
|
||||
return nil, apierrors.NewBusinessError(
|
||||
domain.ErrorCodeConfigNotFound,
|
||||
"config not found or is active",
|
||||
err,
|
||||
)
|
||||
case err != nil:
|
||||
return nil, apierrors.NewInternalServiceError(err)
|
||||
default:
|
||||
return &domain.DeleteResponse{
|
||||
Deleted: 1,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateConfigName
|
||||
// @Summary Метод переименования объекта конфигурации
|
||||
// @Description Изменеяет название конфигурации без повышения версии и без рассылки события
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.UpdateConfigNameRequest true "id конфигурации и новое название"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} apierrors.Error "`errorCode: 2002` - конфиг не найден<br/>"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /config/update_config_name [POST]
|
||||
func (c Config) UpdateConfigName(ctx context.Context, req domain.UpdateConfigNameRequest) error {
|
||||
err := c.service.UpdateConfigName(ctx, req)
|
||||
switch {
|
||||
case errors.Is(err, entity.ErrConfigNotFound):
|
||||
return apierrors.NewBusinessError(
|
||||
domain.ErrorCodeConfigNotFound,
|
||||
"config not found",
|
||||
err,
|
||||
)
|
||||
case err != nil:
|
||||
return apierrors.NewInternalServiceError(err)
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// SyncConfig
|
||||
// @Summary Метод синхронизации актуальной конфигурации пришедешего модуля
|
||||
// @Description Метод синхронизации актуальной конфигурации пришедешего модуля
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.SyncConfigRequest true "название модуля"
|
||||
// @Success 200 {object} domain.Config
|
||||
// @Failure 400 {object} apierrors.Error "`errorCode: 2001` - модуль не найден<br/>`errorCode: 2002` - конфиг не найден"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /config/sync_config [POST]
|
||||
func (c Config) SyncConfig(ctx context.Context, req domain.SyncConfigRequest) error {
|
||||
err := c.service.SyncConfig(ctx, req.ModuleName)
|
||||
switch {
|
||||
case errors.Is(err, entity.ErrModuleNotFound):
|
||||
return apierrors.NewBusinessError(
|
||||
domain.ErrorCodeModuleNotFound,
|
||||
"module not found",
|
||||
err,
|
||||
)
|
||||
case err != nil:
|
||||
return apierrors.NewInternalServiceError(err)
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"isp-config-service/domain"
|
||||
"isp-config-service/entity"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/grpc/apierrors"
|
||||
)
|
||||
|
||||
type ConfigHistoryService interface {
|
||||
GetAllVersions(ctx context.Context, configId string) ([]domain.ConfigVersion, error)
|
||||
Delete(ctx context.Context, id string) error
|
||||
Purge(ctx context.Context, moduleName string, keepVersions int) (map[string]int, error)
|
||||
}
|
||||
|
||||
type ConfigHistory struct {
|
||||
service ConfigHistoryService
|
||||
}
|
||||
|
||||
func NewConfigHistory(service ConfigHistoryService) ConfigHistory {
|
||||
return ConfigHistory{
|
||||
service: service,
|
||||
}
|
||||
}
|
||||
|
||||
// GetAllVersion
|
||||
// @Summary Метод получение старых версий конфигурации
|
||||
// @Description Возвращает предыдущие версии конфигураций
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.IdRequest true "id конфигурации"
|
||||
// @Success 200 {array} domain.ConfigVersion
|
||||
// @Failure 400 {object} apierrors.Error "если не указан массив идентификаторов"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /config/get_all_version [POST]
|
||||
func (c ConfigHistory) GetAllVersion(ctx context.Context, req domain.IdRequest) ([]domain.ConfigVersion, error) {
|
||||
versions, err := c.service.GetAllVersions(ctx, req.Id)
|
||||
switch {
|
||||
case errors.Is(err, entity.ErrConfigNotFound):
|
||||
return nil, apierrors.NewBusinessError(
|
||||
domain.ErrorCodeConfigNotFound,
|
||||
"config not found",
|
||||
err,
|
||||
)
|
||||
case err != nil:
|
||||
return nil, apierrors.NewInternalServiceError(err)
|
||||
default:
|
||||
return versions, nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteConfigVersion
|
||||
// @Summary Метод удаления версии конфигурации
|
||||
// @Description Возвращает количество удаленных версий
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.IdRequest true "id версии конфигурации"
|
||||
// @Success 200 {object} domain.DeleteResponse
|
||||
// @Failure 400 {object} apierrors.Error "не указан массив идентификаторов"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /config/delete_version [POST]
|
||||
func (c ConfigHistory) DeleteConfigVersion(ctx context.Context, req domain.IdRequest) (*domain.DeleteResponse, error) {
|
||||
err := c.service.Delete(ctx, req.Id)
|
||||
if err != nil {
|
||||
return nil, apierrors.NewInternalServiceError(err)
|
||||
}
|
||||
return &domain.DeleteResponse{
|
||||
Deleted: 1,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// PurgeConfigVersions
|
||||
// @Summary Метод удаления старых версий всех конфигураций модуля, оставляет keepVersions последних версий каждой конфигурации
|
||||
// @Description Возвращает количество удаленных версий каждой конфигурации
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.PurgeConfigVersionsRequest true "Название модуля, количество оставленных версий конфигурации"
|
||||
// @Success 200 {object} map[string]int
|
||||
// @Failure 400 {object} apierrors.Error "`errorCode: 2001` - модуль не найден"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /config/purge_versions [POST]
|
||||
func (c ConfigHistory) PurgeConfigVersions(ctx context.Context, req domain.PurgeConfigVersionsRequest) (map[string]int, error) {
|
||||
result, err := c.service.Purge(ctx, req.ModuleName, req.KeepVersions)
|
||||
switch {
|
||||
case errors.Is(err, entity.ErrModuleNotFound):
|
||||
return nil, apierrors.NewBusinessError(
|
||||
domain.ErrorCodeModuleNotFound,
|
||||
"module not found",
|
||||
err,
|
||||
)
|
||||
case err != nil:
|
||||
return nil, apierrors.NewInternalServiceError(err)
|
||||
default:
|
||||
return result, nil
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"isp-config-service/domain"
|
||||
"isp-config-service/entity"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/grpc/apierrors"
|
||||
)
|
||||
|
||||
type ConfigSchemaService interface {
|
||||
SchemaByModuleId(ctx context.Context, moduleId string) (*domain.ConfigSchema, error)
|
||||
UpdateSchemaByModuleName(ctx context.Context, request domain.UpdateSchemaRequest) error
|
||||
}
|
||||
|
||||
type ConfigSchema struct {
|
||||
service ConfigSchemaService
|
||||
}
|
||||
|
||||
func NewConfigSchema(service ConfigSchemaService) ConfigSchema {
|
||||
return ConfigSchema{
|
||||
service: service,
|
||||
}
|
||||
}
|
||||
|
||||
// SchemaByModuleId
|
||||
// @Summary Метод получения схемы конфигурации модуля
|
||||
// @Description Возвращает текущую json схему конфигурации модуля
|
||||
// @Tags Схема
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.GetByModuleIdRequest true "идентификатор модуля"
|
||||
// @Success 200 {object} domain.ConfigSchema
|
||||
// @Failure 400 {object} apierrors.Error "`errorCode: 2005` - схема для модуля не найдена"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /schema/get_by_module_id [POST]
|
||||
func (c ConfigSchema) SchemaByModuleId(ctx context.Context, request domain.GetByModuleIdRequest) (*domain.ConfigSchema, error) {
|
||||
schema, err := c.service.SchemaByModuleId(ctx, request.ModuleId)
|
||||
switch {
|
||||
case errors.Is(err, entity.ErrSchemaNotFound):
|
||||
return nil, apierrors.NewBusinessError(
|
||||
domain.ErrorCodeSchemaNotFound,
|
||||
"config schema not found",
|
||||
err,
|
||||
)
|
||||
case err != nil:
|
||||
return nil, apierrors.NewInternalServiceError(err)
|
||||
default:
|
||||
return schema, nil
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateSchemaByModuleName
|
||||
// @Summary Метод обновления схемы конфигурации модуля
|
||||
// @Description Меняет схему конфигурации модуля на переданную
|
||||
// @Tags Схема
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.UpdateSchemaRequest true "название модуля и схема конфига"
|
||||
// @Success 200 {object} any
|
||||
// @Failure 400 {object} apierrors.Error "`errorCode: 2001` - модуль не найден"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /schema/update_by_module_name [POST]
|
||||
func (c ConfigSchema) UpdateSchemaByModuleName(ctx context.Context, request domain.UpdateSchemaRequest) error {
|
||||
err := c.service.UpdateSchemaByModuleName(ctx, request)
|
||||
switch {
|
||||
case errors.Is(err, entity.ErrModuleNotFound):
|
||||
return apierrors.NewBusinessError(
|
||||
domain.ErrorCodeModuleNotFound,
|
||||
"module not found",
|
||||
err,
|
||||
)
|
||||
case err != nil:
|
||||
return apierrors.NewInternalServiceError(err)
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/txix-open/isp-kit/grpc/apierrors"
|
||||
"isp-config-service/domain"
|
||||
)
|
||||
|
||||
type ModuleService interface {
|
||||
Status(ctx context.Context) ([]domain.ModuleInfo, error)
|
||||
Delete(ctx context.Context, id string) error
|
||||
Connections(ctx context.Context) ([]domain.Connection, error)
|
||||
}
|
||||
|
||||
type Module struct {
|
||||
service ModuleService
|
||||
}
|
||||
|
||||
func NewModule(service ModuleService) Module {
|
||||
return Module{
|
||||
service: service,
|
||||
}
|
||||
}
|
||||
|
||||
// Status
|
||||
// @Summary Метод полчения полной информации о состоянии модулей
|
||||
// @Description Возвращает полное состояние всех модулей в кластере (схема конфигурации, подключенные экземпляры)
|
||||
// @Tags Модули
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {array} domain.ModuleInfo
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /module/get_modules_info [POST]
|
||||
func (c Module) Status(ctx context.Context) ([]domain.ModuleInfo, error) {
|
||||
modulesInfo, err := c.service.Status(ctx)
|
||||
if err != nil {
|
||||
return nil, apierrors.NewInternalServiceError(err)
|
||||
}
|
||||
return modulesInfo, nil
|
||||
}
|
||||
|
||||
// DeleteModule
|
||||
// @Summary Метод удаления объектов модулей по идентификаторам
|
||||
// @Description Возвращает количество удаленных модулей
|
||||
// @Tags Модули
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []string true "массив идентификаторов модулей"
|
||||
// @Success 200 {object} domain.DeleteResponse
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /module/delete_module [POST]
|
||||
func (c Module) DeleteModule(ctx context.Context, identities []string) (*domain.DeleteResponse, error) {
|
||||
id, err := getSingleId(identities)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = c.service.Delete(ctx, id)
|
||||
if err != nil {
|
||||
return nil, apierrors.NewInternalServiceError(err)
|
||||
}
|
||||
|
||||
return &domain.DeleteResponse{
|
||||
Deleted: len(identities),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Connections
|
||||
// @Summary Метод получения маршрутов
|
||||
// @Description Возвращает все доступные роуты
|
||||
// @Tags Модули
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {array} domain.Connection
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /routing/get_routes [POST]
|
||||
func (c Module) Connections(ctx context.Context) ([]domain.Connection, error) {
|
||||
connections, err := c.service.Connections(ctx)
|
||||
if err != nil {
|
||||
return nil, apierrors.NewInternalServiceError(err)
|
||||
}
|
||||
return connections, nil
|
||||
}
|
||||
|
||||
func getSingleId(identities []string) (string, error) {
|
||||
if len(identities) == 0 {
|
||||
return "", apierrors.NewBusinessError(domain.ErrorCodeBadRequest, "at least one id is required", nil)
|
||||
}
|
||||
if len(identities) > 1 {
|
||||
return "", apierrors.NewBusinessError(domain.ErrorCodeBadRequest, "accept only single identity", nil)
|
||||
}
|
||||
return identities[0], nil
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
//nolint:lll
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/grpc/apierrors"
|
||||
_ "github.com/txix-open/isp-kit/grpc/apierrors"
|
||||
"isp-config-service/domain"
|
||||
"isp-config-service/entity"
|
||||
)
|
||||
|
||||
type Service interface {
|
||||
All(ctx context.Context) ([]domain.Variable, error)
|
||||
GetByName(ctx context.Context, name string) (*domain.Variable, error)
|
||||
Create(ctx context.Context, req domain.CreateVariableRequest) error
|
||||
Update(ctx context.Context, req domain.UpdateVariableRequest) error
|
||||
Upsert(ctx context.Context, req []domain.UpsertVariableRequest) error
|
||||
Delete(ctx context.Context, name string) error
|
||||
}
|
||||
|
||||
type Variable struct {
|
||||
service Service
|
||||
}
|
||||
|
||||
func NewVariable(service Service) Variable {
|
||||
return Variable{
|
||||
service: service,
|
||||
}
|
||||
}
|
||||
|
||||
// All
|
||||
// @Summary Метод получения списка всех переменных
|
||||
// @Tags Переменные
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {array} domain.Variable
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /variable/all [POST]
|
||||
func (c Variable) All(ctx context.Context) ([]domain.Variable, error) {
|
||||
return c.service.All(ctx)
|
||||
}
|
||||
|
||||
// GetByName
|
||||
// @Summary Метод получения переменной по точному совпадению имени
|
||||
// @Tags Переменные
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.VariableByNameRequest true "тело запроса"
|
||||
// @Success 200 {object} domain.Variable
|
||||
// @Failure 400 {object} apierrors.Error "`errorCode: 2006` - переменная по имени не найдена<br/>"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /variable/get_by_name [POST]
|
||||
func (c Variable) GetByName(ctx context.Context, req domain.VariableByNameRequest) (*domain.Variable, error) {
|
||||
v, err := c.service.GetByName(ctx, req.Name)
|
||||
switch {
|
||||
case errors.Is(err, entity.ErrVariableNotFound):
|
||||
return nil, apierrors.NewBusinessError(domain.ErrorCodeVariableNotFound, "variable by name not found", err)
|
||||
case err != nil:
|
||||
return nil, apierrors.NewInternalServiceError(err)
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
// Create
|
||||
// @Summary Метод создания новой переменной
|
||||
// @Description Создает новую переменную с указанным наименованием и значением
|
||||
// @Tags Переменные
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.CreateVariableRequest true "тело запроса"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} apierrors.Error "`errorCode: 2007` - переменная с таким именем уже существует<br/>"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /variable/create [POST]
|
||||
func (c Variable) Create(ctx context.Context, req domain.CreateVariableRequest) error {
|
||||
err := c.service.Create(ctx, req)
|
||||
switch {
|
||||
case errors.Is(err, entity.ErrVariableAlreadyExists):
|
||||
return apierrors.NewBusinessError(domain.ErrorCodeVariableAlreadyExists, "variable with the same name already exists", err)
|
||||
case err != nil:
|
||||
return apierrors.NewInternalServiceError(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Update
|
||||
// @Summary Метод обновления переменной
|
||||
// @Description Выполняет обновление переменной по ее названию
|
||||
// @Tags Переменные
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.UpdateVariableRequest true "тело запроса"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} apierrors.Error "`errorCode: 2006` - переменная по имени не найдена<br/>"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /variable/update [POST]
|
||||
func (c Variable) Update(ctx context.Context, req domain.UpdateVariableRequest) error {
|
||||
err := c.service.Update(ctx, req)
|
||||
switch {
|
||||
case errors.Is(err, entity.ErrVariableNotFound):
|
||||
return apierrors.NewBusinessError(domain.ErrorCodeVariableNotFound, "variable by name not found", err)
|
||||
case err != nil:
|
||||
return apierrors.NewInternalServiceError(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Upsert
|
||||
// @Summary Метод добавления/обновления переменных
|
||||
// @Description Выполняет безусловное добавление/обновление указанных в теле запроса переменных
|
||||
// @Description Операция выполняется не в транзакции
|
||||
// @Tags Переменные
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []domain.UpsertVariableRequest true "тело запроса"
|
||||
// @Success 200
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /variable/upsert [POST]
|
||||
func (c Variable) Upsert(ctx context.Context, req []domain.UpsertVariableRequest) error {
|
||||
err := c.service.Upsert(ctx, req)
|
||||
if err != nil {
|
||||
return apierrors.NewInternalServiceError(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Delete
|
||||
// @Summary Метод удаления переменной
|
||||
// @Description Переменная связанная с конфигурациями, не может быть удалена
|
||||
// @Tags Переменные
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.VariableByNameRequest true "тело запроса"
|
||||
// @Success 200
|
||||
// @Failure 400 {object} apierrors.Error "`errorCode: 2006` - переменная по имени не найдена<br/>`errorCode: 2008` - переменная используется в конфигурациях<br/>"
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /variable/delete [POST]
|
||||
func (c Variable) Delete(ctx context.Context, req domain.VariableByNameRequest) error {
|
||||
err := c.service.Delete(ctx, req.Name)
|
||||
switch {
|
||||
case errors.Is(err, entity.ErrVariableNotFound):
|
||||
return apierrors.NewBusinessError(domain.ErrorCodeVariableNotFound, "variable by name not found", err)
|
||||
case errors.Is(err, entity.ErrVariableUsedInConfigs):
|
||||
return apierrors.NewBusinessError(domain.ErrorCodeVariableUsedInConfigs, "variable used in configs", err)
|
||||
case err != nil:
|
||||
return apierrors.NewInternalServiceError(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"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"
|
||||
)
|
||||
|
||||
var CommonConfig *commonConfig
|
||||
|
||||
type commonConfig struct {
|
||||
rstore *store.Store
|
||||
}
|
||||
|
||||
// GetConfigs godoc
|
||||
// @Summary Метод получения объектов конфигурации по идентификаторам
|
||||
// @Description Возвращает массив конфигураций по запрошенным идентификаторам (все, если массив пустой)
|
||||
// @Tags Общие конфигурации
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {array} entity.CommonConfig
|
||||
// @Router /common_config/get_configs [POST]
|
||||
func (c *commonConfig) GetConfigs(identities []string) []entity.CommonConfig {
|
||||
var response []entity.CommonConfig
|
||||
c.rstore.VisitReadonlyState(func(state state.ReadonlyState) {
|
||||
if len(identities) > 0 {
|
||||
response = state.CommonConfigs().GetByIds(identities)
|
||||
} else {
|
||||
response = state.CommonConfigs().GetAll()
|
||||
}
|
||||
})
|
||||
return response
|
||||
}
|
||||
|
||||
// CreateUpdateConfig godoc
|
||||
// @Summary Метод обновления общей конфигурации
|
||||
// @Description Если конфиг с таким id существует, то обновляет данные, если нет, то добавляет данные в базу
|
||||
// В случае обновления рассылает все подключенным модулям актуальную конфигурацию
|
||||
// @Tags Общие конфигурации
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body entity.CommonConfig true "объект для сохранения"
|
||||
// @Success 200 {object} entity.CommonConfig
|
||||
// @Failure 404 {object} structure.GrpcError "если конфигурация не найдена"
|
||||
// @Failure 500 {object} structure.GrpcError
|
||||
// @Router /common_config/create_update_config [POST]
|
||||
func (c *commonConfig) CreateUpdateConfig(config entity.CommonConfig) (*entity.CommonConfig, error) {
|
||||
var response entity.CommonConfig
|
||||
now := state.GenerateDate()
|
||||
config.CreatedAt = now
|
||||
config.UpdatedAt = now
|
||||
upsertConfig := cluster.UpsertCommonConfig{
|
||||
Config: config,
|
||||
}
|
||||
if config.Id == "" {
|
||||
upsertConfig.Config.Id = state.GenerateId()
|
||||
upsertConfig.Create = true
|
||||
}
|
||||
command := cluster.PrepareUpsertCommonConfigCommand(upsertConfig)
|
||||
err := PerformSyncApplyWithError(command, "UpsertCommonConfigCommand", &response)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &response, nil
|
||||
}
|
||||
|
||||
// DeleteConfigs godoc
|
||||
// @Summary Метод удаления объектов общей конфигурации по идентификаторам
|
||||
// @Description Возвращает флаг удаления и набор связей с модулями и конфигурациями, в случае наличия связей deleted всегда false
|
||||
// @Tags Общие конфигурации
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.ConfigIdRequest true "id общей конфигурации"
|
||||
// @Success 200 {object} domain.DeleteCommonConfigResponse
|
||||
// @Failure 500 {object} structure.GrpcError
|
||||
// @Router /common_config/delete_config [POST]
|
||||
func (c *commonConfig) DeleteConfigs(req domain.ConfigIdRequest) (*domain.DeleteCommonConfigResponse, error) {
|
||||
var response domain.DeleteCommonConfigResponse
|
||||
command := cluster.PrepareDeleteCommonConfigsCommand(req.Id)
|
||||
err := PerformSyncApplyWithError(command, "DeleteCommonConfigsCommand", &response)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &response, nil
|
||||
}
|
||||
|
||||
// CompileConfigs godoc
|
||||
// @Summary Метод компиляции итоговой конфигурации для модулей
|
||||
// @Description Возвращает скомпилированный объект конфигурации
|
||||
// @Tags Общие конфигурации
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.CompileConfigsRequest true "перечисление идентификаторов общей конфигурации и исхдных конфиг"
|
||||
// @Success 200 {object} domain.CompiledConfigResponse
|
||||
// @Router /common_config/compile [POST]
|
||||
func (c *commonConfig) CompileConfigs(req domain.CompileConfigsRequest) domain.CompiledConfigResponse {
|
||||
var result map[string]interface{}
|
||||
c.rstore.VisitReadonlyState(func(state state.ReadonlyState) {
|
||||
result = service.ConfigService.CompileConfig(req.Data, state, req.CommonConfigsIdList...)
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
// GetLinks godoc
|
||||
// @Summary Метод получения связей общей конфигурациями с конфигурацией модулей
|
||||
// @Description Возвращает ассоциативный массив, ключами которого являются название модулей, а значения - название конфигурации модуля
|
||||
// @Tags Общие конфигурации
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.ConfigIdRequest true "id общей конфигурации"
|
||||
// @Success 200 {object} domain.CommonConfigLinks
|
||||
// @Router /common_config/get_links [POST]
|
||||
func (c *commonConfig) GetLinks(req domain.ConfigIdRequest) domain.CommonConfigLinks {
|
||||
var result domain.CommonConfigLinks
|
||||
c.rstore.VisitReadonlyState(func(state state.ReadonlyState) {
|
||||
result = service.CommonConfigService.GetCommonConfigLinks(req.Id, state)
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
func NewCommonConfig(rstore *store.Store) *commonConfig {
|
||||
return &commonConfig{
|
||||
rstore: rstore,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/integration-system/isp-lib/utils"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"isp-config-service/cluster"
|
||||
"isp-config-service/domain"
|
||||
"isp-config-service/entity"
|
||||
"isp-config-service/store"
|
||||
"isp-config-service/store/state"
|
||||
)
|
||||
|
||||
var Config *config
|
||||
|
||||
type config struct {
|
||||
rstore *store.Store
|
||||
}
|
||||
|
||||
// GetActiveConfigByModuleName godoc
|
||||
// @Summary Метод получения объекта конфигурации по названию модуля
|
||||
// @Description Возвращает активную конфиграцию по названию модуля
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.GetByModuleNameRequest true "название модуля"
|
||||
// @Success 200 {object} entity.Config
|
||||
// @Failure 404 {object} structure.GrpcError "если конфигурация не найдена"
|
||||
// @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
|
||||
c.rstore.VisitReadonlyState(func(state state.ReadonlyState) {
|
||||
module := state.Modules().GetByName(request.ModuleName)
|
||||
if module != nil {
|
||||
response = state.Configs().GetActiveByModuleId(module.Id)
|
||||
}
|
||||
})
|
||||
if response == nil {
|
||||
return nil, status.Error(codes.NotFound, utils.ValidationError)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// CreateUpdateConfig godoc
|
||||
// @Summary Метод обновления конфигурации
|
||||
// @Description Если конфиг с таким id существует, то обновляет данные, если нет, то добавляет данные в базу
|
||||
// В случае обновления рассылает все подключенным модулям актуальную конфигурацию
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.CreateUpdateConfigRequest true "объект для сохранения"
|
||||
// @Success 200 {object} domain.ConfigModuleInfo
|
||||
// @Failure 404 {object} structure.GrpcError "если конфигурация не найдена"
|
||||
// @Failure 500 {object} structure.GrpcError
|
||||
// @Router /config/create_update_config [POST]
|
||||
func (c *config) CreateUpdateConfig(config domain.CreateUpdateConfigRequest) (*domain.ConfigModuleInfo, error) {
|
||||
var response domain.CreateUpdateConfigResponse
|
||||
now := state.GenerateDate()
|
||||
config.CreatedAt = now
|
||||
config.UpdatedAt = now
|
||||
upsertConfig := cluster.UpsertConfig{
|
||||
Config: config.Config,
|
||||
Unsafe: config.Unsafe,
|
||||
}
|
||||
if config.Id == "" {
|
||||
upsertConfig.Config.Id = state.GenerateId()
|
||||
upsertConfig.Create = true
|
||||
}
|
||||
command := cluster.PrepareUpsertConfigCommand(upsertConfig)
|
||||
err := PerformSyncApplyWithError(command, "UpsertConfigCommand", &response)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if response.Config != nil {
|
||||
return response.Config, nil
|
||||
} else {
|
||||
return nil, utils.CreateValidationErrorDetails(codes.InvalidArgument, utils.ValidationError, response.ErrorDetails)
|
||||
}
|
||||
}
|
||||
|
||||
// MarkConfigAsActive godoc
|
||||
// @Summary Метод активации конфигурации для модуля
|
||||
// @Description Активирует указанную конфигурацию и деактивирует остальные, возвращает активированную конфигурацию
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.ConfigIdRequest true "id конфигурации для изменения"
|
||||
// @Success 200 {object} entity.Config "активированная конфигурация"
|
||||
// @Failure 404 {object} structure.GrpcError "если конфигурация не найдена"
|
||||
// @Failure 500 {object} structure.GrpcError
|
||||
// @Router /config/mark_config_as_active [POST]
|
||||
func (c *config) MarkConfigAsActive(identity domain.ConfigIdRequest) (*entity.Config, error) {
|
||||
var response entity.Config
|
||||
command := cluster.PrepareActivateConfigCommand(identity.Id, state.GenerateDate())
|
||||
err := PerformSyncApplyWithError(command, "ActivateConfigCommand", &response)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &response, nil
|
||||
}
|
||||
|
||||
// DeleteConfigs godoc
|
||||
// @Summary Метод удаления объектов конфигурации по идентификаторам
|
||||
// @Description Возвращает количество удаленных модулей
|
||||
// @Tags Конфигурация
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []string true "массив идентификаторов конфигураций"
|
||||
// @Success 200 {object} domain.DeleteResponse
|
||||
// @Failure 400 {object} structure.GrpcError "если не указан массив идентификаторов"
|
||||
// @Failure 500 {object} structure.GrpcError
|
||||
// @Router /config/delete_config [POST]
|
||||
func (c *config) DeleteConfigs(identities []string) (*domain.DeleteResponse, error) {
|
||||
if len(identities) == 0 {
|
||||
validationErrors := map[string]string{
|
||||
"ids": "Required",
|
||||
}
|
||||
return nil, utils.CreateValidationErrorDetails(codes.InvalidArgument, utils.ValidationError, validationErrors)
|
||||
}
|
||||
var response domain.DeleteResponse
|
||||
command := cluster.PrepareDeleteConfigsCommand(identities)
|
||||
err := PerformSyncApply(command, "DeleteConfigsCommand", &response)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &response, nil
|
||||
}
|
||||
|
||||
func NewConfig(rstore *store.Store) *config {
|
||||
return &config{
|
||||
rstore: rstore,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/integration-system/isp-lib/utils"
|
||||
log "github.com/integration-system/isp-log"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"isp-config-service/cluster"
|
||||
codes2 "isp-config-service/codes"
|
||||
"isp-config-service/holder"
|
||||
)
|
||||
|
||||
var json = jsoniter.ConfigFastest
|
||||
|
||||
func unknownError() error {
|
||||
return status.Error(codes.Unknown, utils.ServiceError)
|
||||
}
|
||||
|
||||
func PerformSyncApply(command []byte, commandName string, responsePtr interface{}) error {
|
||||
applyLogResponse, err := holder.ClusterClient.SyncApply(command)
|
||||
if err != nil {
|
||||
log.Warnf(codes2.SyncApplyError, "apply %s: %v", commandName, err)
|
||||
return unknownError()
|
||||
}
|
||||
if applyLogResponse != nil && applyLogResponse.ApplyError != "" {
|
||||
log.WithMetadata(map[string]interface{}{
|
||||
"result": string(applyLogResponse.Result),
|
||||
"applyError": applyLogResponse.ApplyError,
|
||||
"commandName": commandName,
|
||||
}).Warnf(codes2.SyncApplyError, "apply command")
|
||||
return unknownError()
|
||||
}
|
||||
err = json.Unmarshal(applyLogResponse.Result, responsePtr)
|
||||
if err != nil {
|
||||
return unknownError()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func PerformSyncApplyWithError(command []byte, commandName string, responsePtr interface{}) error {
|
||||
applyLogResponse, err := holder.ClusterClient.SyncApply(command)
|
||||
if err != nil {
|
||||
log.Warnf(codes2.SyncApplyError, "apply %s: %v", commandName, err)
|
||||
return unknownError()
|
||||
}
|
||||
if applyLogResponse != nil && applyLogResponse.ApplyError != "" {
|
||||
log.WithMetadata(map[string]interface{}{
|
||||
"result": string(applyLogResponse.Result),
|
||||
"applyError": applyLogResponse.ApplyError,
|
||||
"commandName": commandName,
|
||||
}).Warnf(codes2.SyncApplyError, "apply command")
|
||||
return unknownError()
|
||||
}
|
||||
clusterResp := cluster.ResponseWithError{
|
||||
Response: responsePtr,
|
||||
}
|
||||
err = json.Unmarshal(applyLogResponse.Result, &clusterResp)
|
||||
if err != nil {
|
||||
return unknownError()
|
||||
}
|
||||
if clusterResp.Error != "" {
|
||||
return status.Error(clusterResp.ErrorCode, clusterResp.Error)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/http/apierrors"
|
||||
"isp-config-service/domain"
|
||||
)
|
||||
|
||||
type metricsService interface {
|
||||
Autodiscovery(ctx context.Context) (domain.AutodiscoveryResponse, error)
|
||||
}
|
||||
|
||||
type Metrics struct {
|
||||
svc metricsService
|
||||
}
|
||||
|
||||
func NewMetrics(svc metricsService) Metrics {
|
||||
return Metrics{svc: svc}
|
||||
}
|
||||
|
||||
// Autodiscovery
|
||||
// @Summary Метод получения конфигурации для HTTP-based service discovery механизма Prometheus
|
||||
// @Tags Метрики
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} domain.AutodiscoveryResponse
|
||||
// @Failure 500 {object} apierrors.Error
|
||||
// @Router /internal/metrics/autodiscovery [POST]
|
||||
func (c Metrics) Autodiscovery(ctx context.Context) (domain.AutodiscoveryResponse, error) {
|
||||
resp, err := c.svc.Autodiscovery(ctx)
|
||||
if err != nil {
|
||||
return nil, apierrors.NewInternalServiceError(errors.WithMessage(err, "autodiscovery"))
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
+49
-124
@@ -1,143 +1,68 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"isp-config-service/cluster"
|
||||
"isp-config-service/domain"
|
||||
"isp-config-service/service"
|
||||
"isp-config-service/store"
|
||||
"isp-config-service/store/state"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/etp/v4"
|
||||
"github.com/txix-open/etp/v4/msg"
|
||||
"github.com/txix-open/isp-kit/cluster"
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
"isp-config-service/helpers"
|
||||
"github.com/integration-system/isp-lib/utils"
|
||||
"google.golang.org/grpc/codes"
|
||||
)
|
||||
|
||||
var (
|
||||
ok = []byte("ok") //nolint:gochecknoglobals
|
||||
)
|
||||
var Module *module
|
||||
|
||||
type ModuleService interface {
|
||||
OnConnect(ctx context.Context, conn *etp.Conn, moduleName string) error
|
||||
OnDisconnect(ctx context.Context, conn *etp.Conn, moduleName string, isNormalClose bool, err error) error
|
||||
OnError(ctx context.Context, conn *etp.Conn, err error)
|
||||
OnModuleReady(
|
||||
ctx context.Context,
|
||||
conn *etp.Conn,
|
||||
backend cluster.BackendDeclaration,
|
||||
) error
|
||||
OnModuleRequirements(
|
||||
ctx context.Context,
|
||||
conn *etp.Conn,
|
||||
requirements cluster.ModuleRequirements,
|
||||
) error
|
||||
OnModuleConfigSchema(
|
||||
ctx context.Context,
|
||||
conn *etp.Conn,
|
||||
data cluster.ConfigData,
|
||||
) error
|
||||
type module struct {
|
||||
rstore *store.Store
|
||||
}
|
||||
|
||||
type Module struct {
|
||||
service ModuleService
|
||||
logger log.Logger
|
||||
// GetModulesAggregatedInfo godoc
|
||||
// @Summary Метод получения полной информации о состоянии модуля
|
||||
// @Description Возвращает полное состояние всех модулей в кластере (конфигурация, схема конфигурации, подключенные экземпляры)
|
||||
// @Tags Модули
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {array} domain.ModuleInfo
|
||||
// @Failure 500 {object} structure.GrpcError
|
||||
// @Router /module/get_modules_info [POST]
|
||||
func (c *module) GetModulesAggregatedInfo() ([]domain.ModuleInfo, error) {
|
||||
var response []domain.ModuleInfo
|
||||
c.rstore.VisitReadonlyState(func(state state.ReadonlyState) {
|
||||
response = service.ModuleRegistryService.GetAggregatedModuleInfo(state)
|
||||
})
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func NewModule(service ModuleService, logger log.Logger) Module {
|
||||
return Module{
|
||||
service: service,
|
||||
logger: logger,
|
||||
// DeleteModules godoc
|
||||
// @Summary Метод удаления объектов модулей по идентификаторам
|
||||
// @Description Возвращает количество удаленных модулей
|
||||
// @Tags Модули
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body []string true "массив идентификаторов модулей"
|
||||
// @Success 200 {object} domain.DeleteResponse
|
||||
// @Failure 500 {object} structure.GrpcError
|
||||
// @Router /module/delete_module [POST]
|
||||
func (*module) DeleteModules(identities []string) (*domain.DeleteResponse, error) {
|
||||
if len(identities) == 0 {
|
||||
validationErrors := map[string]string{
|
||||
"ids": "Required",
|
||||
}
|
||||
return nil, utils.CreateValidationErrorDetails(codes.InvalidArgument, utils.ValidationError, validationErrors)
|
||||
}
|
||||
}
|
||||
|
||||
func (m Module) OnConnect(conn *etp.Conn) {
|
||||
ctx := conn.HttpRequest().Context()
|
||||
err := conn.HttpRequest().ParseForm()
|
||||
var deleteResponse domain.DeleteResponse
|
||||
command := cluster.PrepareDeleteModulesCommand(identities)
|
||||
err := PerformSyncApply(command, "DeleteCommonConfigsCommand", &deleteResponse)
|
||||
if err != nil {
|
||||
m.handleError(ctx, errors.WithMessage(err, "parse form"))
|
||||
_ = conn.Close()
|
||||
return
|
||||
}
|
||||
|
||||
moduleName := helpers.ModuleName(conn)
|
||||
if moduleName == "" {
|
||||
m.handleError(ctx, errors.New("module_name is required query param"))
|
||||
_ = conn.Close()
|
||||
return
|
||||
}
|
||||
|
||||
err = m.service.OnConnect(ctx, conn, moduleName)
|
||||
if err != nil {
|
||||
m.handleError(ctx, errors.WithMessage(err, "handle onConnect"))
|
||||
return nil, err
|
||||
}
|
||||
return &deleteResponse, err
|
||||
}
|
||||
|
||||
func (m Module) OnDisconnect(conn *etp.Conn, err error) {
|
||||
ctx := conn.HttpRequest().Context()
|
||||
handleDisconnectErr := m.service.OnDisconnect(
|
||||
ctx,
|
||||
conn,
|
||||
helpers.ModuleName(conn),
|
||||
etp.IsNormalClose(err),
|
||||
err,
|
||||
)
|
||||
if handleDisconnectErr != nil {
|
||||
m.handleError(ctx, errors.WithMessage(handleDisconnectErr, "handle onDisconnect"))
|
||||
func NewModule(rstore *store.Store) *module {
|
||||
return &module{
|
||||
rstore: rstore,
|
||||
}
|
||||
}
|
||||
|
||||
func (m Module) OnError(conn *etp.Conn, err error) {
|
||||
m.service.OnError(conn.HttpRequest().Context(), conn, err)
|
||||
}
|
||||
|
||||
func (m Module) OnModuleReady(ctx context.Context, conn *etp.Conn, event msg.Event) []byte {
|
||||
backend := cluster.BackendDeclaration{}
|
||||
err := json.Unmarshal(event.Data, &backend)
|
||||
if err != nil {
|
||||
return m.handleError(ctx, errors.WithMessage(err, "unmarshal event data"))
|
||||
}
|
||||
|
||||
err = m.service.OnModuleReady(ctx, conn, backend)
|
||||
if err != nil {
|
||||
return m.handleError(ctx, errors.WithMessage(err, "handle onModuleReady"))
|
||||
}
|
||||
|
||||
return ok
|
||||
}
|
||||
|
||||
func (m Module) OnModuleRequirements(ctx context.Context, conn *etp.Conn, event msg.Event) []byte {
|
||||
requirements := cluster.ModuleRequirements{}
|
||||
err := json.Unmarshal(event.Data, &requirements)
|
||||
if err != nil {
|
||||
return m.handleError(ctx, errors.WithMessage(err, "unmarshal event data"))
|
||||
}
|
||||
|
||||
err = m.service.OnModuleRequirements(ctx, conn, requirements)
|
||||
if err != nil {
|
||||
return m.handleError(ctx, errors.WithMessage(err, "handle onModuleRequirements"))
|
||||
}
|
||||
|
||||
return ok
|
||||
}
|
||||
|
||||
func (m Module) OnModuleConfigSchema(ctx context.Context, conn *etp.Conn, event msg.Event) []byte {
|
||||
configData := cluster.ConfigData{}
|
||||
err := json.Unmarshal(event.Data, &configData)
|
||||
if err != nil {
|
||||
return m.handleError(ctx, errors.WithMessage(err, "unmarshal event data"))
|
||||
}
|
||||
|
||||
err = m.service.OnModuleConfigSchema(ctx, conn, configData)
|
||||
if err != nil {
|
||||
return m.handleError(ctx, errors.WithMessage(err, "handle onModuleConfigSchema"))
|
||||
}
|
||||
|
||||
return ok
|
||||
}
|
||||
|
||||
func (m Module) handleError(
|
||||
ctx context.Context,
|
||||
err error,
|
||||
) []byte {
|
||||
m.logger.Error(ctx, err)
|
||||
return []byte(err.Error())
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/integration-system/isp-lib/structure"
|
||||
"isp-config-service/store"
|
||||
"isp-config-service/store/state"
|
||||
)
|
||||
|
||||
var (
|
||||
Routes *routes
|
||||
)
|
||||
|
||||
type routes struct {
|
||||
rstore *store.Store
|
||||
}
|
||||
|
||||
// GetRoutes godoc
|
||||
// @Summary Метод получения маршрутов
|
||||
// @Description Возвращает все доступные модули
|
||||
// @Tags Роуты
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {array} structure.BackendDeclaration
|
||||
// @Router /routing/get_routes [POST]
|
||||
func (c *routes) GetRoutes() ([]structure.BackendDeclaration, error) {
|
||||
var response structure.RoutingConfig
|
||||
c.rstore.VisitReadonlyState(func(state state.ReadonlyState) {
|
||||
response = state.Mesh().GetRoutes()
|
||||
})
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func NewRoutes(rstore *store.Store) *routes {
|
||||
return &routes{
|
||||
rstore: rstore,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"isp-config-service/domain"
|
||||
"isp-config-service/entity"
|
||||
"isp-config-service/store"
|
||||
"isp-config-service/store/state"
|
||||
)
|
||||
|
||||
var Schema *schema
|
||||
|
||||
type schema struct {
|
||||
rstore *store.Store
|
||||
}
|
||||
|
||||
// GetByModuleId godoc
|
||||
// @Summary Метод получения схемы конфигурации модуля
|
||||
// @Description Возвращает текущую json схему конфигурации модуля
|
||||
// @Tags Схема
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body domain.GetByModuleIdRequest true "идентификатор модуля"
|
||||
// @Success 200 {object} entity.ConfigSchema
|
||||
// @Failure 404 {object} structure.GrpcError "если схема для модуля не найдена"
|
||||
// @Failure 500 {object} structure.GrpcError
|
||||
// @Router /schema/get_by_module_id [POST]
|
||||
func (c *schema) GetByModuleId(request domain.GetByModuleIdRequest) (*entity.ConfigSchema, error) {
|
||||
var result []entity.ConfigSchema
|
||||
c.rstore.VisitReadonlyState(func(state state.ReadonlyState) {
|
||||
result = state.Schemas().GetByModuleIds([]string{request.ModuleId})
|
||||
})
|
||||
if len(result) == 0 {
|
||||
return nil, status.Errorf(codes.NotFound, "schema with moduleId %s not found", request.ModuleId)
|
||||
}
|
||||
return &result[0], nil
|
||||
}
|
||||
|
||||
func NewSchema(rstore *store.Store) *schema {
|
||||
return &schema{
|
||||
rstore: rstore,
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
services:
|
||||
isp-config-service-1:
|
||||
image: "isp-config-service:latest"
|
||||
container_name: "isp-config-service-1"
|
||||
hostname: "isp-config-service-1"
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
grpcOuterAddress.ip: isp-config-service-1
|
||||
rqlite.NodeID: 1
|
||||
rqlite.BootstrapExpect: 3
|
||||
rqlite.RaftAddr: "isp-config-service-1:4002"
|
||||
rqlite.JoinAddrs: "isp-config-service-1:4002,isp-config-service-2:4002,isp-config-service-3:4002"
|
||||
volumes:
|
||||
- "./isp-config-service-1/data:/app/data"
|
||||
isp-config-service-2:
|
||||
image: "isp-config-service:latest"
|
||||
container_name: "isp-config-service-2"
|
||||
hostname: "isp-config-service-2"
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
grpcOuterAddress.ip: isp-config-service-2
|
||||
rqlite.NodeID: 2
|
||||
rqlite.BootstrapExpect: 3
|
||||
rqlite.RaftAddr: "isp-config-service-2:4002"
|
||||
rqlite.JoinAddrs: "isp-config-service-1:4002,isp-config-service-2:4002,isp-config-service-3:4002"
|
||||
volumes:
|
||||
- "./isp-config-service-2/data:/app/data"
|
||||
isp-config-service-3:
|
||||
image: "isp-config-service:latest"
|
||||
container_name: "isp-config-service-3"
|
||||
hostname: "isp-config-service-3"
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
grpcOuterAddress.ip: isp-config-service-3
|
||||
rqlite.NodeID: 3
|
||||
rqlite.BootstrapExpect: 3
|
||||
rqlite.RaftAddr: "isp-config-service-3:4002"
|
||||
rqlite.JoinAddrs: "isp-config-service-1:4002,isp-config-service-2:4002,isp-config-service-3:4002"
|
||||
volumes:
|
||||
- "./isp-config-service-3/data:/app/data"
|
||||
@@ -1,30 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: isp-config-service-internal
|
||||
spec:
|
||||
clusterIP: None
|
||||
publishNotReadyAddresses: True
|
||||
selector:
|
||||
app: isp-config-service
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 4001
|
||||
targetPort: 4001
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: isp-config-service
|
||||
spec:
|
||||
selector:
|
||||
app: isp-config-service
|
||||
ports:
|
||||
- protocol: TCP
|
||||
name: ws
|
||||
port: 9001
|
||||
targetPort: 9001
|
||||
- protocol: TCP
|
||||
name: grpc
|
||||
port: 9002
|
||||
targetPort: 9002
|
||||
@@ -1,87 +0,0 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: isp-config-service
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: isp-config-service # has to match .spec.template.metadata.labels
|
||||
serviceName: isp-config-service-internal
|
||||
replicas: 3
|
||||
podManagementPolicy: "Parallel"
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: isp-config-service # has to match .spec.selector.matchLabels
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 10
|
||||
imagePullSecrets:
|
||||
- name: regcred
|
||||
containers:
|
||||
- name: isp-config-service
|
||||
image: isp-config-service:latest
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: rqlite.NodeID
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: rqlite.BootstrapExpect
|
||||
value: "3"
|
||||
- name: rqlite.HttpAddr
|
||||
value: "0.0.0.0:4001"
|
||||
- name: rqlite.HttpAdv
|
||||
value: "$HOSTNAME:4001"
|
||||
- name: rqlite.RaftAddr
|
||||
value: "0.0.0.0:4002"
|
||||
- name: rqlite.RaftAdv
|
||||
value: "$HOSTNAME:4002"
|
||||
- name: rqlite.JoinAddrs
|
||||
value: ""
|
||||
- name: rqlite.DiscoMode
|
||||
value: "dns"
|
||||
- name: rqlite.DiscoConfig
|
||||
value: "{\"name\":\"isp-config-service-internal\"}"
|
||||
- name: rqlite.JoinInterval
|
||||
value: "1s"
|
||||
- name: rqlite.JoinAttempts
|
||||
value: "120"
|
||||
- name: rqlite.RaftClusterRemoveOnShutdown
|
||||
value: "true"
|
||||
ports:
|
||||
- containerPort: 4001
|
||||
name: rqlite
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
scheme: HTTP
|
||||
path: /readyz
|
||||
port: rqlite
|
||||
httpHeaders:
|
||||
- name: Authorization
|
||||
value: Basic bW9uaXRvcjptb25pdG9y
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 2
|
||||
initialDelaySeconds: 2
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
scheme: HTTP
|
||||
path: /readyz?noleader
|
||||
port: rqlite
|
||||
httpHeaders:
|
||||
- name: Authorization
|
||||
value: Basic bW9uaXRvcjptb25pdG9y
|
||||
initialDelaySeconds: 5
|
||||
timeoutSeconds: 2
|
||||
failureThreshold: 3
|
||||
volumeMounts:
|
||||
- name: isp-config-service-data
|
||||
mountPath: /app/data
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: isp-config-service-data
|
||||
spec:
|
||||
accessModes: [ "ReadWriteOnce" ]
|
||||
storageClassName: "local-path"
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
+680
-680
File diff suppressed because it is too large.
Load diff
@@ -1,36 +0,0 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
ErrorCodeBadRequest = 400
|
||||
ErrorCodeModuleNotFound = 2001
|
||||
ErrorCodeConfigNotFound = 2002
|
||||
ErrorCodeInvalidConfig = 2003
|
||||
ErrorCodeConfigVersionConflict = 2004
|
||||
ErrorCodeSchemaNotFound = 2005
|
||||
ErrorCodeVariableNotFound = 2006
|
||||
ErrorCodeVariableAlreadyExists = 2007
|
||||
ErrorCodeVariableUsedInConfigs = 2008
|
||||
)
|
||||
|
||||
type ConfigValidationError struct {
|
||||
Details map[string]string
|
||||
}
|
||||
|
||||
func NewConfigValidationError(details map[string]string) ConfigValidationError {
|
||||
return ConfigValidationError{
|
||||
Details: details,
|
||||
}
|
||||
}
|
||||
|
||||
func (e ConfigValidationError) Error() string {
|
||||
descriptions := make([]string, 0, len(e.Details))
|
||||
for field, err := range e.Details {
|
||||
descriptions = append(descriptions, fmt.Sprintf("%s -> %s", field, err))
|
||||
}
|
||||
return strings.Join(descriptions, "; ")
|
||||
}
|
||||
+10
-37
@@ -1,52 +1,25 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
)
|
||||
import "isp-config-service/entity"
|
||||
|
||||
type IdRequest struct {
|
||||
Id string `validate:"required"`
|
||||
type ConfigIdRequest struct {
|
||||
Id string `json:"id" valid:"required~Required"`
|
||||
}
|
||||
|
||||
type PurgeConfigVersionsRequest struct {
|
||||
ModuleName string `validate:"required"`
|
||||
KeepVersions int `validate:"required"`
|
||||
type CompileConfigsRequest struct {
|
||||
Data map[string]interface{}
|
||||
CommonConfigsIdList []string
|
||||
}
|
||||
|
||||
type GetByModuleIdRequest struct {
|
||||
ModuleId string `validate:"required"`
|
||||
ModuleId string `valid:"required~Required"`
|
||||
}
|
||||
|
||||
type GetByModuleNameRequest struct {
|
||||
ModuleName string `validate:"required"`
|
||||
}
|
||||
|
||||
type UpdateSchemaRequest struct {
|
||||
ModuleName string `validate:"required"`
|
||||
Schema json.RawMessage `validate:"required" swaggertype:"object"`
|
||||
ModuleName string `valid:"required~Required"`
|
||||
}
|
||||
|
||||
type CreateUpdateConfigRequest struct {
|
||||
Id string
|
||||
Name string `validate:"required"`
|
||||
ModuleId string `validate:"required"`
|
||||
Version int
|
||||
Data json.RawMessage `swaggertype:"object"`
|
||||
Unsafe bool
|
||||
entity.Config
|
||||
Unsafe bool
|
||||
}
|
||||
|
||||
type UpdateConfigNameRequest struct {
|
||||
Id string `validate:"required"`
|
||||
NewConfigName string `validate:"required"`
|
||||
}
|
||||
|
||||
type SyncConfigRequest struct {
|
||||
ModuleName string `validate:"required"`
|
||||
}
|
||||
|
||||
type PrometheusTargets struct {
|
||||
Targets []string
|
||||
Labels map[string]string
|
||||
}
|
||||
|
||||
type AutodiscoveryResponse []PrometheusTargets
|
||||
+23
-49
@@ -1,77 +1,51 @@
|
||||
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/txix-open/isp-kit/json"
|
||||
)
|
||||
|
||||
type DeleteResponse struct {
|
||||
Deleted int
|
||||
}
|
||||
|
||||
type CreateUpdateConfigResponse struct {
|
||||
Config
|
||||
|
||||
IsChanged bool
|
||||
}
|
||||
|
||||
type ModuleInfo struct {
|
||||
Id string
|
||||
Name string
|
||||
Active bool
|
||||
LastConnectedAt *time.Time
|
||||
LastDisconnectedAt *time.Time
|
||||
ConfigSchema json.RawMessage `swaggertype:"object"`
|
||||
Status []Connection
|
||||
CreatedAt time.Time
|
||||
LastConnectedAt time.Time
|
||||
LastDisconnectedAt time.Time
|
||||
Configs []ConfigModuleInfo `json:",omitempty"`
|
||||
ConfigSchema *schema.Schema `json:",omitempty"`
|
||||
Status []Connection `json:",omitempty"`
|
||||
}
|
||||
|
||||
type Connection struct {
|
||||
Id string
|
||||
ModuleName string
|
||||
LibVersion string
|
||||
Version string
|
||||
Address Address
|
||||
Endpoints []EndpointDescriptor
|
||||
Address structure.AddressConfiguration
|
||||
Endpoints []structure.EndpointConfig `json:",omitempty"`
|
||||
EstablishedAt time.Time
|
||||
}
|
||||
|
||||
type Address struct {
|
||||
Ip string
|
||||
Port string
|
||||
type CommonConfigLinks map[string][]string
|
||||
|
||||
type CompiledConfigResponse map[string]interface{}
|
||||
|
||||
type DeleteCommonConfigResponse struct {
|
||||
Deleted bool
|
||||
Links CommonConfigLinks
|
||||
}
|
||||
|
||||
type EndpointDescriptor struct {
|
||||
Path string
|
||||
Inner bool
|
||||
type CreateUpdateConfigResponse struct {
|
||||
ErrorDetails map[string]string
|
||||
Config *ConfigModuleInfo
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Id string
|
||||
Name string
|
||||
ModuleId string
|
||||
Valid bool
|
||||
Data json.RawMessage `swaggertype:"object"`
|
||||
Version int
|
||||
Active bool
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
type ConfigVersion struct {
|
||||
Id string
|
||||
ConfigId string
|
||||
ConfigVersion int
|
||||
Data json.RawMessage `swaggertype:"object"`
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type ConfigSchema struct {
|
||||
Id string
|
||||
Version string
|
||||
ModuleId string
|
||||
Schema json.RawMessage `swaggertype:"object"`
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
type ConfigModuleInfo struct {
|
||||
entity.Config
|
||||
Valid bool
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"isp-config-service/entity"
|
||||
)
|
||||
|
||||
type Variable struct {
|
||||
Name string
|
||||
Description string
|
||||
Type string
|
||||
Value string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
ContainsInConfigs []LinkedConfig
|
||||
}
|
||||
|
||||
type LinkedConfig struct {
|
||||
Id string
|
||||
ModuleId string
|
||||
Name string
|
||||
}
|
||||
|
||||
type CreateVariableRequest struct {
|
||||
Name string `validate:"required"`
|
||||
Description string
|
||||
Type string `validate:"required,oneof=SECRET TEXT"`
|
||||
Value string `validate:"required"`
|
||||
}
|
||||
|
||||
type UpdateVariableRequest struct {
|
||||
Name string `validate:"required"`
|
||||
Description string
|
||||
Value string `validate:"required"`
|
||||
}
|
||||
|
||||
type UpsertVariableRequest struct {
|
||||
Name string `validate:"required"`
|
||||
Description string
|
||||
Type string `validate:"required,oneof=SECRET TEXT"`
|
||||
Value string `validate:"required"`
|
||||
}
|
||||
|
||||
type VariableByNameRequest struct {
|
||||
Name string `validate:"required"`
|
||||
}
|
||||
|
||||
type VariableExtractionResult struct {
|
||||
VariableLinks []entity.ConfigHasVariable
|
||||
AbsentVariables []string
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/txix-open/isp-kit/cluster"
|
||||
"isp-config-service/entity/xtypes"
|
||||
)
|
||||
|
||||
// nolint: tagliatelle
|
||||
type Backend struct {
|
||||
WsConnectionId string `json:"ws_connection_id"`
|
||||
ModuleId string `json:"module_id"`
|
||||
Address string `json:"address"`
|
||||
Version string `json:"version"`
|
||||
LibVersion string `json:"lib_version"`
|
||||
ModuleName string `json:"module_name"`
|
||||
ConfigServiceNodeId string `json:"config_service_node_id"`
|
||||
Endpoints xtypes.Json[[]cluster.EndpointDescriptor] `json:"endpoints"`
|
||||
RequiredModules xtypes.Json[[]cluster.ModuleDependency] `json:"required_modules"`
|
||||
CreatedAt xtypes.Time `json:"created_at"`
|
||||
MetricsAutodiscovery *xtypes.Json[cluster.MetricsAutodiscovery] `json:"metrics_autodiscovery"`
|
||||
}
|
||||
|
||||
// nolint: tagliatelle
|
||||
type MetricsAdWrapper struct {
|
||||
MetricsAutodiscovery xtypes.Json[cluster.MetricsAutodiscovery] `json:"metrics_autodiscovery"`
|
||||
}
|
||||
+30
-32
@@ -1,44 +1,42 @@
|
||||
// nolint: tagliatelle
|
||||
package entity
|
||||
|
||||
import (
|
||||
"isp-config-service/entity/xtypes"
|
||||
"github.com/integration-system/isp-lib/config/schema"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ConfigData map[string]interface{}
|
||||
|
||||
type Config struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
ModuleId string `json:"module_id"`
|
||||
Data []byte `json:"data"`
|
||||
Version int `json:"version"`
|
||||
Active xtypes.Bool `json:"active"`
|
||||
AdminId int `json:"admin_id"`
|
||||
CreatedAt xtypes.Time `json:"created_at"`
|
||||
UpdatedAt xtypes.Time `json:"updated_at"`
|
||||
tableName string `sql:"?db_schema.configs" json:"-"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name" valid:"required~Required"`
|
||||
CommonConfigs []string `json:"commonConfigs" pg:",array"`
|
||||
Description string `json:"description"`
|
||||
ModuleId string `json:"moduleId" valid:"required~Required"`
|
||||
Version int32 `json:"version" sql:",null"`
|
||||
Active bool `json:"active" sql:",null"`
|
||||
CreatedAt time.Time `json:"createdAt" sql:",null"`
|
||||
UpdatedAt time.Time `json:"updatedAt" sql:",null"`
|
||||
Data ConfigData `json:"data" sql:",notnull"`
|
||||
}
|
||||
|
||||
type ConfigMetaWithVariable struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
ModuleId string `json:"module_id"`
|
||||
VariableName string `json:"variable_name"`
|
||||
Active xtypes.Bool `json:"active"`
|
||||
}
|
||||
|
||||
type ConfigHistory struct {
|
||||
Id string `json:"id"`
|
||||
ConfigId string `json:"config_id"`
|
||||
Data []byte `json:"data"`
|
||||
Version int `json:"version"`
|
||||
AdminId int `json:"admin_id"`
|
||||
CreatedAt xtypes.Time `json:"created_at"`
|
||||
type CommonConfig struct {
|
||||
tableName string `sql:"?db_schema.common_configs" json:"-"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name" valid:"required~Required"`
|
||||
Description string `json:"description"`
|
||||
CreatedAt time.Time `json:"createdAt" sql:",null"`
|
||||
UpdatedAt time.Time `json:"updatedAt" sql:",null"`
|
||||
Data ConfigData `json:"data" sql:",notnull"`
|
||||
}
|
||||
|
||||
type ConfigSchema struct {
|
||||
Id string `json:"id"`
|
||||
ModuleId string `json:"module_id"`
|
||||
Data []byte `json:"data"`
|
||||
ModuleVersion string `json:"module_version"`
|
||||
CreatedAt xtypes.Time `json:"created_at"`
|
||||
UpdatedAt xtypes.Time `json:"updated_at"`
|
||||
tableName string `sql:"?db_schema.config_schemas" json:"-"`
|
||||
Id string `json:"id"`
|
||||
Version string
|
||||
ModuleId string
|
||||
Schema schema.Schema
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrConfigNotFound = errors.New("no active config")
|
||||
ErrModuleNotFound = errors.New("module not found")
|
||||
ErrSchemaNotFound = errors.New("config schema not found")
|
||||
ErrConfigNotFoundOrActive = errors.New("config not found or markers as active")
|
||||
ErrConfigConflictUpdate = errors.New("config conflict update")
|
||||
ErrVariableNotFound = errors.New("variable not found")
|
||||
ErrVariableAlreadyExists = errors.New("variable already exists")
|
||||
ErrVariableUsedInConfigs = errors.New("variable used in configs")
|
||||
)
|
||||
@@ -1,52 +0,0 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"isp-config-service/entity/xtypes"
|
||||
)
|
||||
|
||||
type Event struct {
|
||||
Id int `json:"id"`
|
||||
Payload xtypes.Json[EventPayload] `json:"payload"`
|
||||
}
|
||||
|
||||
func NewEvent(payload EventPayload) Event {
|
||||
return Event{
|
||||
Payload: xtypes.Json[EventPayload]{
|
||||
Value: payload,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (e Event) Key() string {
|
||||
switch {
|
||||
case e.Payload.Value.ConfigUpdated != nil:
|
||||
return fmt.Sprintf("config_updated_%s", e.Payload.Value.ConfigUpdated.ModuleId)
|
||||
case e.Payload.Value.ModuleReady != nil:
|
||||
return fmt.Sprintf("module_lifecycle_%s", e.Payload.Value.ModuleReady.ModuleId)
|
||||
case e.Payload.Value.ModuleDisconnected != nil:
|
||||
return fmt.Sprintf("module_lifecycle_%s", e.Payload.Value.ModuleDisconnected.ModuleId)
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// nolint:tagliatelle
|
||||
type EventPayload struct {
|
||||
ConfigUpdated *PayloadConfigUpdated `json:",omitempty"`
|
||||
ModuleReady *PayloadModuleReady `json:",omitempty"`
|
||||
ModuleDisconnected *PayloadModuleDisconnected `json:",omitempty"`
|
||||
}
|
||||
|
||||
type PayloadConfigUpdated struct {
|
||||
ModuleId string
|
||||
}
|
||||
|
||||
type PayloadModuleReady struct {
|
||||
ModuleId string
|
||||
}
|
||||
|
||||
type PayloadModuleDisconnected struct {
|
||||
ModuleId string
|
||||
}
|
||||
+7
-9
@@ -1,14 +1,12 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"isp-config-service/entity/xtypes"
|
||||
)
|
||||
import "time"
|
||||
|
||||
// nolint:tagliatelle
|
||||
type Module struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
LastConnectedAt *xtypes.Time `json:"last_connected_at"`
|
||||
LastDisconnectedAt *xtypes.Time `json:"last_disconnected_at"`
|
||||
CreatedAt xtypes.Time `json:"created_at"`
|
||||
tableName string `sql:"?db_schema.modules" json:"-"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name" valid:"required~Required"`
|
||||
CreatedAt time.Time `json:"createdAt" sql:",null"`
|
||||
LastConnectedAt time.Time `json:"lastConnectedAt"`
|
||||
LastDisconnectedAt time.Time `json:"lastDisconnectedAt"`
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// nolint:tagliatelle
|
||||
package entity
|
||||
|
||||
import (
|
||||
"isp-config-service/entity/xtypes"
|
||||
)
|
||||
|
||||
type Variable struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Type string `json:"type"`
|
||||
Value string `json:"value"`
|
||||
CreatedAt xtypes.Time `json:"created_at"`
|
||||
UpdatedAt xtypes.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
type ConfigHasVariable struct {
|
||||
ConfigId string `json:"config_id"`
|
||||
VariableName string `json:"variable_name"`
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package xtypes
|
||||
|
||||
type Bool bool
|
||||
|
||||
func (l Bool) MarshalJSON() ([]byte, error) {
|
||||
return l.MarshalText()
|
||||
}
|
||||
|
||||
func (l *Bool) UnmarshalJSON(data []byte) error {
|
||||
return l.UnmarshalText(data)
|
||||
}
|
||||
|
||||
func (l Bool) MarshalText() ([]byte, error) {
|
||||
if l {
|
||||
return []byte("1"), nil
|
||||
}
|
||||
return []byte("0"), nil
|
||||
}
|
||||
|
||||
func (l *Bool) UnmarshalText(data []byte) error {
|
||||
*l = string(data) == "1"
|
||||
return nil
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package xtypes
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/isp-kit/json"
|
||||
)
|
||||
|
||||
type Json[T any] struct {
|
||||
Value T
|
||||
}
|
||||
|
||||
func (l Json[T]) MarshalJSON() ([]byte, error) {
|
||||
data, err := l.MarshalText()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return []byte(strconv.Quote(string(data))), nil
|
||||
}
|
||||
|
||||
func (l *Json[T]) UnmarshalJSON(data []byte) error {
|
||||
s, err := strconv.Unquote(string(data))
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "unquote text")
|
||||
}
|
||||
return l.UnmarshalText([]byte(s))
|
||||
}
|
||||
|
||||
func (l Json[T]) MarshalText() ([]byte, error) {
|
||||
data, err := json.Marshal(l.Value)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "marshal json")
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func (l *Json[T]) UnmarshalText(data []byte) error {
|
||||
err := json.Unmarshal(data, &l.Value)
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "unmarshal json")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package xtypes
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type Time time.Time
|
||||
|
||||
func (l Time) MarshalJSON() ([]byte, error) {
|
||||
return l.MarshalText()
|
||||
}
|
||||
|
||||
func (l *Time) UnmarshalJSON(data []byte) error {
|
||||
return l.UnmarshalText(data)
|
||||
}
|
||||
|
||||
func (l Time) MarshalText() ([]byte, error) {
|
||||
t := time.Time(l)
|
||||
value := strconv.Itoa(int(t.Unix()))
|
||||
return []byte(value), nil
|
||||
}
|
||||
|
||||
func (l *Time) UnmarshalText(data []byte) error {
|
||||
if string(data) == "null" {
|
||||
return nil
|
||||
}
|
||||
value, err := strconv.Atoi(string(data))
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "parse int: %s", string(data))
|
||||
}
|
||||
*l = Time(time.Unix(int64(value), 0))
|
||||
return nil
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
module isp-config-service
|
||||
|
||||
go 1.25.0
|
||||
|
||||
replace (
|
||||
github.com/armon/go-metrics => github.com/hashicorp/go-metrics v0.5.1
|
||||
github.com/mattn/go-sqlite3 => github.com/rqlite/go-sqlite3 v1.42.0
|
||||
golang.org/x/text => golang.org/x/text v0.3.8
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/Masterminds/squirrel v1.5.4
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pressly/goose/v3 v3.26.0
|
||||
github.com/prometheus/client_golang v1.23.2
|
||||
github.com/rqlite/gorqlite v0.0.0-20250609141355-ac86a4a1c9a8
|
||||
github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099
|
||||
github.com/rqlite/rqlite/v9 v9.3.2
|
||||
github.com/stretchr/testify v1.11.1
|
||||
github.com/tidwall/gjson v1.18.0
|
||||
github.com/txix-open/etp/v4 v4.0.1
|
||||
github.com/txix-open/go-cmp v0.0.0-20240401171944-16b203530f60
|
||||
github.com/txix-open/isp-kit v1.63.3
|
||||
github.com/xeipuuv/gojsonschema v1.2.0
|
||||
golang.org/x/sync v0.18.0
|
||||
google.golang.org/grpc v1.77.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/armon/go-metrics v0.5.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2 v1.40.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/config v1.32.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.19.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.14 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.14 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.14 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.14 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.14 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.14 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.91.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/signin v1.0.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.30.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.8 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.41.1 // indirect
|
||||
github.com/aws/smithy-go v1.23.2 // indirect
|
||||
github.com/bahlo/generic-list-go v0.2.0 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/buger/jsonparser v1.1.1 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/coder/websocket v1.8.14 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.11 // indirect
|
||||
github.com/getsentry/sentry-go v0.38.0 // indirect
|
||||
github.com/go-faker/faker/v4 v4.7.0 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
|
||||
github.com/hashicorp/go-hclog v1.6.3 // indirect
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
||||
github.com/hashicorp/go-metrics v0.5.4 // indirect
|
||||
github.com/hashicorp/go-msgpack v1.1.5 // indirect
|
||||
github.com/hashicorp/go-msgpack/v2 v2.1.5 // indirect
|
||||
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
||||
github.com/hashicorp/golang-lru v1.0.2 // indirect
|
||||
github.com/hashicorp/raft v1.7.3 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
|
||||
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mailru/easyjson v0.9.1 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.32 // indirect
|
||||
github.com/mfridman/interpolate v0.0.2 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/common v0.67.3 // indirect
|
||||
github.com/prometheus/procfs v0.19.2 // indirect
|
||||
github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48 // indirect
|
||||
github.com/rqlite/sql v0.0.0-20251114131613-ef07423e7137 // indirect
|
||||
github.com/sethvargo/go-retry v0.3.0 // indirect
|
||||
github.com/tidwall/match v1.2.0 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/txix-open/bellows v1.2.0 // indirect
|
||||
github.com/txix-open/jsonschema v1.3.0 // indirect
|
||||
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb // indirect
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
go.etcd.io/bbolt v1.4.3 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 // indirect
|
||||
go.opentelemetry.io/otel v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.38.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.1 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.3 // indirect
|
||||
golang.org/x/crypto v0.45.0 // indirect
|
||||
golang.org/x/net v0.47.0 // indirect
|
||||
golang.org/x/sys v0.38.0 // indirect
|
||||
golang.org/x/text v0.31.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846 // indirect
|
||||
google.golang.org/protobuf v1.36.10 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
@@ -1,469 +0,0 @@
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
|
||||
github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM=
|
||||
github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||
github.com/aws/aws-sdk-go-v2 v1.40.0 h1:/WMUA0kjhZExjOQN2z3oLALDREea1A7TobfuiBrKlwc=
|
||||
github.com/aws/aws-sdk-go-v2 v1.40.0/go.mod h1:c9pm7VwuW0UPxAEYGyTmyurVcNrbF6Rt/wixFqDhcjE=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3 h1:DHctwEM8P8iTXFxC/QK0MRjwEpWQeM9yzidCRjldUz0=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3/go.mod h1:xdCzcZEtnSTKVDOmUZs4l/j3pSV6rpo1WXl5ugNsL8Y=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.32.0 h1:T5WWJYnam9SzBLbsVYDu2HscLDe+GU1AUJtfcDAc/vA=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.32.0/go.mod h1:pSRm/+D3TxBixGMXlgtX4+MPO9VNtEEtiFmNpxksoxw=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.19.0 h1:7zm+ez+qEqLaNsCSRaistkvJRJv8sByDOVuCnyHbP7M=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.19.0/go.mod h1:pHKPblrT7hqFGkNLxqoS3FlGoPrQg4hMIa+4asZzBfs=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.14 h1:WZVR5DbDgxzA0BJeudId89Kmgy6DIU4ORpxwsVHz0qA=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.14/go.mod h1:Dadl9QO0kHgbrH1GRqGiZdYtW5w+IXXaBNCHTIaheM4=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.9 h1:luPCleinMpiPLuC73psYTKmrIVpQ9NhmyNxNGIPkcUE=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.9/go.mod h1:szPVaB6mJ+FuNpHH8LTG32DP6Abr+aGEMdDAyFl5klE=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.14 h1:PZHqQACxYb8mYgms4RZbhZG0a7dPW06xOjmaH0EJC/I=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.14/go.mod h1:VymhrMJUWs69D8u0/lZ7jSB6WgaG/NqHi3gX0aYf6U0=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.14 h1:bOS19y6zlJwagBfHxs0ESzr1XCOU2KXJCWcq3E2vfjY=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.14/go.mod h1:1ipeGBMAxZ0xcTm6y6paC2C/J6f6OO7LBODV9afuAyM=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.14 h1:ITi7qiDSv/mSGDSWNpZ4k4Ve0DQR6Ug2SJQ8zEHoDXg=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.14/go.mod h1:k1xtME53H1b6YpZt74YmwlONMWf4ecM+lut1WQLAF/U=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 h1:x2Ibm/Af8Fi+BH+Hsn9TXGdT+hKbDd5XOTZxTMxDk7o=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3/go.mod h1:IW1jwyrQgMdhisceG8fQLmQIydcT/jWY21rFhzgaKwo=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.5 h1:Hjkh7kE6D81PgrHlE/m9gx+4TyyeLHuY8xJs7yXN5C4=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.5/go.mod h1:nPRXgyCfAurhyaTMoBMwRBYBhaHI4lNPAnJmjM0Tslc=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.14 h1:FIouAnCE46kyYqyhs0XEBDFFSREtdnr8HQuLPQPLCrY=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.14/go.mod h1:UTwDc5COa5+guonQU8qBikJo1ZJ4ln2r1MkF7Dqag1E=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.14 h1:FzQE21lNtUor0Fb7QNgnEyiRCBlolLTX/Z1j65S7teM=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.14/go.mod h1:s1ydyWG9pm3ZwmmYN21HKyG9WzAZhYVW85wMHs5FV6w=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.91.1 h1:f3CVT98cvySOZslMZHusyQHTMY8Xt+F1i0YaR6oEJ4s=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.91.1/go.mod h1:wYNqY3L02Z3IgRYxOBPH9I1zD9Cjh9hI5QOy/eOjQvw=
|
||||
github.com/aws/aws-sdk-go-v2/service/signin v1.0.1 h1:BDgIUYGEo5TkayOWv/oBLPphWwNm/A91AebUjAu5L5g=
|
||||
github.com/aws/aws-sdk-go-v2/service/signin v1.0.1/go.mod h1:iS6EPmNeqCsGo+xQmXv0jIMjyYtQfnwg36zl2FwEouk=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.30.4 h1:U//SlnkE1wOQiIImxzdY5PXat4Wq+8rlfVEw4Y7J8as=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.30.4/go.mod h1:av+ArJpoYf3pgyrj6tcehSFW+y9/QvAY8kMooR9bZCw=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.8 h1:MvlNs/f+9eM0mOjD9JzBUbf5jghyTk3p+O9yHMXX94Y=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.8/go.mod h1:/j67Z5XBVDx8nZVp9EuFM9/BS5dvBznbqILGuu73hug=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.41.1 h1:GdGmKtG+/Krag7VfyOXV17xjTCz0i9NT+JnqLTOI5nA=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.41.1/go.mod h1:6TxbXoDSgBQ225Qd8Q+MbxUxUh6TtNKwbRt/EPS9xso=
|
||||
github.com/aws/smithy-go v1.23.2 h1:Crv0eatJUQhaManss33hS5r40CG3ZFH+21XSkqMrIUM=
|
||||
github.com/aws/smithy-go v1.23.2/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0=
|
||||
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
|
||||
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
|
||||
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/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
|
||||
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
|
||||
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
|
||||
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
|
||||
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
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/coder/websocket v1.8.14 h1:9L0p0iKiNOibykf283eHkKUHHrpG7f65OE3BhhO7v9g=
|
||||
github.com/coder/websocket v1.8.14/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
||||
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/gabriel-vasile/mimetype v1.4.11 h1:AQvxbp830wPhHTqc1u7nzoLT+ZFxGY7emj5DR5DYFik=
|
||||
github.com/gabriel-vasile/mimetype v1.4.11/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/getsentry/sentry-go v0.38.0 h1:S8Xui7gLeAvXINVLMOaX94HnsDf1GexnfXGSNC4+KQs=
|
||||
github.com/getsentry/sentry-go v0.38.0/go.mod h1:eRXCoh3uvmjQLY6qu63BjUZnaBu5L5WhMV1RwYO8W5s=
|
||||
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
||||
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/go-faker/faker/v4 v4.7.0 h1:VboC02cXHl/NuQh5lM2W8b87yp4iFXIu59x4w0RZi4E=
|
||||
github.com/go-faker/faker/v4 v4.7.0/go.mod h1:u1dIRP5neLB6kTzgyVjdBOV5R1uP7BdxkcWk7tiKQXk=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
||||
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-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
|
||||
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM=
|
||||
github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 h1:NmZ1PKzSTQbuGHw9DGPFomqkkLWMC+vZCkfs+FHv1Vg=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3/go.mod h1:zQrxl1YP88HQlA6i9c63DSVPFklWpGX4OWAc9bFuaH4=
|
||||
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 v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
|
||||
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
||||
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-metrics v0.5.1 h1:rfPwUqFU6uZXNvGl4hzjY8LEBsqFVU4si1H9/Hqck/U=
|
||||
github.com/hashicorp/go-metrics v0.5.1/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE=
|
||||
github.com/hashicorp/go-metrics v0.5.4 h1:8mmPiIJkTPPEbAiV97IxdAGNdRdaWwVap1BU6elejKY=
|
||||
github.com/hashicorp/go-metrics v0.5.4/go.mod h1:CG5yz4NZ/AI/aQt9Ucm/vdBnbh7fvmv4lxZ350i+QQI=
|
||||
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||
github.com/hashicorp/go-msgpack v1.1.5 h1:9byZdVjKTe5mce63pRVNP1L7UAmdHOTEMGehn6KvJWs=
|
||||
github.com/hashicorp/go-msgpack v1.1.5/go.mod h1:gWVc3sv/wbDmR3rQsj1CAktEZzoz1YNK9NfGLXJ69/4=
|
||||
github.com/hashicorp/go-msgpack/v2 v2.1.5 h1:Ue879bPnutj/hXfmUk6s/jtIK90XxgiUIcXRl656T44=
|
||||
github.com/hashicorp/go-msgpack/v2 v2.1.5/go.mod h1:bjCsRXpZ7NsJdk45PoCQnzRGDaK8TKm5ZnDI/9y3J4M=
|
||||
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
|
||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
|
||||
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
|
||||
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||
github.com/hashicorp/raft v1.1.0/go.mod h1:4Ak7FSPnuvmb0GV6vgIAJ4vYT4bek9bb6Q+7HVbyzqM=
|
||||
github.com/hashicorp/raft v1.7.3 h1:DxpEqZJysHN0wK+fviai5mFcSYsCkNpFUl1xpAW8Rbo=
|
||||
github.com/hashicorp/raft v1.7.3/go.mod h1:DfvCGFxpAUPE0L4Uc8JLlTPtc3GzSbdH0MTJCLgnmJQ=
|
||||
github.com/hashicorp/raft-boltdb v0.0.0-20210409134258-03c10cc3d4ea/go.mod h1:qRd6nFJYYS6Iqnc/8HcUmko2/2Gw8qTFEmxDLii6W5I=
|
||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
|
||||
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
|
||||
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
||||
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
||||
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.3/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/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw=
|
||||
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o=
|
||||
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk=
|
||||
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8=
|
||||
github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
||||
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY=
|
||||
github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
||||
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
|
||||
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
|
||||
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
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/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pressly/goose/v3 v3.26.0 h1:KJakav68jdH0WDvoAcj8+n61WqOIaPGgH0bJWS6jpmM=
|
||||
github.com/pressly/goose/v3 v3.26.0/go.mod h1:4hC1KrritdCxtuFsqgs1R4AU5bWtTAf+cnWvfhf2DNY=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
|
||||
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
|
||||
github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
|
||||
github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
|
||||
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
|
||||
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.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
|
||||
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
|
||||
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
||||
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
|
||||
github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q=
|
||||
github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
||||
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||
github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws=
|
||||
github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw=
|
||||
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
|
||||
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/rqlite/go-sqlite3 v1.42.0 h1:xfOaauBRqJyww/6g2z910/p3gyw/vjb2GgQYKfrZSrU=
|
||||
github.com/rqlite/go-sqlite3 v1.42.0/go.mod h1:R9H7CatgYBt3c+fSV/5yo2vLh4ZjCB0aMHdkv69fP4A=
|
||||
github.com/rqlite/gorqlite v0.0.0-20250609141355-ac86a4a1c9a8 h1:BoxiqWvhprOB2isgM59s8wkgKwAoyQH66Twfmof41oE=
|
||||
github.com/rqlite/gorqlite v0.0.0-20250609141355-ac86a4a1c9a8/go.mod h1:xF/KoXmrRyahPfo5L7Szb5cAAUl53dMWBh9cMruGEZg=
|
||||
github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48 h1:NZ62M+kT0JqhyFUMc8I4SMmfmD4NGJxhb2ePJQXjryc=
|
||||
github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48/go.mod h1:CRnsxgy5G8fAf5J+AM0yrsSdxXHKkIYOaq2sm+Q4DYc=
|
||||
github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099 h1:5cqkVLdl6sGJSY3kiF2dqaA3bD+8OS5FUdZqO0BxXLU=
|
||||
github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099/go.mod h1:6SVI8KegsW9Fyu2UQ+uvw0JI5CAILRYRyiQ/OFSJPrs=
|
||||
github.com/rqlite/rqlite/v9 v9.3.2 h1:/gpsmjbKqRTb4LEF0G5ik0g3jxKFmvMKK3L11Rk6UYE=
|
||||
github.com/rqlite/rqlite/v9 v9.3.2/go.mod h1:2TBF943qiqoJI+4/o46Rfgec2il/IL6hjlqHXvj0uII=
|
||||
github.com/rqlite/sql v0.0.0-20251114131613-ef07423e7137 h1:OG5MfYAA0yaWgllfPdOq9Xa2bo1vpurCNx1LWz7+Zh0=
|
||||
github.com/rqlite/sql v0.0.0-20251114131613-ef07423e7137/go.mod h1:ib9zVtNgRKiGuoMyUqqL5aNpk+r+++YlyiVIkclVqPg=
|
||||
github.com/sethvargo/go-retry v0.3.0 h1:EEt31A35QhrcRZtrYFDTBg91cqZVnFL2navjDrah2SE=
|
||||
github.com/sethvargo/go-retry v0.3.0/go.mod h1:mNX17F0C/HguQMyMyJxcnU471gOZGxCLyYaFyAZraas=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||
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/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
|
||||
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM=
|
||||
github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
|
||||
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
||||
github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgjeY=
|
||||
github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o=
|
||||
github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIgA=
|
||||
github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8=
|
||||
github.com/txix-open/go-cmp v0.0.0-20240401171944-16b203530f60 h1:7SZ72lNU69g8eiT5rcRh1ubATZPs/J05NEIN7E47TYM=
|
||||
github.com/txix-open/go-cmp v0.0.0-20240401171944-16b203530f60/go.mod h1:jzpq0uwcdGq0OSNXZ6vv6UJkCOU/fLPgeoz+KkGDYgo=
|
||||
github.com/txix-open/grmq v1.9.0 h1:ArDbJJcFX9zXKEcPf49rp9nYiRyGMJxGKJAxdbSsfaM=
|
||||
github.com/txix-open/grmq v1.9.0/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po=
|
||||
github.com/txix-open/isp-kit v1.63.3 h1:UJLgR4z8sYXUX6r1sl6Ww1aijPx6b7ieMeB+elZoViM=
|
||||
github.com/txix-open/isp-kit v1.63.3/go.mod h1:rwqKqB3PyZxaoep6iH1PKL89LS9nzRklA6+S4II72M4=
|
||||
github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4=
|
||||
github.com/txix-open/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
|
||||
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0=
|
||||
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb/go.mod h1:0biAFE0bgbcKeBBAwgEDhbZz6uT1vuSETCrFQlv2RiA=
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/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/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
|
||||
go.etcd.io/bbolt v1.4.3 h1:dEadXpI6G79deX5prL3QRNP6JB8UxVkqo4UPnHaNXJo=
|
||||
go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 h1:2pn7OzMewmYRiNtv1doZnLo3gONcnMHlFnmOR8Vgt+8=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0/go.mod h1:rjbQTDEPQymPE0YnRQp9/NuPwwtL0sesz/fnqRW/v84=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg=
|
||||
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
|
||||
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 h1:aTL7F04bJHUlztTsNGJ2l+6he8c+y/b//eR0jjjemT4=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0/go.mod h1:kldtb7jDTeol0l3ewcmd8SDvx3EmIE7lyvqbasU3QC4=
|
||||
go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA=
|
||||
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI=
|
||||
go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E=
|
||||
go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA=
|
||||
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
|
||||
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
|
||||
go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A=
|
||||
go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc=
|
||||
go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
|
||||
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/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-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
|
||||
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=
|
||||
golang.org/x/exp v0.0.0-20251017212417-90e834f514db h1:by6IehL4BH5k3e3SJmcoNbOobMey2SLpAF79iPOEBvw=
|
||||
golang.org/x/exp v0.0.0-20251017212417-90e834f514db/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/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-20190108225652-1e06a53dbb7e/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-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
|
||||
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
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/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
|
||||
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/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-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-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
|
||||
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
|
||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||
golang.org/x/tools v0.0.0-20190424220101-1e8e1cfdf96b/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
|
||||
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba h1:B14OtaXuMaCQsl2deSvNkyPKIzq3BjfxQp8d00QyWx4=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba/go.mod h1:G5IanEx8/PgI9w6CFcYQf7jMtHQhZruvfM1i3qOqk5U=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846 h1:Wgl1rcDNThT+Zn47YyCXOXyX/COgMTIdhJ717F0l4xk=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
|
||||
google.golang.org/grpc v1.77.0 h1:wVVY6/8cGA6vvffn+wWK5ToddbgdU3d8MNENr4evgXM=
|
||||
google.golang.org/grpc v1.77.0/go.mod h1:z0BY1iVj0q8E1uSQCjL9cppRj+gnZjzDnzV0dHhrNig=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
|
||||
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
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-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||
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.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
modernc.org/libc v1.66.3 h1:cfCbjTUcdsKyyZZfEUKfoHcP3S0Wkvz3jgSzByEWVCQ=
|
||||
modernc.org/libc v1.66.3/go.mod h1:XD9zO8kt59cANKvHPXpx7yS2ELPheAey0vjIuZOhOU8=
|
||||
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
|
||||
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
|
||||
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
|
||||
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
|
||||
modernc.org/sqlite v1.38.2 h1:Aclu7+tgjgcQVShZqim41Bbw9Cho0y/7WzYptXqkEek=
|
||||
modernc.org/sqlite v1.38.2/go.mod h1:cPTJYSlgg3Sfg046yBShXENNtPrWrDX8bsbAQBzgQ5E=
|
||||
@@ -0,0 +1,55 @@
|
||||
package helper
|
||||
|
||||
import (
|
||||
"github.com/integration-system/isp-lib/structure"
|
||||
"isp-config-service/controller"
|
||||
"isp-config-service/domain"
|
||||
"isp-config-service/entity"
|
||||
)
|
||||
|
||||
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"`
|
||||
|
||||
// ===== 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"`
|
||||
MarkConfigAsActive func(identity domain.ConfigIdRequest) (*entity.Config, error) `method:"mark_config_as_active" group:"config" inner:"true"`
|
||||
DeleteConfig func(identities []string) (*domain.DeleteResponse, error) `method:"delete_config" group:"config" inner:"true"`
|
||||
|
||||
// ===== COMMON CONFIG =====
|
||||
GetCommonConfigs func(identities []string) []entity.CommonConfig `method:"get_configs" group:"common_config" inner:"true"`
|
||||
CreateUpdateCommonConfig func(config entity.CommonConfig) (*entity.CommonConfig, error) `method:"create_update_config" group:"common_config" inner:"true"`
|
||||
DeleteCommonConfig func(req domain.ConfigIdRequest) (*domain.DeleteCommonConfigResponse, error) `method:"delete_config" group:"common_config" inner:"true"`
|
||||
CompileConfigs func(req domain.CompileConfigsRequest) domain.CompiledConfigResponse `method:"compile" group:"common_config" inner:"true"`
|
||||
GetLinks func(req domain.ConfigIdRequest) domain.CommonConfigLinks `method:"get_links" group:"common_config" inner:"true"`
|
||||
|
||||
// ===== ROUTING =====
|
||||
GetRoutes func() ([]structure.BackendDeclaration, error) `method:"get_routes" group:"routing" inner:"true"`
|
||||
|
||||
// ===== SCHEMA =====
|
||||
GetSchemaByModuleId func(domain.GetByModuleIdRequest) (*entity.ConfigSchema, error) `method:"get_by_module_id" group:"schema" inner:"true"`
|
||||
}
|
||||
|
||||
func GetHandlers() *Handlers {
|
||||
return &Handlers{
|
||||
DeleteModules: controller.Module.DeleteModules,
|
||||
GetModulesInfo: controller.Module.GetModulesAggregatedInfo,
|
||||
|
||||
GetActiveConfigByModuleName: controller.Config.GetActiveConfigByModuleName,
|
||||
CreateUpdateConfig: controller.Config.CreateUpdateConfig,
|
||||
MarkConfigAsActive: controller.Config.MarkConfigAsActive,
|
||||
DeleteConfig: controller.Config.DeleteConfigs,
|
||||
|
||||
GetCommonConfigs: controller.CommonConfig.GetConfigs,
|
||||
CreateUpdateCommonConfig: controller.CommonConfig.CreateUpdateConfig,
|
||||
DeleteCommonConfig: controller.CommonConfig.DeleteConfigs,
|
||||
CompileConfigs: controller.CommonConfig.CompileConfigs,
|
||||
GetLinks: controller.CommonConfig.GetLinks,
|
||||
|
||||
GetRoutes: controller.Routes.GetRoutes,
|
||||
|
||||
GetSchemaByModuleId: controller.Schema.GetByModuleId,
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package helpers
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/txix-open/etp/v4"
|
||||
"github.com/txix-open/isp-kit/cluster"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
"isp-config-service/entity"
|
||||
)
|
||||
|
||||
func ModuleName(conn *etp.Conn) string {
|
||||
return conn.HttpRequest().Form.Get("module_name")
|
||||
}
|
||||
|
||||
func SplitAddress(backend entity.Backend) (cluster.AddressConfiguration, error) {
|
||||
host, port, err := net.SplitHostPort(backend.Address)
|
||||
if err != nil {
|
||||
return cluster.AddressConfiguration{}, errors.WithMessagef(err, "split backend %s address: %s", backend.ModuleId, backend.Address)
|
||||
}
|
||||
return cluster.AddressConfiguration{
|
||||
IP: host,
|
||||
Port: port,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func LogFields(conn *etp.Conn) []log.Field {
|
||||
return []log.Field{
|
||||
log.String("moduleName", ModuleName(conn)),
|
||||
log.String("connId", conn.Id()),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package holder
|
||||
|
||||
import (
|
||||
etp "github.com/integration-system/isp-etp-go"
|
||||
"isp-config-service/cluster"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
var (
|
||||
ClusterClient *cluster.Client
|
||||
EtpServer etp.Server
|
||||
HttpServer *http.Server
|
||||
)
|
||||
@@ -1,49 +1,221 @@
|
||||
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"
|
||||
log "github.com/integration-system/isp-log"
|
||||
"github.com/thecodeteam/goodbye"
|
||||
"isp-config-service/cluster"
|
||||
"isp-config-service/codes"
|
||||
"isp-config-service/conf"
|
||||
"isp-config-service/routes"
|
||||
"isp-config-service/service/startup"
|
||||
"isp-config-service/controller"
|
||||
"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"
|
||||
)
|
||||
|
||||
"github.com/txix-open/isp-kit/bootstrap"
|
||||
"github.com/txix-open/isp-kit/shutdown"
|
||||
const (
|
||||
moduleName = "config"
|
||||
defaultWsConnectionReadLimit int64 = 4 << 20 // 4 MB
|
||||
)
|
||||
|
||||
var (
|
||||
version = "1.0.0"
|
||||
version = "0.1.0"
|
||||
date = "undefined"
|
||||
|
||||
shutdownChan = make(chan struct{})
|
||||
muxer mux.Mux
|
||||
)
|
||||
|
||||
// @title isp-config-service
|
||||
// @version 3.0.0
|
||||
// @description Модуль управления конфигурациями
|
||||
func init() {
|
||||
config.InitConfig(&conf.Configuration{})
|
||||
if utils.LOG_LEVEL != "" {
|
||||
_ = log.SetLevel(utils.LOG_LEVEL)
|
||||
}
|
||||
}
|
||||
|
||||
// @title ISP configuration service
|
||||
// @version 2.0.0
|
||||
// @description Сервис управления конфигурацией модулей ISP кластера
|
||||
|
||||
// @license.name GNU GPL v3.0
|
||||
|
||||
// @host localhost:9000
|
||||
// @host localhost:9003
|
||||
// @BasePath /api/config
|
||||
|
||||
//go:generate swag init --parseDependency
|
||||
//go:generate rm -f docs/swagger.json docs/docs.go
|
||||
func main() {
|
||||
boot := bootstrap.New(version, conf.Remote{}, routes.EndpointDescriptors())
|
||||
app := boot.App
|
||||
logger := app.Logger()
|
||||
|
||||
startup, err := startup.New(boot)
|
||||
if err != nil {
|
||||
boot.Fatal(err)
|
||||
ctx := context.Background()
|
||||
cfg := config.Get().(*conf.Configuration)
|
||||
handlers := helper.GetHandlers()
|
||||
endpoints := backend.GetEndpoints(cfg.ModuleName, handlers)
|
||||
address := cfg.GrpcOuterAddress
|
||||
if address.IP == "" {
|
||||
ip, err := getOutboundIp()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
address.IP = ip
|
||||
}
|
||||
app.AddRunners(startup)
|
||||
app.AddClosers(startup.Closers()...)
|
||||
|
||||
shutdown.On(func() {
|
||||
logger.Info(app.Context(), "starting shutdown")
|
||||
app.Shutdown()
|
||||
logger.Info(app.Context(), "shutdown completed")
|
||||
})
|
||||
|
||||
err = app.Run()
|
||||
if err != nil {
|
||||
boot.Fatal(err)
|
||||
declaration := structure.BackendDeclaration{
|
||||
ModuleName: cfg.ModuleName,
|
||||
Version: version,
|
||||
LibVersion: bootstrap.LibraryVersion,
|
||||
Endpoints: endpoints,
|
||||
Address: address,
|
||||
}
|
||||
|
||||
model.DbClient.ReceiveConfiguration(cfg.Database)
|
||||
|
||||
httpListener, raftListener, err := initMultiplexer(cfg.WS.Rest)
|
||||
if err != nil {
|
||||
log.Fatalf(codes.InitMuxError, "init mux: %v", err)
|
||||
}
|
||||
|
||||
_, raftStore := initRaft(raftListener, cfg.Cluster, declaration)
|
||||
initWebsocket(ctx, cfg.WS.WsConnectionReadLimitKB, httpListener, raftStore)
|
||||
initGrpc(cfg.WS.Grpc, raftStore)
|
||||
|
||||
defer goodbye.Exit(ctx, -1)
|
||||
goodbye.Notify(ctx)
|
||||
goodbye.Register(onShutdown)
|
||||
|
||||
<-shutdownChan
|
||||
}
|
||||
|
||||
func initMultiplexer(addressConfiguration structure.AddressConfiguration) (net.Listener, net.Listener, error) {
|
||||
outerAddr, err := net.ResolveTCPAddr("tcp4", addressConfiguration.GetAddress())
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("resolve outer address: %v", err)
|
||||
}
|
||||
tcpListener, err := net.ListenTCP("tcp4", outerAddr)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("create tcp transport: %v", err)
|
||||
}
|
||||
|
||||
muxer = mux.New(tcpListener)
|
||||
httpListener := muxer.Match(mux.HTTP1())
|
||||
raftListener := muxer.Match(mux.Any())
|
||||
|
||||
go func() {
|
||||
if err := muxer.Serve(); err != nil {
|
||||
log.Fatalf(codes.InitMuxError, "serve mux: %v", err)
|
||||
}
|
||||
}()
|
||||
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
|
||||
}
|
||||
etpConfig := etp.ServerConfig{
|
||||
InsecureSkipVerify: true,
|
||||
ConnectionReadLimit: connectionReadLimit,
|
||||
}
|
||||
etpServer := etp.NewServer(ctx, etpConfig)
|
||||
subs.NewSocketEventHandler(etpServer, raftStore).SubscribeAll()
|
||||
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/isp-etp/", etpServer.ServeHttp)
|
||||
httpServer := &http.Server{Handler: mux}
|
||||
go func() {
|
||||
if err := httpServer.Serve(listener); err != nil && err != http.ErrServerClosed {
|
||||
log.Fatalf(codes.StartHttpServerError, "http server closed: %v", err)
|
||||
}
|
||||
}()
|
||||
holder.EtpServer = etpServer
|
||||
holder.HttpServer = httpServer
|
||||
}
|
||||
|
||||
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)
|
||||
return nil, nil
|
||||
}
|
||||
raftStore := store.NewStateStore(raftState)
|
||||
r, err := raft.NewRaft(listener, clusterCfg, raftStore)
|
||||
if err != nil {
|
||||
log.Fatalf(codes.InitRaftError, "unable to create raft server. %v", err)
|
||||
return nil, nil
|
||||
}
|
||||
clusterClient := cluster.NewRaftClusterClient(r, declaration, func(address string) {
|
||||
raftStore.VisitState(func(s state.WritableState) {
|
||||
cfg := config.Get().(*conf.Configuration)
|
||||
addr, err := net.ResolveTCPAddr("tcp", address)
|
||||
if err != nil {
|
||||
panic(err) // must never occured
|
||||
}
|
||||
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")
|
||||
service.ClusterMeshService.HandleDeleteBackendDeclarationCommand(back, s)
|
||||
})
|
||||
})
|
||||
holder.ClusterClient = clusterClient
|
||||
|
||||
if clusterCfg.BootstrapCluster {
|
||||
err = r.BootstrapCluster() // err can be ignored
|
||||
if err != nil {
|
||||
log.Errorf(codes.BootstrapClusterError, "bootstrap cluster. %v", err)
|
||||
}
|
||||
}
|
||||
return clusterClient, raftStore
|
||||
}
|
||||
|
||||
func initGrpc(bindAddress structure.AddressConfiguration, raftStore *store.Store) {
|
||||
controller.Routes = controller.NewRoutes(raftStore)
|
||||
controller.Schema = controller.NewSchema(raftStore)
|
||||
controller.Module = controller.NewModule(raftStore)
|
||||
controller.Config = controller.NewConfig(raftStore)
|
||||
controller.CommonConfig = controller.NewCommonConfig(raftStore)
|
||||
defaultService := backend.GetDefaultService(moduleName, helper.GetHandlers())
|
||||
backend.StartBackendGrpcServer(bindAddress, defaultService)
|
||||
}
|
||||
|
||||
func onShutdown(ctx context.Context, _ os.Signal) {
|
||||
defer close(shutdownChan)
|
||||
|
||||
backend.StopGrpcServer()
|
||||
holder.EtpServer.Close()
|
||||
|
||||
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")
|
||||
}
|
||||
|
||||
if err := holder.ClusterClient.Shutdown(); err != nil {
|
||||
log.Warnf(codes.RaftShutdownError, "raft shutdown err: %v", err)
|
||||
} else {
|
||||
log.Info(codes.RaftShutdownInfo, "raft shutdown success")
|
||||
}
|
||||
|
||||
_ = muxer.Close()
|
||||
}
|
||||
|
||||
func getOutboundIp() (string, error) {
|
||||
conn, err := net.Dial("udp", "9.9.9.9:80")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer conn.Close()
|
||||
return conn.LocalAddr().(*net.UDPAddr).IP.To4().String(), nil
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package middlewares
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/txix-open/isp-kit/http/httpcli"
|
||||
"github.com/txix-open/isp-kit/metrics"
|
||||
"isp-config-service/middlewares/sql_metrics"
|
||||
)
|
||||
|
||||
func SqlOperationMiddleware() httpcli.Middleware {
|
||||
//nolint:promlinter
|
||||
sqlQueryDuration := metrics.GetOrRegister(metrics.DefaultRegistry, prometheus.NewSummaryVec(prometheus.SummaryOpts{
|
||||
Subsystem: "sql",
|
||||
Name: "query_duration_ms",
|
||||
Help: "The latencies of sql query",
|
||||
Objectives: metrics.DefaultObjectives,
|
||||
}, []string{"operation"}))
|
||||
return func(next httpcli.RoundTripper) httpcli.RoundTripper {
|
||||
return httpcli.RoundTripperFunc(func(ctx context.Context, request *httpcli.Request) (*httpcli.Response, error) {
|
||||
label := sql_metrics.OperationLabelFromContext(ctx)
|
||||
now := time.Now()
|
||||
resp, err := next.RoundTrip(ctx, request)
|
||||
if label != "" {
|
||||
duration := time.Since(now)
|
||||
sqlQueryDuration.WithLabelValues(label).Observe(metrics.Milliseconds(duration))
|
||||
}
|
||||
return resp, err //nolint:wrapcheck
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package sql_metrics
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type tracerContextKey int
|
||||
|
||||
const (
|
||||
labelContextKey = tracerContextKey(2)
|
||||
)
|
||||
|
||||
func OperationLabelToContext(ctx context.Context, label string) context.Context {
|
||||
return context.WithValue(ctx, labelContextKey, label)
|
||||
}
|
||||
|
||||
func OperationLabelFromContext(ctx context.Context) string {
|
||||
value, _ := ctx.Value(labelContextKey).(string)
|
||||
return value
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package middlewares
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/txix-open/etp/v4"
|
||||
|
||||
"github.com/txix-open/etp/v4/msg"
|
||||
"github.com/txix-open/isp-kit/log"
|
||||
"isp-config-service/helpers"
|
||||
)
|
||||
|
||||
type EtpMiddleware func(next etp.Handler) etp.Handler
|
||||
|
||||
func EtpLogger(logger log.Logger) EtpMiddleware {
|
||||
return func(next etp.Handler) etp.Handler {
|
||||
return etp.HandlerFunc(func(ctx context.Context, conn *etp.Conn, event msg.Event) []byte {
|
||||
fields := append(
|
||||
helpers.LogFields(conn),
|
||||
log.String("event", event.Name),
|
||||
)
|
||||
logger.Debug(ctx, "event received", fields...)
|
||||
return next.Handle(ctx, conn, event)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//nolint:ireturn
|
||||
func EtpChain(root etp.Handler, middlewares ...EtpMiddleware) etp.Handler {
|
||||
for i := len(middlewares) - 1; i >= 0; i-- {
|
||||
root = middlewares[i](root)
|
||||
}
|
||||
return root
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
-- +goose Up
|
||||
CREATE schema if NOT EXISTS "config_service";
|
||||
|
||||
-- +goose Down
|
||||
DROP schema if EXISTS config_service CASCADE;
|
||||
@@ -0,0 +1,47 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE instances (
|
||||
id serial4 NOT NULL PRIMARY KEY,
|
||||
uuid UUID NOT NULL,
|
||||
"name" varchar(255) NOT NULL,
|
||||
created_at timestamp DEFAULT (now() at time zone 'utc') NOT NULL
|
||||
);
|
||||
|
||||
-- +goose StatementBegin
|
||||
CREATE OR REPLACE FUNCTION update_created_modified_column_date()
|
||||
RETURNS TRIGGER AS
|
||||
$body$
|
||||
BEGIN
|
||||
IF TG_OP = 'UPDATE' THEN
|
||||
NEW.created_at = OLD.created_at;
|
||||
NEW.updated_at = (now() at time zone 'utc');
|
||||
ELSIF TG_OP = 'INSERT' THEN
|
||||
NEW.updated_at = (now() at time zone 'utc');
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$body$ LANGUAGE plpgsql;
|
||||
-- +goose StatementEnd
|
||||
|
||||
-- +goose StatementBegin
|
||||
CREATE OR REPLACE FUNCTION update_created_column_date()
|
||||
RETURNS TRIGGER AS
|
||||
$body$
|
||||
BEGIN
|
||||
IF TG_OP = 'UPDATE' THEN
|
||||
NEW.created_at = OLD.created_at;
|
||||
ELSIF TG_OP = 'INSERT' THEN
|
||||
NEW.created_at = (now() at time zone 'utc');
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$body$ LANGUAGE plpgsql;
|
||||
-- +goose StatementEnd
|
||||
|
||||
CREATE TRIGGER update_customer_modtime BEFORE INSERT OR UPDATE ON instances
|
||||
FOR EACH ROW EXECUTE PROCEDURE update_created_column_date();
|
||||
|
||||
ALTER TABLE instances ADD CONSTRAINT "UQ_instances_uuid" UNIQUE ("uuid");
|
||||
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE instances;
|
||||
@@ -0,0 +1,24 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE modules (
|
||||
id serial4 NOT NULL PRIMARY KEY,
|
||||
instance_id int4 NOT NULL,
|
||||
"name" varchar(255) NOT NULL,
|
||||
"active" bool DEFAULT true,
|
||||
created_at timestamp DEFAULT (now() at time zone 'utc') NOT NULL,
|
||||
last_connected_at timestamp,
|
||||
last_disconnected_at timestamp
|
||||
);
|
||||
|
||||
ALTER TABLE modules
|
||||
ADD CONSTRAINT "FK_modules_instanceId_instances_id"
|
||||
FOREIGN KEY ("instance_id") REFERENCES instances ("id")
|
||||
ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
CREATE INDEX IX_modules_instanceId ON modules USING hash (instance_id);
|
||||
|
||||
CREATE TRIGGER update_customer_modtime BEFORE INSERT OR UPDATE ON modules
|
||||
FOR EACH ROW EXECUTE PROCEDURE update_created_column_date();
|
||||
|
||||
ALTER TABLE modules ADD CONSTRAINT "UQ_modules_instanceId_name" UNIQUE ("instance_id", "name");
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE modules;
|
||||
@@ -0,0 +1,70 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE configs (
|
||||
id serial8 NOT NULL PRIMARY KEY,
|
||||
module_id int4 NOT NULL,
|
||||
"version" int4 NOT NULL,
|
||||
"active" bool DEFAULT false,
|
||||
created_at timestamp DEFAULT (now() at time zone 'utc') NOT NULL,
|
||||
updated_at timestamp DEFAULT (now() at time zone 'utc') NOT NULL,
|
||||
"data" jsonb NOT NULL DEFAULT '{}'
|
||||
);
|
||||
|
||||
ALTER TABLE configs
|
||||
ADD CONSTRAINT "FK_configs_moduleId_modules_id"
|
||||
FOREIGN KEY ("module_id") REFERENCES modules ("id")
|
||||
ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
CREATE INDEX IX_configs_moduleId ON configs USING hash (module_id);
|
||||
|
||||
-- +goose StatementBegin
|
||||
CREATE OR REPLACE FUNCTION deactivate_config()
|
||||
RETURNS TRIGGER AS
|
||||
$body$
|
||||
DECLARE
|
||||
last_version integer;
|
||||
BEGIN
|
||||
NEW.updated_at = (now() at time zone 'utc');
|
||||
IF TG_OP = 'INSERT'
|
||||
THEN
|
||||
EXECUTE format('
|
||||
SELECT version
|
||||
FROM %I.configs
|
||||
WHERE module_id = ' || NEW.module_id || '
|
||||
ORDER BY created_at DESC
|
||||
LIMIT 1;
|
||||
', TG_TABLE_SCHEMA) INTO last_version;
|
||||
IF last_version IS NOT NULL
|
||||
THEN
|
||||
NEW.version = last_version + 1;
|
||||
ELSE
|
||||
NEW.version = 1;
|
||||
END IF;
|
||||
ELSE
|
||||
NEW.version = OLD.version;
|
||||
NEW.created_at = OLD.created_at;
|
||||
END IF;
|
||||
|
||||
IF NEW.active = TRUE
|
||||
THEN
|
||||
EXECUTE format('
|
||||
UPDATE %I.configs
|
||||
SET active = FALSE,
|
||||
updated_at = (now() at time zone ''utc'')
|
||||
WHERE active = TRUE AND ' || NEW.id || ' != id AND module_id = ' || NEW.module_id || ';
|
||||
', TG_TABLE_SCHEMA);
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$body$ LANGUAGE plpgsql;
|
||||
-- +goose StatementEnd
|
||||
|
||||
CREATE TRIGGER "deactivate_config"
|
||||
BEFORE INSERT OR UPDATE ON configs
|
||||
FOR EACH ROW EXECUTE PROCEDURE deactivate_config();
|
||||
|
||||
CREATE TRIGGER update_config_create_time BEFORE INSERT OR UPDATE ON configs
|
||||
FOR EACH ROW EXECUTE PROCEDURE update_created_column_date();
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE configs;
|
||||
DROP FUNCTION deactivate_config;
|
||||
@@ -0,0 +1,9 @@
|
||||
-- +goose Up
|
||||
ALTER TABLE configs
|
||||
ADD COLUMN name VARCHAR(255) NOT NULL DEFAULT 'unnamed',
|
||||
ADD COLUMN description TEXT;
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE configs
|
||||
DROP COLUMN name,
|
||||
DROP COLUMN description;
|
||||
@@ -0,0 +1,23 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE config_schemas (
|
||||
id SERIAL4 PRIMARY KEY,
|
||||
module_id INTEGER NOT NULL,
|
||||
version VARCHAR(255) NOT NULL,
|
||||
schema JSONB NOT NULL DEFAULT '{}',
|
||||
created_at TIMESTAMP NOT NULL DEFAULT (now() at time zone 'utc'),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT (now() at time zone 'utc'),
|
||||
CONSTRAINT FK_module_id__module_id FOREIGN KEY (module_id)
|
||||
REFERENCES modules (id) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE TRIGGER update_schema_create_time
|
||||
BEFORE INSERT OR UPDATE
|
||||
ON config_schemas
|
||||
FOR EACH ROW EXECUTE PROCEDURE update_created_modified_column_date();
|
||||
|
||||
CREATE INDEX IX_schemes_moduleId
|
||||
ON config_schemas
|
||||
USING hash (module_id);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE config_schemas;
|
||||
@@ -0,0 +1,46 @@
|
||||
-- +goose Up
|
||||
|
||||
DROP TABLE instances CASCADE;
|
||||
|
||||
DROP TRIGGER update_config_create_time ON configs;
|
||||
DROP TRIGGER deactivate_config on configs;
|
||||
DROP TRIGGER update_schema_create_time ON config_schemas;
|
||||
DROP TRIGGER update_customer_modtime ON modules;
|
||||
|
||||
|
||||
ALTER TABLE configs
|
||||
DROP CONSTRAINT "FK_configs_moduleId_modules_id";
|
||||
|
||||
ALTER TABLE config_schemas
|
||||
DROP CONSTRAINT "fk_module_id__module_id";
|
||||
|
||||
ALTER TABLE configs
|
||||
ALTER COLUMN id TYPE varchar(255),
|
||||
ALTER COLUMN module_id TYPE varchar(255),
|
||||
ADD COLUMN common_configs varchar(255)[] NOT NULL DEFAULT '{}';
|
||||
|
||||
ALTER TABLE config_schemas
|
||||
ALTER COLUMN module_id TYPE varchar(255),
|
||||
ALTER COLUMN id TYPE varchar(255);
|
||||
|
||||
ALTER TABLE modules
|
||||
ALTER COLUMN id TYPE varchar(255),
|
||||
DROP COLUMN active,
|
||||
DROP COLUMN instance_id;
|
||||
|
||||
|
||||
CREATE TABLE common_configs
|
||||
(
|
||||
id VARCHAR(255) NOT NULL PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL DEFAULT 'unnamed',
|
||||
description TEXT,
|
||||
created_at timestamp NOT NULL DEFAULT (now() at time zone 'utc'),
|
||||
updated_at timestamp NOT NULL DEFAULT (now() at time zone 'utc'),
|
||||
data jsonb NOT NULL DEFAULT '{}'
|
||||
);
|
||||
|
||||
|
||||
-- +goose Down
|
||||
|
||||
DROP TABLE common_configs;
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
-- +goose Up
|
||||
-- +goose NO TRANSACTION
|
||||
create table isp_config_service__module
|
||||
(
|
||||
id text not null primary key,
|
||||
name text not null unique,
|
||||
last_connected_at integer,
|
||||
last_disconnected_at integer,
|
||||
created_at integer not null default (unixepoch())
|
||||
);
|
||||
|
||||
create table isp_config_service__config
|
||||
(
|
||||
id text not null primary key,
|
||||
name text not null,
|
||||
module_id text not null,
|
||||
data blob not null,
|
||||
version int not null default 1,
|
||||
active int not null default 0,
|
||||
admin_id int not null default 0,
|
||||
created_at integer not null default (unixepoch()),
|
||||
updated_at integer not null default (unixepoch()),
|
||||
foreign key (module_id) references isp_config_service__module (id) on delete cascade on update cascade
|
||||
);
|
||||
|
||||
create index IX_isp_config_service__config__module_id on isp_config_service__config (module_id);
|
||||
|
||||
create table isp_config_service__config_history
|
||||
(
|
||||
id text not null primary key,
|
||||
config_id text not null,
|
||||
data blob not null,
|
||||
version int not null default 1,
|
||||
admin_id int not null default 0,
|
||||
created_at integer not null default (unixepoch()),
|
||||
foreign key (config_id) references isp_config_service__config (id) on delete cascade on update cascade
|
||||
);
|
||||
|
||||
create index IX_isp_config_service__config_history__config_id on isp_config_service__config_history (config_id);
|
||||
|
||||
create table isp_config_service__config_schema
|
||||
(
|
||||
id text not null primary key,
|
||||
module_id text not null unique,
|
||||
data blob not null,
|
||||
module_version text not null default 1,
|
||||
created_at integer not null default (unixepoch()),
|
||||
updated_at integer not null default (unixepoch()),
|
||||
foreign key (module_id) references isp_config_service__module (id) on delete cascade on update cascade
|
||||
);
|
||||
|
||||
create table isp_config_service__backend
|
||||
(
|
||||
module_id text not null,
|
||||
address text not null,
|
||||
version text not null,
|
||||
lib_version text not null,
|
||||
module_name text not null,
|
||||
endpoints blob not null,
|
||||
required_modules blob not null,
|
||||
created_at integer not null default (unixepoch()),
|
||||
updated_at integer not null default (unixepoch()),
|
||||
primary key (module_id, address),
|
||||
foreign key (module_id) references isp_config_service__module (id) on delete cascade on update cascade
|
||||
);
|
||||
|
||||
create table isp_config_service__event
|
||||
(
|
||||
id integer,
|
||||
payload blob not null,
|
||||
created_at integer not null default (unixepoch()),
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
drop table isp_config_service__module;
|
||||
drop table isp_config_service__config;
|
||||
drop table isp_config_service__config_history;
|
||||
drop table isp_config_service__config_schema;
|
||||
drop table isp_config_service__backend;
|
||||
drop table isp_config_service__event;
|
||||
@@ -1,17 +0,0 @@
|
||||
-- +goose Up
|
||||
-- +goose NO TRANSACTION
|
||||
CREATE TABLE isp_config_service__event_autoincrement (
|
||||
id integer primary key autoincrement,
|
||||
payload blob not null,
|
||||
created_at integer not null default (unixepoch())
|
||||
);
|
||||
|
||||
INSERT INTO
|
||||
isp_config_service__event_autoincrement (id, payload, created_at)
|
||||
SELECT id, payload, created_at
|
||||
FROM isp_config_service__event;
|
||||
DROP TABLE isp_config_service__event;
|
||||
|
||||
ALTER TABLE isp_config_service__event_autoincrement RENAME TO isp_config_service__event;
|
||||
|
||||
-- +goose Down
|
||||
@@ -1,24 +0,0 @@
|
||||
-- +goose Up
|
||||
-- +goose NO TRANSACTION
|
||||
drop table isp_config_service__backend;
|
||||
|
||||
create table isp_config_service__backend
|
||||
(
|
||||
ws_connection_id text not null,
|
||||
module_id text not null,
|
||||
address text not null,
|
||||
version text not null,
|
||||
lib_version text not null,
|
||||
module_name text not null,
|
||||
config_service_node_id text not null,
|
||||
endpoints blob not null,
|
||||
required_modules blob not null,
|
||||
created_at integer not null default (unixepoch()),
|
||||
primary key (ws_connection_id),
|
||||
foreign key (module_id) references isp_config_service__module (id) on delete cascade on update cascade
|
||||
);
|
||||
|
||||
create index IX_isp_config_service__backend__module_id on isp_config_service__backend (module_id);
|
||||
create index IX_isp_config_service__backend__node_id on isp_config_service__backend(config_service_node_id);
|
||||
|
||||
-- +goose Down
|
||||
@@ -1,26 +0,0 @@
|
||||
-- +goose Up
|
||||
-- +goose NO TRANSACTION
|
||||
create table isp_config_service__variable
|
||||
(
|
||||
name text primary key,
|
||||
description text not null,
|
||||
type text not null,
|
||||
value text not null,
|
||||
created_at integer not null default (unixepoch()),
|
||||
updated_at integer not null default (unixepoch())
|
||||
);
|
||||
|
||||
create table isp_config_service__config_has_variable
|
||||
(
|
||||
config_id text not null,
|
||||
variable_name text not null,
|
||||
primary key (config_id, variable_name),
|
||||
foreign key (config_id) references isp_config_service__config (id) on delete cascade on update cascade,
|
||||
foreign key (variable_name) references isp_config_service__variable (name)
|
||||
);
|
||||
|
||||
create index IX_isp_config_service__config_has_variable__variable_name on isp_config_service__config_has_variable (variable_name);
|
||||
|
||||
-- +goose Down
|
||||
drop table isp_config_service__config_has_variable;
|
||||
drop table isp_config_service__variable;
|
||||
@@ -1,6 +0,0 @@
|
||||
-- +goose Up
|
||||
-- +goose NO TRANSACTION
|
||||
alter table isp_config_service__backend add column metrics_autodiscovery blob;
|
||||
|
||||
-- +goose Down
|
||||
alter table isp_config_service__backend drop column metrics_autodiscovery;
|
||||
@@ -1,10 +0,0 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"embed"
|
||||
)
|
||||
|
||||
var (
|
||||
//go:embed *
|
||||
Migrations embed.FS
|
||||
)
|
||||
@@ -0,0 +1,22 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/integration-system/isp-lib/database"
|
||||
log "github.com/integration-system/isp-log"
|
||||
"github.com/integration-system/isp-log/stdcodes"
|
||||
)
|
||||
|
||||
var (
|
||||
DbClient = database.NewRxDbClient(
|
||||
database.WithSchemaEnsuring(),
|
||||
database.WithSchemaAutoInjecting(),
|
||||
database.WithMigrationsEnsuring(),
|
||||
database.WithInitializingErrorHandler(func(err *database.ErrorEvent) {
|
||||
log.Fatal(stdcodes.InitializingDbError, err.Error())
|
||||
}),
|
||||
)
|
||||
ConfigRep ConfigRepository = &configRepPg{rxClient: DbClient}
|
||||
CommonConfigRep CommonConfigRepository = &commonConfigRepPg{rxClient: DbClient}
|
||||
SchemaRep SchemaRepository = &schemaRepPg{rxClient: DbClient}
|
||||
ModuleRep ModulesRepository = &modulesRepPg{rxClient: DbClient}
|
||||
)
|
||||
@@ -0,0 +1,54 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/go-pg/pg"
|
||||
"github.com/integration-system/isp-lib/database"
|
||||
"isp-config-service/entity"
|
||||
)
|
||||
|
||||
type CommonConfigRepository interface {
|
||||
Snapshot() ([]entity.CommonConfig, error)
|
||||
Upsert(config entity.CommonConfig) (*entity.CommonConfig, error)
|
||||
Delete(identities []string) (int, error)
|
||||
}
|
||||
|
||||
type commonConfigRepPg struct {
|
||||
rxClient *database.RxDbClient
|
||||
}
|
||||
|
||||
func (r *commonConfigRepPg) Snapshot() ([]entity.CommonConfig, error) {
|
||||
configs := make([]entity.CommonConfig, 0)
|
||||
err := r.rxClient.Visit(func(db *pg.DB) error {
|
||||
return db.Model(&configs).Select()
|
||||
})
|
||||
return configs, err
|
||||
}
|
||||
|
||||
func (r *commonConfigRepPg) Upsert(config entity.CommonConfig) (*entity.CommonConfig, error) {
|
||||
err := r.rxClient.Visit(func(db *pg.DB) error {
|
||||
_, err := db.Model(&config).
|
||||
OnConflict("(id) DO UPDATE").
|
||||
Returning("*").
|
||||
Insert()
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &config, err
|
||||
}
|
||||
|
||||
func (r *commonConfigRepPg) Delete(identities []string) (int, error) {
|
||||
var err error
|
||||
var res pg.Result
|
||||
err = r.rxClient.Visit(func(db *pg.DB) error {
|
||||
res, err = db.Model(&entity.CommonConfig{}).
|
||||
Where("id IN (?)", pg.In(identities)).
|
||||
Delete()
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return res.RowsAffected(), err
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/go-pg/pg"
|
||||
"github.com/integration-system/isp-lib/database"
|
||||
"isp-config-service/entity"
|
||||
)
|
||||
|
||||
type ConfigRepository interface {
|
||||
Snapshot() ([]entity.Config, error)
|
||||
Upsert(config entity.Config) (*entity.Config, error)
|
||||
Delete(identities []string) (int, error)
|
||||
}
|
||||
|
||||
type configRepPg struct {
|
||||
rxClient *database.RxDbClient
|
||||
}
|
||||
|
||||
func (r *configRepPg) Snapshot() ([]entity.Config, error) {
|
||||
configs := make([]entity.Config, 0)
|
||||
err := r.rxClient.Visit(func(db *pg.DB) error {
|
||||
return db.Model(&configs).Select()
|
||||
})
|
||||
return configs, err
|
||||
}
|
||||
|
||||
func (r *configRepPg) Upsert(config entity.Config) (*entity.Config, error) {
|
||||
err := r.rxClient.Visit(func(db *pg.DB) error {
|
||||
_, err := db.Model(&config).
|
||||
OnConflict("(id) DO UPDATE").
|
||||
Returning("*").
|
||||
Insert()
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &config, err
|
||||
}
|
||||
|
||||
func (r *configRepPg) Delete(identities []string) (int, error) {
|
||||
var err error
|
||||
var res pg.Result
|
||||
err = r.rxClient.Visit(func(db *pg.DB) error {
|
||||
res, err = db.Model(&entity.Config{}).
|
||||
Where("id IN (?)", pg.In(identities)).
|
||||
Delete()
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return res.RowsAffected(), err
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/go-pg/pg"
|
||||
"github.com/integration-system/isp-lib/database"
|
||||
"isp-config-service/entity"
|
||||
)
|
||||
|
||||
type ModulesRepository interface {
|
||||
Snapshot() ([]entity.Module, error)
|
||||
Upsert(module entity.Module) (*entity.Module, error)
|
||||
Delete(identities []string) (int, error)
|
||||
}
|
||||
|
||||
type modulesRepPg struct {
|
||||
rxClient *database.RxDbClient
|
||||
}
|
||||
|
||||
func (r *modulesRepPg) Snapshot() ([]entity.Module, error) {
|
||||
modules := make([]entity.Module, 0)
|
||||
err := r.rxClient.Visit(func(db *pg.DB) error {
|
||||
return db.Model(&modules).Select()
|
||||
})
|
||||
return modules, err
|
||||
}
|
||||
|
||||
func (r *modulesRepPg) Upsert(module entity.Module) (*entity.Module, error) {
|
||||
err := r.rxClient.Visit(func(db *pg.DB) error {
|
||||
_, err := db.Model(&module).
|
||||
OnConflict("(id) DO UPDATE").
|
||||
Returning("*").
|
||||
Insert()
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &module, err
|
||||
}
|
||||
|
||||
func (r *modulesRepPg) Delete(identities []string) (int, error) {
|
||||
var err error
|
||||
var res pg.Result
|
||||
err = r.rxClient.Visit(func(db *pg.DB) error {
|
||||
res, err = db.Model(&entity.Module{}).
|
||||
Where("id IN (?)", pg.In(identities)).Delete()
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return res.RowsAffected(), err
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/go-pg/pg"
|
||||
"github.com/integration-system/isp-lib/database"
|
||||
"isp-config-service/entity"
|
||||
)
|
||||
|
||||
type SchemaRepository interface {
|
||||
Snapshot() ([]entity.ConfigSchema, error)
|
||||
Upsert(schema entity.ConfigSchema) (*entity.ConfigSchema, error)
|
||||
Delete(identities []string) (int, error)
|
||||
}
|
||||
|
||||
type schemaRepPg struct {
|
||||
rxClient *database.RxDbClient
|
||||
}
|
||||
|
||||
func (r *schemaRepPg) Snapshot() ([]entity.ConfigSchema, error) {
|
||||
schemas := make([]entity.ConfigSchema, 0)
|
||||
err := r.rxClient.Visit(func(db *pg.DB) error {
|
||||
return db.Model(&schemas).Select()
|
||||
})
|
||||
return schemas, err
|
||||
}
|
||||
|
||||
func (r *schemaRepPg) Upsert(schema entity.ConfigSchema) (*entity.ConfigSchema, error) {
|
||||
err := r.rxClient.Visit(func(db *pg.DB) error {
|
||||
_, err := db.Model(&schema).
|
||||
OnConflict("(id) DO UPDATE").
|
||||
Returning("*").
|
||||
Insert()
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &schema, err
|
||||
}
|
||||
|
||||
func (r *schemaRepPg) Delete(identities []string) (int, error) {
|
||||
var err error
|
||||
var res pg.Result
|
||||
err = r.rxClient.Visit(func(db *pg.DB) error {
|
||||
res, err = db.Model(&entity.ConfigSchema{}).
|
||||
Where("id IN (?)", pg.In(identities)).Delete()
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return res.RowsAffected(), err
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
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
@@ -0,0 +1,186 @@
|
||||
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
@@ -0,0 +1,118 @@
|
||||
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
@@ -0,0 +1,22 @@
|
||||
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
@@ -0,0 +1,105 @@
|
||||
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()
|
||||
}
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
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"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultSyncTimeout = 3 * time.Second
|
||||
dbFile = "raft_db"
|
||||
)
|
||||
|
||||
type ChangeLeaderNotification struct {
|
||||
IsLeader bool
|
||||
CurrentLeaderAddress string
|
||||
LeaderElected bool
|
||||
}
|
||||
|
||||
type Raft struct {
|
||||
r *raft.Raft
|
||||
cfg conf.ClusterConfiguration
|
||||
leaderObs *raft.Observer
|
||||
leaderObsCh chan raft.Observation
|
||||
changeLeaderCh chan ChangeLeaderNotification
|
||||
closer chan struct{}
|
||||
}
|
||||
|
||||
func (r *Raft) BootstrapCluster() error {
|
||||
peers := makeConfiguration(r.cfg.Peers)
|
||||
|
||||
if f := r.r.BootstrapCluster(peers); f.Error() != nil {
|
||||
return errors.WithMessage(f.Error(), "bootstrap cluster")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Raft) SyncApply(command []byte) (interface{}, error) {
|
||||
f := r.r.Apply(command, defaultSyncTimeout)
|
||||
if err := f.Error(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return f.Response(), nil
|
||||
}
|
||||
|
||||
func (r *Raft) LeaderCh() <-chan ChangeLeaderNotification {
|
||||
return r.changeLeaderCh
|
||||
}
|
||||
|
||||
func (r *Raft) GracefulShutdown() error {
|
||||
r.r.DeregisterObserver(r.leaderObs)
|
||||
close(r.closer)
|
||||
close(r.changeLeaderCh)
|
||||
return r.r.Shutdown().Error()
|
||||
}
|
||||
|
||||
func (r *Raft) listenLeader() {
|
||||
for {
|
||||
select {
|
||||
case _, ok := <-r.leaderObsCh:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
currentLeader := r.r.Leader()
|
||||
select {
|
||||
case r.changeLeaderCh <- ChangeLeaderNotification{
|
||||
IsLeader: r.r.State() == raft.Leader,
|
||||
CurrentLeaderAddress: string(currentLeader),
|
||||
LeaderElected: currentLeader != "",
|
||||
}:
|
||||
default:
|
||||
continue
|
||||
}
|
||||
case <-r.closer:
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func NewRaft(tcpListener net.Listener, configuration conf.ClusterConfiguration, state raft.FSM) (*Raft, error) {
|
||||
logStore, store, snapshotStore, err := makeStores(configuration)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
streamLayer := &StreamLayer{Listener: tcpListener}
|
||||
timeout := time.Duration(configuration.ConnectTimeoutSeconds) * time.Second
|
||||
trans := raft.NewNetworkTransport(streamLayer, len(configuration.Peers), timeout, os.Stdout)
|
||||
|
||||
cfg := raft.DefaultConfig()
|
||||
cfg.Logger = &LoggerAdapter{name: "RAFT"}
|
||||
cfg.NoSnapshotRestoreOnStart = true
|
||||
cfg.LocalID = raft.ServerID(configuration.OuterAddress)
|
||||
r, err := raft.NewRaft(cfg, state, logStore, store, snapshotStore, trans)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "create raft")
|
||||
}
|
||||
|
||||
leaderObs, leaderObsCh := makeLeaderObserver()
|
||||
r.RegisterObserver(leaderObs)
|
||||
raft := &Raft{
|
||||
r: r,
|
||||
cfg: configuration,
|
||||
leaderObs: leaderObs,
|
||||
leaderObsCh: leaderObsCh,
|
||||
changeLeaderCh: make(chan ChangeLeaderNotification, 10),
|
||||
closer: make(chan struct{}),
|
||||
}
|
||||
go raft.listenLeader()
|
||||
|
||||
return raft, nil
|
||||
}
|
||||
|
||||
func makeLeaderObserver() (*raft.Observer, chan raft.Observation) {
|
||||
ch := make(chan raft.Observation)
|
||||
obs := raft.NewObserver(ch, false, func(o *raft.Observation) bool {
|
||||
_, ok := o.Data.(raft.LeaderObservation)
|
||||
return ok
|
||||
})
|
||||
return obs, ch
|
||||
}
|
||||
|
||||
func makeConfiguration(peers []string) raft.Configuration {
|
||||
servers := make([]raft.Server, len(peers))
|
||||
for i, peer := range peers {
|
||||
servers[i] = raft.Server{
|
||||
ID: raft.ServerID(peer),
|
||||
Address: raft.ServerAddress(peer),
|
||||
}
|
||||
}
|
||||
return raft.Configuration{
|
||||
Servers: servers,
|
||||
}
|
||||
}
|
||||
|
||||
func makeStores(configuration conf.ClusterConfiguration) (raft.LogStore, raft.StableStore, raft.SnapshotStore, error) {
|
||||
if configuration.InMemory {
|
||||
dbStore := raft.NewInmemStore()
|
||||
snapStore := raft.NewInmemSnapshotStore()
|
||||
return dbStore, dbStore, snapStore, nil
|
||||
} else {
|
||||
dbStore, err := raftboltdb.NewBoltStore(filepath.Join(configuration.DataDir, dbFile))
|
||||
if err != nil {
|
||||
return nil, nil, nil, errors.WithMessage(err, "create db")
|
||||
}
|
||||
|
||||
snapStore, err := raft.NewFileSnapshotStore(configuration.DataDir, 1, os.Stdout)
|
||||
if err != nil {
|
||||
return nil, nil, nil, errors.WithMessage(err, "create snapshot store")
|
||||
}
|
||||
|
||||
return dbStore, dbStore, snapStore, nil
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package raft
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/raft"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
type StreamLayer struct {
|
||||
net.Listener
|
||||
}
|
||||
|
||||
func (r *StreamLayer) Dial(address raft.ServerAddress, timeout time.Duration) (net.Conn, error) {
|
||||
return net.DialTimeout("tcp", string(address), timeout)
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/Masterminds/squirrel"
|
||||
"github.com/pkg/errors"
|
||||
"isp-config-service/entity"
|
||||
"isp-config-service/middlewares/sql_metrics"
|
||||
"isp-config-service/service/rqlite/db"
|
||||
)
|
||||
|
||||
type Backend struct {
|
||||
db db.DB
|
||||
}
|
||||
|
||||
func NewBackend(db db.DB) Backend {
|
||||
return Backend{
|
||||
db: db,
|
||||
}
|
||||
}
|
||||
|
||||
func (r Backend) Insert(ctx context.Context, backend entity.Backend) error {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Backend.Insert")
|
||||
|
||||
query, args, err := squirrel.Insert(Table("backend")).
|
||||
Columns("ws_connection_id", "module_id", "address",
|
||||
"version", "lib_version", "module_name", "config_service_node_id",
|
||||
"endpoints", "required_modules", "metrics_autodiscovery").
|
||||
Values(backend.WsConnectionId, backend.ModuleId, backend.Address,
|
||||
backend.Version, backend.LibVersion, backend.ModuleName, backend.ConfigServiceNodeId,
|
||||
backend.Endpoints, backend.RequiredModules, backend.MetricsAutodiscovery,
|
||||
).
|
||||
ToSql()
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
_, err = r.db.Exec(ctx, query, args...)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r Backend) DeleteByWsConnectionIds(ctx context.Context, wsConnectionIds []string) error {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Backend.DeleteByWsConnectionIds")
|
||||
|
||||
query, args, err := squirrel.Delete(Table("backend")).
|
||||
Where(squirrel.Eq{
|
||||
"ws_connection_id": wsConnectionIds,
|
||||
}).ToSql()
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
_, err = r.db.Exec(ctx, query, args...)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r Backend) DeleteByConfigServiceNodeId(ctx context.Context, configServiceNodeId string) (int, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Backend.DeleteByConfigServiceNodeId")
|
||||
|
||||
query, args, err := squirrel.Delete(Table("backend")).
|
||||
Where(squirrel.Eq{
|
||||
"config_service_node_id": configServiceNodeId,
|
||||
}).ToSql()
|
||||
if err != nil {
|
||||
return 0, errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
result, err := r.db.Exec(ctx, query, args...)
|
||||
if err != nil {
|
||||
return 0, errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
|
||||
deleted, err := result.RowsAffected()
|
||||
if err != nil {
|
||||
return 0, errors.WithMessage(err, "rows affected")
|
||||
}
|
||||
|
||||
return int(deleted), nil
|
||||
}
|
||||
|
||||
func (r Backend) GetByConfigServiceNodeId(ctx context.Context, configServiceNodeId string) ([]entity.Backend, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Backend.GetByConfigServiceNodeId")
|
||||
|
||||
query, args, err := squirrel.Select("*").
|
||||
From(Table("backend")).
|
||||
Where(squirrel.Eq{
|
||||
"config_service_node_id": configServiceNodeId,
|
||||
}).OrderBy("created_at desc").
|
||||
ToSql()
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
result := make([]entity.Backend, 0)
|
||||
err = r.db.Select(ctx, &result, query, args...)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "select: %s", query)
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (r Backend) All(ctx context.Context) ([]entity.Backend, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Backend.All")
|
||||
|
||||
result := make([]entity.Backend, 0)
|
||||
query := fmt.Sprintf("SELECT * FROM %s order by created_at desc", Table("backend"))
|
||||
err := r.db.Select(ctx, &result, query)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "select: %s", query)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (r Backend) GetByModuleId(ctx context.Context, moduleId string) ([]entity.Backend, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Backend.GetByModuleId")
|
||||
|
||||
query, args, err := squirrel.Select("*").
|
||||
From(Table("backend")).
|
||||
Where(squirrel.Eq{
|
||||
"module_id": moduleId,
|
||||
}).OrderBy("created_at desc").
|
||||
ToSql()
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
result := make([]entity.Backend, 0)
|
||||
err = r.db.Select(ctx, &result, query, args...)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "select: %s", query)
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (r Backend) AllMetricsAutodiscovery(ctx context.Context) ([]entity.MetricsAdWrapper, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Backend.AllMetricsAutodiscovery")
|
||||
|
||||
result := make([]entity.MetricsAdWrapper, 0)
|
||||
query := fmt.Sprintf(`
|
||||
SELECT metrics_autodiscovery FROM %s
|
||||
WHERE metrics_autodiscovery IS NOT NULL
|
||||
ORDER BY module_name, created_at DESC`,
|
||||
Table("backend"),
|
||||
)
|
||||
err := r.db.Select(ctx, &result, query)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "select %s", query)
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -1,227 +0,0 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/Masterminds/squirrel"
|
||||
"github.com/pkg/errors"
|
||||
"isp-config-service/domain"
|
||||
"isp-config-service/entity"
|
||||
"isp-config-service/entity/xtypes"
|
||||
"isp-config-service/middlewares/sql_metrics"
|
||||
"isp-config-service/service/rqlite/db"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
db db.DB
|
||||
}
|
||||
|
||||
func NewConfig(db db.DB) Config {
|
||||
return Config{
|
||||
db: db,
|
||||
}
|
||||
}
|
||||
|
||||
func (r Config) Insert(ctx context.Context, cfg entity.Config) error {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Config.Insert")
|
||||
|
||||
query, args, err := squirrel.Insert(Table("config")).
|
||||
Columns("id", "name", "module_id", "data", "version", "active", "admin_id").
|
||||
Values(cfg.Id, cfg.Name, cfg.ModuleId, cfg.Data, cfg.Version, cfg.Active, cfg.AdminId).
|
||||
Suffix("on conflict (id) do nothing").
|
||||
ToSql()
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
_, err = r.db.Exec(ctx, query, args...)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r Config) GetActive(ctx context.Context, moduleId string) (*entity.Config, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Config.GetActive")
|
||||
|
||||
query, args, err := squirrel.Select("*").
|
||||
From(Table("config")).
|
||||
Where(squirrel.Eq{
|
||||
"module_id": moduleId,
|
||||
"active": xtypes.Bool(true),
|
||||
}).OrderBy("version DESC").
|
||||
Limit(1).
|
||||
ToSql()
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
return selectRow[entity.Config](ctx, r.db, query, args...)
|
||||
}
|
||||
|
||||
func (r Config) GetByModuleId(ctx context.Context, moduleId string) ([]entity.Config, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Config.GetByModuleId")
|
||||
|
||||
query, args, err := squirrel.Select("*").
|
||||
From(Table("config")).
|
||||
Where(squirrel.Eq{
|
||||
"module_id": moduleId,
|
||||
}).OrderBy("created_at desc").
|
||||
ToSql()
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
result := make([]entity.Config, 0)
|
||||
err = r.db.Select(ctx, &result, query, args...)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "select: %s", query)
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (r Config) GetById(ctx context.Context, id string) (*entity.Config, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Config.GetById")
|
||||
|
||||
query, args, err := squirrel.Select("*").
|
||||
From(Table("config")).
|
||||
Where(squirrel.Eq{
|
||||
"id": id,
|
||||
}).ToSql()
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
return selectRow[entity.Config](ctx, r.db, query, args...)
|
||||
}
|
||||
|
||||
func (r Config) DeleteNonActiveById(ctx context.Context, id string) (bool, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Config.DeleteNonActiveById")
|
||||
|
||||
query, args, err := squirrel.Delete(Table("config")).
|
||||
Where(squirrel.Eq{
|
||||
"id": id,
|
||||
"active": xtypes.Bool(false),
|
||||
}).ToSql()
|
||||
if err != nil {
|
||||
return false, errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
result, err := r.db.Exec(ctx, query, args...)
|
||||
if err != nil {
|
||||
return false, errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
|
||||
affected, err := result.RowsAffected()
|
||||
if err != nil {
|
||||
return false, errors.WithMessage(err, "get rows affected")
|
||||
}
|
||||
return affected > 0, nil
|
||||
}
|
||||
|
||||
func (r Config) UpdateByVersion(ctx context.Context, cfg entity.Config) (bool, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Config.UpdateByVersion")
|
||||
|
||||
query, args, err := squirrel.Update(Table("config")).
|
||||
SetMap(map[string]any{
|
||||
"name": cfg.Name,
|
||||
"data": cfg.Data,
|
||||
"version": squirrel.Expr("version + 1"),
|
||||
"updated_at": squirrel.Expr("unixepoch()"),
|
||||
"admin_id": cfg.AdminId,
|
||||
}).Where(squirrel.Eq{
|
||||
"id": cfg.Id,
|
||||
"version": cfg.Version,
|
||||
}).ToSql()
|
||||
if err != nil {
|
||||
return false, errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
result, err := r.db.Exec(ctx, query, args...)
|
||||
if err != nil {
|
||||
return false, errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
|
||||
affected, err := result.RowsAffected()
|
||||
if err != nil {
|
||||
return false, errors.WithMessage(err, "get rows affected")
|
||||
}
|
||||
return affected > 0, nil
|
||||
}
|
||||
|
||||
func (r Config) SetActive(ctx context.Context, configId string, active xtypes.Bool) error {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Config.SetActive")
|
||||
|
||||
query, args, err := squirrel.Update(Table("config")).
|
||||
Set("active", active).
|
||||
Set("updated_at", squirrel.Expr("unixepoch()")).
|
||||
Where(squirrel.Eq{
|
||||
"id": configId,
|
||||
}).ToSql()
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
_, err = r.db.Exec(ctx, query, args...)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r Config) GetMetaByVariables(ctx context.Context, variables []string) (map[string][]entity.ConfigMetaWithVariable, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Config.GetMetaByVariables")
|
||||
|
||||
query, args, err := squirrel.Select("c.id", "c.name", "c.module_id", "c.active", "l.variable_name").
|
||||
From(Table("config c")).
|
||||
Join(fmt.Sprintf("%s l on c.id = l.config_id", Table("config_has_variable"))).
|
||||
Where(squirrel.Eq{
|
||||
"l.variable_name": variables,
|
||||
}).ToSql()
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
list := make([]entity.ConfigMetaWithVariable, 0)
|
||||
err = r.db.Select(ctx, &list, query, args...)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "select: %s", query)
|
||||
}
|
||||
|
||||
result := make(map[string][]entity.ConfigMetaWithVariable)
|
||||
for _, variable := range list {
|
||||
result[variable.VariableName] = append(result[variable.VariableName], variable)
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (r Config) UpdateConfigName(ctx context.Context, req domain.UpdateConfigNameRequest) (bool, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Config.UpdateConfigName")
|
||||
|
||||
query, args, err := squirrel.Update(Table("config")).
|
||||
Set("name", req.NewConfigName).
|
||||
Where(squirrel.Eq{
|
||||
"id": req.Id,
|
||||
}).
|
||||
ToSql()
|
||||
if err != nil {
|
||||
return false, errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
result, err := r.db.Exec(ctx, query, args...)
|
||||
if err != nil {
|
||||
return false, errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
|
||||
affected, err := result.RowsAffected()
|
||||
if err != nil {
|
||||
return false, errors.WithMessage(err, "get rows affected")
|
||||
}
|
||||
|
||||
return affected > 0, nil
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/Masterminds/squirrel"
|
||||
"github.com/pkg/errors"
|
||||
"isp-config-service/entity"
|
||||
"isp-config-service/middlewares/sql_metrics"
|
||||
"isp-config-service/service/rqlite/db"
|
||||
)
|
||||
|
||||
type ConfigHistory struct {
|
||||
db db.DB
|
||||
}
|
||||
|
||||
func NewConfigHistory(db db.DB) ConfigHistory {
|
||||
return ConfigHistory{
|
||||
db: db,
|
||||
}
|
||||
}
|
||||
|
||||
func (r ConfigHistory) GetByConfigId(ctx context.Context, configId string) ([]entity.ConfigHistory, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "ConfigHistory.GetByConfigId")
|
||||
|
||||
query := fmt.Sprintf(`select * from %s where config_id = ? order by version desc`, Table("config_history"))
|
||||
result := make([]entity.ConfigHistory, 0)
|
||||
err := r.db.Select(ctx, &result, query, configId)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "select: %s", query)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (r ConfigHistory) Delete(ctx context.Context, id string) error {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "ConfigHistory.Delete")
|
||||
|
||||
query := fmt.Sprintf(`delete from %s where id = ?`, Table("config_history"))
|
||||
_, err := r.db.Exec(ctx, query, id)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r ConfigHistory) InsertV2(ctx context.Context, history entity.ConfigHistory) error {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "ConfigHistory.InsertV2")
|
||||
|
||||
query, args, err := squirrel.Insert(Table("config_history")).
|
||||
Columns("id", "config_id", "data", "version", "admin_id").
|
||||
Values(history.Id, history.ConfigId, history.Data, history.Version, history.AdminId).
|
||||
ToSql()
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
_, err = r.db.Exec(ctx, query, args...)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r ConfigHistory) Insert(ctx context.Context, history entity.ConfigHistory) error {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "ConfigHistory.Insert")
|
||||
|
||||
query, args, err := squirrel.Insert(Table("config_history")).
|
||||
Columns("id", "config_id", "data", "version", "admin_id", "created_at").
|
||||
Values(history.Id, history.ConfigId, history.Data, history.Version, history.AdminId, history.CreatedAt).
|
||||
ToSql()
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
_, err = r.db.Exec(ctx, query, args...)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r ConfigHistory) DeleteOld(ctx context.Context, configId string, keepVersions int) (int, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "ConfigHistory.DeleteOld")
|
||||
|
||||
query := fmt.Sprintf(`delete from %s where config_id = ? and id not in (
|
||||
select id from %s where config_id = ? order by version desc limit ?
|
||||
)`, Table("config_history"), Table("config_history"))
|
||||
result, err := r.db.Exec(ctx, query, configId, configId, keepVersions)
|
||||
if err != nil {
|
||||
return 0, errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
|
||||
rowsAffected, err := result.RowsAffected()
|
||||
if err != nil {
|
||||
return 0, errors.WithMessage(err, "get rows affected")
|
||||
}
|
||||
|
||||
return int(rowsAffected), nil
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
|
||||
"github.com/Masterminds/squirrel"
|
||||
"github.com/pkg/errors"
|
||||
"isp-config-service/entity"
|
||||
"isp-config-service/middlewares/sql_metrics"
|
||||
"isp-config-service/service/rqlite/db"
|
||||
)
|
||||
|
||||
type ConfigSchema struct {
|
||||
db db.DB
|
||||
}
|
||||
|
||||
func NewConfigSchema(db db.DB) ConfigSchema {
|
||||
return ConfigSchema{
|
||||
db: db,
|
||||
}
|
||||
}
|
||||
|
||||
func (r ConfigSchema) Upsert(ctx context.Context, schema entity.ConfigSchema) error {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "ConfigSchema.Upsert")
|
||||
|
||||
query, args, err := squirrel.Insert(Table("config_schema")).
|
||||
Columns("id", "module_id", "data", "module_version").
|
||||
Values(schema.Id, schema.ModuleId, schema.Data, schema.ModuleVersion).
|
||||
Suffix(`on conflict (module_id) do update
|
||||
set data = excluded.data, module_version = excluded.module_version, updated_at = unixepoch()`).
|
||||
ToSql()
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
_, err = r.db.Exec(ctx, query, args...)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r ConfigSchema) All(ctx context.Context) ([]entity.ConfigSchema, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "ConfigSchema.All")
|
||||
|
||||
result := make([]entity.ConfigSchema, 0)
|
||||
query := fmt.Sprintf("select * from %s order by created_at", Table("config_schema"))
|
||||
err := r.db.Select(ctx, &result, query)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "select: %s", query)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (r ConfigSchema) GetByModuleId(ctx context.Context, moduleId string) (*entity.ConfigSchema, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "ConfigSchema.GetByModuleId")
|
||||
|
||||
query, args, err := squirrel.Select("*").
|
||||
From(Table("config_schema")).
|
||||
Where(squirrel.Eq{"module_id": moduleId}).
|
||||
ToSql()
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
return selectRow[entity.ConfigSchema](ctx, r.db, query, args...)
|
||||
}
|
||||
|
||||
func (r ConfigSchema) UpdateByModuleId(ctx context.Context, moduleId string, data []byte) error {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "ConfigSchema.UpdateByModuleId")
|
||||
query, args, err := squirrel.Update(Table("config_schema")).
|
||||
Set("data", data).
|
||||
Set("updated_at", squirrel.Expr("unixepoch()")).
|
||||
Where(squirrel.Eq{"module_id": moduleId}).
|
||||
ToSql()
|
||||
if err != nil {
|
||||
return errors.WithMessage(err, "build query")
|
||||
}
|
||||
|
||||
_, err = r.db.Exec(ctx, query, args...)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//nolint:nilnil
|
||||
func selectRow[T any](ctx context.Context, db db.DB, query string, args ...interface{}) (*T, error) {
|
||||
var result T
|
||||
err := db.SelectRow(ctx, &result, query, args...)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return nil, nil
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "select row: %s", query)
|
||||
}
|
||||
return &result, nil
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"isp-config-service/entity"
|
||||
"isp-config-service/entity/xtypes"
|
||||
"isp-config-service/middlewares/sql_metrics"
|
||||
"isp-config-service/service/rqlite/db"
|
||||
)
|
||||
|
||||
type Event struct {
|
||||
db db.DB
|
||||
}
|
||||
|
||||
func NewEvent(db db.DB) Event {
|
||||
return Event{
|
||||
db: db,
|
||||
}
|
||||
}
|
||||
|
||||
func (r Event) Insert(ctx context.Context, event entity.Event) error {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Event.Insert")
|
||||
|
||||
query := fmt.Sprintf("insert into %s (payload) values (?)", Table("event"))
|
||||
_, err := r.db.Exec(ctx, query, event.Payload)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r Event) Get(ctx context.Context, lastEventId int, limit int) ([]entity.Event, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Event.Get")
|
||||
|
||||
query := fmt.Sprintf("select * from %s where id > ? order by id limit ?", Table("event"))
|
||||
result := make([]entity.Event, 0)
|
||||
err := r.db.Select(ctx, &result, query, lastEventId, limit)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessagef(err, "select: %s", query)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (r Event) DeleteByCreatedAt(ctx context.Context, before xtypes.Time) (int, error) {
|
||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Event.DeleteByCreatedAt")
|
||||
|
||||
query := fmt.Sprintf("delete from %s where created_at < ?", Table("event"))
|
||||
result, err := r.db.Exec(ctx, query, before)
|
||||
if err != nil {
|
||||
return 0, errors.WithMessagef(err, "exec: %s", query)
|
||||
}
|
||||
|
||||
affected, err := result.RowsAffected()
|
||||
if err != nil {
|
||||
return 0, errors.WithMessage(err, "get affected rows")
|
||||
}
|
||||
|
||||
return int(affected), nil
|
||||
}
|
||||
Loaded 100 of 164 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user