Skip to content

Commit

Permalink
feat: BBR限流实现
Browse files Browse the repository at this point in the history
  • Loading branch information
WTIFS committed Oct 30, 2023
1 parent 5528d2f commit 6af0d02
Show file tree
Hide file tree
Showing 80 changed files with 5,534 additions and 332 deletions.
6 changes: 6 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ type ConfigAPI interface {
api.SDKOwner
// GetConfigFile obtaining the configuration file
GetConfigFile(namespace, fileGroup, fileName string) (ConfigFile, error)
// CreateConfigFile create configuration file
CreateConfigFile(namespace, fileGroup, fileName, content string) error
// UpdateConfigFile update configuration file
UpdateConfigFile(namespace, fileGroup, fileName, content string) error
// PublishConfigFile publish configuration file
PublishConfigFile(namespace, fileGroup, fileName string) error
}

// RouterAPI routing api methods
Expand Down
6 changes: 6 additions & 0 deletions api/config_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ type ConfigFileAPI interface {
SDKOwner
// GetConfigFile 获取配置文件
GetConfigFile(namespace, fileGroup, fileName string) (model.ConfigFile, error)
// CreateConfigFile 创建配置文件
CreateConfigFile(namespace, fileGroup, fileName, content string) error
// UpdateConfigFile 更新配置文件
UpdateConfigFile(namespace, fileGroup, fileName, content string) error
// PublishConfigFile 发布配置文件
PublishConfigFile(namespace, fileGroup, fileName string) error
}

var (
Expand Down
15 changes: 15 additions & 0 deletions api/config_file_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ func (c *configFileAPI) GetConfigFile(namespace, fileGroup, fileName string) (mo
return c.context.GetEngine().SyncGetConfigFile(namespace, fileGroup, fileName)
}

// CreateConfigFile 创建配置文件
func (c *configFileAPI) CreateConfigFile(namespace, fileGroup, fileName, content string) error {
return c.context.GetEngine().SyncCreateConfigFile(namespace, fileGroup, fileName, content)
}

// UpdateConfigFile 更新配置文件
func (c *configFileAPI) UpdateConfigFile(namespace, fileGroup, fileName, content string) error {
return c.context.GetEngine().SyncUpdateConfigFile(namespace, fileGroup, fileName, content)
}

// PublishConfigFile 发布配置文件
func (c *configFileAPI) PublishConfigFile(namespace, fileGroup, fileName string) error {
return c.context.GetEngine().SyncPublishConfigFile(namespace, fileGroup, fileName)
}

// SDKContext 获取SDK上下文
func (c *configFileAPI) SDKContext() SDKContext {
return c.context
Expand Down
15 changes: 15 additions & 0 deletions api_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ func (c *configAPI) GetConfigFile(namespace, fileGroup, fileName string) (Config
return c.rawAPI.GetConfigFile(namespace, fileGroup, fileName)
}

// CreateConfigFile 创建配置文件
func (c *configAPI) CreateConfigFile(namespace, fileGroup, fileName, content string) error {
return c.rawAPI.CreateConfigFile(namespace, fileGroup, fileName, content)
}

// UpdateConfigFile 更新配置文件
func (c *configAPI) UpdateConfigFile(namespace, fileGroup, fileName, content string) error {
return c.rawAPI.UpdateConfigFile(namespace, fileGroup, fileName, content)
}

// PublishConfigFile 发布配置文件
func (c *configAPI) PublishConfigFile(namespace, fileGroup, fileName string) error {
return c.rawAPI.PublishConfigFile(namespace, fileGroup, fileName)
}

// SDKContext 获取SDK上下文
func (c *configAPI) SDKContext() api.SDKContext {
return c.rawAPI.SDKContext()
Expand Down
38 changes: 38 additions & 0 deletions examples/configuration/crud/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module github.com/polarismesh/polaris-go-configuration

go 1.20

require github.com/polarismesh/polaris-go v1.5.4-incompatible

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/dlclark/regexp2 v1.7.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/polarismesh/specification v1.4.0 // indirect
github.com/prometheus/client_golang v1.12.2 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/net v0.2.0 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/text v0.4.0 // indirect
google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a // indirect
google.golang.org/grpc v1.51.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

replace github.com/polarismesh/polaris-go => ../../../
Loading

0 comments on commit 6af0d02

Please sign in to comment.