Skip to content

Commit

Permalink
Merge branch 'main' into compilation_directive
Browse files Browse the repository at this point in the history
  • Loading branch information
seeflood authored Sep 27, 2022
2 parents 8ff1182 + 559d2c8 commit b249fa5
Show file tree
Hide file tree
Showing 103 changed files with 166 additions and 164 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion cmd/layotto_multiple_api/helloworld/component/in_memory.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion components/configstores/apollo/change_listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func setupChangeListener() *changeListener {
return newChangeListener(mockRepo)
}

//Test modified
// Test modified
func Test_changeListener_OnChange(t *testing.T) {
lis := setupChangeListener()
ch := make(chan *configstores.SubscribeResp)
Expand Down
4 changes: 2 additions & 2 deletions components/configstores/apollo/configstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func newHttpClient() httpClient {
}
}

//Init SetConfig the configuration store.
// Init SetConfig the configuration store.
func (c *ConfigStore) Init(config *configstores.StoreConfig) error {
err := c.doInit(config)
if err != nil {
Expand Down Expand Up @@ -602,7 +602,7 @@ func (c *ConfigStore) initTagsClient(tagCfg *repoConfig) error {
return c.tagsRepo.Connect()
}

//refer to https://www.apolloconfig.com/#/zh/usage/apollo-open-api-platform?id=_327-%e5%88%9b%e5%bb%banamespace
// refer to https://www.apolloconfig.com/#/zh/usage/apollo-open-api-platform?id=_327-%e5%88%9b%e5%bb%banamespace
func (c *ConfigStore) createNamespace(env string, appId string, cluster string, namespace string) error {
// 1. request
url := fmt.Sprintf(createNamespaceUrlTpl, c.openAPIAddress, appId)
Expand Down
2 changes: 1 addition & 1 deletion components/configstores/apollo/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func init() {
agollo.SetLogger(NewDefaultLogger(log.DefaultLogger))
}

//Implement Repository interface
// Implement Repository interface
type AgolloRepository struct {
client agollo.Client
cfg *repoConfig
Expand Down
3 changes: 1 addition & 2 deletions components/configstores/etcdv3/etcdv3.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -60,7 +59,7 @@ func NewStore() configstores.Store {
return &EtcdV3ConfigStore{subscribeKey: make(map[string]string), watchRespCh: make(chan *configstores.SubscribeResp)}
}

//Init init the configuration store.
// Init init the configuration store.
func (c *EtcdV3ConfigStore) Init(config *configstores.StoreConfig) error {
t, err := strconv.Atoi(config.TimeOut)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion components/configstores/etcdv3/etcdv3_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/custom/component.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/custom/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/custom/registry.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/lock/consul/consul_lock.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
5 changes: 2 additions & 3 deletions components/lock/consul/consul_lock_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -49,7 +48,7 @@ func TestConsulLock_Features(t *testing.T) {
assert.True(t, len(comp.Features()) == 0)
}

//A lock A unlock
// A lock A unlock
func TestConsulLock_TryLock(t *testing.T) {
//mock
ctrl := gomock.NewController(t)
Expand Down Expand Up @@ -94,7 +93,7 @@ func TestConsulLock_TryLock(t *testing.T) {

}

//A lock B lock
// A lock B lock
func TestConsulLock_ALock_BLock(t *testing.T) {

//mock
Expand Down
1 change: 0 additions & 1 deletion components/lock/etcd/etcd_lock.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/lock/etcd/etcd_lock_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/lock/lock_store.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/lock/mongo/mongo_lock.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/lock/mongo/mongo_lock_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
5 changes: 2 additions & 3 deletions components/lock/redis/cluster_redis_lock.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,8 +27,8 @@ import (
"mosn.io/layotto/components/pkg/utils"
)

//RedLock
//it will be best to use at least 5 hosts
// RedLock
// it will be best to use at least 5 hosts
type ClusterRedisLock struct {
clients []*redis.Client
metadata utils.RedisClusterMetadata
Expand Down
1 change: 0 additions & 1 deletion components/lock/redis/cluster_redis_lock_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/lock/redis/standalone_redis_lock.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/lock/redis/standalone_redis_lock_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/lock/types.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
6 changes: 3 additions & 3 deletions components/lock/zookeeper/zookeeper_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type ZookeeperLock struct {
logger log.ErrorLogger
}

//NewZookeeperLock Create ZookeeperLock
// NewZookeeperLock Create ZookeeperLock
func NewZookeeperLock(logger log.ErrorLogger) *ZookeeperLock {
lock := &ZookeeperLock{
logger: logger,
Expand Down Expand Up @@ -76,7 +76,7 @@ func (p *ZookeeperLock) Features() []lock.Feature {
return nil
}

//TryLock Node tries to acquire a zookeeper lock
// TryLock Node tries to acquire a zookeeper lock
func (p *ZookeeperLock) TryLock(req *lock.TryLockRequest) (*lock.TryLockResponse, error) {

conn, err := p.factory.NewConnection(time.Duration(req.Expire)*time.Second, p.metadata)
Expand Down Expand Up @@ -110,7 +110,7 @@ func (p *ZookeeperLock) TryLock(req *lock.TryLockRequest) (*lock.TryLockResponse

}

//Unlock Node tries to release a zookeeper lock
// Unlock Node tries to release a zookeeper lock
func (p *ZookeeperLock) Unlock(req *lock.UnlockRequest) (*lock.UnlockResponse, error) {

conn := p.unlockConn
Expand Down
4 changes: 2 additions & 2 deletions components/oss/aliyun/oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ func (a *AliyunOSS) SignURL(ctx context.Context, req *l8oss.SignURLInput) (*l8os
return &l8oss.SignURLOutput{SignedUrl: resp}, err
}

//UpdateDownloadBandwidthRateLimit update all client rate
// UpdateDownloadBandwidthRateLimit update all client rate
func (a *AliyunOSS) UpdateDownloadBandwidthRateLimit(ctx context.Context, req *l8oss.UpdateBandwidthRateLimitInput) error {
cli, err := a.getClient()
if err != nil {
Expand All @@ -570,7 +570,7 @@ func (a *AliyunOSS) UpdateDownloadBandwidthRateLimit(ctx context.Context, req *l
return err
}

//UpdateUploadBandwidthRateLimit update all client rate
// UpdateUploadBandwidthRateLimit update all client rate
func (a *AliyunOSS) UpdateUploadBandwidthRateLimit(ctx context.Context, req *l8oss.UpdateBandwidthRateLimitInput) error {
cli, err := a.getClient()
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion components/pkg/actuators/actutors_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/pkg/common/error.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/pkg/mock/custom_component_mock.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/pkg/mock/mongo_lock_mock.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/pkg/mock/mongo_sequencer_mock.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/pkg/utils/consul.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/pkg/utils/etcd.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/pkg/utils/mongo.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/pkg/utils/mysql.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/pkg/utils/oss.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/pkg/utils/redis.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/pkg/utils/zookeeper.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/pubsub/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
// 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 pubsub

const (
Expand Down
2 changes: 1 addition & 1 deletion components/ref/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package ref

//Config is ref json config
// Config is ref json config
type Config struct {
SecretRef []*Item `json:"secret_ref"`
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/sequencer/etcd/store.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/sequencer/etcd/store_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/sequencer/mongo/mongo_sequencer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/sequencer/mongo/mongo_sequencer_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/sequencer/mysql/mysql.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/sequencer/mysql/mysql_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
7 changes: 3 additions & 4 deletions components/sequencer/redis/standalone_redis_sequencer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,9 +42,9 @@ func NewStandaloneRedisSequencer(logger log.ErrorLogger) *StandaloneRedisSequenc
}

/*
1. exists and >= biggerThan, no operation required, return 0
2. not exists or < biggthan, reset val, return 1
3. lua script occur error, such as tonumer(string), return error
1. exists and >= biggerThan, no operation required, return 0
2. not exists or < biggthan, reset val, return 1
3. lua script occur error, such as tonumer(string), return error
*/
const initScript = `
if redis.call('exists', KEYS[1])==1 and tonumber(redis.call('get', KEYS[1])) >= tonumber(ARGV[1]) then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/sequencer/store.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/sequencer/zookeeper/zookeeper_sequencer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion components/sequencer/zookeeper/zookeeper_sequencer_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
3 changes: 1 addition & 2 deletions components/trace/export.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,7 +16,7 @@ import (
"sync"
)

//Exporter is used to export Span
// Exporter is used to export Span
type Exporter interface {
ExportSpan(s *Span)
}
Expand Down
1 change: 0 additions & 1 deletion components/trace/export_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright 2021 Layotto Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion components/trace/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (
generators sync.Map
)

//Generator is used to get or generate traceId/spanId/context
// Generator is used to get or generate traceId/spanId/context
type Generator interface {
GetTraceId(ctx context.Context) string
GetSpanId(ctx context.Context) string
Expand Down
Loading

0 comments on commit b249fa5

Please sign in to comment.