diff --git a/cmd/layotto_multiple_api/helloworld/component/helloworld.go b/cmd/layotto_multiple_api/helloworld/component/helloworld.go index fef68dcce8..fe0e5ec0e2 100644 --- a/cmd/layotto_multiple_api/helloworld/component/helloworld.go +++ b/cmd/layotto_multiple_api/helloworld/component/helloworld.go @@ -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. diff --git a/cmd/layotto_multiple_api/helloworld/component/in_memory.go b/cmd/layotto_multiple_api/helloworld/component/in_memory.go index 46b0344b5d..8eecb56036 100644 --- a/cmd/layotto_multiple_api/helloworld/component/in_memory.go +++ b/cmd/layotto_multiple_api/helloworld/component/in_memory.go @@ -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. diff --git a/cmd/layotto_multiple_api/helloworld/component/say_goodbye.go b/cmd/layotto_multiple_api/helloworld/component/say_goodbye.go index d053bcd71b..9d9234c282 100644 --- a/cmd/layotto_multiple_api/helloworld/component/say_goodbye.go +++ b/cmd/layotto_multiple_api/helloworld/component/say_goodbye.go @@ -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. diff --git a/components/configstores/apollo/change_listener_test.go b/components/configstores/apollo/change_listener_test.go index e73cb8b7a5..58b40a8143 100644 --- a/components/configstores/apollo/change_listener_test.go +++ b/components/configstores/apollo/change_listener_test.go @@ -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) diff --git a/components/configstores/apollo/configstore.go b/components/configstores/apollo/configstore.go index 2f1c5f11da..263fda0c2c 100644 --- a/components/configstores/apollo/configstore.go +++ b/components/configstores/apollo/configstore.go @@ -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 { @@ -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) diff --git a/components/configstores/apollo/repository.go b/components/configstores/apollo/repository.go index ddd55f2aa3..e479d5b5e8 100644 --- a/components/configstores/apollo/repository.go +++ b/components/configstores/apollo/repository.go @@ -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 diff --git a/components/configstores/etcdv3/etcdv3.go b/components/configstores/etcdv3/etcdv3.go index 38a140facd..f5e53ae659 100644 --- a/components/configstores/etcdv3/etcdv3.go +++ b/components/configstores/etcdv3/etcdv3.go @@ -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. @@ -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 { diff --git a/components/configstores/etcdv3/etcdv3_test.go b/components/configstores/etcdv3/etcdv3_test.go index ee2d4bf9e5..1b7703d0bc 100644 --- a/components/configstores/etcdv3/etcdv3_test.go +++ b/components/configstores/etcdv3/etcdv3_test.go @@ -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. diff --git a/components/custom/component.go b/components/custom/component.go index 2b76f67ec1..b679e6be3c 100644 --- a/components/custom/component.go +++ b/components/custom/component.go @@ -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. diff --git a/components/custom/config.go b/components/custom/config.go index 82a794875f..304bd8be1d 100644 --- a/components/custom/config.go +++ b/components/custom/config.go @@ -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. diff --git a/components/custom/registry.go b/components/custom/registry.go index 06e282a3a5..802cd38e24 100644 --- a/components/custom/registry.go +++ b/components/custom/registry.go @@ -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. diff --git a/components/lock/consul/consul_lock.go b/components/lock/consul/consul_lock.go index a88e44403a..0a6c358f67 100644 --- a/components/lock/consul/consul_lock.go +++ b/components/lock/consul/consul_lock.go @@ -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. diff --git a/components/lock/consul/consul_lock_test.go b/components/lock/consul/consul_lock_test.go index 84468deeec..bc929246e1 100644 --- a/components/lock/consul/consul_lock_test.go +++ b/components/lock/consul/consul_lock_test.go @@ -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. @@ -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) @@ -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 diff --git a/components/lock/etcd/etcd_lock.go b/components/lock/etcd/etcd_lock.go index 65e713111d..a11414c933 100644 --- a/components/lock/etcd/etcd_lock.go +++ b/components/lock/etcd/etcd_lock.go @@ -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. diff --git a/components/lock/etcd/etcd_lock_test.go b/components/lock/etcd/etcd_lock_test.go index 36faff1fca..facef6c58d 100644 --- a/components/lock/etcd/etcd_lock_test.go +++ b/components/lock/etcd/etcd_lock_test.go @@ -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. diff --git a/components/lock/lock_store.go b/components/lock/lock_store.go index 5a8c223c77..70608a761c 100644 --- a/components/lock/lock_store.go +++ b/components/lock/lock_store.go @@ -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. diff --git a/components/lock/mongo/mongo_lock.go b/components/lock/mongo/mongo_lock.go index ae0bfa44ce..1737f243f9 100644 --- a/components/lock/mongo/mongo_lock.go +++ b/components/lock/mongo/mongo_lock.go @@ -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. diff --git a/components/lock/mongo/mongo_lock_test.go b/components/lock/mongo/mongo_lock_test.go index d65b4a6aed..49e1749e56 100644 --- a/components/lock/mongo/mongo_lock_test.go +++ b/components/lock/mongo/mongo_lock_test.go @@ -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. diff --git a/components/lock/redis/cluster_redis_lock.go b/components/lock/redis/cluster_redis_lock.go index a9f9e62f91..879865ba1b 100644 --- a/components/lock/redis/cluster_redis_lock.go +++ b/components/lock/redis/cluster_redis_lock.go @@ -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. @@ -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 diff --git a/components/lock/redis/cluster_redis_lock_test.go b/components/lock/redis/cluster_redis_lock_test.go index 4b8fdd4110..acd5e3ce71 100644 --- a/components/lock/redis/cluster_redis_lock_test.go +++ b/components/lock/redis/cluster_redis_lock_test.go @@ -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. diff --git a/components/lock/redis/standalone_redis_lock.go b/components/lock/redis/standalone_redis_lock.go index 2da5287a25..5a1f1f2b61 100644 --- a/components/lock/redis/standalone_redis_lock.go +++ b/components/lock/redis/standalone_redis_lock.go @@ -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. diff --git a/components/lock/redis/standalone_redis_lock_test.go b/components/lock/redis/standalone_redis_lock_test.go index 4172d433bc..71e03c0252 100644 --- a/components/lock/redis/standalone_redis_lock_test.go +++ b/components/lock/redis/standalone_redis_lock_test.go @@ -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. diff --git a/components/lock/types.go b/components/lock/types.go index 517a991d57..4dfeb9aa3a 100644 --- a/components/lock/types.go +++ b/components/lock/types.go @@ -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. diff --git a/components/lock/zookeeper/zookeeper_lock.go b/components/lock/zookeeper/zookeeper_lock.go index 18c060f0fc..ff49188228 100644 --- a/components/lock/zookeeper/zookeeper_lock.go +++ b/components/lock/zookeeper/zookeeper_lock.go @@ -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, @@ -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) @@ -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 diff --git a/components/oss/aliyun/oss.go b/components/oss/aliyun/oss.go index 16022aa8d7..5cdf54de96 100644 --- a/components/oss/aliyun/oss.go +++ b/components/oss/aliyun/oss.go @@ -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 { @@ -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 { diff --git a/components/pkg/actuators/actutors_test.go b/components/pkg/actuators/actutors_test.go index 6f8bcd8942..f43c20cd37 100644 --- a/components/pkg/actuators/actutors_test.go +++ b/components/pkg/actuators/actutors_test.go @@ -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. diff --git a/components/pkg/common/error.go b/components/pkg/common/error.go index 7bd9a73b56..fd31cc433e 100644 --- a/components/pkg/common/error.go +++ b/components/pkg/common/error.go @@ -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. diff --git a/components/pkg/mock/custom_component_mock.go b/components/pkg/mock/custom_component_mock.go index 3096cc13e7..34c21846a1 100644 --- a/components/pkg/mock/custom_component_mock.go +++ b/components/pkg/mock/custom_component_mock.go @@ -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. diff --git a/components/pkg/mock/mongo_lock_mock.go b/components/pkg/mock/mongo_lock_mock.go index c9cdc81cab..089e5763bf 100644 --- a/components/pkg/mock/mongo_lock_mock.go +++ b/components/pkg/mock/mongo_lock_mock.go @@ -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. diff --git a/components/pkg/mock/mongo_sequencer_mock.go b/components/pkg/mock/mongo_sequencer_mock.go index cf8aeecea6..9a2d84b0d5 100644 --- a/components/pkg/mock/mongo_sequencer_mock.go +++ b/components/pkg/mock/mongo_sequencer_mock.go @@ -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. diff --git a/components/pkg/utils/consul.go b/components/pkg/utils/consul.go index 20e5fa55bb..d9787eef5a 100644 --- a/components/pkg/utils/consul.go +++ b/components/pkg/utils/consul.go @@ -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. diff --git a/components/pkg/utils/etcd.go b/components/pkg/utils/etcd.go index a16a359d3a..fd1fcb70e8 100644 --- a/components/pkg/utils/etcd.go +++ b/components/pkg/utils/etcd.go @@ -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. diff --git a/components/pkg/utils/mongo.go b/components/pkg/utils/mongo.go index ec7110f5ca..bef87bf114 100644 --- a/components/pkg/utils/mongo.go +++ b/components/pkg/utils/mongo.go @@ -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. diff --git a/components/pkg/utils/mysql.go b/components/pkg/utils/mysql.go index be4b0993e6..d814a016f8 100644 --- a/components/pkg/utils/mysql.go +++ b/components/pkg/utils/mysql.go @@ -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. diff --git a/components/pkg/utils/oss.go b/components/pkg/utils/oss.go index aa6959ba34..ecd789a333 100644 --- a/components/pkg/utils/oss.go +++ b/components/pkg/utils/oss.go @@ -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. diff --git a/components/pkg/utils/redis.go b/components/pkg/utils/redis.go index 687a2f3c35..55a3f5126f 100644 --- a/components/pkg/utils/redis.go +++ b/components/pkg/utils/redis.go @@ -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. diff --git a/components/pkg/utils/zookeeper.go b/components/pkg/utils/zookeeper.go index a6ce4e1d62..c484b07eff 100644 --- a/components/pkg/utils/zookeeper.go +++ b/components/pkg/utils/zookeeper.go @@ -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. diff --git a/components/pubsub/types.go b/components/pubsub/types.go index 5a3bdc3fc2..d6fa6f3798 100644 --- a/components/pubsub/types.go +++ b/components/pubsub/types.go @@ -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 ( diff --git a/components/ref/config.go b/components/ref/config.go index 6d7ab5842d..e6416e706e 100644 --- a/components/ref/config.go +++ b/components/ref/config.go @@ -16,7 +16,7 @@ package ref -//Config is ref json config +// Config is ref json config type Config struct { SecretRef []*Item `json:"secret_ref"` } diff --git a/components/rpc/invoker/mosn/transport_protocol/bolt_test.go b/components/rpc/invoker/mosn/transport_protocol/bolt_test.go index 1d1e906e2f..0d08edf555 100644 --- a/components/rpc/invoker/mosn/transport_protocol/bolt_test.go +++ b/components/rpc/invoker/mosn/transport_protocol/bolt_test.go @@ -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. diff --git a/components/sequencer/etcd/store.go b/components/sequencer/etcd/store.go index 1887b5174c..20a211873d 100644 --- a/components/sequencer/etcd/store.go +++ b/components/sequencer/etcd/store.go @@ -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. diff --git a/components/sequencer/etcd/store_test.go b/components/sequencer/etcd/store_test.go index f07a1ea06a..2ae4188da2 100644 --- a/components/sequencer/etcd/store_test.go +++ b/components/sequencer/etcd/store_test.go @@ -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. diff --git a/components/sequencer/mongo/mongo_sequencer.go b/components/sequencer/mongo/mongo_sequencer.go index 46e9aa6bb9..4932504795 100644 --- a/components/sequencer/mongo/mongo_sequencer.go +++ b/components/sequencer/mongo/mongo_sequencer.go @@ -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. diff --git a/components/sequencer/mongo/mongo_sequencer_test.go b/components/sequencer/mongo/mongo_sequencer_test.go index fa602f5b4f..49c60e5d5a 100644 --- a/components/sequencer/mongo/mongo_sequencer_test.go +++ b/components/sequencer/mongo/mongo_sequencer_test.go @@ -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. diff --git a/components/sequencer/mysql/mysql.go b/components/sequencer/mysql/mysql.go index fe2502ed91..255fe86f11 100644 --- a/components/sequencer/mysql/mysql.go +++ b/components/sequencer/mysql/mysql.go @@ -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. diff --git a/components/sequencer/mysql/mysql_test.go b/components/sequencer/mysql/mysql_test.go index 7c6df65b8b..a3c4996f45 100644 --- a/components/sequencer/mysql/mysql_test.go +++ b/components/sequencer/mysql/mysql_test.go @@ -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. diff --git a/components/sequencer/redis/standalone_redis_sequencer.go b/components/sequencer/redis/standalone_redis_sequencer.go index a8e25026ea..cff92f46be 100644 --- a/components/sequencer/redis/standalone_redis_sequencer.go +++ b/components/sequencer/redis/standalone_redis_sequencer.go @@ -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. @@ -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 diff --git a/components/sequencer/redis/standalone_redis_sequencer_test.go b/components/sequencer/redis/standalone_redis_sequencer_test.go index 365b6c4f9b..6ac44dec8c 100644 --- a/components/sequencer/redis/standalone_redis_sequencer_test.go +++ b/components/sequencer/redis/standalone_redis_sequencer_test.go @@ -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. diff --git a/components/sequencer/store.go b/components/sequencer/store.go index 5304b07887..9fd2657129 100644 --- a/components/sequencer/store.go +++ b/components/sequencer/store.go @@ -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. diff --git a/components/sequencer/zookeeper/zookeeper_sequencer.go b/components/sequencer/zookeeper/zookeeper_sequencer.go index 7f7959d717..ab27683509 100644 --- a/components/sequencer/zookeeper/zookeeper_sequencer.go +++ b/components/sequencer/zookeeper/zookeeper_sequencer.go @@ -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. diff --git a/components/sequencer/zookeeper/zookeeper_sequencer_test.go b/components/sequencer/zookeeper/zookeeper_sequencer_test.go index c44fa8c19c..fab6b71e3c 100644 --- a/components/sequencer/zookeeper/zookeeper_sequencer_test.go +++ b/components/sequencer/zookeeper/zookeeper_sequencer_test.go @@ -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. diff --git a/components/trace/export.go b/components/trace/export.go index eabf3e63eb..952f942df6 100644 --- a/components/trace/export.go +++ b/components/trace/export.go @@ -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. @@ -17,7 +16,7 @@ import ( "sync" ) -//Exporter is used to export Span +// Exporter is used to export Span type Exporter interface { ExportSpan(s *Span) } diff --git a/components/trace/export_test.go b/components/trace/export_test.go index 0d1a622078..ad7ec5473c 100644 --- a/components/trace/export_test.go +++ b/components/trace/export_test.go @@ -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. diff --git a/components/trace/generator.go b/components/trace/generator.go index 47a7179e2b..bd40152149 100644 --- a/components/trace/generator.go +++ b/components/trace/generator.go @@ -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 diff --git a/components/trace/generator_test.go b/components/trace/generator_test.go index 66353415b1..dbd06db842 100644 --- a/components/trace/generator_test.go +++ b/components/trace/generator_test.go @@ -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. diff --git a/components/trace/span.go b/components/trace/span.go index 47171cb7dc..8698b9e138 100644 --- a/components/trace/span.go +++ b/components/trace/span.go @@ -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. diff --git a/components/trace/types.go b/components/trace/types.go index 990849c3a9..cc8ff382e6 100644 --- a/components/trace/types.go +++ b/components/trace/types.go @@ -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. diff --git a/components/trace/utils.go b/components/trace/utils.go index 141745f1ef..c3bd56d83e 100644 --- a/components/trace/utils.go +++ b/components/trace/utils.go @@ -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. diff --git a/components/trace/utils_test.go b/components/trace/utils_test.go index 4c3b226f6f..35eaf2a2f1 100644 --- a/components/trace/utils_test.go +++ b/components/trace/utils_test.go @@ -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. diff --git a/demo/faas/code/golang/client/function.go b/demo/faas/code/golang/client/function.go index a4a5c26e3d..fa6a0163ee 100644 --- a/demo/faas/code/golang/client/function.go +++ b/demo/faas/code/golang/client/function.go @@ -104,6 +104,7 @@ func (ctx *httpHeaders) OnHttpStreamDone() { const ID = "id_1" // DO NOT MODIFY THE FOLLOWING FUNCTIONS! +// //export proxy_get_id func GetID() { _ = ID[len(ID)-1] diff --git a/demo/faas/code/golang/server/function.go b/demo/faas/code/golang/server/function.go index 5cbb031fe6..c417df51fc 100644 --- a/demo/faas/code/golang/server/function.go +++ b/demo/faas/code/golang/server/function.go @@ -84,6 +84,7 @@ func (ctx *httpHeaders) OnHttpStreamDone() { const ID = "id_2" // DO NOT MODIFY THE FOLLOWING FUNCTIONS! +// //export proxy_get_id func GetID() { _ = ID[len(ID)-1] diff --git a/diagnostics/exporter_iml/stdout.go b/diagnostics/exporter_iml/stdout.go index 7ef0b016e9..d2e810c4f7 100644 --- a/diagnostics/exporter_iml/stdout.go +++ b/diagnostics/exporter_iml/stdout.go @@ -13,7 +13,7 @@ func init() { trace.RegisterExporter("stdout", &StdoutExporter{}) } -//StdoutExporter is the implementation of Exporter, export span information to log +// StdoutExporter is the implementation of Exporter, export span information to log type StdoutExporter struct{} var _ trace.Exporter = &StdoutExporter{} diff --git a/diagnostics/genetator.go b/diagnostics/genetator.go index debd9b1ed3..83f547c4d7 100644 --- a/diagnostics/genetator.go +++ b/diagnostics/genetator.go @@ -20,7 +20,7 @@ func init() { trace.RegisterGenerator("mosntracing", &OpenGenerator{}) } -//OpenGenerator is the default implementation of Generator +// OpenGenerator is the default implementation of Generator type OpenGenerator struct { } diff --git a/diagnostics/tracing.go b/diagnostics/tracing.go index 4be1f0baea..58e932d26f 100644 --- a/diagnostics/tracing.go +++ b/diagnostics/tracing.go @@ -18,7 +18,7 @@ const ( defaultGenerator = "mosntracing" ) -//grpcTracer is used to start a new Span +// grpcTracer is used to start a new Span type grpcTracer struct { config map[string]interface{} } diff --git a/docs/en/start/lock/start.md b/docs/en/start/lock/start.md index 4865764349..3658ca57b9 100644 --- a/docs/en/start/lock/start.md +++ b/docs/en/start/lock/start.md @@ -76,6 +76,8 @@ The layotto file will be generated in the directory, run it: ## step 2. Run the client program, call Layotto to add, delete, modify and query + +### **Go** ```shell cd ${project_path}/demo/lock/common/ @@ -98,6 +100,46 @@ client2 succeeded in unlocking Demo success! ``` +### **Java** + +Download java sdk and examples: + +```shell @if.not.exist java-sdk +git clone https://github.com/layotto/java-sdk +``` + +Change directory: + +```shell +cd java-sdk +``` + +Build: + +```shell @if.not.exist examples-lock/target/examples-lock-jar-with-dependencies.jar +# build example jar +mvn -f examples-lock/pom.xml clean package +``` + +Run the examples: + +```shell +java -jar examples-lock/target/examples-lock-jar-with-dependencies.jar +``` + +And you will see: + +```bash +TryLockResponse{success=true} +TryLockResponse{success=true} +TryLockResponse{success=true} +UnlockResponse{status=SUCCESS} +TryLockResponse{success=true} +UnlockResponse{status=LOCK_UNEXIST} +``` + + + ## Next Step ### What did this client Demo do? The demo client program uses the golang version SDK provided by Layotto, calls the Layotto distributed lock API, and starts multiple goroutines to do locking and unlocking operations. diff --git a/docs/zh/start/lock/start.md b/docs/zh/start/lock/start.md index 674fd4a67f..a224cfd1e8 100644 --- a/docs/zh/start/lock/start.md +++ b/docs/zh/start/lock/start.md @@ -1,16 +1,14 @@ -# 基于 Redis 使用分布式锁 - -## 快速开始 +# 快速开始: 基于 Redis 使用分布式锁 该示例展示了如何通过Layotto调用 Redis,进行分布式锁的抢锁、解锁操作。 该示例的架构如下图,启动的进程有:Redis、Layotto、一个演示用的client程序(其中包含两个协程,并发抢锁) ![img.png](../../../img/lock/img.png) -### step 1. 部署 Redis 和 Layotto +## step 1. 部署 Redis 和 Layotto -#### **使用 Docker Compose** +### **使用 Docker Compose** 您可以用 docker-compose 启动 Redis 和 Layotto ```bash @@ -19,13 +17,13 @@ cd docker/layotto-redis docker-compose up -d ``` -#### **本地编译(不适合 Windows)** +### **本地编译(不适合 Windows)** 您可以使用 Docker 运行 Redis,然后本地编译、运行 Layotto。 > [!TIP|label: 不适合 Windows 用户] > Layotto 在 Windows 下会编译失败。建议 Windows 用户使用 docker-compose 部署 -#### step 1.1. 用 Docker 运行 Redis +### step 1.1. 用 Docker 运行 Redis 1. 取最新版的 Redis 镜像。 这里我们拉取官方的最新版本的镜像: @@ -55,7 +53,7 @@ docker run -itd --name redis-test -p 6380:6379 redis -p 6380:6379:映射容器服务的 6379 端口到宿主机的 6380 端口。外部可以直接通过宿主机ip:6380 访问到 Redis 的服务。 -#### step 1.2. 运行 Layotto +### step 1.2. 运行 Layotto 将项目代码下载到本地后,切换代码目录: @@ -77,7 +75,9 @@ go build -o layotto -### step 2. 运行客户端程序,调用Layotto抢锁/解锁 +## step 2. 运行客户端程序,调用Layotto抢锁/解锁 + +### **Go** ```shell cd ${project_path}/demo/lock/common/ @@ -100,8 +100,48 @@ client2 succeeded in unlocking Demo success! ``` -### 下一步 -#### 这个客户端程序做了什么? +### **Java** + +下载 java sdk 和示例代码: + +```shell @if.not.exist java-sdk +git clone https://github.com/layotto/java-sdk +``` + +切换目录: + +```shell +cd java-sdk +``` + +构建: + +```shell @if.not.exist examples-lock/target/examples-lock-jar-with-dependencies.jar +# build example jar +mvn -f examples-lock/pom.xml clean package +``` + +运行: + +```shell +java -jar examples-lock/target/examples-lock-jar-with-dependencies.jar +``` + +打印出以下信息说明运行成功: + +```bash +TryLockResponse{success=true} +TryLockResponse{success=true} +TryLockResponse{success=true} +UnlockResponse{status=SUCCESS} +TryLockResponse{success=true} +UnlockResponse{status=LOCK_UNEXIST} +``` + + + +## 下一步 +### 这个客户端程序做了什么? 示例客户端程序中使用了Layotto提供的golang版本sdk,调用Layotto 分布式锁API,启动多个协程进行抢锁、解锁操作。 sdk位于`sdk`目录下,用户可以通过sdk调用Layotto提供的API。 @@ -111,9 +151,9 @@ sdk位于`sdk`目录下,用户可以通过sdk调用Layotto提供的API。 其实sdk只是对grpc很薄的封装,用sdk约等于直接用grpc调。 -#### 细节以后再说,继续体验其他API +### 细节以后再说,继续体验其他API 通过左侧的导航栏,继续体验别的API吧! -#### 了解分布式锁 API的实现原理 +### 了解分布式锁 API的实现原理 如果您对实现原理感兴趣,或者想扩展一些功能,可以阅读[分布式锁 API的设计文档](zh/design/lock/lock-api-design.md) \ No newline at end of file diff --git a/pkg/actuator/health/endpoint.go b/pkg/actuator/health/endpoint.go index dd2956807b..4f55a3e443 100644 --- a/pkg/actuator/health/endpoint.go +++ b/pkg/actuator/health/endpoint.go @@ -54,15 +54,15 @@ func NewEndpoint() *Endpoint { // Handle will check health status.The structure of the returned map is like: // -// { -// "status": "DOWN", -// "components": { -// "readinessProbe": { -// "status": "DOWN", -// "details": {} -// } -// } -// } +// { +// "status": "DOWN", +// "components": { +// "readinessProbe": { +// "status": "DOWN", +// "details": {} +// } +// } +// } func (e *Endpoint) Handle(ctx context.Context, params http.ParamsScanner) (map[string]interface{}, error) { result := make(map[string]interface{}) // 1. validate params diff --git a/pkg/filter/network/tcpcopy/strategy/switch.go b/pkg/filter/network/tcpcopy/strategy/switch.go index 5b3682c784..52b5a73a71 100644 --- a/pkg/filter/network/tcpcopy/strategy/switch.go +++ b/pkg/filter/network/tcpcopy/strategy/switch.go @@ -86,7 +86,7 @@ var ( initOnce = new(sync.Once) ) -//For hot reloading app-level dumpConfig +// For hot reloading app-level dumpConfig func UpdateAppDumpConfig(value string) bool { if value == "" { return false @@ -129,7 +129,7 @@ func UpdateAppDumpConfig(value string) bool { return true } -//For hot reloading global dumpConfig +// For hot reloading global dumpConfig func UpdateGlobalDumpConfig(value string) bool { if "" == value { return false diff --git a/pkg/grpc/default_api/api_file.go b/pkg/grpc/default_api/api_file.go index 241e66005f..0d2d0f2af9 100644 --- a/pkg/grpc/default_api/api_file.go +++ b/pkg/grpc/default_api/api_file.go @@ -131,7 +131,7 @@ func (a *api) PutFile(stream runtimev1pb.Runtime_PutFileServer) error { return nil } -//ListFile list all files +// ListFile list all files func (a *api) ListFile(ctx context.Context, in *runtimev1pb.ListFileRequest) (*runtimev1pb.ListFileResp, error) { if in.Request == nil { return nil, status.Errorf(codes.InvalidArgument, "request can't be nil") @@ -159,7 +159,7 @@ func (a *api) ListFile(ctx context.Context, in *runtimev1pb.ListFileRequest) (*r return &runtimev1pb.ListFileResp{Files: files, Marker: resp.Marker, IsTruncated: resp.IsTruncated}, nil } -//DelFile delete specific file +// DelFile delete specific file func (a *api) DelFile(ctx context.Context, in *runtimev1pb.DelFileRequest) (*emptypb.Empty, error) { errCode := codes.Internal if in.Request == nil { @@ -181,7 +181,7 @@ func (a *api) DelFile(ctx context.Context, in *runtimev1pb.DelFileRequest) (*emp return &emptypb.Empty{}, nil } -//GetFileMeta get meta of file +// GetFileMeta get meta of file func (a *api) GetFileMeta(ctx context.Context, in *runtimev1pb.GetFileMetaRequest) (*runtimev1pb.GetFileMetaResponse, error) { errCode := codes.Internal if in.Request == nil { diff --git a/pkg/grpc/extension/s3/s3_test.go b/pkg/grpc/extension/s3/s3_test.go index ae8f880113..cfa25da821 100644 --- a/pkg/grpc/extension/s3/s3_test.go +++ b/pkg/grpc/extension/s3/s3_test.go @@ -209,7 +209,7 @@ func TestDeleteObject(t *testing.T) { assert.Equal(t, "123", resp.VersionId) } -//TestPutObjectTagging +// TestPutObjectTagging func TestPutObjectTagging(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -230,7 +230,7 @@ func TestPutObjectTagging(t *testing.T) { assert.Nil(t, err) } -//TestDeleteObjectTagging +// TestDeleteObjectTagging func TestDeleteObjectTagging(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -251,7 +251,7 @@ func TestDeleteObjectTagging(t *testing.T) { assert.Nil(t, err) } -//TestGetObjectTagging +// TestGetObjectTagging func TestGetObjectTagging(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -274,7 +274,7 @@ func TestGetObjectTagging(t *testing.T) { assert.Equal(t, "123", resp.VersionId) } -//TestCopyObject +// TestCopyObject func TestCopyObject(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -296,7 +296,7 @@ func TestCopyObject(t *testing.T) { assert.Equal(t, "etag", resp.CopyObjectResult.Etag) } -//TestDeleteObjects +// TestDeleteObjects func TestDeleteObjects(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -319,7 +319,7 @@ func TestDeleteObjects(t *testing.T) { assert.Equal(t, "version", resp.Deleted[0].VersionId) } -//TestListObjects +// TestListObjects func TestListObjects(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -363,7 +363,7 @@ func TestListObjects(t *testing.T) { assert.Equal(t, "delimiter", resp.Delimiter) } -//TestGetObjectCannedAcl +// TestGetObjectCannedAcl func TestGetObjectCannedAcl(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -397,7 +397,7 @@ func TestGetObjectCannedAcl(t *testing.T) { assert.Equal(t, "yes", resp.RequestCharged) } -//TestPutObjectCannedAcl +// TestPutObjectCannedAcl func TestPutObjectCannedAcl(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -430,7 +430,7 @@ func TestPutObjectCannedAcl(t *testing.T) { assert.Equal(t, "yes", resp.RequestCharged) } -//TestRestoreObject +// TestRestoreObject func TestRestoreObject(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -464,7 +464,7 @@ func TestRestoreObject(t *testing.T) { assert.Equal(t, "yes", resp.RestoreOutputPath) } -//TestCreateMultipartUpload +// TestCreateMultipartUpload func TestCreateMultipartUpload(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -497,7 +497,7 @@ func TestCreateMultipartUpload(t *testing.T) { assert.Equal(t, "object", resp.Key) } -//TestUploadPartCopy +// TestUploadPartCopy func TestUploadPartCopy(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -530,7 +530,7 @@ func TestUploadPartCopy(t *testing.T) { assert.Equal(t, true, resp.BucketKeyEnabled) } -//TestCompleteMultipartUpload +// TestCompleteMultipartUpload func TestCompleteMultipartUpload(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -569,7 +569,7 @@ func TestCompleteMultipartUpload(t *testing.T) { assert.Equal(t, true, resp.BucketKeyEnabled) } -//TestAbortMultipartUpload +// TestAbortMultipartUpload func TestAbortMultipartUpload(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -604,7 +604,7 @@ func TestAbortMultipartUpload(t *testing.T) { assert.Equal(t, "true", resp.RequestCharged) } -//TestListMultipartUploads +// TestListMultipartUploads func TestListMultipartUploads(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -635,7 +635,7 @@ func TestListMultipartUploads(t *testing.T) { assert.Equal(t, "layotto", resp.Bucket) } -//TestListObjectVersions +// TestListObjectVersions func TestListObjectVersions(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -668,7 +668,7 @@ func TestListObjectVersions(t *testing.T) { assert.Equal(t, "layotto", resp.Delimiter) } -//TestHeadObject +// TestHeadObject func TestHeadObject(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -701,7 +701,7 @@ func TestHeadObject(t *testing.T) { assert.Equal(t, map[string]string{"key": "value"}, resp.ResultMetadata) } -//TestIsObjectExist +// TestIsObjectExist func TestIsObjectExist(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -734,7 +734,7 @@ func TestIsObjectExist(t *testing.T) { assert.Equal(t, true, resp.FileExist) } -//TestSignURL +// TestSignURL func TestSignURL(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -767,7 +767,7 @@ func TestSignURL(t *testing.T) { assert.Equal(t, "http://object", resp.SignedUrl) } -//TestUpdateDownLoadBandwidthRateLimit +// TestUpdateDownLoadBandwidthRateLimit func TestUpdateDownLoadBandwidthRateLimit(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -794,7 +794,7 @@ func TestUpdateDownLoadBandwidthRateLimit(t *testing.T) { assert.Nil(t, err) } -//TestUpdateUpLoadBandwidthRateLimit +// TestUpdateUpLoadBandwidthRateLimit func TestUpdateUpLoadBandwidthRateLimit(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} @@ -821,7 +821,7 @@ func TestUpdateUpLoadBandwidthRateLimit(t *testing.T) { assert.Nil(t, err) } -//TestListParts +// TestListParts func TestListParts(t *testing.T) { // prepare oss server ac := &grpc.ApplicationContext{AppId: "test", Oss: map[string]l8s3.Oss{}} diff --git a/pkg/runtime/lock/factory.go b/pkg/runtime/lock/factory.go index 7db50702d1..5685b97672 100644 --- a/pkg/runtime/lock/factory.go +++ b/pkg/runtime/lock/factory.go @@ -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. diff --git a/pkg/runtime/lock/factory_test.go b/pkg/runtime/lock/factory_test.go index 52a551032a..2f77f69030 100644 --- a/pkg/runtime/lock/factory_test.go +++ b/pkg/runtime/lock/factory_test.go @@ -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. diff --git a/pkg/runtime/lock/lock_config.go b/pkg/runtime/lock/lock_config.go index 6b2c4cf2e1..a16f3524f1 100644 --- a/pkg/runtime/lock/lock_config.go +++ b/pkg/runtime/lock/lock_config.go @@ -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. diff --git a/pkg/runtime/lock/lock_config_test.go b/pkg/runtime/lock/lock_config_test.go index b32ed9257f..8623278a4e 100644 --- a/pkg/runtime/lock/lock_config_test.go +++ b/pkg/runtime/lock/lock_config_test.go @@ -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. diff --git a/pkg/runtime/lock/registry.go b/pkg/runtime/lock/registry.go index 46cbc9c762..77d7c31d36 100644 --- a/pkg/runtime/lock/registry.go +++ b/pkg/runtime/lock/registry.go @@ -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. diff --git a/pkg/runtime/lock/registry_test.go b/pkg/runtime/lock/registry_test.go index 53fb92bbc9..b41b445a5e 100644 --- a/pkg/runtime/lock/registry_test.go +++ b/pkg/runtime/lock/registry_test.go @@ -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. diff --git a/pkg/runtime/pubsub/factory_test.go b/pkg/runtime/pubsub/factory_test.go index 0b3a05cade..e11d608017 100644 --- a/pkg/runtime/pubsub/factory_test.go +++ b/pkg/runtime/pubsub/factory_test.go @@ -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. diff --git a/pkg/runtime/ref/injector.go b/pkg/runtime/ref/injector.go index 94ce34f207..64a1aa2ba1 100644 --- a/pkg/runtime/ref/injector.go +++ b/pkg/runtime/ref/injector.go @@ -26,7 +26,7 @@ type DefaultInjector struct { Container RefContainer } -//InjectSecretRef inject secret to metaData +// InjectSecretRef inject secret to metaData // TODO: permission control func (i *DefaultInjector) InjectSecretRef(items []*ref.Item, metaData map[string]string) (map[string]string, error) { if metaData == nil { diff --git a/pkg/runtime/secretstores/factory.go b/pkg/runtime/secretstores/factory.go index ef96c0afed..20e1416497 100644 --- a/pkg/runtime/secretstores/factory.go +++ b/pkg/runtime/secretstores/factory.go @@ -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. diff --git a/pkg/runtime/sequencer/cache.go b/pkg/runtime/sequencer/cache.go index 559157d271..d81b1acc15 100644 --- a/pkg/runtime/sequencer/cache.go +++ b/pkg/runtime/sequencer/cache.go @@ -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. @@ -60,7 +59,7 @@ func NewDoubleBuffer(key string, store sequencer.Store) *DoubleBuffer { return d } -//init double buffer +// init double buffer func (d *DoubleBuffer) init() error { buffer, err := d.getNewBuffer() @@ -73,7 +72,7 @@ func (d *DoubleBuffer) init() error { return nil } -//getId next id +// getId next id func (d *DoubleBuffer) getId() (int64, error) { d.lock.Lock() @@ -123,7 +122,7 @@ func (d *DoubleBuffer) getId() (int64, error) { return next, nil } -//swap inUseBuffer and BackUpBuffer, must be locked +// swap inUseBuffer and BackUpBuffer, must be locked func (d *DoubleBuffer) swap() error { select { @@ -140,7 +139,7 @@ func (d *DoubleBuffer) swap() error { } } -//getNewBuffer return a new segment +// getNewBuffer return a new segment func (d *DoubleBuffer) getNewBuffer() (*Buffer, error) { support, result, err := d.Store.GetSegment(&sequencer.GetSegmentRequest{ Key: d.Key, @@ -161,7 +160,7 @@ func (d *DoubleBuffer) getNewBuffer() (*Buffer, error) { // BufferCatch catch key and buffer var BufferCatch = map[string]*DoubleBuffer{} -//read/write lock for BufferCatch +// read/write lock for BufferCatch var rwLock sync.RWMutex func GetNextIdFromCache(ctx context.Context, store sequencer.Store, req *sequencer.GetNextIdRequest) (bool, int64, error) { diff --git a/pkg/runtime/sequencer/cache_test.go b/pkg/runtime/sequencer/cache_test.go index 38e43a6d34..975c9f98e9 100644 --- a/pkg/runtime/sequencer/cache_test.go +++ b/pkg/runtime/sequencer/cache_test.go @@ -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. diff --git a/pkg/runtime/sequencer/factory.go b/pkg/runtime/sequencer/factory.go index ac2778b7de..b203872f30 100644 --- a/pkg/runtime/sequencer/factory.go +++ b/pkg/runtime/sequencer/factory.go @@ -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. diff --git a/pkg/runtime/sequencer/factory_test.go b/pkg/runtime/sequencer/factory_test.go index d5f8cd468a..866eea7eac 100644 --- a/pkg/runtime/sequencer/factory_test.go +++ b/pkg/runtime/sequencer/factory_test.go @@ -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. diff --git a/pkg/runtime/sequencer/registry.go b/pkg/runtime/sequencer/registry.go index c54894ad42..33803c2067 100644 --- a/pkg/runtime/sequencer/registry.go +++ b/pkg/runtime/sequencer/registry.go @@ -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. diff --git a/pkg/runtime/sequencer/registry_test.go b/pkg/runtime/sequencer/registry_test.go index 43a702889f..11d5f94856 100644 --- a/pkg/runtime/sequencer/registry_test.go +++ b/pkg/runtime/sequencer/registry_test.go @@ -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. diff --git a/pkg/runtime/sequencer/sequencer_config.go b/pkg/runtime/sequencer/sequencer_config.go index b0f8337cd0..e8270b441c 100644 --- a/pkg/runtime/sequencer/sequencer_config.go +++ b/pkg/runtime/sequencer/sequencer_config.go @@ -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. diff --git a/pkg/runtime/sequencer/sequencer_config_test.go b/pkg/runtime/sequencer/sequencer_config_test.go index bb85f491dd..4f185fb76d 100644 --- a/pkg/runtime/sequencer/sequencer_config_test.go +++ b/pkg/runtime/sequencer/sequencer_config_test.go @@ -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. diff --git a/pkg/runtime/state/compatibility.go b/pkg/runtime/state/compatibility.go index 3c84d2a3a7..79c190423c 100644 --- a/pkg/runtime/state/compatibility.go +++ b/pkg/runtime/state/compatibility.go @@ -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. @@ -39,7 +38,7 @@ type StoreConfiguration struct { keyPrefixStrategy string } -//Save StateConfiguration by storeName +// Save StateConfiguration by storeName func SaveStateConfiguration(storeName string, metadata map[string]string) error { // convert strategy := metadata[strategyKey] diff --git a/pkg/runtime/state/factory_test.go b/pkg/runtime/state/factory_test.go index 0127554460..e6ab5e61c3 100644 --- a/pkg/runtime/state/factory_test.go +++ b/pkg/runtime/state/factory_test.go @@ -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. diff --git a/pkg/wasm/dispatch.go b/pkg/wasm/dispatch.go index da75969bf7..9a0b9ba4c1 100644 --- a/pkg/wasm/dispatch.go +++ b/pkg/wasm/dispatch.go @@ -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. diff --git a/pkg/wasm/exports.go b/pkg/wasm/exports.go index 8aa2df76f7..89fc461bec 100644 --- a/pkg/wasm/exports.go +++ b/pkg/wasm/exports.go @@ -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. diff --git a/pkg/wasm/factory_test.go b/pkg/wasm/factory_test.go index 33110d6948..c04d26fd60 100644 --- a/pkg/wasm/factory_test.go +++ b/pkg/wasm/factory_test.go @@ -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. diff --git a/pkg/wasm/watcher.go b/pkg/wasm/watcher.go index 868e9e9e06..8297720546 100644 --- a/pkg/wasm/watcher.go +++ b/pkg/wasm/watcher.go @@ -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. diff --git a/sdk/go-sdk/client/client.go b/sdk/go-sdk/client/client.go index b650053671..352ef2f123 100644 --- a/sdk/go-sdk/client/client.go +++ b/sdk/go-sdk/client/client.go @@ -120,9 +120,10 @@ type runtimeAPI interface { // Note, this default factory function creates runtime client only once. All subsequent invocations // will return the already created instance. To create multiple instances of the runtime client, // use one of the parameterized factory functions: -// NewClientWithPort(port string) (client Client, err error) -// NewClientWithAddress(address string) (client Client, err error) -// NewClientWithConnection(conn *grpc.ClientConn) Client +// +// NewClientWithPort(port string) (client Client, err error) +// NewClientWithAddress(address string) (client Client, err error) +// NewClientWithConnection(conn *grpc.ClientConn) Client func NewClient() (client Client, err error) { port := os.Getenv(runtimePortEnvVarName) if port == "" { diff --git a/sdk/go-sdk/client/invoke.go b/sdk/go-sdk/client/invoke.go index 787a35fd7d..f5bbee1684 100755 --- a/sdk/go-sdk/client/invoke.go +++ b/sdk/go-sdk/client/invoke.go @@ -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. diff --git a/sdk/go-sdk/client/invoke_test.go b/sdk/go-sdk/client/invoke_test.go index fda578f7d7..1125777f25 100755 --- a/sdk/go-sdk/client/invoke_test.go +++ b/sdk/go-sdk/client/invoke_test.go @@ -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. diff --git a/sdk/go-sdk/client/lock.go b/sdk/go-sdk/client/lock.go index 88a05849e8..80ef9ee281 100644 --- a/sdk/go-sdk/client/lock.go +++ b/sdk/go-sdk/client/lock.go @@ -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. diff --git a/sdk/go-sdk/client/pubsub.go b/sdk/go-sdk/client/pubsub.go index 5234cd45e1..1c401bb38b 100644 --- a/sdk/go-sdk/client/pubsub.go +++ b/sdk/go-sdk/client/pubsub.go @@ -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. diff --git a/sdk/go-sdk/client/pubsub_test.go b/sdk/go-sdk/client/pubsub_test.go index 8d8269b70f..5c3a485706 100644 --- a/sdk/go-sdk/client/pubsub_test.go +++ b/sdk/go-sdk/client/pubsub_test.go @@ -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. diff --git a/sdk/go-sdk/client/secret.go b/sdk/go-sdk/client/secret.go index d4641a38ba..cb7a24b34c 100644 --- a/sdk/go-sdk/client/secret.go +++ b/sdk/go-sdk/client/secret.go @@ -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. diff --git a/sdk/go-sdk/client/sequencer.go b/sdk/go-sdk/client/sequencer.go index b14756a51d..788778d8ab 100644 --- a/sdk/go-sdk/client/sequencer.go +++ b/sdk/go-sdk/client/sequencer.go @@ -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. diff --git a/sdk/go-sdk/client/state.go b/sdk/go-sdk/client/state.go index 1589a05e1b..04d2fc92f1 100755 --- a/sdk/go-sdk/client/state.go +++ b/sdk/go-sdk/client/state.go @@ -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. diff --git a/sdk/go-sdk/client/state_test.go b/sdk/go-sdk/client/state_test.go index 5f0095b3d5..d6325816f0 100755 --- a/sdk/go-sdk/client/state_test.go +++ b/sdk/go-sdk/client/state_test.go @@ -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.