diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml deleted file mode 100644 index 1cc293dc..00000000 --- a/.gitea/workflows/lint.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: lint -on: - pull_request: - branches: - - master - - v3 -jobs: - lint: - name: lint - runs-on: ubuntu-latest - steps: - - name: setup-go - uses: actions/setup-go@v3 - with: - go-version: 1.21 - - name: checkout - uses: actions/checkout@v3 - - name: deps - run: go get -v -d ./... - - name: lint - uses: https://github.com/golangci/golangci-lint-action@v3.4.0 - continue-on-error: true - with: - version: v1.52 diff --git a/.gitea/workflows/pipeline.yml b/.gitea/workflows/pipeline.yml new file mode 100644 index 00000000..31f97f3b --- /dev/null +++ b/.gitea/workflows/pipeline.yml @@ -0,0 +1,40 @@ +name: pipeline +on: + pull_request: + branches: + - master + - v3 + - v4 +jobs: + lint: + name: lint + runs-on: ubuntu-latest + steps: + - name: setup-go + uses: actions/setup-go@v5 + with: + go-version: 'stable' + - name: checkout + uses: actions/checkout@v3 + - name: deps + run: go get -v -d ./... + - name: lint + uses: https://github.com/golangci/golangci-lint-action@v6 + with: + version: v1.62.2 + test: + name: test + runs-on: ubuntu-latest + steps: + - name: setup-go + uses: actions/setup-go@v5 + with: + go-version: 'stable' + - name: checkout + uses: actions/checkout@v3 + - name: deps + run: go get -v -d ./... + - name: test + env: + INTEGRATION_TESTS: yes + run: go test -mod readonly -v ./... diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml deleted file mode 100644 index b3e67b06..00000000 --- a/.gitea/workflows/pr.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: pr -on: - pull_request: - branches: - - master - - v3 -jobs: - test: - name: test - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v3 - - name: setup-go - uses: actions/setup-go@v3 - with: - go-version: 1.21 - - name: deps - run: go get -v -t -d ./... - - name: test - env: - INTEGRATION_TESTS: yes - run: go test -mod readonly -v ./... diff --git a/.golangci.yml b/.golangci.yml index 524fc7f8..2bb1c300 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,44 +1,5 @@ run: - concurrency: 4 + concurrency: 8 deadline: 5m issues-exit-code: 1 tests: true - -linters-settings: - govet: - check-shadowing: true - enable: - - fieldalignment - -linters: - enable: - - govet - - deadcode - - errcheck - - govet - - ineffassign - - staticcheck - - structcheck - - typecheck - - unused - - varcheck - - bodyclose - - gci - - goconst - - gocritic - - gosimple - - gofmt - - gofumpt - - goimports - - revive - - gosec - - makezero - - misspell - - nakedret - - nestif - - nilerr - - noctx - - prealloc - - unconvert - - unparam - disable-all: false diff --git a/store/store.go b/store/store.go index c5b8ac3e..74f28f32 100644 --- a/store/store.go +++ b/store/store.go @@ -7,6 +7,14 @@ import ( "time" ) +type EventType int + +const ( + EventTypeUnknown = iota + EventTypeConnect + EventTypeDisconnect +) + var ( ErrWatcherStopped = errors.New("watcher stopped") // ErrNotConnected is returned when a store is not connected @@ -21,6 +29,11 @@ var ( DefaultSeparator = "/" ) +type Event interface { + Error() error + Type() EventType +} + // Store is a data storage interface type Store interface { // Name returns store name @@ -105,3 +118,14 @@ func NewWatchOptions(opts ...WatchOption) (WatchOptions, error) { return options, err } + +type Watcher interface { + // Next is a blocking call + Next() (Event, error) + // Stop stops the watcher + Stop() +} + +func Watch(context.Context) (Watcher, error) { + return nil, nil +}