Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support local config file watcher of client and server #1

Merged
merged 34 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3b34e7c
feat: support local file config of client and server
ozline Oct 2, 2023
c47a4f1
del: .DS_Store
ozline Oct 2, 2023
9e01f04
add: license header
ozline Oct 2, 2023
242717a
fix: staticcheck error report
ozline Oct 2, 2023
f4cf3f2
fix: use NewRetryContainerWithPercentageLimit to create retry container
ozline Oct 2, 2023
8d9c92e
docs: correct sentence placement
ozline Oct 2, 2023
6ead95d
fix: use individual module in example folder
ozline Oct 2, 2023
a372a31
feat: merge ClientWatcher and ServerWatcher into ConfigWatcher
ozline Oct 3, 2023
68b6990
fix: update error judgment of utils.PathExists()
ozline Oct 3, 2023
6eba926
docs: update README.md
ozline Oct 4, 2023
b10abcb
chore: move example folder to kitex-contrib/example
ozline Oct 5, 2023
1dfea61
fix: set alias for client/server to avoid same package name
ozline Oct 5, 2023
6d2d202
fix: delete useless log
ozline Oct 5, 2023
0dc0263
fix: add recover for new goroutines to avoid crashing
ozline Oct 5, 2023
1567da3
add: comments for exported symbols
ozline Oct 5, 2023
a0d8016
del: monitor/key.go
ozline Oct 5, 2023
cb78481
feat: separating filewatch and configmonitor
ozline Oct 7, 2023
9cdb0d2
docs: update README.md
ozline Oct 7, 2023
86f2b44
fix: README.md usage import package error
ozline Oct 7, 2023
b1f980e
add: monitor test cases
ozline Oct 8, 2023
489a8f1
test: add entire progress test
ozline Oct 8, 2023
abbda21
fix: add mutex for start/stop file watching
ozline Oct 8, 2023
3cf499a
fix: staticcheck error report
ozline Oct 9, 2023
2f6a647
fix: multiple clients can listen to the same key without affecting ea…
ozline Oct 27, 2023
a8ce31c
delete: remove the gomock module and use self-made simple mock instead
ozline Nov 14, 2023
1d243fa
feat: upgrade required module version
ozline Nov 14, 2023
1fd11a1
fix: remove redundant golang versions in workflow tests
ozline Dec 9, 2023
823dd13
add: use example of this lib
ozline Dec 9, 2023
26d9d64
fix: README_CN.md spell error
ozline Dec 15, 2023
83c4867
chore: README add supported file types
ozline Dec 15, 2023
e8cbcb7
fix: panic when type assertion fails at runtime
ozline Dec 15, 2023
396f24a
chore: add log while callback is nil
ozline Dec 15, 2023
2ac0b70
fix: README.md lib name error
ozline Dec 15, 2023
8a66f15
chore: add licenses
li-jin-gou Dec 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add: license header
  • Loading branch information
ozline committed Oct 2, 2023
commit 9e01f041a86cddfc7d6807e95372aa88db284aca
14 changes: 14 additions & 0 deletions client/circuit_breaker.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package client

import (
Expand Down
14 changes: 14 additions & 0 deletions client/retry.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package client

import (
Expand Down
14 changes: 14 additions & 0 deletions client/rpc_timeout.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package client

import (
Expand Down
14 changes: 14 additions & 0 deletions client/suite.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package client

import (
Expand Down
14 changes: 14 additions & 0 deletions client/watch.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package client

import (
Expand Down Expand Up @@ -69,7 +83,7 @@
return
}

if resp == nil {

Check failure on line 86 in client/watch.go

View workflow job for this annotation

GitHub Actions / staticcheck

[staticcheck] reported by reviewdog 🐶 this nil check is never true Raw Output: {"source":{"name":"staticcheck","url":"https://staticcheck.io"},"message":"this nil check is never true","code":{"value":"SA4031","url":"https://staticcheck.io/docs/checks#SA4031"},"location":{"path":"/data00/runner/kitex-contrib-sg-runner-05/config-file/config-file/client/watch.go","range":{"start":{"line":86,"column":5}}},"severity":"ERROR"}
klog.Warnf("[local] the parsed data is nil, skip\n")
return
}
Expand Down
14 changes: 14 additions & 0 deletions example/client/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
Expand Down
14 changes: 14 additions & 0 deletions example/server/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
Expand Down
14 changes: 14 additions & 0 deletions parser/client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package parser

import (
Expand Down
14 changes: 14 additions & 0 deletions parser/parser.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package parser

import (
Expand Down
14 changes: 14 additions & 0 deletions parser/server.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package parser

import "github.com/cloudwego/kitex/pkg/limiter"
Expand Down
14 changes: 14 additions & 0 deletions server/limit.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package server

import (
Expand Down
14 changes: 14 additions & 0 deletions server/suite.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package server

import (
Expand Down
14 changes: 14 additions & 0 deletions server/watch.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package server

import (
Expand Down Expand Up @@ -60,7 +74,7 @@
return
}

if resp == nil {

Check failure on line 77 in server/watch.go

View workflow job for this annotation

GitHub Actions / staticcheck

[staticcheck] reported by reviewdog 🐶 this nil check is never true Raw Output: {"source":{"name":"staticcheck","url":"https://staticcheck.io"},"message":"this nil check is never true","code":{"value":"SA4031","url":"https://staticcheck.io/docs/checks#SA4031"},"location":{"path":"/data00/runner/kitex-contrib-sg-runner-05/config-file/config-file/server/watch.go","range":{"start":{"line":77,"column":5}}},"severity":"ERROR"}
klog.Warnf("[local] the parsed data is nil, skip\n")
return
}
Expand Down
14 changes: 14 additions & 0 deletions utils/filewatcher.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package utils

import (
Expand Down
14 changes: 14 additions & 0 deletions utils/set.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package utils

import "sync"
Expand Down
14 changes: 14 additions & 0 deletions utils/utils.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 CloudWeGo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package utils

import (
Expand Down
Loading