From ed7b93b83258e7a48588bd2b53d8e1591989b03c Mon Sep 17 00:00:00 2001 From: jyjiangkai Date: Wed, 21 Dec 2022 16:44:55 +0800 Subject: [PATCH 01/46] fix: the route cannot be updated after the controller leader switched (#356) Signed-off-by: jyjiangkai Signed-off-by: jyjiangkai --- pkg/cluster/raw_client/conn.go | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/pkg/cluster/raw_client/conn.go b/pkg/cluster/raw_client/conn.go index 79e50e5f0..a2ad27efa 100644 --- a/pkg/cluster/raw_client/conn.go +++ b/pkg/cluster/raw_client/conn.go @@ -16,11 +16,9 @@ package raw_client import ( "context" - stderr "errors" "fmt" "os" "strconv" - "strings" "sync" "time" @@ -190,7 +188,7 @@ func isNeedRetry(err error) bool { if err == nil { return false } - if stderr.Is(err, errors.ErrNoControllerLeader) { + if errors.Is(err, errors.ErrNotLeader) { return true } sts := status.Convert(err) @@ -200,20 +198,6 @@ func isNeedRetry(err error) bool { if sts.Code() == codes.Unavailable { return true } - - if strings.Contains(sts.Message(), "NOT_LEADER") { - return true - } - //errType, ok := errpb.Convert(sts.Message()) - //if !ok { - // return false - //} - //if errType.Code == errpb.ErrorCode_NOT_LEADER { - // log.Info(nil, "ErrorCode_NOT_LEADER", map[string]interface{}{ - // log.KeyError: err, - // }) - // return true - //} return false } From 4d26646edb11451fac768397eb59cf3700ccc7fc Mon Sep 17 00:00:00 2001 From: delu Date: Thu, 22 Dec 2022 15:45:16 +0800 Subject: [PATCH 02/46] feat: transformer function struct (#357) * feat: function struct Signed-off-by: delu * feat: function struct Signed-off-by: delu * ut: fix ut Signed-off-by: delu Signed-off-by: delu --- .golangci.yaml | 5 +- .../trigger/validation/subscripton.go | 8 +- internal/primitive/transform/action/action.go | 210 ++++++------------ .../primitive/transform/action/action_test.go | 44 ++-- .../{ => condition}/condition_if_action.go | 33 +-- .../condition_if_action_test.go | 48 ++-- .../date_format.go} | 31 +-- .../action/datetime/date_format_test.go | 53 +++++ .../action/datetime/unixtime_format.go | 33 +++ .../unixtime_format_test.go} | 53 +---- .../transform/action/math/math_add.go | 33 +++ .../transform/action/math/math_add_test.go | 39 ++++ .../transform/action/math/math_div.go | 32 +++ .../transform/action/math/math_div_test.go | 50 +++++ .../transform/action/math/math_mul.go | 33 +++ .../transform/action/math/math_mul_test.go | 39 ++++ .../transform/action/math/math_sub.go | 32 +++ .../transform/action/math/math_sub_test.go | 39 ++++ .../primitive/transform/action/math_action.go | 54 ----- .../transform/action/math_action_test.go | 85 ------- .../transform/action/string_action.go | 69 ------ .../transform/action/string_action_test.go | 129 ----------- .../transform/action/strings/add_prefix.go | 32 +++ .../action/strings/add_prefix_test.go | 41 ++++ .../transform/action/strings/add_suffix.go | 32 +++ .../action/strings/add_suffix_test.go | 41 ++++ .../transform/action/strings/join.go | 33 +++ .../transform/action/strings/join_test.go | 74 ++++++ .../transform/action/strings/lower_case.go | 32 +++ .../action/strings/lower_case_test.go | 41 ++++ .../replace_with_regrex.go} | 25 ++- .../replace_with_regrex_test.go} | 12 +- .../transform/action/strings/upper_case.go | 32 +++ .../action/strings/upper_case_test.go | 41 ++++ .../transform/action/struct_action.go | 186 ---------------- .../transform/action/struct_action_test.go | 168 -------------- .../transform/action/structs/create.go | 57 +++++ .../transform/action/structs/create_test.go | 60 +++++ .../transform/action/structs/delete.go | 44 ++++ .../transform/action/structs/delete_test.go | 51 +++++ .../transform/action/structs/move.go | 62 ++++++ .../transform/action/structs/move_test.go | 60 +++++ .../transform/action/structs/rename.go | 62 ++++++ .../transform/action/structs/rename_test.go | 54 +++++ .../transform/action/structs/replace.go | 58 +++++ .../transform/action/structs/replace_test.go | 51 +++++ ...mat_functions.go => datatime_functions.go} | 3 +- .../primitive/transform/runtime/action.go | 75 +++++++ .../{action => runtime}/action_bench_test.go | 5 +- .../transform/runtime/action_test.go | 70 ++++++ internal/primitive/transform/runtime/init.go | 57 +++++ internal/trigger/mock_worker.go | 14 ++ internal/trigger/server.go | 9 +- internal/trigger/server_test.go | 1 + .../trigger/transform/pipeline/pipeline.go | 3 +- internal/trigger/worker.go | 10 +- 56 files changed, 1746 insertions(+), 1002 deletions(-) rename internal/primitive/transform/action/{ => condition}/condition_if_action.go (69%) rename internal/primitive/transform/action/{ => condition}/condition_if_action_test.go (64%) rename internal/primitive/transform/action/{time_action.go => datetime/date_format.go} (56%) create mode 100644 internal/primitive/transform/action/datetime/date_format_test.go create mode 100644 internal/primitive/transform/action/datetime/unixtime_format.go rename internal/primitive/transform/action/{time_action_test.go => datetime/unixtime_format_test.go} (52%) create mode 100644 internal/primitive/transform/action/math/math_add.go create mode 100644 internal/primitive/transform/action/math/math_add_test.go create mode 100644 internal/primitive/transform/action/math/math_div.go create mode 100644 internal/primitive/transform/action/math/math_div_test.go create mode 100644 internal/primitive/transform/action/math/math_mul.go create mode 100644 internal/primitive/transform/action/math/math_mul_test.go create mode 100644 internal/primitive/transform/action/math/math_sub.go create mode 100644 internal/primitive/transform/action/math/math_sub_test.go delete mode 100644 internal/primitive/transform/action/math_action.go delete mode 100644 internal/primitive/transform/action/math_action_test.go delete mode 100644 internal/primitive/transform/action/string_action.go delete mode 100644 internal/primitive/transform/action/string_action_test.go create mode 100644 internal/primitive/transform/action/strings/add_prefix.go create mode 100644 internal/primitive/transform/action/strings/add_prefix_test.go create mode 100644 internal/primitive/transform/action/strings/add_suffix.go create mode 100644 internal/primitive/transform/action/strings/add_suffix_test.go create mode 100644 internal/primitive/transform/action/strings/join.go create mode 100644 internal/primitive/transform/action/strings/join_test.go create mode 100644 internal/primitive/transform/action/strings/lower_case.go create mode 100644 internal/primitive/transform/action/strings/lower_case_test.go rename internal/primitive/transform/action/{regex_action.go => strings/replace_with_regrex.go} (77%) rename internal/primitive/transform/action/{regex_action_test.go => strings/replace_with_regrex_test.go} (72%) create mode 100644 internal/primitive/transform/action/strings/upper_case.go create mode 100644 internal/primitive/transform/action/strings/upper_case_test.go delete mode 100644 internal/primitive/transform/action/struct_action.go delete mode 100644 internal/primitive/transform/action/struct_action_test.go create mode 100644 internal/primitive/transform/action/structs/create.go create mode 100644 internal/primitive/transform/action/structs/create_test.go create mode 100644 internal/primitive/transform/action/structs/delete.go create mode 100644 internal/primitive/transform/action/structs/delete_test.go create mode 100644 internal/primitive/transform/action/structs/move.go create mode 100644 internal/primitive/transform/action/structs/move_test.go create mode 100644 internal/primitive/transform/action/structs/rename.go create mode 100644 internal/primitive/transform/action/structs/rename_test.go create mode 100644 internal/primitive/transform/action/structs/replace.go create mode 100644 internal/primitive/transform/action/structs/replace_test.go rename internal/primitive/transform/function/{format_functions.go => datatime_functions.go} (99%) create mode 100644 internal/primitive/transform/runtime/action.go rename internal/primitive/transform/{action => runtime}/action_bench_test.go (96%) create mode 100644 internal/primitive/transform/runtime/action_test.go create mode 100644 internal/primitive/transform/runtime/init.go diff --git a/.golangci.yaml b/.golangci.yaml index 5b18aa929..3102b59a3 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -396,6 +396,9 @@ issues: - source: "strconv|make|len|math" linters: - gomnd + - path: "action" + linters: + - dupl - path: "convert.go" linters: - dupl @@ -412,7 +415,7 @@ issues: linters: - gosec - gomnd - - path: "action.go" + - path: "init.go" linters: - gochecknoinits - path: "^vsctl" diff --git a/internal/controller/trigger/validation/subscripton.go b/internal/controller/trigger/validation/subscripton.go index 52648b4b8..574bac348 100644 --- a/internal/controller/trigger/validation/subscripton.go +++ b/internal/controller/trigger/validation/subscripton.go @@ -19,12 +19,10 @@ import ( "fmt" "net/url" - "github.com/linkall-labs/vanus/internal/primitive/transform/action" - - "github.com/linkall-labs/vanus/internal/primitive/transform/arg" - "github.com/linkall-labs/vanus/internal/primitive" "github.com/linkall-labs/vanus/internal/primitive/cel" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" "github.com/linkall-labs/vanus/pkg/errors" ctrlpb "github.com/linkall-labs/vanus/proto/pkg/controller" metapb "github.com/linkall-labs/vanus/proto/pkg/meta" @@ -176,7 +174,7 @@ func validateTransformer(ctx context.Context, transformer *metapb.Transformer) e for i, command := range a.Command { commands[i] = command.AsInterface() } - if _, err := action.NewAction(commands); err != nil { + if _, err := runtime.NewAction(commands); err != nil { return errors.ErrInvalidRequest.WithMessage( fmt.Sprintf("transformer pipeline %dst command %s is invalid:[%s]", n+1, commands[0], err.Error())) } diff --git a/internal/primitive/transform/action/action.go b/internal/primitive/transform/action/action.go index 8a27ba274..d844f17ab 100644 --- a/internal/primitive/transform/action/action.go +++ b/internal/primitive/transform/action/action.go @@ -16,18 +16,14 @@ package action import ( "fmt" - "strings" - - "github.com/linkall-labs/vanus/internal/primitive/transform/function" "github.com/linkall-labs/vanus/internal/primitive/transform/arg" "github.com/linkall-labs/vanus/internal/primitive/transform/common" "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/function" "github.com/pkg/errors" ) -type newAction func() Action - type Action interface { // Name func name Name() string @@ -41,190 +37,108 @@ type Action interface { Execute(ceCtx *context.EventContext) error } -type commonAction struct { - name string - fixedArgs []arg.TypeList - variadicArg arg.TypeList - fn function.Function +type CommonAction struct { + ActionName string + FixedArgs []arg.TypeList + VariadicArg arg.TypeList + Fn function.Function - args []arg.Arg - argTypes []common.Type - targetArg arg.Arg + Args []arg.Arg + ArgTypes []common.Type + TargetArg arg.Arg } -func (a *commonAction) Name() string { - if a.name != "" { - return a.name - } - if a.fn != nil { - return a.fn.Name() +func (a *CommonAction) Name() string { + return a.ActionName +} + +func (a *CommonAction) Arity() int { + return len(a.FixedArgs) +} + +func (a *CommonAction) ArgType(index int) arg.TypeList { + if index < len(a.FixedArgs) { + return a.FixedArgs[index] } - return "" + return a.VariadicArg } -func (a *commonAction) Arity() int { - return len(a.fixedArgs) +func (a *CommonAction) IsVariadic() bool { + return len(a.VariadicArg) > 0 } -func (a *commonAction) ArgType(index int) arg.TypeList { - if index < len(a.fixedArgs) { - return a.fixedArgs[index] +func (a *CommonAction) RunArgs(ceCtx *context.EventContext) ([]interface{}, error) { + args := make([]interface{}, len(a.Args)) + if len(a.Args) != len(a.ArgTypes) { + return nil, fmt.Errorf("arg lenth %d not same arg type %d", len(a.Args), len(a.ArgTypes)) } - return a.variadicArg + for i, _arg := range a.Args { + value, err := _arg.Evaluate(ceCtx) + if err != nil { + return nil, errors.Wrapf(err, "arg %s evaluate error", _arg.Original()) + } + v, err := common.Cast(value, a.ArgTypes[i]) + if err != nil { + return nil, err + } + args[i] = v + } + return args, nil } -func (a *commonAction) IsVariadic() bool { - return len(a.variadicArg) > 0 +type FunctionAction struct { + CommonAction } -func (a *commonAction) Init(args []arg.Arg) error { - a.targetArg = args[0] - a.args = args[1:] +func (a *FunctionAction) Init(args []arg.Arg) error { + a.TargetArg = args[0] + a.Args = args[1:] return a.setArgTypes() } -func (a *commonAction) setArgTypes() error { - if a.fn == nil { +func (a *FunctionAction) setArgTypes() error { + if a.Fn == nil { return fmt.Errorf("fn is nil") } - if len(a.args) < a.fn.Arity() { + if len(a.Args) < a.Fn.Arity() { return ErrArgNumber } - if len(a.args) > a.fn.Arity() && !a.fn.IsVariadic() { + if len(a.Args) > a.Fn.Arity() && !a.Fn.IsVariadic() { return ErrArgNumber } - argTypes := make([]common.Type, len(a.args)) - for i := 0; i < len(a.args); i++ { - argTypes[i] = *a.fn.ArgType(i) + argTypes := make([]common.Type, len(a.Args)) + for i := 0; i < len(a.Args); i++ { + argTypes[i] = *a.Fn.ArgType(i) } - a.argTypes = argTypes + a.ArgTypes = argTypes return nil } -func (a *commonAction) Execute(ceCtx *context.EventContext) error { - if a.fn == nil { +func (a *FunctionAction) Execute(ceCtx *context.EventContext) error { + if a.Fn == nil { return fmt.Errorf("fn is nil") } - args, err := a.runArgs(ceCtx) + args, err := a.RunArgs(ceCtx) if err != nil { return err } - fnValue, err := a.fn.Execute(args) + fnValue, err := a.Fn.Execute(args) if err != nil { return err } - return a.targetArg.SetValue(ceCtx, fnValue) + return a.TargetArg.SetValue(ceCtx, fnValue) } -func (a *commonAction) runArgs(ceCtx *context.EventContext) ([]interface{}, error) { - args := make([]interface{}, len(a.args)) - if len(a.args) != len(a.argTypes) { - return nil, fmt.Errorf("arg lenth %d not same arg type %d", len(a.args), len(a.argTypes)) - } - for i, _arg := range a.args { - value, err := _arg.Evaluate(ceCtx) - if err != nil { - return nil, errors.Wrapf(err, "arg %s evaluate error", _arg.Original()) - } - v, err := common.Cast(value, a.argTypes[i]) - if err != nil { - return nil, err - } - args[i] = v - } - return args, nil +type SourceTargetSameAction struct { + FunctionAction } -type sourceTargetSameAction struct { - commonAction -} - -func (a *sourceTargetSameAction) Init(args []arg.Arg) error { - a.targetArg = args[0] - a.args = args +func (a *SourceTargetSameAction) Init(args []arg.Arg) error { + a.TargetArg = args[0] + a.Args = args return a.setArgTypes() } -var actionMap = map[string]newAction{} - -func AddAction(actionFn newAction) error { - a := actionFn() - if _, exist := actionMap[a.Name()]; exist { - return ErrExist - } - actionMap[a.Name()] = actionFn - return nil -} - -func init() { - for _, fn := range []newAction{ - // struct - newCreateActionAction, - newDeleteAction, - newReplaceAction, - newMoveActionAction, - newRenameActionAction, - // math - newMathAddActionAction, - newMathSubActionAction, - newMathMulActionAction, - newMathDivActionAction, - // format - newDateFormatAction, - newUnixTimeFormatAction, - // string - newJoinAction, - newUpperAction, - newLowerAction, - newAddPrefixAction, - newAddSuffixAction, - newReplaceWithRegexAction, - // condition - newConditionIfAction, - } { - if err := AddAction(fn); err != nil { - panic(err) - } - } -} - -func NewAction(command []interface{}) (Action, error) { - funcName, ok := command[0].(string) - if !ok { - return nil, fmt.Errorf("command name must be stirng") - } - actionFn, exist := actionMap[strings.ToUpper(funcName)] - if !exist { - return nil, fmt.Errorf("command %s not exist", funcName) - } - a := actionFn() - argNum := len(command) - 1 - if argNum < a.Arity() { - return nil, fmt.Errorf("command %s arg number is not enough, it need %d but only have %d", - funcName, a.Arity(), argNum) - } - if argNum > a.Arity() && !a.IsVariadic() { - return nil, fmt.Errorf("command %s arg number is too many, it need %d but have %d", funcName, a.Arity(), argNum) - } - args := make([]arg.Arg, argNum) - for i := 1; i < len(command); i++ { - _arg, err := arg.NewArg(command[i]) - if err != nil { - return nil, errors.Wrapf(err, "command %s arg %d is invalid", funcName, i) - } - argType := a.ArgType(i - 1) - if !argType.Contains(_arg) { - return nil, fmt.Errorf("command %s arg %d not support type %s", funcName, i, _arg.Type()) - } - args[i-1] = _arg - } - err := a.Init(args) - if err != nil { - return nil, errors.Wrapf(err, "command %s init error", funcName) - } - return a, nil -} - var ( ErrExist = fmt.Errorf("action have exist") ErrArgNumber = fmt.Errorf("action arg number invalid") diff --git a/internal/primitive/transform/action/action_test.go b/internal/primitive/transform/action/action_test.go index 74474c94f..5ecb1da25 100644 --- a/internal/primitive/transform/action/action_test.go +++ b/internal/primitive/transform/action/action_test.go @@ -12,43 +12,27 @@ // See the License for the specific language governing permissions and // limitations under the License. -package action +package action_test import ( "testing" + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" . "github.com/smartystreets/goconvey/convey" ) -func TestNewAction(t *testing.T) { - Convey("test new action", t, func() { - Convey("func name is not string", func() { - _, err := NewAction([]interface{}{123}) - So(err, ShouldNotBeNil) - }) - Convey("func name no exist", func() { - _, err := NewAction([]interface{}{"UnknownCommand"}) - So(err, ShouldNotBeNil) - }) - Convey("func arity not enough", func() { - _, err := NewAction([]interface{}{"delete"}) - So(err, ShouldNotBeNil) - }) - Convey("func arity number greater than", func() { - _, err := NewAction([]interface{}{"delete", "arg1", "arg2"}) - So(err, ShouldNotBeNil) - }) - Convey("func new arg error", func() { - _, err := NewAction([]interface{}{"delete", "$.a-b"}) - So(err, ShouldNotBeNil) - }) - Convey("func new arg type is invalid", func() { - _, err := NewAction([]interface{}{"delete", "arg"}) - So(err, ShouldNotBeNil) - }) - Convey("func new valid", func() { - _, err := NewAction([]interface{}{"delete", "$.id"}) - So(err, ShouldBeNil) +func TestActionExecute(t *testing.T) { + Convey("test action", t, func() { + a, err := runtime.NewAction([]interface{}{"delete", "$.test"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "abc") + err = a.Execute(&context.EventContext{ + Event: &e, }) + So(err, ShouldBeNil) + So(len(e.Extensions()), ShouldEqual, 0) }) } diff --git a/internal/primitive/transform/action/condition_if_action.go b/internal/primitive/transform/action/condition/condition_if_action.go similarity index 69% rename from internal/primitive/transform/action/condition_if_action.go rename to internal/primitive/transform/action/condition/condition_if_action.go index 1b8272022..49801c1ba 100644 --- a/internal/primitive/transform/action/condition_if_action.go +++ b/internal/primitive/transform/action/condition/condition_if_action.go @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -package action +package condition import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" "github.com/linkall-labs/vanus/internal/primitive/transform/arg" "github.com/linkall-labs/vanus/internal/primitive/transform/common" "github.com/linkall-labs/vanus/internal/primitive/transform/context" @@ -22,46 +23,46 @@ import ( ) type conditionIfAction struct { - commonAction + action.CommonAction } -// ["condition_if","$.targetPath","$.path","op","compareValue","trueValue","falseValue"] +// NewConditionIfAction ["condition_if","$.targetPath","$.path","op","compareValue","trueValue","falseValue"] // op must be string and only support ==,>=,>,<=,< . -func newConditionIfAction() Action { +func NewConditionIfAction() action.Action { return &conditionIfAction{ - commonAction{ - name: "CONDITION_IF", - fixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All, arg.All, arg.All, arg.All}, + action.CommonAction{ + ActionName: "CONDITION_IF", + FixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All, arg.All, arg.All, arg.All}, }, } } func (a *conditionIfAction) Init(args []arg.Arg) error { - a.targetArg = args[0] - a.args = args[1:] + a.TargetArg = args[0] + a.Args = args[1:] return nil } func (a *conditionIfAction) Execute(ceCtx *context.EventContext) error { - v, err := a.args[1].Evaluate(ceCtx) + v, err := a.Args[1].Evaluate(ceCtx) if err != nil { - return errors.Wrapf(err, "arg %s evaluate error", a.args[1].Original()) + return errors.Wrapf(err, "arg %s evaluate error", a.Args[1].Original()) } op, ok := v.(string) if !ok { return errors.New("op type must be string") } if op == "==" { - a.argTypes = []common.Type{common.String, common.String, common.String, common.Any, common.Any} + a.ArgTypes = []common.Type{common.String, common.String, common.String, common.Any, common.Any} } else { switch op { case ">=", ">", "<=", "<": - a.argTypes = []common.Type{common.Number, common.String, common.Number, common.Any, common.Any} + a.ArgTypes = []common.Type{common.Number, common.String, common.Number, common.Any, common.Any} default: return errors.Errorf("not support op [%s]", op) } } - args, err := a.runArgs(ceCtx) + args, err := a.RunArgs(ceCtx) if err != nil { return err } @@ -79,7 +80,7 @@ func (a *conditionIfAction) Execute(ceCtx *context.EventContext) error { result = args[0].(float64) < args[2].(float64) } if result { - return a.targetArg.SetValue(ceCtx, args[3]) + return a.TargetArg.SetValue(ceCtx, args[3]) } - return a.targetArg.SetValue(ceCtx, args[4]) + return a.TargetArg.SetValue(ceCtx, args[4]) } diff --git a/internal/primitive/transform/action/condition_if_action_test.go b/internal/primitive/transform/action/condition/condition_if_action_test.go similarity index 64% rename from internal/primitive/transform/action/condition_if_action_test.go rename to internal/primitive/transform/action/condition/condition_if_action_test.go index 4479723b1..b4d12f5d1 100644 --- a/internal/primitive/transform/action/condition_if_action_test.go +++ b/internal/primitive/transform/action/condition/condition_if_action_test.go @@ -12,91 +12,95 @@ // See the License for the specific language governing permissions and // limitations under the License. -package action +package condition_test import ( "testing" + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/condition" "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" . "github.com/smartystreets/goconvey/convey" ) func TestConditionIfAction(t *testing.T) { + funcName := condition.NewConditionIfAction().Name() Convey("test condition if ==", t, func() { Convey("test string", func() { - a, err := NewAction([]interface{}{newConditionIfAction().Name(), "$.test2", "$.test", "==", "test", true, false}) + a, err := runtime.NewAction([]interface{}{funcName, "$.test2", "$.test", "==", "test", true, false}) So(err, ShouldBeNil) - e := newEvent() + e := cetest.MinEvent() e.SetExtension("test", "test") err = a.Execute(&context.EventContext{ - Event: e, + Event: &e, }) So(err, ShouldBeNil) So(e.Extensions()["test2"], ShouldEqual, true) }) Convey("test number", func() { - a, err := NewAction([]interface{}{newConditionIfAction().Name(), "$.test2", "$.test", "==", 123, true, false}) + a, err := runtime.NewAction([]interface{}{funcName, "$.test2", "$.test", "==", 123, true, false}) So(err, ShouldBeNil) - e := newEvent() + e := cetest.MinEvent() e.SetExtension("test", 123) err = a.Execute(&context.EventContext{ - Event: e, + Event: &e, }) So(err, ShouldBeNil) So(e.Extensions()["test2"], ShouldEqual, true) }) }) Convey("test condition >=", t, func() { - a, err := NewAction([]interface{}{newConditionIfAction().Name(), "$.test2", "$.test", ">=", int32(123), true, false}) + a, err := runtime.NewAction([]interface{}{funcName, "$.test2", "$.test", ">=", int32(123), true, false}) So(err, ShouldBeNil) - e := newEvent() + e := cetest.MinEvent() e.SetExtension("test", "456") err = a.Execute(&context.EventContext{ - Event: e, + Event: &e, }) So(err, ShouldBeNil) So(e.Extensions()["test2"], ShouldEqual, true) }) Convey("test condition >", t, func() { - a, err := NewAction([]interface{}{newConditionIfAction().Name(), "$.test2", "$.test", ">", int32(123), true, false}) + a, err := runtime.NewAction([]interface{}{funcName, "$.test2", "$.test", ">", int32(123), true, false}) So(err, ShouldBeNil) - e := newEvent() + e := cetest.MinEvent() e.SetExtension("test", 456) err = a.Execute(&context.EventContext{ - Event: e, + Event: &e, }) So(err, ShouldBeNil) So(e.Extensions()["test2"], ShouldEqual, true) }) Convey("test condition <=", t, func() { - a, err := NewAction([]interface{}{newConditionIfAction().Name(), "$.test2", "$.test", "<=", "123", true, false}) + a, err := runtime.NewAction([]interface{}{funcName, "$.test2", "$.test", "<=", "123", true, false}) So(err, ShouldBeNil) - e := newEvent() + e := cetest.MinEvent() e.SetExtension("test", 456) err = a.Execute(&context.EventContext{ - Event: e, + Event: &e, }) So(err, ShouldBeNil) So(e.Extensions()["test2"], ShouldEqual, false) }) Convey("test condition <", t, func() { - a, err := NewAction([]interface{}{newConditionIfAction().Name(), "$.test2", "$.test", "<", "123", true, false}) + a, err := runtime.NewAction([]interface{}{funcName, "$.test2", "$.test", "<", "123", true, false}) So(err, ShouldBeNil) - e := newEvent() + e := cetest.MinEvent() e.SetExtension("test", 456) err = a.Execute(&context.EventContext{ - Event: e, + Event: &e, }) So(err, ShouldBeNil) So(e.Extensions()["test2"], ShouldEqual, false) }) Convey("test condition unDefine op invalid", t, func() { - a, err := NewAction([]interface{}{newConditionIfAction().Name(), "$.test2", "$.test", "<==", "123", true, false}) + a, err := runtime.NewAction([]interface{}{funcName, "$.test2", "$.test", "<==", "123", true, false}) So(err, ShouldBeNil) - e := newEvent() + e := cetest.MinEvent() e.SetExtension("test", 456) err = a.Execute(&context.EventContext{ - Event: e, + Event: &e, }) So(err, ShouldNotBeNil) }) diff --git a/internal/primitive/transform/action/time_action.go b/internal/primitive/transform/action/datetime/date_format.go similarity index 56% rename from internal/primitive/transform/action/time_action.go rename to internal/primitive/transform/action/datetime/date_format.go index 58986c45e..2eeb315fa 100644 --- a/internal/primitive/transform/action/time_action.go +++ b/internal/primitive/transform/action/datetime/date_format.go @@ -12,31 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -package action +package datetime import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" "github.com/linkall-labs/vanus/internal/primitive/transform/arg" "github.com/linkall-labs/vanus/internal/primitive/transform/function" ) -// ["date_format", "key", "format","timeZone"]. -func newDateFormatAction() Action { - return &sourceTargetSameAction{ - commonAction{ - fixedArgs: []arg.TypeList{arg.EventList, arg.All}, - variadicArg: arg.All, - fn: function.DateFormatFunction, - }, - } -} - -// ["unix_time_format", "key", "format","timeZone"]. -func newUnixTimeFormatAction() Action { - return &sourceTargetSameAction{ - commonAction{ - fixedArgs: []arg.TypeList{arg.EventList, arg.All}, - variadicArg: arg.All, - fn: function.UnixTimeFormatFunction, - }, +// NewDateFormatAction ["date_format", "path", "format","timeZone"]. +func NewDateFormatAction() action.Action { + a := &action.SourceTargetSameAction{} + a.CommonAction = action.CommonAction{ + ActionName: "DATE_FORMAT", + FixedArgs: []arg.TypeList{arg.EventList, arg.All}, + VariadicArg: arg.All, + Fn: function.DateFormatFunction, } + return a } diff --git a/internal/primitive/transform/action/datetime/date_format_test.go b/internal/primitive/transform/action/datetime/date_format_test.go new file mode 100644 index 000000000..6f8a88341 --- /dev/null +++ b/internal/primitive/transform/action/datetime/date_format_test.go @@ -0,0 +1,53 @@ +// Copyright 2022 Linkall Inc. +// +// 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 datetime_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/datetime" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestDateFormatAction(t *testing.T) { + funcName := datetime.NewDateFormatAction().Name() + Convey("test format date", t, func() { + Convey("test default time zone", func() { + e := cetest.MinEvent() + e.SetExtension("test", "2022-11-15T15:41:25Z") + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "Y-m-d H:i:s"}) + So(err, ShouldBeNil) + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, "2022-11-15 15:41:25") + }) + Convey("test with time zone", func() { + e := cetest.MinEvent() + e.SetExtension("test", "2022-11-15T15:41:25Z") + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "Y-m-d H:i:s", "EST"}) + So(err, ShouldBeNil) + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, "2022-11-15 10:41:25") + }) + }) +} diff --git a/internal/primitive/transform/action/datetime/unixtime_format.go b/internal/primitive/transform/action/datetime/unixtime_format.go new file mode 100644 index 000000000..fc77176ac --- /dev/null +++ b/internal/primitive/transform/action/datetime/unixtime_format.go @@ -0,0 +1,33 @@ +// Copyright 2022 Linkall Inc. +// +// 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 datetime + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/function" +) + +// NewUnixTimeFormatAction ["unix_time_format", "path", "format","timeZone"]. +func NewUnixTimeFormatAction() action.Action { + a := &action.SourceTargetSameAction{} + a.CommonAction = action.CommonAction{ + ActionName: "UNIX_TIME_FORMAT", + FixedArgs: []arg.TypeList{arg.EventList, arg.All}, + VariadicArg: arg.All, + Fn: function.UnixTimeFormatFunction, + } + return a +} diff --git a/internal/primitive/transform/action/time_action_test.go b/internal/primitive/transform/action/datetime/unixtime_format_test.go similarity index 52% rename from internal/primitive/transform/action/time_action_test.go rename to internal/primitive/transform/action/datetime/unixtime_format_test.go index 57a048b3c..4e7d9e88e 100644 --- a/internal/primitive/transform/action/time_action_test.go +++ b/internal/primitive/transform/action/datetime/unixtime_format_test.go @@ -12,59 +12,27 @@ // See the License for the specific language governing permissions and // limitations under the License. -package action +package datetime_test import ( "testing" + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/datetime" "github.com/linkall-labs/vanus/internal/primitive/transform/context" - - ce "github.com/cloudevents/sdk-go/v2" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" . "github.com/smartystreets/goconvey/convey" ) -func newEvent() *ce.Event { - e := ce.NewEvent() - e.SetID("testID") - e.SetType("testType") - e.SetSource("testSource") - return &e -} - -func TestDateFormatAction(t *testing.T) { - Convey("test format date", t, func() { - Convey("test default time zone", func() { - e := newEvent() - e.SetExtension("test", "2022-11-15T15:41:25Z") - a, err := NewAction([]interface{}{newDateFormatAction().Name(), "$.test", "Y-m-d H:i:s"}) - So(err, ShouldBeNil) - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldBeNil) - So(e.Extensions()["test"], ShouldEqual, "2022-11-15 15:41:25") - }) - Convey("test with time zone", func() { - e := newEvent() - e.SetExtension("test", "2022-11-15T15:41:25Z") - a, err := NewAction([]interface{}{newDateFormatAction().Name(), "$.test", "Y-m-d H:i:s", "EST"}) - So(err, ShouldBeNil) - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldBeNil) - So(e.Extensions()["test"], ShouldEqual, "2022-11-15 10:41:25") - }) - }) -} - func TestUnixTimeFormatAction(t *testing.T) { + funcName := datetime.NewUnixTimeFormatAction().Name() Convey("test format unix time", t, func() { Convey("test with default time zone", func() { - a, err := NewAction([]interface{}{newUnixTimeFormatAction().Name(), "$.data.time", "Y-m-d H:i:s"}) + a, err := runtime.NewAction([]interface{}{funcName, "$.data.time", "Y-m-d H:i:s"}) So(err, ShouldBeNil) + e := cetest.MinEvent() ceCtx := &context.EventContext{ - Event: newEvent(), + Event: &e, Data: map[string]interface{}{"time": float64(1668498285)}, } err = a.Execute(ceCtx) @@ -72,10 +40,11 @@ func TestUnixTimeFormatAction(t *testing.T) { So(ceCtx.Data.(map[string]interface{})["time"], ShouldEqual, "2022-11-15 07:44:45") }) Convey("test with time zone", func() { - a, err := NewAction([]interface{}{newUnixTimeFormatAction().Name(), "$.data.time", "Y-m-d H:i:s", "EST"}) + a, err := runtime.NewAction([]interface{}{funcName, "$.data.time", "Y-m-d H:i:s", "EST"}) So(err, ShouldBeNil) + e := cetest.MinEvent() ceCtx := &context.EventContext{ - Event: newEvent(), + Event: &e, Data: map[string]interface{}{"time": float64(1668498285)}, } err = a.Execute(ceCtx) diff --git a/internal/primitive/transform/action/math/math_add.go b/internal/primitive/transform/action/math/math_add.go new file mode 100644 index 000000000..490b0b64f --- /dev/null +++ b/internal/primitive/transform/action/math/math_add.go @@ -0,0 +1,33 @@ +// Copyright 2022 Linkall Inc. +// +// 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 math + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/function" +) + +// NewMathAddAction ["math_add", "toKey","key1","key2"]. +func NewMathAddAction() action.Action { + a := &action.FunctionAction{} + a.CommonAction = action.CommonAction{ + ActionName: "MATH_ADD", + FixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All}, + VariadicArg: arg.All, + Fn: function.MathAddFunction, + } + return a +} diff --git a/internal/primitive/transform/action/math/math_add_test.go b/internal/primitive/transform/action/math/math_add_test.go new file mode 100644 index 000000000..9b13e0ca5 --- /dev/null +++ b/internal/primitive/transform/action/math/math_add_test.go @@ -0,0 +1,39 @@ +// Copyright 2022 Linkall Inc. +// +// 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 math_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/math" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestMathAddAction(t *testing.T) { + funcName := math.NewMathAddAction().Name() + Convey("test math add", t, func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "123", "456", "321"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, int32(900)) + }) +} diff --git a/internal/primitive/transform/action/math/math_div.go b/internal/primitive/transform/action/math/math_div.go new file mode 100644 index 000000000..69848826e --- /dev/null +++ b/internal/primitive/transform/action/math/math_div.go @@ -0,0 +1,32 @@ +// Copyright 2022 Linkall Inc. +// +// 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 math + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/function" +) + +// NewMathDivAction ["math_div", "toKey","key1","key2"]. +func NewMathDivAction() action.Action { + a := &action.FunctionAction{} + a.CommonAction = action.CommonAction{ + ActionName: "MATH_DIV", + FixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All}, + Fn: function.MathDivFunction, + } + return a +} diff --git a/internal/primitive/transform/action/math/math_div_test.go b/internal/primitive/transform/action/math/math_div_test.go new file mode 100644 index 000000000..0c8799259 --- /dev/null +++ b/internal/primitive/transform/action/math/math_div_test.go @@ -0,0 +1,50 @@ +// Copyright 2022 Linkall Inc. +// +// 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 math_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/math" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestMathDivAction(t *testing.T) { + funcName := math.NewMathDivAction().Name() + Convey("test math div", t, func() { + Convey("div zero", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "333", "0"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldNotBeNil) + }) + Convey("div", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "333", "3"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, int32(111)) + }) + }) +} diff --git a/internal/primitive/transform/action/math/math_mul.go b/internal/primitive/transform/action/math/math_mul.go new file mode 100644 index 000000000..2b9c6f56d --- /dev/null +++ b/internal/primitive/transform/action/math/math_mul.go @@ -0,0 +1,33 @@ +// Copyright 2022 Linkall Inc. +// +// 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 math + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/function" +) + +// NewMathMulAction ["math_mul", "toKey","key1","key2"]. +func NewMathMulAction() action.Action { + a := &action.FunctionAction{} + a.CommonAction = action.CommonAction{ + ActionName: "MATH_MUL", + FixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All}, + VariadicArg: arg.All, + Fn: function.MathMulFunction, + } + return a +} diff --git a/internal/primitive/transform/action/math/math_mul_test.go b/internal/primitive/transform/action/math/math_mul_test.go new file mode 100644 index 000000000..21b26df49 --- /dev/null +++ b/internal/primitive/transform/action/math/math_mul_test.go @@ -0,0 +1,39 @@ +// Copyright 2022 Linkall Inc. +// +// 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 math_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/math" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestMathMulAction(t *testing.T) { + funcName := math.NewMathMulAction().Name() + Convey("test math mul", t, func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "111", "2", "3"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, int32(666)) + }) +} diff --git a/internal/primitive/transform/action/math/math_sub.go b/internal/primitive/transform/action/math/math_sub.go new file mode 100644 index 000000000..22a7b9f98 --- /dev/null +++ b/internal/primitive/transform/action/math/math_sub.go @@ -0,0 +1,32 @@ +// Copyright 2022 Linkall Inc. +// +// 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 math + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/function" +) + +// NewMathSubAction ["math_sub", "targetPath","value1","value2"]. +func NewMathSubAction() action.Action { + a := &action.FunctionAction{} + a.CommonAction = action.CommonAction{ + ActionName: "MATH_SUB", + FixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All}, + Fn: function.MathSubFunction, + } + return a +} diff --git a/internal/primitive/transform/action/math/math_sub_test.go b/internal/primitive/transform/action/math/math_sub_test.go new file mode 100644 index 000000000..4c6f5a0b0 --- /dev/null +++ b/internal/primitive/transform/action/math/math_sub_test.go @@ -0,0 +1,39 @@ +// Copyright 2022 Linkall Inc. +// +// 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 math_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/math" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestMathSubAction(t *testing.T) { + funcName := math.NewMathSubAction().Name() + Convey("test math sub", t, func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "456", "123"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, int32(333)) + }) +} diff --git a/internal/primitive/transform/action/math_action.go b/internal/primitive/transform/action/math_action.go deleted file mode 100644 index ce1b78892..000000000 --- a/internal/primitive/transform/action/math_action.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2022 Linkall Inc. -// -// 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 action - -import ( - "github.com/linkall-labs/vanus/internal/primitive/transform/arg" - "github.com/linkall-labs/vanus/internal/primitive/transform/function" -) - -// ["math_add", "toKey","key1","key2"]. -func newMathAddActionAction() Action { - return &commonAction{ - fixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All}, - variadicArg: arg.All, - fn: function.MathAddFunction, - } -} - -// ["math_sub", "toKey","key1","key2"]. -func newMathSubActionAction() Action { - return &commonAction{ - fixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All}, - fn: function.MathSubFunction, - } -} - -// ["math_mul", "toKey","key1","key2"]. -func newMathMulActionAction() Action { - return &commonAction{ - fixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All}, - variadicArg: arg.All, - fn: function.MathMulFunction, - } -} - -// ["math_div", "toKey","key1","key2"]. -func newMathDivActionAction() Action { - return &commonAction{ - fixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All}, - fn: function.MathDivFunction, - } -} diff --git a/internal/primitive/transform/action/math_action_test.go b/internal/primitive/transform/action/math_action_test.go deleted file mode 100644 index c64eaf482..000000000 --- a/internal/primitive/transform/action/math_action_test.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2022 Linkall Inc. -// -// 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 action - -import ( - "testing" - - "github.com/linkall-labs/vanus/internal/primitive/transform/context" - . "github.com/smartystreets/goconvey/convey" -) - -func TestMathAddAction(t *testing.T) { - Convey("test math add", t, func() { - a, err := NewAction([]interface{}{newMathAddActionAction().Name(), "$.test", "123", "456", "321"}) - So(err, ShouldBeNil) - e := newEvent() - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldBeNil) - So(e.Extensions()["test"], ShouldEqual, int32(900)) - }) -} - -func TestMathSubAction(t *testing.T) { - Convey("test math sub", t, func() { - a, err := NewAction([]interface{}{newMathSubActionAction().Name(), "$.test", "456", "123"}) - So(err, ShouldBeNil) - e := newEvent() - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldBeNil) - So(e.Extensions()["test"], ShouldEqual, int32(333)) - }) -} - -func TestMathMulAction(t *testing.T) { - Convey("test math mul", t, func() { - a, err := NewAction([]interface{}{newMathMulActionAction().Name(), "$.test", "111", "2", "3"}) - So(err, ShouldBeNil) - e := newEvent() - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldBeNil) - So(e.Extensions()["test"], ShouldEqual, int32(666)) - }) -} - -func TestMathDivAction(t *testing.T) { - Convey("test math div", t, func() { - Convey("div zero", func() { - a, err := NewAction([]interface{}{newMathDivActionAction().Name(), "$.test", "333", "0"}) - So(err, ShouldBeNil) - e := newEvent() - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldNotBeNil) - }) - Convey("div", func() { - a, err := NewAction([]interface{}{newMathDivActionAction().Name(), "$.test", "333", "3"}) - So(err, ShouldBeNil) - e := newEvent() - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldBeNil) - So(e.Extensions()["test"], ShouldEqual, int32(111)) - }) - }) -} diff --git a/internal/primitive/transform/action/string_action.go b/internal/primitive/transform/action/string_action.go deleted file mode 100644 index baecc7dde..000000000 --- a/internal/primitive/transform/action/string_action.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2022 Linkall Inc. -// -// 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 action - -import ( - "github.com/linkall-labs/vanus/internal/primitive/transform/arg" - "github.com/linkall-labs/vanus/internal/primitive/transform/function" -) - -// ["join", "toKey", "separator","key1",...]. -func newJoinAction() Action { - return &commonAction{ - fixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All}, - variadicArg: arg.All, - fn: function.JoinFunction, - } -} - -// ["upper_case", "key"]. -func newUpperAction() Action { - return &sourceTargetSameAction{ - commonAction{ - fixedArgs: []arg.TypeList{arg.EventList}, - fn: function.UpperFunction, - }, - } -} - -// ["lower_case", "key"]. -func newLowerAction() Action { - return &sourceTargetSameAction{ - commonAction{ - fixedArgs: []arg.TypeList{arg.EventList}, - fn: function.LowerFunction, - }, - } -} - -// ["add_prefix", "key", "value"]. -func newAddPrefixAction() Action { - return &sourceTargetSameAction{ - commonAction{ - fixedArgs: []arg.TypeList{arg.EventList, arg.All}, - fn: function.AddPrefixFunction, - }, - } -} - -// ["add_suffix", "key", "value"]. -func newAddSuffixAction() Action { - return &sourceTargetSameAction{ - commonAction{ - fixedArgs: []arg.TypeList{arg.EventList, arg.All}, - fn: function.AddSuffixFunction, - }, - } -} diff --git a/internal/primitive/transform/action/string_action_test.go b/internal/primitive/transform/action/string_action_test.go deleted file mode 100644 index d2d7905a9..000000000 --- a/internal/primitive/transform/action/string_action_test.go +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright 2022 Linkall Inc. -// -// 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 action - -import ( - "testing" - - "github.com/linkall-labs/vanus/internal/primitive/transform/context" - . "github.com/smartystreets/goconvey/convey" -) - -func TestJoinAction(t *testing.T) { - Convey("test join action", t, func() { - eventCtx := &context.EventContext{ - Event: newEvent(), - Data: map[string]interface{}{ - "array": []map[string]interface{}{ - {"key1": "value1"}, - {"key1": "value11"}, - {"key1": "value111"}, - }, - }, - } - Convey("test string", func() { - Convey("test one param", func() { - a, err := NewAction([]interface{}{newJoinAction().Name(), "$.test1", ",", "abc"}) - So(err, ShouldBeNil) - err = a.Execute(eventCtx) - So(err, ShouldBeNil) - So(eventCtx.Event.Extensions()["test1"], ShouldEqual, "abc") - }) - Convey("test many param", func() { - a, err := NewAction([]interface{}{newJoinAction().Name(), "$.test2", ",", "abc", "123"}) - So(err, ShouldBeNil) - err = a.Execute(eventCtx) - So(err, ShouldBeNil) - So(eventCtx.Event.Extensions()["test2"], ShouldEqual, "abc,123") - }) - }) - Convey("test string array", func() { - Convey("test one param", func() { - a, err := NewAction([]interface{}{newJoinAction().Name(), "$.array1", ",", "$.data.array[:].key1"}) - So(err, ShouldBeNil) - err = a.Execute(eventCtx) - So(err, ShouldBeNil) - So(eventCtx.Event.Extensions()["array1"], ShouldEqual, "value1,value11,value111") - }) - Convey("test many mixture param", func() { - a, err := NewAction([]interface{}{newJoinAction().Name(), "$.array2", ",", "$.data.array[:].key1", "$.source", "abc"}) - So(err, ShouldBeNil) - err = a.Execute(eventCtx) - So(err, ShouldBeNil) - So(eventCtx.Event.Extensions()["array2"], ShouldEqual, "value1,value11,value111,testSource,abc") - }) - }) - }) -} - -func TestUpperAction(t *testing.T) { - Convey("test upper", t, func() { - a, err := NewAction([]interface{}{newUpperAction().Name(), "$.test"}) - So(err, ShouldBeNil) - e := newEvent() - e.SetExtension("test", "testValue") - ceCtx := &context.EventContext{ - Event: e, - } - err = a.Execute(ceCtx) - So(err, ShouldBeNil) - So(e.Extensions()["test"], ShouldEqual, "TESTVALUE") - }) -} - -func TestLowerAction(t *testing.T) { - Convey("test lower", t, func() { - a, err := NewAction([]interface{}{newLowerAction().Name(), "$.test"}) - So(err, ShouldBeNil) - e := newEvent() - e.SetExtension("test", "testValue") - ceCtx := &context.EventContext{ - Event: e, - } - err = a.Execute(ceCtx) - So(err, ShouldBeNil) - So(e.Extensions()["test"], ShouldEqual, "testvalue") - }) -} - -func TestAddPrefixAction(t *testing.T) { - Convey("test add prefix", t, func() { - a, err := NewAction([]interface{}{newAddPrefixAction().Name(), "$.test", "prefix"}) - So(err, ShouldBeNil) - e := newEvent() - e.SetExtension("test", "testValue") - ceCtx := &context.EventContext{ - Event: e, - } - err = a.Execute(ceCtx) - So(err, ShouldBeNil) - So(e.Extensions()["test"], ShouldEqual, "prefixtestValue") - }) -} - -func TestAddSuffixAction(t *testing.T) { - Convey("test add suffix", t, func() { - a, err := NewAction([]interface{}{newAddSuffixAction().Name(), "$.test", "suffix"}) - So(err, ShouldBeNil) - e := newEvent() - e.SetExtension("test", "testValue") - ceCtx := &context.EventContext{ - Event: e, - } - err = a.Execute(ceCtx) - So(err, ShouldBeNil) - So(e.Extensions()["test"], ShouldEqual, "testValuesuffix") - }) -} diff --git a/internal/primitive/transform/action/strings/add_prefix.go b/internal/primitive/transform/action/strings/add_prefix.go new file mode 100644 index 000000000..83910e198 --- /dev/null +++ b/internal/primitive/transform/action/strings/add_prefix.go @@ -0,0 +1,32 @@ +// Copyright 2022 Linkall Inc. +// +// 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 strings + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/function" +) + +// NewAddPrefixAction ["add_prefix", "key", "value"]. +func NewAddPrefixAction() action.Action { + a := &action.SourceTargetSameAction{} + a.CommonAction = action.CommonAction{ + ActionName: "ADD_PREFIX", + FixedArgs: []arg.TypeList{arg.EventList, arg.All}, + Fn: function.AddPrefixFunction, + } + return a +} diff --git a/internal/primitive/transform/action/strings/add_prefix_test.go b/internal/primitive/transform/action/strings/add_prefix_test.go new file mode 100644 index 000000000..649c61322 --- /dev/null +++ b/internal/primitive/transform/action/strings/add_prefix_test.go @@ -0,0 +1,41 @@ +// Copyright 2022 Linkall Inc. +// +// 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 strings_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/strings" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestAddPrefixAction(t *testing.T) { + funcName := strings.NewAddPrefixAction().Name() + Convey("test add prefix", t, func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "prefix"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "testValue") + ceCtx := &context.EventContext{ + Event: &e, + } + err = a.Execute(ceCtx) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, "prefixtestValue") + }) +} diff --git a/internal/primitive/transform/action/strings/add_suffix.go b/internal/primitive/transform/action/strings/add_suffix.go new file mode 100644 index 000000000..5dec5a563 --- /dev/null +++ b/internal/primitive/transform/action/strings/add_suffix.go @@ -0,0 +1,32 @@ +// Copyright 2022 Linkall Inc. +// +// 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 strings + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/function" +) + +// NewAddSuffixAction ["add_suffix", "key", "value"]. +func NewAddSuffixAction() action.Action { + a := &action.SourceTargetSameAction{} + a.CommonAction = action.CommonAction{ + ActionName: "ADD_SUFFIX", + FixedArgs: []arg.TypeList{arg.EventList, arg.All}, + Fn: function.AddSuffixFunction, + } + return a +} diff --git a/internal/primitive/transform/action/strings/add_suffix_test.go b/internal/primitive/transform/action/strings/add_suffix_test.go new file mode 100644 index 000000000..f4be309ed --- /dev/null +++ b/internal/primitive/transform/action/strings/add_suffix_test.go @@ -0,0 +1,41 @@ +// Copyright 2022 Linkall Inc. +// +// 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 strings_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/strings" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestAddSuffixAction(t *testing.T) { + funcName := strings.NewAddSuffixAction().Name() + Convey("test add suffix", t, func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "suffix"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "testValue") + ceCtx := &context.EventContext{ + Event: &e, + } + err = a.Execute(ceCtx) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, "testValuesuffix") + }) +} diff --git a/internal/primitive/transform/action/strings/join.go b/internal/primitive/transform/action/strings/join.go new file mode 100644 index 000000000..42773402f --- /dev/null +++ b/internal/primitive/transform/action/strings/join.go @@ -0,0 +1,33 @@ +// Copyright 2022 Linkall Inc. +// +// 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 strings + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/function" +) + +// NewJoinAction ["join", "toKey", "separator","key1",...]. +func NewJoinAction() action.Action { + a := &action.FunctionAction{} + a.CommonAction = action.CommonAction{ + ActionName: "JOIN", + FixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All}, + VariadicArg: arg.All, + Fn: function.JoinFunction, + } + return a +} diff --git a/internal/primitive/transform/action/strings/join_test.go b/internal/primitive/transform/action/strings/join_test.go new file mode 100644 index 000000000..25c532f86 --- /dev/null +++ b/internal/primitive/transform/action/strings/join_test.go @@ -0,0 +1,74 @@ +// Copyright 2022 Linkall Inc. +// +// 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 strings_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/strings" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestJoinAction(t *testing.T) { + funcName := strings.NewJoinAction().Name() + Convey("test join action", t, func() { + e := cetest.MinEvent() + eventCtx := &context.EventContext{ + Event: &e, + Data: map[string]interface{}{ + "array": []map[string]interface{}{ + {"key1": "value1"}, + {"key1": "value11"}, + {"key1": "value111"}, + }, + }, + } + Convey("test string", func() { + Convey("test one param", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test1", ",", "abc"}) + So(err, ShouldBeNil) + err = a.Execute(eventCtx) + So(err, ShouldBeNil) + So(eventCtx.Event.Extensions()["test1"], ShouldEqual, "abc") + }) + Convey("test many param", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test2", ",", "abc", "123"}) + So(err, ShouldBeNil) + err = a.Execute(eventCtx) + So(err, ShouldBeNil) + So(eventCtx.Event.Extensions()["test2"], ShouldEqual, "abc,123") + }) + }) + Convey("test string array", func() { + Convey("test one param", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.array1", ",", "$.data.array[:].key1"}) + So(err, ShouldBeNil) + err = a.Execute(eventCtx) + So(err, ShouldBeNil) + So(eventCtx.Event.Extensions()["array1"], ShouldEqual, "value1,value11,value111") + }) + Convey("test many mixture param", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.array2", ",", "$.data.array[:].key1", "abc"}) + So(err, ShouldBeNil) + err = a.Execute(eventCtx) + So(err, ShouldBeNil) + So(eventCtx.Event.Extensions()["array2"], ShouldEqual, "value1,value11,value111,abc") + }) + }) + }) +} diff --git a/internal/primitive/transform/action/strings/lower_case.go b/internal/primitive/transform/action/strings/lower_case.go new file mode 100644 index 000000000..ba67b759b --- /dev/null +++ b/internal/primitive/transform/action/strings/lower_case.go @@ -0,0 +1,32 @@ +// Copyright 2022 Linkall Inc. +// +// 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 strings + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/function" +) + +// NewLowerAction ["lower_case", "key"]. +func NewLowerAction() action.Action { + a := &action.SourceTargetSameAction{} + a.CommonAction = action.CommonAction{ + ActionName: "LOWER_CASE", + FixedArgs: []arg.TypeList{arg.EventList}, + Fn: function.LowerFunction, + } + return a +} diff --git a/internal/primitive/transform/action/strings/lower_case_test.go b/internal/primitive/transform/action/strings/lower_case_test.go new file mode 100644 index 000000000..79c6bf0c0 --- /dev/null +++ b/internal/primitive/transform/action/strings/lower_case_test.go @@ -0,0 +1,41 @@ +// Copyright 2022 Linkall Inc. +// +// 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 strings_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/strings" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestLowerAction(t *testing.T) { + funcName := strings.NewLowerAction().Name() + Convey("test lower", t, func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "testValue") + ceCtx := &context.EventContext{ + Event: &e, + } + err = a.Execute(ceCtx) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, "testvalue") + }) +} diff --git a/internal/primitive/transform/action/regex_action.go b/internal/primitive/transform/action/strings/replace_with_regrex.go similarity index 77% rename from internal/primitive/transform/action/regex_action.go rename to internal/primitive/transform/action/strings/replace_with_regrex.go index 4f60add8c..dc795142e 100644 --- a/internal/primitive/transform/action/regex_action.go +++ b/internal/primitive/transform/action/strings/replace_with_regrex.go @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -package action +package strings import ( "regexp" "sync" + "github.com/linkall-labs/vanus/internal/primitive/transform/action" "github.com/linkall-labs/vanus/internal/primitive/transform/arg" "github.com/linkall-labs/vanus/internal/primitive/transform/common" "github.com/linkall-labs/vanus/internal/primitive/transform/context" @@ -25,31 +26,31 @@ import ( ) type replaceWithRegexAction struct { - commonAction + action.CommonAction pattern *regexp.Regexp expr string lock sync.RWMutex } -// ["replace_with_regex", "key", "pattern", "value"]. -func newReplaceWithRegexAction() Action { +// NewReplaceWithRegexAction ["replace_with_regex", "key", "pattern", "value"]. +func NewReplaceWithRegexAction() action.Action { return &replaceWithRegexAction{ - commonAction: commonAction{ - name: "REPLACE_WITH_REGEX", - fixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All}, + CommonAction: action.CommonAction{ + ActionName: "REPLACE_WITH_REGEX", + FixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All}, }, } } func (a *replaceWithRegexAction) Init(args []arg.Arg) error { - a.targetArg = args[0] - a.args = args - a.argTypes = []common.Type{common.String, common.String, common.String} + a.TargetArg = args[0] + a.Args = args + a.ArgTypes = []common.Type{common.String, common.String, common.String} return nil } func (a *replaceWithRegexAction) Execute(ceCtx *context.EventContext) error { - args, err := a.runArgs(ceCtx) + args, err := a.RunArgs(ceCtx) if err != nil { return err } @@ -63,7 +64,7 @@ func (a *replaceWithRegexAction) Execute(ceCtx *context.EventContext) error { } } newValue := a.getPattern().ReplaceAllString(originalValue, value) - return a.targetArg.SetValue(ceCtx, newValue) + return a.TargetArg.SetValue(ceCtx, newValue) } func (a *replaceWithRegexAction) setPattern(expr string) error { diff --git a/internal/primitive/transform/action/regex_action_test.go b/internal/primitive/transform/action/strings/replace_with_regrex_test.go similarity index 72% rename from internal/primitive/transform/action/regex_action_test.go rename to internal/primitive/transform/action/strings/replace_with_regrex_test.go index a28c81759..7a831e5ba 100644 --- a/internal/primitive/transform/action/regex_action_test.go +++ b/internal/primitive/transform/action/strings/replace_with_regrex_test.go @@ -12,23 +12,27 @@ // See the License for the specific language governing permissions and // limitations under the License. -package action +package strings_test import ( "testing" + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/strings" "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" . "github.com/smartystreets/goconvey/convey" ) func TestReplaceWithRegexAction(t *testing.T) { + funcName := strings.NewReplaceWithRegexAction().Name() Convey("test replace with regex", t, func() { - a, err := NewAction([]interface{}{newReplaceWithRegexAction().Name(), "$.test", "a", "value"}) + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "a", "value"}) So(err, ShouldBeNil) - e := newEvent() + e := cetest.MinEvent() e.SetExtension("test", "a-a") err = a.Execute(&context.EventContext{ - Event: e, + Event: &e, }) So(err, ShouldBeNil) So(e.Extensions()["test"], ShouldEqual, "value-value") diff --git a/internal/primitive/transform/action/strings/upper_case.go b/internal/primitive/transform/action/strings/upper_case.go new file mode 100644 index 000000000..62cfd2141 --- /dev/null +++ b/internal/primitive/transform/action/strings/upper_case.go @@ -0,0 +1,32 @@ +// Copyright 2022 Linkall Inc. +// +// 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 strings + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/function" +) + +// NewUpperAction ["upper_case", "key"]. +func NewUpperAction() action.Action { + a := &action.SourceTargetSameAction{} + a.CommonAction = action.CommonAction{ + ActionName: "UPPER_CASE", + FixedArgs: []arg.TypeList{arg.EventList}, + Fn: function.UpperFunction, + } + return a +} diff --git a/internal/primitive/transform/action/strings/upper_case_test.go b/internal/primitive/transform/action/strings/upper_case_test.go new file mode 100644 index 000000000..0d0b3048f --- /dev/null +++ b/internal/primitive/transform/action/strings/upper_case_test.go @@ -0,0 +1,41 @@ +// Copyright 2022 Linkall Inc. +// +// 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 strings_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/strings" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestUpperAction(t *testing.T) { + funcName := strings.NewUpperAction().Name() + Convey("test upper", t, func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "testValue") + ceCtx := &context.EventContext{ + Event: &e, + } + err = a.Execute(ceCtx) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, "TESTVALUE") + }) +} diff --git a/internal/primitive/transform/action/struct_action.go b/internal/primitive/transform/action/struct_action.go deleted file mode 100644 index 8c8fd269a..000000000 --- a/internal/primitive/transform/action/struct_action.go +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright 2022 Linkall Inc. -// -// 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 action - -import ( - "fmt" - - "github.com/linkall-labs/vanus/internal/primitive/transform/arg" - "github.com/linkall-labs/vanus/internal/primitive/transform/common" - "github.com/linkall-labs/vanus/internal/primitive/transform/context" -) - -// ["delete", "key"]. -type deleteAction struct { - commonAction -} - -func newDeleteAction() Action { - return &deleteAction{ - commonAction{ - name: "DELETE", - fixedArgs: []arg.TypeList{arg.EventList}, - }, - } -} - -func (a *deleteAction) Init(args []arg.Arg) error { - a.targetArg = args[0] - return nil -} - -func (a *deleteAction) Execute(ceCtx *context.EventContext) error { - return a.targetArg.DeleteValue(ceCtx) -} - -type createAction struct { - commonAction -} - -// ["create", "toKey", value]. -func newCreateActionAction() Action { - return &createAction{ - commonAction{ - name: "CREATE", - fixedArgs: []arg.TypeList{arg.EventList, arg.All}, - }, - } -} - -func (a *createAction) Init(args []arg.Arg) error { - a.targetArg = args[0] - a.args = args[1:] - a.argTypes = []common.Type{common.Any} - return nil -} - -func (a *createAction) Execute(ceCtx *context.EventContext) error { - v, _ := a.targetArg.Evaluate(ceCtx) - if v != nil { - return fmt.Errorf("key %s exist", a.targetArg.Original()) - } - args, err := a.runArgs(ceCtx) - if err != nil { - return err - } - return a.targetArg.SetValue(ceCtx, args[0]) -} - -type replaceAction struct { - commonAction -} - -// ["replace", "toKey", value]. -func newReplaceAction() Action { - return &replaceAction{ - commonAction{ - name: "REPLACE", - fixedArgs: []arg.TypeList{arg.EventList, arg.All}, - }, - } -} - -func (a *replaceAction) Init(args []arg.Arg) error { - a.targetArg = args[0] - a.args = args[1:] - a.argTypes = []common.Type{common.Any} - return nil -} - -func (a *replaceAction) Execute(ceCtx *context.EventContext) error { - v, _ := a.targetArg.Evaluate(ceCtx) - if v == nil { - return fmt.Errorf("key %s not exist", a.targetArg.Original()) - } - args, err := a.runArgs(ceCtx) - if err != nil { - return err - } - return a.targetArg.SetValue(ceCtx, args[0]) -} - -type moveAction struct { - commonAction -} - -// ["move", "fromKey", "toKey"]. -func newMoveActionAction() Action { - return &moveAction{ - commonAction{ - name: "MOVE", - fixedArgs: []arg.TypeList{arg.EventList, arg.EventList}, - }, - } -} - -func (a *moveAction) Init(args []arg.Arg) error { - a.targetArg = args[1] - a.args = args[:1] - a.argTypes = []common.Type{common.Any} - return nil -} - -func (a *moveAction) Execute(ceCtx *context.EventContext) error { - v, _ := a.targetArg.Evaluate(ceCtx) - if v != nil { - return fmt.Errorf("key %s exist", a.targetArg.Original()) - } - args, err := a.runArgs(ceCtx) - if err != nil { - return err - } - err = a.targetArg.SetValue(ceCtx, args[0]) - if err != nil { - return err - } - return a.args[0].DeleteValue(ceCtx) -} - -type renameAction struct { - commonAction -} - -// ["rename", "key", "newKey"]. -func newRenameActionAction() Action { - return &renameAction{ - commonAction{ - name: "RENAME", - fixedArgs: []arg.TypeList{arg.EventList, arg.EventList}, - }, - } -} - -func (a *renameAction) Init(args []arg.Arg) error { - a.targetArg = args[1] - a.args = args[:1] - a.argTypes = []common.Type{common.Any} - return nil -} - -func (a *renameAction) Execute(ceCtx *context.EventContext) error { - v, _ := a.targetArg.Evaluate(ceCtx) - if v != nil { - return fmt.Errorf("key %s exist", a.targetArg.Original()) - } - args, err := a.runArgs(ceCtx) - if err != nil { - return err - } - err = a.targetArg.SetValue(ceCtx, args[0]) - if err != nil { - return err - } - return a.args[0].DeleteValue(ceCtx) -} diff --git a/internal/primitive/transform/action/struct_action_test.go b/internal/primitive/transform/action/struct_action_test.go deleted file mode 100644 index db62be426..000000000 --- a/internal/primitive/transform/action/struct_action_test.go +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2022 Linkall Inc. -// -// 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 action - -import ( - "testing" - - "github.com/linkall-labs/vanus/internal/primitive/transform/context" - . "github.com/smartystreets/goconvey/convey" -) - -func TestDeleteAction(t *testing.T) { - Convey("test delete", t, func() { - Convey("delete cant not delete key", func() { - a, err := NewAction([]interface{}{newDeleteAction().Name(), "$.id"}) - So(err, ShouldBeNil) - e := newEvent() - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldNotBeNil) - }) - Convey("delete", func() { - a, err := NewAction([]interface{}{newDeleteAction().Name(), "$.test"}) - So(err, ShouldBeNil) - e := newEvent() - e.SetExtension("test", "abc") - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldBeNil) - So(len(e.Extensions()), ShouldEqual, 0) - }) - }) -} - -func TestCreateAction(t *testing.T) { - Convey("test create", t, func() { - Convey("create exist key", func() { - a, err := NewAction([]interface{}{newCreateActionAction().Name(), "$.test", "newValue"}) - So(err, ShouldBeNil) - e := newEvent() - e.SetExtension("test", "abc") - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldNotBeNil) - }) - Convey("creat invalid value", func() { - a, err := NewAction([]interface{}{newCreateActionAction().Name(), "$.test", map[string]interface{}{"a": "b"}}) - So(err, ShouldBeNil) - e := newEvent() - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldNotBeNil) - }) - Convey("creat", func() { - a, err := NewAction([]interface{}{newCreateActionAction().Name(), "$.test", "testValue"}) - So(err, ShouldBeNil) - e := newEvent() - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldBeNil) - So(e.Extensions()["test"], ShouldEqual, "testValue") - }) - }) -} - -func TestReplaceAction(t *testing.T) { - Convey("test replace", t, func() { - Convey("replace no exist key", func() { - a, err := NewAction([]interface{}{newReplaceAction().Name(), "$.test", "newValue"}) - So(err, ShouldBeNil) - e := newEvent() - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldNotBeNil) - }) - Convey("replace", func() { - a, err := NewAction([]interface{}{newReplaceAction().Name(), "$.test", "testValue"}) - So(err, ShouldBeNil) - e := newEvent() - e.SetExtension("test", "abc") - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldBeNil) - So(e.Extensions()["test"], ShouldEqual, "testValue") - }) - }) -} - -func TestMoveAction(t *testing.T) { - Convey("test move", t, func() { - Convey("move target key exist", func() { - a, err := NewAction([]interface{}{newMoveActionAction().Name(), "$.test", "$.data.abc.test"}) - So(err, ShouldBeNil) - e := newEvent() - e.SetExtension("test", "abc") - err = a.Execute(&context.EventContext{ - Event: e, - Data: map[string]interface{}{ - "abc": map[string]interface{}{ - "test": "value", - }, - }, - }) - So(err, ShouldNotBeNil) - }) - Convey("move", func() { - a, err := NewAction([]interface{}{newMoveActionAction().Name(), "$.test", "$.data.abc.test"}) - So(err, ShouldBeNil) - e := newEvent() - e.SetExtension("test", "abc") - ceCtx := &context.EventContext{ - Event: e, - Data: map[string]interface{}{}, - } - err = a.Execute(ceCtx) - So(err, ShouldBeNil) - So(len(e.Extensions()), ShouldEqual, 0) - So(ceCtx.Data.(map[string]interface{})["abc"].(map[string]interface{})["test"], ShouldEqual, "abc") - }) - }) -} - -func TestRenameAction(t *testing.T) { - Convey("test rename", t, func() { - Convey("rename target key exist", func() { - a, err := NewAction([]interface{}{newRenameActionAction().Name(), "$.test", "$.test2"}) - So(err, ShouldBeNil) - e := newEvent() - e.SetExtension("test", "abc") - e.SetExtension("test2", "abc2") - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldNotBeNil) - }) - Convey("rename", func() { - a, err := NewAction([]interface{}{newRenameActionAction().Name(), "$.test", "$.test2"}) - So(err, ShouldBeNil) - e := newEvent() - e.SetExtension("test", "abc") - err = a.Execute(&context.EventContext{ - Event: e, - }) - So(err, ShouldBeNil) - So(len(e.Extensions()), ShouldEqual, 1) - So(e.Extensions()["test2"], ShouldEqual, "abc") - }) - }) -} diff --git a/internal/primitive/transform/action/structs/create.go b/internal/primitive/transform/action/structs/create.go new file mode 100644 index 000000000..eaedb8dde --- /dev/null +++ b/internal/primitive/transform/action/structs/create.go @@ -0,0 +1,57 @@ +// Copyright 2022 Linkall Inc. +// +// 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 structs + +import ( + "fmt" + + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/common" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" +) + +type createAction struct { + action.CommonAction +} + +// NewCreateAction ["create", "path", value]. +func NewCreateAction() action.Action { + return &createAction{ + action.CommonAction{ + ActionName: "CREATE", + FixedArgs: []arg.TypeList{arg.EventList, arg.All}, + }, + } +} + +func (a *createAction) Init(args []arg.Arg) error { + a.TargetArg = args[0] + a.Args = args[1:] + a.ArgTypes = []common.Type{common.Any} + return nil +} + +func (a *createAction) Execute(ceCtx *context.EventContext) error { + v, _ := a.TargetArg.Evaluate(ceCtx) + if v != nil { + return fmt.Errorf("key %s exist", a.TargetArg.Original()) + } + args, err := a.RunArgs(ceCtx) + if err != nil { + return err + } + return a.TargetArg.SetValue(ceCtx, args[0]) +} diff --git a/internal/primitive/transform/action/structs/create_test.go b/internal/primitive/transform/action/structs/create_test.go new file mode 100644 index 000000000..b35414858 --- /dev/null +++ b/internal/primitive/transform/action/structs/create_test.go @@ -0,0 +1,60 @@ +// Copyright 2022 Linkall Inc. +// +// 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 structs_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/structs" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestCreateAction(t *testing.T) { + funcName := structs.NewCreateAction().Name() + Convey("test create", t, func() { + Convey("create exist key", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "newValue"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "abc") + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldNotBeNil) + }) + Convey("creat invalid value", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", map[string]interface{}{"a": "b"}}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldNotBeNil) + }) + Convey("creat", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "testValue"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, "testValue") + }) + }) +} diff --git a/internal/primitive/transform/action/structs/delete.go b/internal/primitive/transform/action/structs/delete.go new file mode 100644 index 000000000..da49bcfba --- /dev/null +++ b/internal/primitive/transform/action/structs/delete.go @@ -0,0 +1,44 @@ +// Copyright 2022 Linkall Inc. +// +// 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 structs + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" +) + +// ["delete", "key"]. +type deleteAction struct { + action.CommonAction +} + +func NewDeleteAction() action.Action { + return &deleteAction{ + action.CommonAction{ + ActionName: "DELETE", + FixedArgs: []arg.TypeList{arg.EventList}, + }, + } +} + +func (a *deleteAction) Init(args []arg.Arg) error { + a.TargetArg = args[0] + return nil +} + +func (a *deleteAction) Execute(ceCtx *context.EventContext) error { + return a.TargetArg.DeleteValue(ceCtx) +} diff --git a/internal/primitive/transform/action/structs/delete_test.go b/internal/primitive/transform/action/structs/delete_test.go new file mode 100644 index 000000000..84c2459bd --- /dev/null +++ b/internal/primitive/transform/action/structs/delete_test.go @@ -0,0 +1,51 @@ +// Copyright 2022 Linkall Inc. +// +// 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 structs_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/structs" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestDeleteAction(t *testing.T) { + funcName := structs.NewDeleteAction().Name() + Convey("test delete", t, func() { + Convey("delete cant not delete key", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.id"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldNotBeNil) + }) + Convey("delete", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "abc") + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldBeNil) + So(len(e.Extensions()), ShouldEqual, 0) + }) + }) +} diff --git a/internal/primitive/transform/action/structs/move.go b/internal/primitive/transform/action/structs/move.go new file mode 100644 index 000000000..46666c8b5 --- /dev/null +++ b/internal/primitive/transform/action/structs/move.go @@ -0,0 +1,62 @@ +// Copyright 2022 Linkall Inc. +// +// 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 structs + +import ( + "fmt" + + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/common" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" +) + +// ["move", "fromKey", "toKey"]. +type moveAction struct { + action.CommonAction +} + +func NewMoveAction() action.Action { + return &moveAction{ + action.CommonAction{ + ActionName: "MOVE", + FixedArgs: []arg.TypeList{arg.EventList, arg.EventList}, + }, + } +} + +func (a *moveAction) Init(args []arg.Arg) error { + a.TargetArg = args[1] + a.Args = args[:1] + a.ArgTypes = []common.Type{common.Any} + return nil +} + +func (a *moveAction) Execute(ceCtx *context.EventContext) error { + v, _ := a.TargetArg.Evaluate(ceCtx) + if v != nil { + return fmt.Errorf("key %s exist", a.TargetArg.Original()) + } + args, err := a.RunArgs(ceCtx) + if err != nil { + return err + } + err = a.TargetArg.SetValue(ceCtx, args[0]) + if err != nil { + return err + } + return a.Args[0].DeleteValue(ceCtx) +} diff --git a/internal/primitive/transform/action/structs/move_test.go b/internal/primitive/transform/action/structs/move_test.go new file mode 100644 index 000000000..bf8201201 --- /dev/null +++ b/internal/primitive/transform/action/structs/move_test.go @@ -0,0 +1,60 @@ +// Copyright 2022 Linkall Inc. +// +// 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 structs_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/structs" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestMoveAction(t *testing.T) { + funcName := structs.NewMoveAction().Name() + Convey("test move", t, func() { + Convey("move target key exist", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "$.data.abc.test"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "abc") + err = a.Execute(&context.EventContext{ + Event: &e, + Data: map[string]interface{}{ + "abc": map[string]interface{}{ + "test": "value", + }, + }, + }) + So(err, ShouldNotBeNil) + }) + Convey("move", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "$.data.abc.test"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "abc") + ceCtx := &context.EventContext{ + Event: &e, + Data: map[string]interface{}{}, + } + err = a.Execute(ceCtx) + So(err, ShouldBeNil) + So(len(e.Extensions()), ShouldEqual, 0) + So(ceCtx.Data.(map[string]interface{})["abc"].(map[string]interface{})["test"], ShouldEqual, "abc") + }) + }) +} diff --git a/internal/primitive/transform/action/structs/rename.go b/internal/primitive/transform/action/structs/rename.go new file mode 100644 index 000000000..3b7e2246f --- /dev/null +++ b/internal/primitive/transform/action/structs/rename.go @@ -0,0 +1,62 @@ +// Copyright 2022 Linkall Inc. +// +// 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 structs + +import ( + "fmt" + + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/common" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" +) + +// ["rename", "key", "newKey"]. +type renameAction struct { + action.CommonAction +} + +func NewRenameAction() action.Action { + return &renameAction{ + action.CommonAction{ + ActionName: "RENAME", + FixedArgs: []arg.TypeList{arg.EventList, arg.EventList}, + }, + } +} + +func (a *renameAction) Init(args []arg.Arg) error { + a.TargetArg = args[1] + a.Args = args[:1] + a.ArgTypes = []common.Type{common.Any} + return nil +} + +func (a *renameAction) Execute(ceCtx *context.EventContext) error { + v, _ := a.TargetArg.Evaluate(ceCtx) + if v != nil { + return fmt.Errorf("key %s exist", a.TargetArg.Original()) + } + args, err := a.RunArgs(ceCtx) + if err != nil { + return err + } + err = a.TargetArg.SetValue(ceCtx, args[0]) + if err != nil { + return err + } + return a.Args[0].DeleteValue(ceCtx) +} diff --git a/internal/primitive/transform/action/structs/rename_test.go b/internal/primitive/transform/action/structs/rename_test.go new file mode 100644 index 000000000..74d86f796 --- /dev/null +++ b/internal/primitive/transform/action/structs/rename_test.go @@ -0,0 +1,54 @@ +// Copyright 2022 Linkall Inc. +// +// 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 structs_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/structs" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestRenameAction(t *testing.T) { + funcName := structs.NewRenameAction().Name() + Convey("test rename", t, func() { + Convey("rename target key exist", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "$.test2"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "abc") + e.SetExtension("test2", "abc2") + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldNotBeNil) + }) + Convey("rename", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "$.test2"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "abc") + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldBeNil) + So(len(e.Extensions()), ShouldEqual, 1) + So(e.Extensions()["test2"], ShouldEqual, "abc") + }) + }) +} diff --git a/internal/primitive/transform/action/structs/replace.go b/internal/primitive/transform/action/structs/replace.go new file mode 100644 index 000000000..ce1cf93dd --- /dev/null +++ b/internal/primitive/transform/action/structs/replace.go @@ -0,0 +1,58 @@ +// Copyright 2022 Linkall Inc. +// +// 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 structs + +import ( + "fmt" + + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/common" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" +) + +// ["replace", "toKey", value]. +type replaceAction struct { + action.CommonAction +} + +func NewReplaceAction() action.Action { + return &replaceAction{ + action.CommonAction{ + ActionName: "REPLACE", + FixedArgs: []arg.TypeList{arg.EventList, arg.All}, + }, + } +} + +func (a *replaceAction) Init(args []arg.Arg) error { + a.TargetArg = args[0] + a.Args = args[1:] + a.ArgTypes = []common.Type{common.Any} + return nil +} + +func (a *replaceAction) Execute(ceCtx *context.EventContext) error { + v, _ := a.TargetArg.Evaluate(ceCtx) + if v == nil { + return fmt.Errorf("key %s not exist", a.TargetArg.Original()) + } + args, err := a.RunArgs(ceCtx) + if err != nil { + return err + } + return a.TargetArg.SetValue(ceCtx, args[0]) +} diff --git a/internal/primitive/transform/action/structs/replace_test.go b/internal/primitive/transform/action/structs/replace_test.go new file mode 100644 index 000000000..617e08b2a --- /dev/null +++ b/internal/primitive/transform/action/structs/replace_test.go @@ -0,0 +1,51 @@ +// Copyright 2022 Linkall Inc. +// +// 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 structs_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/structs" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestReplaceAction(t *testing.T) { + funcName := structs.NewReplaceAction().Name() + Convey("test replace", t, func() { + Convey("replace no exist key", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "newValue"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldNotBeNil) + }) + Convey("replace", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "testValue"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "abc") + err = a.Execute(&context.EventContext{ + Event: &e, + }) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, "testValue") + }) + }) +} diff --git a/internal/primitive/transform/function/format_functions.go b/internal/primitive/transform/function/datatime_functions.go similarity index 99% rename from internal/primitive/transform/function/format_functions.go rename to internal/primitive/transform/function/datatime_functions.go index 84ef3df73..908befb39 100644 --- a/internal/primitive/transform/function/format_functions.go +++ b/internal/primitive/transform/function/datatime_functions.go @@ -17,9 +17,8 @@ package function import ( "time" - "github.com/linkall-labs/vanus/internal/primitive/transform/function/util" - "github.com/linkall-labs/vanus/internal/primitive/transform/common" + "github.com/linkall-labs/vanus/internal/primitive/transform/function/util" ) var DateFormatFunction = function{ diff --git a/internal/primitive/transform/runtime/action.go b/internal/primitive/transform/runtime/action.go new file mode 100644 index 000000000..12dd0e760 --- /dev/null +++ b/internal/primitive/transform/runtime/action.go @@ -0,0 +1,75 @@ +// Copyright 2022 Linkall Inc. +// +// 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 runtime + +import ( + "fmt" + stdStrs "strings" + + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/pkg/errors" +) + +type newAction func() action.Action + +var actionMap = map[string]newAction{} + +func AddAction(actionFn newAction) error { + a := actionFn() + name := stdStrs.ToUpper(a.Name()) + if _, exist := actionMap[name]; exist { + return fmt.Errorf("action %s has exist", name) + } + actionMap[name] = actionFn + return nil +} + +func NewAction(command []interface{}) (action.Action, error) { + funcName, ok := command[0].(string) + if !ok { + return nil, fmt.Errorf("command name must be string") + } + actionFn, exist := actionMap[stdStrs.ToUpper(funcName)] + if !exist { + return nil, fmt.Errorf("command %s not exist", funcName) + } + a := actionFn() + argNum := len(command) - 1 + if argNum < a.Arity() { + return nil, fmt.Errorf("command %s arg number is not enough, it need %d but only have %d", + funcName, a.Arity(), argNum) + } + if argNum > a.Arity() && !a.IsVariadic() { + return nil, fmt.Errorf("command %s arg number is too many, it need %d but have %d", funcName, a.Arity(), argNum) + } + args := make([]arg.Arg, argNum) + for i := 1; i < len(command); i++ { + _arg, err := arg.NewArg(command[i]) + if err != nil { + return nil, errors.Wrapf(err, "command %s arg %d is invalid", funcName, i) + } + argType := a.ArgType(i - 1) + if !argType.Contains(_arg) { + return nil, fmt.Errorf("command %s arg %d not support type %s", funcName, i, _arg.Type()) + } + args[i-1] = _arg + } + err := a.Init(args) + if err != nil { + return nil, errors.Wrapf(err, "command %s init error", funcName) + } + return a, nil +} diff --git a/internal/primitive/transform/action/action_bench_test.go b/internal/primitive/transform/runtime/action_bench_test.go similarity index 96% rename from internal/primitive/transform/action/action_bench_test.go rename to internal/primitive/transform/runtime/action_bench_test.go index 459012e3e..13699d78a 100644 --- a/internal/primitive/transform/action/action_bench_test.go +++ b/internal/primitive/transform/runtime/action_bench_test.go @@ -12,12 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -package action_test +package runtime import ( "testing" - "github.com/linkall-labs/vanus/internal/primitive/transform/action" "github.com/linkall-labs/vanus/internal/primitive/transform/context" ce "github.com/cloudevents/sdk-go/v2" @@ -25,7 +24,7 @@ import ( ) func actionBenchmark(command []interface{}) func(b *testing.B) { - a, err := action.NewAction(command) + a, err := NewAction(command) if err != nil { panic(err) } diff --git a/internal/primitive/transform/runtime/action_test.go b/internal/primitive/transform/runtime/action_test.go new file mode 100644 index 000000000..4cb486708 --- /dev/null +++ b/internal/primitive/transform/runtime/action_test.go @@ -0,0 +1,70 @@ +// Copyright 2022 Linkall Inc. +// +// 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 runtime + +import ( + "testing" + + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/function" + . "github.com/smartystreets/goconvey/convey" +) + +func newTestAction() action.Action { + return &action.SourceTargetSameAction{ + FunctionAction: action.FunctionAction{ + CommonAction: action.CommonAction{ + ActionName: "test_func", + FixedArgs: []arg.TypeList{arg.EventList}, + Fn: function.LowerFunction, + }, + }, + } +} + +func TestNewAction(t *testing.T) { + _ = AddAction(newTestAction) + Convey("test new action", t, func() { + Convey("func name is not string", func() { + _, err := NewAction([]interface{}{123}) + So(err, ShouldNotBeNil) + }) + Convey("func name no exist", func() { + _, err := NewAction([]interface{}{"UnknownCommand"}) + So(err, ShouldNotBeNil) + }) + Convey("func arity not enough", func() { + _, err := NewAction([]interface{}{"test_func"}) + So(err, ShouldNotBeNil) + }) + Convey("func arity number greater than", func() { + _, err := NewAction([]interface{}{"test_func", "arg1", "arg2"}) + So(err, ShouldNotBeNil) + }) + Convey("func new arg error", func() { + _, err := NewAction([]interface{}{"test_func", "$.a-b"}) + So(err, ShouldNotBeNil) + }) + Convey("func new arg type is invalid", func() { + _, err := NewAction([]interface{}{"test_func", "arg"}) + So(err, ShouldNotBeNil) + }) + Convey("func new valid", func() { + _, err := NewAction([]interface{}{"test_func", "$.id"}) + So(err, ShouldBeNil) + }) + }) +} diff --git a/internal/primitive/transform/runtime/init.go b/internal/primitive/transform/runtime/init.go new file mode 100644 index 000000000..0e6739bb7 --- /dev/null +++ b/internal/primitive/transform/runtime/init.go @@ -0,0 +1,57 @@ +// Copyright 2022 Linkall Inc. +// +// 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 runtime + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action/datetime" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/math" + + "github.com/linkall-labs/vanus/internal/primitive/transform/action/strings" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/structs" + + "github.com/linkall-labs/vanus/internal/primitive/transform/action/condition" +) + +func init() { + for _, fn := range []newAction{ + // struct + structs.NewCreateAction, + structs.NewDeleteAction, + structs.NewReplaceAction, + structs.NewMoveAction, + structs.NewRenameAction, + // math + math.NewMathAddAction, + math.NewMathSubAction, + math.NewMathMulAction, + math.NewMathDivAction, + // datetime + datetime.NewDateFormatAction, + datetime.NewUnixTimeFormatAction, + // string + strings.NewJoinAction, + strings.NewUpperAction, + strings.NewLowerAction, + strings.NewAddPrefixAction, + strings.NewAddSuffixAction, + strings.NewReplaceWithRegexAction, + // condition + condition.NewConditionIfAction, + } { + if err := AddAction(fn); err != nil { + panic(err) + } + } +} diff --git a/internal/trigger/mock_worker.go b/internal/trigger/mock_worker.go index ff5a030d5..0213b3e33 100644 --- a/internal/trigger/mock_worker.go +++ b/internal/trigger/mock_worker.go @@ -50,6 +50,20 @@ func (mr *MockWorkerMockRecorder) AddSubscription(ctx, subscription interface{}) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddSubscription", reflect.TypeOf((*MockWorker)(nil).AddSubscription), ctx, subscription) } +// Init mocks base method. +func (m *MockWorker) Init(ctx context.Context) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Init", ctx) + ret0, _ := ret[0].(error) + return ret0 +} + +// Init indicates an expected call of Init. +func (mr *MockWorkerMockRecorder) Init(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Init", reflect.TypeOf((*MockWorker)(nil).Init), ctx) +} + // PauseSubscription mocks base method. func (m *MockWorker) PauseSubscription(ctx context.Context, id vanus.ID) error { m.ctrl.T.Helper() diff --git a/internal/trigger/server.go b/internal/trigger/server.go index 82725a20c..a65dc9ade 100644 --- a/internal/trigger/server.go +++ b/internal/trigger/server.go @@ -156,7 +156,14 @@ func (s *server) ResetOffsetToTimestamp(ctx context.Context, } func (s *server) Initialize(ctx context.Context) error { - err := s.worker.Register(ctx) + err := s.worker.Init(ctx) + if err != nil { + log.Error(ctx, "worker init error", map[string]interface{}{ + log.KeyError: err, + }) + return err + } + err = s.worker.Register(ctx) if err != nil { log.Error(ctx, "register trigger worker error", map[string]interface{}{ "tcAddr": s.config.ControllerAddr, diff --git a/internal/trigger/server_test.go b/internal/trigger/server_test.go index 06fa41929..a44d5f6bc 100644 --- a/internal/trigger/server_test.go +++ b/internal/trigger/server_test.go @@ -102,6 +102,7 @@ func TestServerInitAndClose(t *testing.T) { s := NewTriggerServer(Config{}).(*server) s.worker = w Convey("test init", func() { + w.EXPECT().Init(gomock.Any()).Return(nil) w.EXPECT().Register(gomock.Any()).Return(nil) err := s.Initialize(ctx) So(err, ShouldBeNil) diff --git a/internal/trigger/transform/pipeline/pipeline.go b/internal/trigger/transform/pipeline/pipeline.go index 9a26ac1d5..c35c71c54 100644 --- a/internal/trigger/transform/pipeline/pipeline.go +++ b/internal/trigger/transform/pipeline/pipeline.go @@ -20,6 +20,7 @@ import ( "github.com/linkall-labs/vanus/internal/primitive" "github.com/linkall-labs/vanus/internal/primitive/transform/action" "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" "github.com/linkall-labs/vanus/observability/log" ) @@ -36,7 +37,7 @@ func NewPipeline() *Pipeline { func (p *Pipeline) Parse(actions []*primitive.Action) { p.actions = make([]action.Action, 0, len(actions)) for i := range actions { - _action, err := action.NewAction(actions[i].Command) + _action, err := runtime.NewAction(actions[i].Command) if err != nil { // it has check in controller so err must be nil otherwise controller check has bug log.Warning(stdCtx.TODO(), "new action error", map[string]interface{}{ diff --git a/internal/trigger/worker.go b/internal/trigger/worker.go index eced639be..ef1f4fd91 100644 --- a/internal/trigger/worker.go +++ b/internal/trigger/worker.go @@ -36,6 +36,7 @@ import ( ) type Worker interface { + Init(ctx context.Context) error Register(ctx context.Context) error Unregister(ctx context.Context) error Start(ctx context.Context) error @@ -78,11 +79,7 @@ func NewWorker(config Config) Worker { triggerMap: make(map[vanus.ID]trigger.Trigger), newTrigger: trigger.NewTrigger, } - if err := m.ctrl.WaitForControllerReady(false); err != nil { - panic("wait for controller ready timeout") - } m.client = m.ctrl.TriggerService().RawClient() - m.ctx, m.stop = context.WithCancel(context.Background()) return m } @@ -106,6 +103,11 @@ func (w *worker) deleteTrigger(id vanus.ID) { delete(w.triggerMap, id) } +func (w *worker) Init(ctx context.Context) error { + err := w.ctrl.WaitForControllerReady(false) + return err +} + func (w *worker) Register(ctx context.Context) error { _, err := w.client.RegisterTriggerWorker(ctx, &ctrlpb.RegisterTriggerWorkerRequest{ Address: w.config.TriggerAddr, From f4de8b17dec4df23ddce1743f0d79c6ec14d6e6a Mon Sep 17 00:00:00 2001 From: delu Date: Fri, 23 Dec 2022 15:04:28 +0800 Subject: [PATCH 03/46] feat: add function render_array (#358) * feat: add function render_array Signed-off-by: delu * feat: add function render_array Signed-off-by: delu * fix: golangci init Signed-off-by: delu Signed-off-by: delu --- .../transform/action/render/array.go | 114 +++++++++++++ .../transform/action/render/array_test.go | 155 ++++++++++++++++++ internal/primitive/transform/arg/arg.go | 2 +- internal/primitive/transform/runtime/init.go | 7 +- 4 files changed, 274 insertions(+), 4 deletions(-) create mode 100644 internal/primitive/transform/action/render/array.go create mode 100644 internal/primitive/transform/action/render/array_test.go diff --git a/internal/primitive/transform/action/render/array.go b/internal/primitive/transform/action/render/array.go new file mode 100644 index 000000000..5d34c6290 --- /dev/null +++ b/internal/primitive/transform/action/render/array.go @@ -0,0 +1,114 @@ +// Copyright 2022 Linkall Inc. +// +// 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 render + +import ( + "fmt" + "strings" + + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/common" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" +) + +// ["render_array","targetPath","render root","render template"]. +type renderArrayAction struct { + action.CommonAction + paths []string + template string + leftDelim string + rightDelim string +} + +func NewRenderArrayAction() action.Action { + a := &renderArrayAction{ + leftDelim: "<@", + rightDelim: ">", + } + a.CommonAction = action.CommonAction{ + ActionName: "RENDER_ARRAY", + FixedArgs: []arg.TypeList{arg.EventList, []arg.Type{arg.EventData}, []arg.Type{arg.Constant}}, + } + return a +} + +func (a *renderArrayAction) Init(args []arg.Arg) error { + a.TargetArg = args[0] + jsonPrefix := args[1].Original() + text := args[2].Original() + var pos int + var sb strings.Builder + leftDelimLen := len(a.leftDelim) + for { + x := strings.Index(text[pos:], a.leftDelim) + if x < 0 { + sb.WriteString(text[pos:]) + break + } + ldp := pos + x + leftDelimLen + y := strings.Index(text[ldp:], a.rightDelim) + if y < 0 { + sb.WriteString(text[pos:]) + break + } + if x > 0 { + sb.WriteString(text[pos : pos+x]) + } + a.paths = append(a.paths, text[ldp:ldp+y]) + + sb.WriteString("%v") + pos = ldp + y + len(a.rightDelim) + if pos == len(text) { + break + } + } + a.template = sb.String() + for _, path := range a.paths { + _arg, err := arg.NewArg(jsonPrefix + "[:]" + path) + if err != nil { + return err + } + a.Args = append(a.Args, _arg) + a.ArgTypes = append(a.ArgTypes, common.Array) + } + return nil +} + +func (a *renderArrayAction) Execute(ceCtx *context.EventContext) error { + args, err := a.RunArgs(ceCtx) + if err != nil { + return err + } + if len(args) == 0 { + return a.TargetArg.SetValue(ceCtx, []string{a.template}) + } + _len := len(args[0].([]interface{})) + for i := 1; i < len(args); i++ { + if len(args[i].([]interface{})) != _len { + return fmt.Errorf("template %s value length is not same", a.leftDelim+a.paths[i]+a.rightDelim) + } + } + + target := make([]string, _len) + for i := 0; i < _len; i++ { + value := make([]interface{}, len(a.paths)) + for j := 0; j < len(args); j++ { + value[j] = args[j].([]interface{})[i] + } + target[i] = fmt.Sprintf(a.template, value...) + } + return a.TargetArg.SetValue(ceCtx, target) +} diff --git a/internal/primitive/transform/action/render/array_test.go b/internal/primitive/transform/action/render/array_test.go new file mode 100644 index 000000000..cce109cac --- /dev/null +++ b/internal/primitive/transform/action/render/array_test.go @@ -0,0 +1,155 @@ +// Copyright 2022 Linkall Inc. +// +// 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 render_test + +import ( + stdJson "encoding/json" + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/render" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestRenderArrayAction(t *testing.T) { + funcName := render.NewRenderArrayAction().Name() + Convey("test render array invalid", t, func() { + jsonStr := `{ + "array": [ + { + "name": "name1", + "number": 1 + }, + { + "name": "name2", + "number": "2" + }, + { + "name": "name3" + } + ] + }` + Convey("render param not same", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.data.render", "$.data.array", "begin <@.name> <@.number> end"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + err = a.Execute(&context.EventContext{ + Event: &e, + Data: data, + }) + So(err, ShouldNotBeNil) + }) + }) + Convey("test render array valid", t, func() { + jsonStr := `{ + "array": [ + { + "name": "name1", + "number": 1 + }, + { + "name": "name2", + "number": "2" + }, + { + "name": "name3", + "number": "3" + } + ] + }` + Convey("render constants", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.data.render", "$.data.array", "abc"}) + So(err, ShouldBeNil) + + e := cetest.MinEvent() + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + err = a.Execute(&context.EventContext{ + Event: &e, + Data: data, + }) + So(err, ShouldBeNil) + render, exist := data["render"] + So(exist, ShouldBeTrue) + So(len(render.([]string)), ShouldEqual, 1) + So(render.([]string)[0], ShouldEqual, "abc") + }) + Convey("render variable template", func() { + Convey("render all variable", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.data.render", "$.data.array", "<@.name><@.number>"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + err = a.Execute(&context.EventContext{ + Event: &e, + Data: data, + }) + So(err, ShouldBeNil) + render, exist := data["render"] + So(exist, ShouldBeTrue) + So(len(render.([]string)), ShouldEqual, 3) + So(render.([]string)[0], ShouldEqual, "name11") + So(render.([]string)[1], ShouldEqual, "name22") + So(render.([]string)[2], ShouldEqual, "name33") + }) + Convey("render begin and end", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.data.render", "$.data.array", "<@.name> and <@.number>"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + err = a.Execute(&context.EventContext{ + Event: &e, + Data: data, + }) + So(err, ShouldBeNil) + render, exist := data["render"] + So(exist, ShouldBeTrue) + So(len(render.([]string)), ShouldEqual, 3) + So(render.([]string)[0], ShouldEqual, "name1 and 1") + So(render.([]string)[1], ShouldEqual, "name2 and 2") + So(render.([]string)[2], ShouldEqual, "name3 and 3") + }) + Convey("render other", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.data.render", "$.data.array", "Name: <@.name> Num: <@.number> <@abc"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + err = a.Execute(&context.EventContext{ + Event: &e, + Data: data, + }) + So(err, ShouldBeNil) + render, exist := data["render"] + So(exist, ShouldBeTrue) + So(len(render.([]string)), ShouldEqual, 3) + So(render.([]string)[0], ShouldEqual, "Name: name1 Num: 1 <@abc") + So(render.([]string)[1], ShouldEqual, "Name: name2 Num: 2 <@abc") + So(render.([]string)[2], ShouldEqual, "Name: name3 Num: 3 <@abc") + }) + }) + }) +} diff --git a/internal/primitive/transform/arg/arg.go b/internal/primitive/transform/arg/arg.go index 96872c3b9..a928ed070 100644 --- a/internal/primitive/transform/arg/arg.go +++ b/internal/primitive/transform/arg/arg.go @@ -83,7 +83,7 @@ func NewArg(arg interface{}) (Arg, error) { if argLen >= 2 && argName[:2] == EventArgPrefix { return newEventAttribute(argName) } - if argLen >= 3 && argName[0] == '<' && argName[argLen-1] == '>' { + if argLen >= 3 && argName[0] == '<' && argName[argLen-1] == '>' && argName[1] != '@' { return newDefine(argName), nil } } diff --git a/internal/primitive/transform/runtime/init.go b/internal/primitive/transform/runtime/init.go index 0e6739bb7..60438cb5d 100644 --- a/internal/primitive/transform/runtime/init.go +++ b/internal/primitive/transform/runtime/init.go @@ -15,13 +15,12 @@ package runtime import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action/condition" "github.com/linkall-labs/vanus/internal/primitive/transform/action/datetime" "github.com/linkall-labs/vanus/internal/primitive/transform/action/math" - + "github.com/linkall-labs/vanus/internal/primitive/transform/action/render" "github.com/linkall-labs/vanus/internal/primitive/transform/action/strings" "github.com/linkall-labs/vanus/internal/primitive/transform/action/structs" - - "github.com/linkall-labs/vanus/internal/primitive/transform/action/condition" ) func init() { @@ -49,6 +48,8 @@ func init() { strings.NewReplaceWithRegexAction, // condition condition.NewConditionIfAction, + // render + render.NewRenderArrayAction, } { if err := AddAction(fn); err != nil { panic(err) From 6fbb9b4059998e2076a5e8a75b771ecf97194fd3 Mon Sep 17 00:00:00 2001 From: delu Date: Sat, 24 Dec 2022 20:00:18 +0800 Subject: [PATCH 04/46] feat: support push ordered event (#360) Signed-off-by: delu Signed-off-by: delu --- internal/convert/convert.go | 2 + internal/primitive/subscription.go | 2 + internal/trigger/trigger/config.go | 8 ++ internal/trigger/trigger/trigger.go | 45 +++++--- internal/trigger/trigger/util.go | 4 + internal/trigger/worker.go | 3 +- proto/pkg/meta/meta.pb.go | 170 +++++++++++++++------------- proto/proto/meta.proto | 1 + vsctl/command/flag.go | 1 + vsctl/command/subscription.go | 5 +- 10 files changed, 142 insertions(+), 99 deletions(-) diff --git a/internal/convert/convert.go b/internal/convert/convert.go index 2bb4fd060..801cd6c4e 100644 --- a/internal/convert/convert.go +++ b/internal/convert/convert.go @@ -207,6 +207,7 @@ func fromPbSubscriptionConfig(config *pb.SubscriptionConfig) primitive.Subscript MaxRetryAttempts: config.MaxRetryAttempts, DeliveryTimeout: config.DeliveryTimeout, DeadLetterEventbus: config.DeadLetterEventbus, + OrderedEvent: config.OrderedEvent, } switch config.OffsetType { case pb.SubscriptionConfig_LATEST: @@ -226,6 +227,7 @@ func toPbSubscriptionConfig(config primitive.SubscriptionConfig) *pb.Subscriptio MaxRetryAttempts: config.MaxRetryAttempts, DeliveryTimeout: config.DeliveryTimeout, DeadLetterEventbus: config.DeadLetterEventbus, + OrderedEvent: config.OrderedEvent, } switch config.OffsetType { case primitive.LatestOffset: diff --git a/internal/primitive/subscription.go b/internal/primitive/subscription.go index fb9401b5e..1e0b644b9 100644 --- a/internal/primitive/subscription.go +++ b/internal/primitive/subscription.go @@ -71,6 +71,8 @@ type SubscriptionConfig struct { DeliveryTimeout uint32 `json:"delivery_timeout,omitempty"` MaxRetryAttempts *uint32 `json:"max_retry_attempts,omitempty"` DeadLetterEventbus string `json:"dead_letter_eventbus,omitempty"` + // send event with ordered + OrderedEvent bool `json:"ordered_event"` } // GetMaxRetryAttempts return MaxRetryAttempts if nil return -1. diff --git a/internal/trigger/trigger/config.go b/internal/trigger/trigger/config.go index 490744f17..6e6470688 100644 --- a/internal/trigger/trigger/config.go +++ b/internal/trigger/trigger/config.go @@ -38,6 +38,7 @@ type Config struct { Controllers []string DeadLetterEventbus string MaxWriteAttempt int + Ordered bool } func defaultConfig() Config { @@ -91,6 +92,13 @@ func WithDeliveryTimeout(timeout uint32) Option { } } +func WithOrdered(ordered bool) Option { + return func(t *trigger) { + t.config.Ordered = ordered + t.config.FilterProcessSize = 1 + } +} + func WithRateLimit(rateLimit uint32) Option { return func(t *trigger) { t.config.RateLimit = rateLimit diff --git a/internal/trigger/trigger/trigger.go b/internal/trigger/trigger/trigger.go index 4797e4b85..bf1238f76 100644 --- a/internal/trigger/trigger/trigger.go +++ b/internal/trigger/trigger/trigger.go @@ -278,27 +278,38 @@ func (t *trigger) runEventSend(ctx context.Context) { if !ok { return } - go func(event info.EventRecord) { - code, err := t.sendEvent(ctx, event.Event) - if err != nil { - metrics.TriggerPushEventCounter.WithLabelValues(t.subscriptionIDStr, metrics.LabelValuePushEventFail).Inc() - log.Info(ctx, "send event fail", map[string]interface{}{ - log.KeyError: err, - "event": event.Event, - }) - t.writeFailEvent(ctx, event.Event, code, err) - } else { - metrics.TriggerPushEventCounter.WithLabelValues(t.subscriptionIDStr, metrics.LabelValuePushEventSuccess).Inc() - log.Debug(ctx, "send event success", map[string]interface{}{ - "event": event.Event, - }) - } - t.offsetManager.EventCommit(event.OffsetInfo) - }(event) + if t.config.Ordered { + t.processEvent(ctx, event) + } else { + go func(event info.EventRecord) { + t.processEvent(ctx, event) + }(event) + } } } } +func (t *trigger) processEvent(ctx context.Context, event info.EventRecord) { + code, err := t.sendEvent(ctx, event.Event) + if err != nil { + metrics.TriggerPushEventCounter.WithLabelValues(t.subscriptionIDStr, metrics.LabelValuePushEventFail).Inc() + log.Info(ctx, "send event fail", map[string]interface{}{ + log.KeyError: err, + "event": event.Event, + }) + if t.config.Ordered { + // ordered event no need retry direct into dead letter + code = NoNeedRetryCode + } + t.writeFailEvent(ctx, event.Event, code, err) + } else { + metrics.TriggerPushEventCounter.WithLabelValues(t.subscriptionIDStr, metrics.LabelValuePushEventSuccess).Inc() + log.Debug(ctx, "send event success", map[string]interface{}{ + "event": event.Event, + }) + } + t.offsetManager.EventCommit(event.OffsetInfo) +} func (t *trigger) writeFailEvent(ctx context.Context, e *ce.Event, code int, sendErr error) { needRetry, reason := isShouldRetry(code) ec, _ := e.Context.(*ce.EventContextV1) diff --git a/internal/trigger/trigger/util.go b/internal/trigger/trigger/util.go index f836c6379..c6151f72d 100644 --- a/internal/trigger/trigger/util.go +++ b/internal/trigger/trigger/util.go @@ -39,8 +39,12 @@ func newEventClient(sink primitive.URI, } } +const NoNeedRetryCode = -1 + func isShouldRetry(statusCode int) (bool, string) { switch statusCode { + case NoNeedRetryCode: + return false, "NoNeedRetry" case 400: return false, "BadRequest" case 403: diff --git a/internal/trigger/worker.go b/internal/trigger/worker.go index ef1f4fd91..512256add 100644 --- a/internal/trigger/worker.go +++ b/internal/trigger/worker.go @@ -299,6 +299,7 @@ func (w *worker) getTriggerOptions(subscription *primitive.Subscription) []trigg opts = append(opts, trigger.WithRateLimit(config.RateLimit), trigger.WithDeliveryTimeout(config.DeliveryTimeout), trigger.WithMaxRetryAttempts(config.GetMaxRetryAttempts()), - trigger.WithDeadLetterEventbus(config.DeadLetterEventbus)) + trigger.WithDeadLetterEventbus(config.DeadLetterEventbus), + trigger.WithOrdered(config.OrderedEvent)) return opts } diff --git a/proto/pkg/meta/meta.pb.go b/proto/pkg/meta/meta.pb.go index 1c11a9a3f..ba358e273 100644 --- a/proto/pkg/meta/meta.pb.go +++ b/proto/pkg/meta/meta.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.19.4 +// protoc v3.19.1 // source: meta.proto package meta @@ -1340,6 +1340,7 @@ type SubscriptionConfig struct { DeliveryTimeout uint32 `protobuf:"varint,4,opt,name=delivery_timeout,json=deliveryTimeout,proto3" json:"delivery_timeout,omitempty"` MaxRetryAttempts *uint32 `protobuf:"varint,5,opt,name=max_retry_attempts,json=maxRetryAttempts,proto3,oneof" json:"max_retry_attempts,omitempty"` DeadLetterEventbus string `protobuf:"bytes,6,opt,name=dead_letter_eventbus,json=deadLetterEventbus,proto3" json:"dead_letter_eventbus,omitempty"` + OrderedEvent bool `protobuf:"varint,7,opt,name=ordered_event,json=orderedEvent,proto3" json:"ordered_event,omitempty"` } func (x *SubscriptionConfig) Reset() { @@ -1416,6 +1417,13 @@ func (x *SubscriptionConfig) GetDeadLetterEventbus() string { return "" } +func (x *SubscriptionConfig) GetOrderedEvent() bool { + if x != nil { + return x.OrderedEvent + } + return false +} + type Filter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1943,7 +1951,7 @@ var file_meta_proto_rawDesc = []byte{ 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, - 0xaa, 0x03, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0xcf, 0x03, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x52, 0x0a, 0x0b, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x5f, @@ -1963,91 +1971,93 @@ var file_meta_proto_rawDesc = []byte{ 0x6d, 0x70, 0x74, 0x73, 0x88, 0x01, 0x01, 0x12, 0x30, 0x0a, 0x14, 0x64, 0x65, 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x72, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x64, 0x65, 0x61, 0x64, 0x4c, 0x65, 0x74, 0x74, 0x65, - 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x22, 0x35, 0x0a, 0x0a, 0x4f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x41, 0x54, 0x45, 0x53, - 0x54, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x41, 0x52, 0x4c, 0x49, 0x45, 0x53, 0x54, 0x10, - 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x49, 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x10, 0x02, - 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x65, - 0x74, 0x72, 0x79, 0x5f, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x73, 0x22, 0xa3, 0x04, 0x0a, - 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x72, 0x64, + 0x65, 0x72, 0x65, 0x64, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0c, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x35, + 0x0a, 0x0a, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, + 0x4c, 0x41, 0x54, 0x45, 0x53, 0x54, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x41, 0x52, 0x4c, + 0x49, 0x45, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x49, 0x4d, 0x45, 0x53, 0x54, + 0x41, 0x4d, 0x50, 0x10, 0x02, 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x6d, + 0x61, 0x78, 0x5f, 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, + 0x73, 0x22, 0xa3, 0x04, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x05, + 0x65, 0x78, 0x61, 0x63, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6c, 0x69, + 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, + 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x45, 0x78, 0x61, 0x63, 0x74, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, 0x12, 0x3e, 0x0a, 0x06, 0x70, 0x72, 0x65, + 0x66, 0x69, 0x78, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x3e, 0x0a, 0x06, 0x73, 0x75, 0x66, + 0x66, 0x69, 0x78, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x06, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x12, 0x2c, 0x0a, 0x03, 0x6e, 0x6f, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x46, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x2e, 0x45, 0x78, 0x61, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x65, - 0x78, 0x61, 0x63, 0x74, 0x12, 0x3e, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, - 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x2e, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x70, 0x72, - 0x65, 0x66, 0x69, 0x78, 0x12, 0x3e, 0x0a, 0x06, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, + 0x65, 0x72, 0x52, 0x03, 0x6e, 0x6f, 0x74, 0x12, 0x2c, 0x0a, 0x03, 0x61, 0x6c, 0x6c, 0x18, 0x05, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, - 0x2e, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x73, 0x75, - 0x66, 0x66, 0x69, 0x78, 0x12, 0x2c, 0x0a, 0x03, 0x6e, 0x6f, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6e, - 0x6f, 0x74, 0x12, 0x2c, 0x0a, 0x03, 0x61, 0x6c, 0x6c, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x03, 0x61, 0x6c, 0x6c, - 0x12, 0x2c, 0x0a, 0x03, 0x61, 0x6e, 0x79, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, - 0x74, 0x61, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x03, 0x61, 0x6e, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x73, 0x71, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x71, 0x6c, - 0x12, 0x10, 0x0a, 0x03, 0x63, 0x65, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, - 0x65, 0x6c, 0x1a, 0x38, 0x0a, 0x0a, 0x45, 0x78, 0x61, 0x63, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x03, 0x61, 0x6c, 0x6c, 0x12, 0x2c, 0x0a, 0x03, 0x61, 0x6e, 0x79, 0x18, 0x06, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, + 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x03, + 0x61, 0x6e, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x71, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x73, 0x71, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x65, 0x6c, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x63, 0x65, 0x6c, 0x1a, 0x38, 0x0a, 0x0a, 0x45, 0x78, 0x61, 0x63, 0x74, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, - 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x53, 0x75, 0x66, 0x66, 0x69, - 0x78, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x22, 0x75, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, - 0x38, 0x0a, 0x07, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x07, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x22, 0x46, 0x0a, 0x0a, 0x4f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, - 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x49, - 0x64, 0x22, 0xe1, 0x01, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, - 0x72, 0x12, 0x43, 0x0a, 0x06, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x2b, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, - 0x65, 0x72, 0x2e, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, - 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, - 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, - 0x74, 0x65, 0x12, 0x36, 0x0a, 0x08, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, - 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x08, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x1a, 0x39, 0x0a, 0x0b, 0x44, 0x65, - 0x66, 0x69, 0x6e, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3a, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x30, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, - 0x64, 0x2a, 0x33, 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x54, 0x69, 0x65, 0x72, - 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x45, 0x4d, 0x4f, 0x52, 0x59, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, - 0x53, 0x53, 0x44, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x48, 0x44, 0x44, 0x10, 0x02, 0x12, 0x06, - 0x0a, 0x02, 0x53, 0x33, 0x10, 0x03, 0x2a, 0x26, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, - 0x73, 0x73, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x4e, - 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4c, 0x5a, 0x34, 0x10, 0x01, 0x2a, 0x3a, - 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x54, - 0x54, 0x50, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x57, 0x53, 0x5f, 0x4c, 0x41, 0x4d, 0x42, - 0x44, 0x41, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x47, 0x43, 0x4c, 0x4f, 0x55, 0x44, 0x5f, 0x46, - 0x55, 0x4e, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x10, 0x02, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, - 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x75, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x27, 0x0a, 0x0f, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, + 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x4f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x22, 0x46, + 0x0a, 0x0a, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, + 0x67, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, + 0x74, 0x4c, 0x6f, 0x67, 0x49, 0x64, 0x22, 0xe1, 0x01, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x12, 0x43, 0x0a, 0x06, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x06, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x74, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x36, 0x0a, 0x08, 0x70, 0x69, 0x70, 0x65, 0x6c, + 0x69, 0x6e, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x41, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x1a, + 0x39, 0x0a, 0x0b, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3a, 0x0a, 0x06, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x07, 0x63, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2a, 0x33, 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x54, 0x69, 0x65, 0x72, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x45, 0x4d, 0x4f, 0x52, 0x59, 0x10, + 0x00, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x53, 0x44, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x48, 0x44, + 0x44, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x53, 0x33, 0x10, 0x03, 0x2a, 0x26, 0x0a, 0x11, 0x43, + 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, + 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4c, 0x5a, + 0x34, 0x10, 0x01, 0x2a, 0x3a, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, + 0x08, 0x0a, 0x04, 0x48, 0x54, 0x54, 0x50, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x57, 0x53, + 0x5f, 0x4c, 0x41, 0x4d, 0x42, 0x44, 0x41, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x47, 0x43, 0x4c, + 0x4f, 0x55, 0x44, 0x5f, 0x46, 0x55, 0x4e, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x10, 0x02, 0x42, + 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, + 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x76, 0x61, 0x6e, 0x75, 0x73, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/proto/meta.proto b/proto/proto/meta.proto index 5b5f28310..588395d27 100644 --- a/proto/proto/meta.proto +++ b/proto/proto/meta.proto @@ -167,6 +167,7 @@ message SubscriptionConfig { uint32 delivery_timeout = 4; optional uint32 max_retry_attempts = 5; string dead_letter_eventbus = 6; + bool ordered_event = 7; } message Filter { diff --git a/vsctl/command/flag.go b/vsctl/command/flag.go index 2b9e9ecec..c0acee2cd 100644 --- a/vsctl/command/flag.go +++ b/vsctl/command/flag.go @@ -45,6 +45,7 @@ var ( description string subscriptionName string disableSubscription bool + orderedPushEvent bool subProtocol string sinkCredentialType string diff --git a/vsctl/command/subscription.go b/vsctl/command/subscription.go index 07316ad01..f964a2d97 100644 --- a/vsctl/command/subscription.go +++ b/vsctl/command/subscription.go @@ -18,7 +18,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/linkall-labs/vanus/internal/primitive/vanus" "io/ioutil" "os" "time" @@ -30,6 +29,7 @@ import ( "github.com/jedib0t/go-pretty/v6/text" "github.com/linkall-labs/vanus/internal/convert" "github.com/linkall-labs/vanus/internal/primitive" + "github.com/linkall-labs/vanus/internal/primitive/vanus" ctrlpb "github.com/linkall-labs/vanus/proto/pkg/controller" "github.com/linkall-labs/vanus/proto/pkg/meta" metapb "github.com/linkall-labs/vanus/proto/pkg/meta" @@ -160,6 +160,7 @@ func createSubscriptionCommand() *cobra.Command { config := &meta.SubscriptionConfig{ RateLimit: rateLimit, DeliveryTimeout: deliveryTimeout, + OrderedEvent: orderedPushEvent, } if maxRetryAttempts >= 0 { value := uint32(maxRetryAttempts) @@ -218,6 +219,8 @@ func createSubscriptionCommand() *cobra.Command { cmd.Flags().StringVar(&description, "description", "", "subscription description") cmd.Flags().BoolVar(&disableSubscription, "disable", false, "whether disable the "+ "subscription (just create if disable=true)") + cmd.Flags().BoolVar(&orderedPushEvent, "ordered-event", false, "whether push the "+ + "event with ordered") return cmd } From be0087e222f890bfcdfb01d4fb229dcd29a98f11 Mon Sep 17 00:00:00 2001 From: delu Date: Sat, 24 Dec 2022 20:01:18 +0800 Subject: [PATCH 05/46] feat: add function length (#364) Signed-off-by: delu Signed-off-by: delu --- .../transform/action/common/length.go | 32 +++++ .../transform/action/common/length_test.go | 110 ++++++++++++++++++ .../transform/function/common_function.go | 39 +++++++ internal/primitive/transform/runtime/init.go | 3 + 4 files changed, 184 insertions(+) create mode 100644 internal/primitive/transform/action/common/length.go create mode 100644 internal/primitive/transform/action/common/length_test.go create mode 100644 internal/primitive/transform/function/common_function.go diff --git a/internal/primitive/transform/action/common/length.go b/internal/primitive/transform/action/common/length.go new file mode 100644 index 000000000..b341274a8 --- /dev/null +++ b/internal/primitive/transform/action/common/length.go @@ -0,0 +1,32 @@ +// Copyright 2022 Linkall Inc. +// +// 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 common + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/function" +) + +// NewLengthAction ["length", targetPath, value]. +func NewLengthAction() action.Action { + a := &action.FunctionAction{} + a.CommonAction = action.CommonAction{ + ActionName: "LENGTH", + FixedArgs: []arg.TypeList{arg.EventList, arg.All}, + Fn: function.LengthFunction, + } + return a +} diff --git a/internal/primitive/transform/action/common/length_test.go b/internal/primitive/transform/action/common/length_test.go new file mode 100644 index 000000000..79e7e9ba6 --- /dev/null +++ b/internal/primitive/transform/action/common/length_test.go @@ -0,0 +1,110 @@ +// Copyright 2022 Linkall Inc. +// +// 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 common_test + +import ( + stdJson "encoding/json" + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/common" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestLengthAction(t *testing.T) { + funcName := common.NewLengthAction().Name() + Convey("test length", t, func() { + jsonStr := `{ + "array": ["123",4,true], + "string": "string", + "map":{ + "key1":"value1", + "key2":"value2" + }, + "number": 10, + "bool": false + }` + Convey("test array", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.data.length", "$.data.array"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + err = a.Execute(&context.EventContext{ + Event: &e, + Data: data, + }) + So(err, ShouldBeNil) + So(data["length"], ShouldEqual, 3) + }) + Convey("test string", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.data.length", "$.data.string"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + err = a.Execute(&context.EventContext{ + Event: &e, + Data: data, + }) + So(err, ShouldBeNil) + So(data["length"], ShouldEqual, 6) + }) + Convey("test map", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.data.length", "$.data.map"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + err = a.Execute(&context.EventContext{ + Event: &e, + Data: data, + }) + So(err, ShouldBeNil) + So(data["length"], ShouldEqual, 2) + }) + Convey("test bool", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.data.length", "$.data.bool"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + err = a.Execute(&context.EventContext{ + Event: &e, + Data: data, + }) + So(err, ShouldNotBeNil) + }) + Convey("test number", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.data.length", "$.data.number"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + err = a.Execute(&context.EventContext{ + Event: &e, + Data: data, + }) + So(err, ShouldNotBeNil) + }) + }) +} diff --git a/internal/primitive/transform/function/common_function.go b/internal/primitive/transform/function/common_function.go new file mode 100644 index 000000000..db88d23ac --- /dev/null +++ b/internal/primitive/transform/function/common_function.go @@ -0,0 +1,39 @@ +// Copyright 2022 Linkall Inc. +// +// 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 function + +import ( + "fmt" + + "github.com/linkall-labs/vanus/internal/primitive/transform/common" +) + +var LengthFunction = function{ + name: "length", + fixedArgs: []common.Type{common.Any}, + fn: func(args []interface{}) (interface{}, error) { + switch v := args[0].(type) { + case string: + return len(v), nil + case []interface{}: + return len(v), nil + case map[string]interface{}: + return len(v), nil + default: + // maybe bool, float64, int32 + return nil, fmt.Errorf("length not support %v", v) + } + }, +} diff --git a/internal/primitive/transform/runtime/init.go b/internal/primitive/transform/runtime/init.go index 60438cb5d..726616972 100644 --- a/internal/primitive/transform/runtime/init.go +++ b/internal/primitive/transform/runtime/init.go @@ -15,6 +15,7 @@ package runtime import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action/common" "github.com/linkall-labs/vanus/internal/primitive/transform/action/condition" "github.com/linkall-labs/vanus/internal/primitive/transform/action/datetime" "github.com/linkall-labs/vanus/internal/primitive/transform/action/math" @@ -50,6 +51,8 @@ func init() { condition.NewConditionIfAction, // render render.NewRenderArrayAction, + // common + common.NewLengthAction, } { if err := AddAction(fn); err != nil { panic(err) From 3b5089991e0aa15a2bca4cb119fb758e412680ff Mon Sep 17 00:00:00 2001 From: James Yin Date: Sat, 24 Dec 2022 20:48:50 +0800 Subject: [PATCH 06/46] fix(store): pack records panic after wal recovery (#366) Signed-off-by: James Yin Signed-off-by: James Yin --- internal/store/wal/wal.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/store/wal/wal.go b/internal/store/wal/wal.go index cf5465b1e..c9efcec88 100644 --- a/internal/store/wal/wal.go +++ b/internal/store/wal/wal.go @@ -164,6 +164,11 @@ func open(ctx context.Context, dir string, cfg config) (*WAL, error) { if err := w.wb.RecoverFromFile(f.f, w.wb.SO-f.so, int(off-w.wb.SO)); err != nil { return nil, err } + if w.wb.Full() { + // switch to next block + w.allocator.Free(w.wb) + w.wb = w.allocator.Next() + } } go w.runCallback() //nolint:contextcheck // wrong advice From f5782454cb8a4ab662387479222aac2185174dcf Mon Sep 17 00:00:00 2001 From: delu Date: Mon, 26 Dec 2022 12:01:30 +0800 Subject: [PATCH 07/46] feat: add debezium convert to mongodb sink (#367) Signed-off-by: xdlbdy Signed-off-by: xdlbdy --- .../action/source/convert_to_mongodb_sink.go | 113 ++++++++++++++++++ .../source/convert_to_mongodb_sink_test.go | 104 ++++++++++++++++ internal/primitive/transform/arg/event.go | 48 ++++---- internal/primitive/transform/runtime/init.go | 3 + 4 files changed, 245 insertions(+), 23 deletions(-) create mode 100644 internal/primitive/transform/action/source/convert_to_mongodb_sink.go create mode 100644 internal/primitive/transform/action/source/convert_to_mongodb_sink_test.go diff --git a/internal/primitive/transform/action/source/convert_to_mongodb_sink.go b/internal/primitive/transform/action/source/convert_to_mongodb_sink.go new file mode 100644 index 000000000..54196d047 --- /dev/null +++ b/internal/primitive/transform/action/source/convert_to_mongodb_sink.go @@ -0,0 +1,113 @@ +// Copyright 2022 Linkall Inc. +// +// 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 source + +import ( + "fmt" + + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/common" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" +) + +const debeziumOp = "iodebeziumop" + +// ["debezium_convert_to_mongodb_sink","unique_key","unique_value"]. +type debeziumConvertToMongoDBSink struct { + action.CommonAction +} + +func NewDebeziumConvertToMongoDBSink() action.Action { + a := &debeziumConvertToMongoDBSink{} + a.CommonAction = action.CommonAction{ + ActionName: "debezium_convert_to_mongodb_sink", + FixedArgs: []arg.TypeList{arg.All, arg.All}, + VariadicArg: arg.All, + } + return a +} + +func (a *debeziumConvertToMongoDBSink) Init(args []arg.Arg) error { + if len(args)%2 != 0 { + return fmt.Errorf("arg number invalid, key and keyValue must pair") + } + // op arg. + _arg, _ := arg.NewArg("$." + debeziumOp) + a.Args = append(a.Args, _arg) + // data arg. + _arg, _ = arg.NewArg("$.data") + a.Args = append(a.Args, _arg) + a.ArgTypes = []common.Type{common.String, common.Any} + a.TargetArg = _arg + for i := 0; i < len(args); { + // unique key name. + a.Args = append(a.Args, args[i]) + a.ArgTypes = append(a.ArgTypes, common.String) + // unique key value path. + a.Args = append(a.Args, args[i+1]) + a.ArgTypes = append(a.ArgTypes, common.Any) + i += 2 + } + return nil +} + +func (a *debeziumConvertToMongoDBSink) Execute(ceCtx *context.EventContext) error { + args, err := a.RunArgs(ceCtx) + if err != nil { + return err + } + op, _ := args[0].(string) + data := args[1] + uniqueMap := make(map[string]interface{}) + for i := 2; i < len(args); { + uniqueMap[args[i].(string)] = args[i+1] + i += 2 + } + result := map[string]interface{}{} + switch op { + case "r", "c": + // insert. + result["inserts"] = []interface{}{data} + case "u": + // update. + dataMap, ok := data.(map[string]interface{}) + if !ok { + return fmt.Errorf("data only support map") + } + for k := range uniqueMap { + // remove unique key form update. + delete(dataMap, k) + } + result["updates"] = []interface{}{ + map[string]interface{}{ + "filter": uniqueMap, + "update": map[string]interface{}{ + "$set": dataMap, + }, + }, + } + case "d": + // delete. + result["deletes"] = []interface{}{ + map[string]interface{}{ + "filter": uniqueMap, + }, + } + default: + return fmt.Errorf("unknown op %s", op) + } + return a.TargetArg.SetValue(ceCtx, result) +} diff --git a/internal/primitive/transform/action/source/convert_to_mongodb_sink_test.go b/internal/primitive/transform/action/source/convert_to_mongodb_sink_test.go new file mode 100644 index 000000000..85881933d --- /dev/null +++ b/internal/primitive/transform/action/source/convert_to_mongodb_sink_test.go @@ -0,0 +1,104 @@ +// Copyright 2022 Linkall Inc. +// +// 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 source_test + +import ( + stdJson "encoding/json" + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/source" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestDebeziumToMongoDBSinkAction(t *testing.T) { + funcName := source.NewDebeziumConvertToMongoDBSink().Name() + debeziumOp := "iodebeziumop" + Convey("test convert mongodb sink invalid", t, func() { + jsonStr := `{ + "num": 123, + "name": "vanus", + "desc": "vanus is good" + }` + Convey("test insert", func() { + a, err := runtime.NewAction([]interface{}{funcName, "num", "$.data.num", "name", "$.data.name"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension(debeziumOp, "c") + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + ceCtx := &context.EventContext{ + Event: &e, + Data: data, + } + err = a.Execute(ceCtx) + So(err, ShouldBeNil) + result := ceCtx.Data.(map[string]interface{}) + So(result["inserts"], ShouldNotBeNil) + So(len(result["inserts"].([]interface{})), ShouldEqual, 1) + inserts := result["inserts"].([]interface{})[0].(map[string]interface{}) + So(inserts["num"], ShouldEqual, 123) + So(inserts["name"], ShouldEqual, "vanus") + So(inserts["desc"], ShouldEqual, "vanus is good") + }) + Convey("test update", func() { + a, err := runtime.NewAction([]interface{}{funcName, "num", "$.data.num", "name", "$.data.name"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension(debeziumOp, "u") + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + ceCtx := &context.EventContext{ + Event: &e, + Data: data, + } + err = a.Execute(ceCtx) + So(err, ShouldBeNil) + result := ceCtx.Data.(map[string]interface{}) + So(result["updates"], ShouldNotBeNil) + So(len(result["updates"].([]interface{})), ShouldEqual, 1) + updates := result["updates"].([]interface{})[0].(map[string]interface{}) + So(updates["filter"].(map[string]interface{})["name"], ShouldEqual, "vanus") + So(updates["filter"].(map[string]interface{})["num"], ShouldEqual, 123) + So(updates["update"].(map[string]interface{})["$set"].(map[string]interface{})["desc"], + ShouldEqual, "vanus is good") + }) + Convey("test delete", func() { + a, err := runtime.NewAction([]interface{}{funcName, "num", "$.data.num", "name", "$.data.name"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension(debeziumOp, "d") + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + ceCtx := &context.EventContext{ + Event: &e, + Data: data, + } + err = a.Execute(ceCtx) + So(err, ShouldBeNil) + result := ceCtx.Data.(map[string]interface{}) + So(result["deletes"], ShouldNotBeNil) + So(len(result["deletes"].([]interface{})), ShouldEqual, 1) + deletes := result["deletes"].([]interface{})[0].(map[string]interface{}) + So(deletes["filter"].(map[string]interface{})["name"], ShouldEqual, "vanus") + So(deletes["filter"].(map[string]interface{})["num"], ShouldEqual, 123) + }) + }) +} diff --git a/internal/primitive/transform/arg/event.go b/internal/primitive/transform/arg/event.go index 5ba35f952..3c67c1f18 100644 --- a/internal/primitive/transform/arg/event.go +++ b/internal/primitive/transform/arg/event.go @@ -17,12 +17,10 @@ package arg import ( "strings" - "github.com/pkg/errors" - "github.com/linkall-labs/vanus/internal/primitive/transform/context" - "github.com/linkall-labs/vanus/internal/trigger/util" pkgUtil "github.com/linkall-labs/vanus/pkg/util" + "github.com/pkg/errors" ) type eventAttribute struct { @@ -73,22 +71,19 @@ func (arg eventAttribute) DeleteValue(ceCtx *context.EventContext) error { type eventData struct { path string original string - data bool } // newEventData name format is $.data.key . func newEventData(name string) Arg { - var data bool - var path string if name == EventDataArgPrefix { - data = true - path = "" - } else { - path = name[7:] + return eventDataAll{ + eventData{ + path: "", + original: name, + }} } return eventData{ - data: data, - path: path, + path: name[7:], original: name, } } @@ -106,9 +101,6 @@ func (arg eventData) Original() string { } func (arg eventData) Evaluate(ceCtx *context.EventContext) (interface{}, error) { - if arg.data { - return ceCtx.Data, nil - } v, err := util.LookupData(ceCtx.Data, EventArgPrefix+arg.path) if err != nil { if errors.Is(err, util.ErrKeyNotFound) { @@ -123,18 +115,28 @@ func (arg eventData) Evaluate(ceCtx *context.EventContext) (interface{}, error) } func (arg eventData) SetValue(ceCtx *context.EventContext, value interface{}) error { - if arg.data { - ceCtx.Data = value - return nil - } util.SetData(ceCtx.Data, arg.path, value) return nil } func (arg eventData) DeleteValue(ceCtx *context.EventContext) error { - if arg.data { - ceCtx.Data = map[string]interface{}{} - return nil - } return util.DeleteData(ceCtx.Data, arg.path) } + +type eventDataAll struct { + eventData +} + +func (arg eventDataAll) Evaluate(ceCtx *context.EventContext) (interface{}, error) { + return ceCtx.Data, nil +} + +func (arg eventDataAll) SetValue(ceCtx *context.EventContext, value interface{}) error { + ceCtx.Data = value + return nil +} + +func (arg eventDataAll) DeleteValue(ceCtx *context.EventContext) error { + ceCtx.Data = map[string]interface{}{} + return nil +} diff --git a/internal/primitive/transform/runtime/init.go b/internal/primitive/transform/runtime/init.go index 726616972..70c7d62fe 100644 --- a/internal/primitive/transform/runtime/init.go +++ b/internal/primitive/transform/runtime/init.go @@ -20,6 +20,7 @@ import ( "github.com/linkall-labs/vanus/internal/primitive/transform/action/datetime" "github.com/linkall-labs/vanus/internal/primitive/transform/action/math" "github.com/linkall-labs/vanus/internal/primitive/transform/action/render" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/source" "github.com/linkall-labs/vanus/internal/primitive/transform/action/strings" "github.com/linkall-labs/vanus/internal/primitive/transform/action/structs" ) @@ -53,6 +54,8 @@ func init() { render.NewRenderArrayAction, // common common.NewLengthAction, + // source + source.NewDebeziumConvertToMongoDBSink, } { if err := AddAction(fn); err != nil { panic(err) From 41b10a8eb271106f9b874fbcc55553edb488bfb4 Mon Sep 17 00:00:00 2001 From: delu Date: Mon, 26 Dec 2022 15:41:32 +0800 Subject: [PATCH 08/46] fix: fix transformer convert array (#368) * fix: transformer data type not array convert to array Signed-off-by: xdlbdy * feat: transformer add panic conver Signed-off-by: xdlbdy Signed-off-by: xdlbdy --- .../transform/action/render/array_test.go | 27 +++++++++++++++++++ internal/primitive/transform/common/cast.go | 11 ++++++-- internal/trigger/transform/transformer.go | 18 ++++++++++--- 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/internal/primitive/transform/action/render/array_test.go b/internal/primitive/transform/action/render/array_test.go index cce109cac..bf6ba7c3f 100644 --- a/internal/primitive/transform/action/render/array_test.go +++ b/internal/primitive/transform/action/render/array_test.go @@ -152,4 +152,31 @@ func TestRenderArrayAction(t *testing.T) { }) }) }) + Convey("test array length 1", t, func() { + jsonStr := `{ + "array": [ + { + "name": "name1", + "number": 1 + } + ] + }` + Convey("render other", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.data.render", "$.data.array", "Name: <@.name> Num: <@.number> <@abc"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + err = a.Execute(&context.EventContext{ + Event: &e, + Data: data, + }) + So(err, ShouldBeNil) + render, exist := data["render"] + So(exist, ShouldBeTrue) + So(len(render.([]string)), ShouldEqual, 1) + So(render.([]string)[0], ShouldEqual, "Name: name1 Num: 1 <@abc") + }) + }) } diff --git a/internal/primitive/transform/common/cast.go b/internal/primitive/transform/common/cast.go index c8301f85c..89f1b0973 100644 --- a/internal/primitive/transform/common/cast.go +++ b/internal/primitive/transform/common/cast.go @@ -28,9 +28,11 @@ func Cast(val interface{}, target Type) (interface{}, error) { case String: switch value := val.(type) { case int32: // ce attribute - return strconv.Itoa(int(value)), nil + return strconv.FormatInt(int64(value), 10), nil + case int64: // ce attribute + return strconv.FormatInt(value, 10), nil case float64: // ce data json marshal - return strconv.FormatFloat(value, 'f', -1, 64), nil + return fmt.Sprintf("%v", val), nil case bool: return strconv.FormatBool(value), nil } @@ -77,6 +79,11 @@ func Cast(val interface{}, target Type) (interface{}, error) { } return stringArr, nil } + case Array: + switch value := val.(type) { + case string, int32, int64, float64, bool: + return []interface{}{value}, nil + } } // AnyType doesn't need casting diff --git a/internal/trigger/transform/transformer.go b/internal/trigger/transform/transformer.go index d365db9a3..59f63447f 100644 --- a/internal/trigger/transform/transformer.go +++ b/internal/trigger/transform/transformer.go @@ -16,14 +16,15 @@ package transform import ( "encoding/json" - - "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "runtime" ce "github.com/cloudevents/sdk-go/v2" "github.com/linkall-labs/vanus/internal/primitive" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" "github.com/linkall-labs/vanus/internal/trigger/transform/define" "github.com/linkall-labs/vanus/internal/trigger/transform/pipeline" "github.com/linkall-labs/vanus/internal/trigger/transform/template" + "github.com/pkg/errors" ) type Transformer struct { @@ -47,9 +48,18 @@ func NewTransformer(transformer *primitive.Transformer) *Transformer { return tf } -func (tf *Transformer) Execute(event *ce.Event) error { +func (tf *Transformer) Execute(event *ce.Event) (err error) { + defer func() { + if r := recover(); r != nil { + size := 1024 + stacktrace := make([]byte, size) + stacktrace = stacktrace[:runtime.Stack(stacktrace, false)] + err = errors.New(string(stacktrace)) + } + }() + var data interface{} - err := json.Unmarshal(event.Data(), &data) + err = json.Unmarshal(event.Data(), &data) if err != nil { return err } From fc27e09ca6a3e345dbc40c92f6b3144164e19029 Mon Sep 17 00:00:00 2001 From: James Yin Date: Mon, 26 Dec 2022 20:09:58 +0800 Subject: [PATCH 09/46] fix(store): raft commit ahead of stable entries (#369) Signed-off-by: James Yin Signed-off-by: James Yin --- raft/log.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raft/log.go b/raft/log.go index 5992599cb..08a0bc6ee 100644 --- a/raft/log.go +++ b/raft/log.go @@ -287,7 +287,7 @@ func (l *raftLog) appliedTo(i uint64) { func (l *raftLog) localCommitTo(tocommit uint64) { if tocommit >= l.unstable.offset { - tocommit = l.unstable.offset + tocommit = l.unstable.offset - 1 } // never decrease commit if l.localCommitted < tocommit { From b3f905fe8706b3b72b0e46d6eb88a25bf33aced5 Mon Sep 17 00:00:00 2001 From: wenfeng Date: Tue, 27 Dec 2022 14:35:52 +0800 Subject: [PATCH 10/46] feat: gateway supports batch write (#359) * feat: gateway supports batch write Signed-off-by: wenfeng * fix license Signed-off-by: wenfeng * update gomod Signed-off-by: wenfeng * update gomod Signed-off-by: wenfeng Signed-off-by: wenfeng --- client/go.mod | 5 +- client/go.sum | 300 +------ client/internal/vanus/codec/protobuf.go | 44 +- client/internal/vanus/store/block_store.go | 26 +- client/pkg/api/client.go | 3 +- client/pkg/api/mock_client.go | 20 + client/pkg/eventbus/eventbus.go | 24 + client/pkg/eventlog/eventlog.go | 2 + client/pkg/eventlog/eventlog_impl.go | 42 + client/pkg/eventlog/log_segment.go | 16 + client/pkg/eventlog/segment_block.go | 5 + go.mod | 9 +- go.sum | 19 +- internal/gateway/proxy/proxy.go | 69 ++ internal/store/schema/ce/convert/entry.go | 20 +- internal/store/schema/ce/convert/protobuf.go | 32 +- internal/store/schema/ce/testing/event.go | 16 +- internal/store/segment/api.go | 2 +- internal/store/segment/api_test.go | 3 +- internal/store/segment/mock_server.go | 2 +- internal/store/segment/server.go | 2 +- internal/store/vsb/fragment_test.go | 4 +- pkg/go.mod | 1 - proto/go.mod | 2 - proto/include/cloudevents/buf.gen.yaml | 6 - proto/include/cloudevents/cloudevents.proto | 67 -- proto/include/cloudevents/pkg/go.mod | 5 - proto/include/cloudevents/pkg/go.sum | 8 - .../cloudevents/pkg/v1/cloudevents.pb.go | 547 ------------- proto/pkg/cloudevents/cloudevents.pb.go | 723 +++++++++++++++++ proto/pkg/segment/segment.pb.go | 765 ++++++++++++++---- proto/pkg/segment/segment_grpc.pb.go | 464 ----------- proto/proto/cloudevents.proto | 92 +++ proto/proto/segment.proto | 8 +- test/benchmark/command/component.go | 3 +- test/e2e/append/main.go | 9 +- 36 files changed, 1748 insertions(+), 1617 deletions(-) delete mode 100644 proto/include/cloudevents/buf.gen.yaml delete mode 100644 proto/include/cloudevents/cloudevents.proto delete mode 100644 proto/include/cloudevents/pkg/go.mod delete mode 100644 proto/include/cloudevents/pkg/go.sum delete mode 100644 proto/include/cloudevents/pkg/v1/cloudevents.pb.go create mode 100644 proto/pkg/cloudevents/cloudevents.pb.go delete mode 100644 proto/pkg/segment/segment_grpc.pb.go create mode 100644 proto/proto/cloudevents.proto diff --git a/client/go.mod b/client/go.mod index 65012a9d4..e9a214119 100644 --- a/client/go.mod +++ b/client/go.mod @@ -3,7 +3,6 @@ module github.com/linkall-labs/vanus/client go 1.18 require ( - cloudevents.io/genproto v1.0.2 github.com/cloudevents/sdk-go/v2 v2.11.0 github.com/golang/mock v1.6.0 github.com/linkall-labs/vanus/observability v0.5.1 @@ -29,9 +28,7 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/sirupsen/logrus v1.9.0 // indirect - github.com/stretchr/objx v0.4.0 // indirect go.opentelemetry.io/otel v1.11.1 // indirect - go.opentelemetry.io/otel/exporters/jaeger v1.9.0 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0 // indirect @@ -49,7 +46,7 @@ require ( ) replace ( - cloudevents.io/genproto => ../proto/include/cloudevents/pkg + cloud.google.com/go => cloud.google.com/go v0.100.2 github.com/linkall-labs/vanus/observability => ../observability github.com/linkall-labs/vanus/pkg => ../pkg github.com/linkall-labs/vanus/proto => ../proto diff --git a/client/go.sum b/client/go.sum index de2b0e4f3..15530f076 100644 --- a/client/go.sum +++ b/client/go.sum @@ -1,39 +1,8 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go v0.100.2 h1:t9Iw5QH5v4XtlEQaCtUY7x6sCABps8sW0acw7e2WQ6Y= +cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= +cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= cloud.google.com/go/compute v1.7.0 h1:v/k9Eueb8aAJ0vZuxKMrgm6kPhCLZU9HxFU+AFDs9Uk= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= @@ -41,9 +10,6 @@ github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInq github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudevents/sdk-go/v2 v2.11.0 h1:pCb7Cdkb8XpUoil+miuw6PEzuCG9cc8Erj8y1/q3odo= github.com/cloudevents/sdk-go/v2 v2.11.0/go.mod h1:xDmKfzNjM8gBvjaF8ijFjM1VYOVUEeUfapHMUX1T5To= @@ -62,6 +28,7 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= @@ -69,9 +36,6 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/fatih/set v0.2.1 h1:nn2CaJyknWE/6txyUDGwysr3G5QC6xWB/PtVjPBbeaA= github.com/fatih/set v0.2.1/go.mod h1:+RKtMCH+favT2+3YecHGxcc0b4KyVWA1QWWJUs4E0CI= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -80,24 +44,14 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -109,50 +63,31 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -165,7 +100,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/scylladb/go-set v1.0.2 h1:SkvlMCKhP0wyyct6j+0IHJkBkSZL+TDzZ4E7f7BCcRE= github.com/scylladb/go-set v1.0.2/go.mod h1:DkpGd78rljTxKAnTDPFqXSGxvETQnJyuSOQwsHycqfs= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= @@ -174,30 +108,18 @@ github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4 h1:PRXhsszxTt5bbPriTjmaweWUsAnJYeWBhUMLRetUgBU= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4/go.mod h1:05eWWy6ZWzmpeImD3UowLTB3VjDMU1yxQ+ENuVWDM3c= go.opentelemetry.io/otel v1.11.1 h1:4WLLAmcfkmDk2ukNXJyq3/kiz/3UzCaYq6PskJsaou4= go.opentelemetry.io/otel v1.11.1/go.mod h1:1nNhXBbWSD0nsL38H6btgnFN2k4i0sNLHNNMZMSbUGE= -go.opentelemetry.io/otel/exporters/jaeger v1.9.0 h1:gAEgEVGDWwFjcis9jJTOJqZNxDzoZfR12WNIxr7g9Ww= -go.opentelemetry.io/otel/exporters/jaeger v1.9.0/go.mod h1:hquezOLVAybNW6vanIxkdLXTXvzlj2Vn3wevSP15RYs= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 h1:ggqApEjDKczicksfvZUCxuvoyDmR6Sbm56LwiK8DVR0= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0/go.mod h1:78XhIg8Ht9vR4tbLNUhXsiOnE2HOuSeKAiAcoVQEpOY= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 h1:NN90Cuna0CnBg8YNu1Q0V35i2E8LDByFOwHRCq/ZP9I= @@ -221,40 +143,14 @@ go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95a go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -262,214 +158,105 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220909164309-bea034e7d591 h1:D0B/7al0LLrVC8aWF4+oxpv/m8bc7ViFfVS8/gXGdqI= golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094 h1:2o1E+E8TpNLklK9nHiPiK1uzIYrIHt+cQx3ynCwq9V8= golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44= golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= +google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f h1:hJ/Y5SqPXbarffmAsApliUlcvMU+wScNGfyop4bZm8o= google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -478,7 +265,6 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= @@ -487,8 +273,6 @@ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -498,12 +282,4 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/client/internal/vanus/codec/protobuf.go b/client/internal/vanus/codec/protobuf.go index faac3a434..617e9b570 100644 --- a/client/internal/vanus/codec/protobuf.go +++ b/client/internal/vanus/codec/protobuf.go @@ -12,9 +12,9 @@ import ( stdtime "time" // third-party libraries - cepb "cloudevents.io/genproto/v1" "github.com/cloudevents/sdk-go/v2/event" "github.com/cloudevents/sdk-go/v2/types" + cepb "github.com/linkall-labs/vanus/proto/pkg/cloudevents" "google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/known/timestamppb" ) @@ -35,14 +35,14 @@ var ( zeroTime = stdtime.Time{} ) -// convert an SDK event to a protobuf variant of the event that can be marshaled. +// ToProto convert an SDK event to a protobuf variant of the event that can be marshaled. func ToProto(e *event.Event) (*cepb.CloudEvent, error) { container := &cepb.CloudEvent{ Id: e.ID(), Source: e.Source(), SpecVersion: e.SpecVersion(), Type: e.Type(), - Attributes: make(map[string]*cepb.CloudEventAttributeValue), + Attributes: make(map[string]*cepb.CloudEvent_CloudEventAttributeValue), } if e.DataContentType() != "" { container.Attributes[datacontenttype], _ = attributeFor(e.DataContentType()) @@ -78,39 +78,39 @@ func ToProto(e *event.Event) (*cepb.CloudEvent, error) { return container, nil } -func attributeFor(v interface{}) (*cepb.CloudEventAttributeValue, error) { +func attributeFor(v interface{}) (*cepb.CloudEvent_CloudEventAttributeValue, error) { vv, err := types.Validate(v) if err != nil { return nil, err } - attr := &cepb.CloudEventAttributeValue{} + attr := &cepb.CloudEvent_CloudEventAttributeValue{} switch vt := vv.(type) { case bool: - attr.Attr = &cepb.CloudEventAttributeValue_CeBoolean{ + attr.Attr = &cepb.CloudEvent_CloudEventAttributeValue_CeBoolean{ CeBoolean: vt, } case int32: - attr.Attr = &cepb.CloudEventAttributeValue_CeInteger{ + attr.Attr = &cepb.CloudEvent_CloudEventAttributeValue_CeInteger{ CeInteger: vt, } case string: - attr.Attr = &cepb.CloudEventAttributeValue_CeString{ + attr.Attr = &cepb.CloudEvent_CloudEventAttributeValue_CeString{ CeString: vt, } case []byte: - attr.Attr = &cepb.CloudEventAttributeValue_CeBytes{ + attr.Attr = &cepb.CloudEvent_CloudEventAttributeValue_CeBytes{ CeBytes: vt, } case types.URI: - attr.Attr = &cepb.CloudEventAttributeValue_CeUri{ + attr.Attr = &cepb.CloudEvent_CloudEventAttributeValue_CeUri{ CeUri: vt.String(), } case types.URIRef: - attr.Attr = &cepb.CloudEventAttributeValue_CeUriRef{ + attr.Attr = &cepb.CloudEvent_CloudEventAttributeValue_CeUriRef{ CeUriRef: vt.String(), } case types.Timestamp: - attr.Attr = &cepb.CloudEventAttributeValue_CeTimestamp{ + attr.Attr = &cepb.CloudEvent_CloudEventAttributeValue_CeTimestamp{ CeTimestamp: timestamppb.New(vt.Time), } default: @@ -119,30 +119,30 @@ func attributeFor(v interface{}) (*cepb.CloudEventAttributeValue, error) { return attr, nil } -func valueFrom(attr *cepb.CloudEventAttributeValue) (interface{}, error) { +func valueFrom(attr *cepb.CloudEvent_CloudEventAttributeValue) (interface{}, error) { var v interface{} switch vt := attr.Attr.(type) { - case *cepb.CloudEventAttributeValue_CeBoolean: + case *cepb.CloudEvent_CloudEventAttributeValue_CeBoolean: v = vt.CeBoolean - case *cepb.CloudEventAttributeValue_CeInteger: + case *cepb.CloudEvent_CloudEventAttributeValue_CeInteger: v = vt.CeInteger - case *cepb.CloudEventAttributeValue_CeString: + case *cepb.CloudEvent_CloudEventAttributeValue_CeString: v = vt.CeString - case *cepb.CloudEventAttributeValue_CeBytes: + case *cepb.CloudEvent_CloudEventAttributeValue_CeBytes: v = vt.CeBytes - case *cepb.CloudEventAttributeValue_CeUri: + case *cepb.CloudEvent_CloudEventAttributeValue_CeUri: uri, err := url.Parse(vt.CeUri) if err != nil { return nil, fmt.Errorf("failed to parse URI value %s: %s", vt.CeUri, err.Error()) } v = uri - case *cepb.CloudEventAttributeValue_CeUriRef: + case *cepb.CloudEvent_CloudEventAttributeValue_CeUriRef: uri, err := url.Parse(vt.CeUriRef) if err != nil { return nil, fmt.Errorf("failed to parse URIRef value %s: %s", vt.CeUriRef, err.Error()) } v = types.URIRef{URL: *uri} - case *cepb.CloudEventAttributeValue_CeTimestamp: + case *cepb.CloudEvent_CloudEventAttributeValue_CeTimestamp: v = vt.CeTimestamp.AsTime() default: return nil, fmt.Errorf("unsupported attribute type: %T", vt) @@ -150,7 +150,7 @@ func valueFrom(attr *cepb.CloudEventAttributeValue) (interface{}, error) { return types.Validate(v) } -// Convert from a protobuf variant into the generic, SDK event. +// FromProto Convert from a protobuf variant into the generic, SDK event. func FromProto(container *cepb.CloudEvent) (*event.Event, error) { e := event.New() e.SetID(container.Id) @@ -179,7 +179,7 @@ func FromProto(container *cepb.CloudEvent) (*event.Event, error) { if container.Attributes != nil { attr := container.Attributes[datacontenttype] if attr != nil { - if stattr, ok := attr.Attr.(*cepb.CloudEventAttributeValue_CeString); ok { + if stattr, ok := attr.Attr.(*cepb.CloudEvent_CloudEventAttributeValue_CeString); ok { contentType = stattr.CeString } } diff --git a/client/internal/vanus/store/block_store.go b/client/internal/vanus/store/block_store.go index fa1fca447..62e8bc011 100644 --- a/client/internal/vanus/store/block_store.go +++ b/client/internal/vanus/store/block_store.go @@ -22,12 +22,12 @@ import ( "github.com/linkall-labs/vanus/observability/tracing" "go.opentelemetry.io/otel/trace" - // third-party libraries - cepb "cloudevents.io/genproto/v1" ce "github.com/cloudevents/sdk-go/v2" "google.golang.org/grpc" // first-party libraries + // third-party libraries + cepb "github.com/linkall-labs/vanus/proto/pkg/cloudevents" segpb "github.com/linkall-labs/vanus/proto/pkg/segment" // this project @@ -156,3 +156,25 @@ func (s *BlockStore) LookupOffset(ctx context.Context, blockID uint64, t time.Ti } return res.Offset, nil } + +func (s *BlockStore) AppendBatch(ctx context.Context, block uint64, event *cepb.CloudEventBatch) (int64, error) { + _ctx, span := s.tracer.Start(ctx, "AppendBatch") + defer span.End() + + req := &segpb.AppendToBlockRequest{ + BlockId: block, + Events: event, + } + + client, err := s.client.Get(_ctx) + if err != nil { + return -1, err + } + + res, err := client.(segpb.SegmentServerClient).AppendToBlock(_ctx, req) + if err != nil { + return -1, err + } + // TODO(Y. F. Zhang): batch events + return res.GetOffsets()[0], nil +} diff --git a/client/pkg/api/client.go b/client/pkg/api/client.go index 177c99f13..f5b092c69 100644 --- a/client/pkg/api/client.go +++ b/client/pkg/api/client.go @@ -17,8 +17,8 @@ package api import ( "context" - ce "github.com/cloudevents/sdk-go/v2" + "github.com/linkall-labs/vanus/proto/pkg/cloudevents" ) type Eventbus interface { @@ -33,6 +33,7 @@ type Eventbus interface { type BusWriter interface { AppendOne(ctx context.Context, event *ce.Event, opts ...WriteOption) (eid string, err error) AppendMany(ctx context.Context, events []*ce.Event, opts ...WriteOption) (eid string, err error) + AppendBatch(ctx context.Context, events *cloudevents.CloudEventBatch, opts ...WriteOption) (err error) } type BusReader interface { diff --git a/client/pkg/api/mock_client.go b/client/pkg/api/mock_client.go index 7b37012d7..ffb896001 100644 --- a/client/pkg/api/mock_client.go +++ b/client/pkg/api/mock_client.go @@ -10,6 +10,7 @@ import ( v2 "github.com/cloudevents/sdk-go/v2" gomock "github.com/golang/mock/gomock" + cloudevents "github.com/linkall-labs/vanus/proto/pkg/cloudevents" ) // MockEventbus is a mock of Eventbus interface. @@ -146,6 +147,25 @@ func (m *MockBusWriter) EXPECT() *MockBusWriterMockRecorder { return m.recorder } +// AppendBatch mocks base method. +func (m *MockBusWriter) AppendBatch(ctx context.Context, events *cloudevents.CloudEventBatch, opts ...WriteOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, events} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "AppendBatch", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// AppendBatch indicates an expected call of AppendBatch. +func (mr *MockBusWriterMockRecorder) AppendBatch(ctx, events interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, events}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppendBatch", reflect.TypeOf((*MockBusWriter)(nil).AppendBatch), varargs...) +} + // AppendMany mocks base method. func (m *MockBusWriter) AppendMany(ctx context.Context, events []*v2.Event, opts ...WriteOption) (string, error) { m.ctrl.T.Helper() diff --git a/client/pkg/eventbus/eventbus.go b/client/pkg/eventbus/eventbus.go index 2d1c2697b..813a8a806 100644 --- a/client/pkg/eventbus/eventbus.go +++ b/client/pkg/eventbus/eventbus.go @@ -20,6 +20,7 @@ import ( "encoding/base64" "encoding/binary" stderrors "errors" + "github.com/linkall-labs/vanus/proto/pkg/cloudevents" "io" "sync" @@ -445,6 +446,29 @@ type busWriter struct { tracer *tracing.Tracer } +func (w *busWriter) AppendBatch(ctx context.Context, events *cloudevents.CloudEventBatch, opts ...api.WriteOption) (err error) { + _ctx, span := w.tracer.Start(ctx, "CloudEventBatch") + defer span.End() + + var writeOpts *api.WriteOptions = w.opts + if len(opts) > 0 { + writeOpts = w.opts.Copy() + for _, opt := range opts { + opt(writeOpts) + } + } + + // 1. pick a writer of eventlog + lw, err := w.pickWritableLog(_ctx, writeOpts) + if err != nil { + return err + } + + // 2. append the event to the eventlog + _, err = lw.AppendMany(_ctx, events) + return err +} + var _ api.BusWriter = (*busWriter)(nil) func (w *busWriter) AppendOne(ctx context.Context, event *ce.Event, opts ...api.WriteOption) (eid string, err error) { diff --git a/client/pkg/eventlog/eventlog.go b/client/pkg/eventlog/eventlog.go index 4f6e1c2f7..f96756e19 100644 --- a/client/pkg/eventlog/eventlog.go +++ b/client/pkg/eventlog/eventlog.go @@ -18,6 +18,7 @@ package eventlog import ( // standard libraries. "context" + "github.com/linkall-labs/vanus/proto/pkg/cloudevents" // third-party libraries. ce "github.com/cloudevents/sdk-go/v2" @@ -50,6 +51,7 @@ type LogWriter interface { Close(ctx context.Context) Append(ctx context.Context, event *ce.Event) (off int64, err error) + AppendMany(ctx context.Context, events *cloudevents.CloudEventBatch) (off int64, err error) } type LogReader interface { diff --git a/client/pkg/eventlog/eventlog_impl.go b/client/pkg/eventlog/eventlog_impl.go index d9dc2ea7e..c0acd5100 100644 --- a/client/pkg/eventlog/eventlog_impl.go +++ b/client/pkg/eventlog/eventlog_impl.go @@ -17,6 +17,7 @@ package eventlog import ( // standard libraries. "context" + "github.com/linkall-labs/vanus/proto/pkg/cloudevents" "io" "sort" "sync" @@ -329,6 +330,10 @@ func (l *eventlog) refreshReadableSegments(ctx context.Context) { _ = l.readableWatcher.Refresh(ctx) } +var ( + _ LogWriter = &logWriter{} +) + // logWriter is the writer of eventlog. // // Append is thread-safety. @@ -338,6 +343,28 @@ type logWriter struct { mu sync.RWMutex } +func (w *logWriter) AppendMany(ctx context.Context, events *cloudevents.CloudEventBatch) (off int64, err error) { + retryTimes := defaultRetryTimes + for i := 1; i <= retryTimes; i++ { + offset, err := w.doAppendBatch(ctx, events) + if err == nil { + return offset, nil + } + vlog.Warning(ctx, "failed to Append", map[string]interface{}{ + vlog.KeyError: err, + "offset": offset, + }) + if errors.Is(err, errors.ErrSegmentFull) { + if i < retryTimes { + continue + } + } + return -1, err + } + + return -1, errors.ErrUnknown +} + func (w *logWriter) Log() Eventlog { return w.elog } @@ -385,6 +412,21 @@ func (w *logWriter) doAppend(ctx context.Context, event *ce.Event) (int64, error return offset, nil } +func (w *logWriter) doAppendBatch(ctx context.Context, event *cloudevents.CloudEventBatch) (int64, error) { + segment, err := w.selectWritableSegment(ctx) + if err != nil { + return -1, err + } + offset, err := segment.AppendBatch(ctx, event) + if err != nil { + if errors.Is(err, errors.ErrSegmentFull) { + segment.SetNotWritable() + } + return -1, err + } + return offset, nil +} + func (w *logWriter) selectWritableSegment(ctx context.Context) (*segment, error) { segment := func() *segment { w.mu.RLock() diff --git a/client/pkg/eventlog/log_segment.go b/client/pkg/eventlog/log_segment.go index 498c1a268..ac73e3be9 100644 --- a/client/pkg/eventlog/log_segment.go +++ b/client/pkg/eventlog/log_segment.go @@ -18,6 +18,7 @@ import ( // standard libraries. "context" "encoding/binary" + "github.com/linkall-labs/vanus/proto/pkg/cloudevents" "math" "sync" "time" @@ -171,6 +172,21 @@ func (s *segment) Append(ctx context.Context, event *ce.Event) (int64, error) { return off + s.startOffset, nil } +func (s *segment) AppendBatch(ctx context.Context, event *cloudevents.CloudEventBatch) (int64, error) { + _ctx, span := s.tracer.Start(ctx, "AppendBatch") + defer span.End() + + b := s.preferSegmentBlock() + if b == nil { + return -1, errors.ErrNotLeader + } + off, err := b.AppendBatch(_ctx, event) + if err != nil { + return -1, err + } + return off + s.startOffset, nil +} + func (s *segment) Read(ctx context.Context, from int64, size int16, pollingTimeout uint32) ([]*ce.Event, error) { if from < s.startOffset { return nil, errors.ErrOffsetUnderflow diff --git a/client/pkg/eventlog/segment_block.go b/client/pkg/eventlog/segment_block.go index 7344240d2..cafd5c221 100644 --- a/client/pkg/eventlog/segment_block.go +++ b/client/pkg/eventlog/segment_block.go @@ -25,6 +25,7 @@ import ( "github.com/linkall-labs/vanus/client/internal/vanus/store" "github.com/linkall-labs/vanus/client/pkg/record" "github.com/linkall-labs/vanus/pkg/errors" + "github.com/linkall-labs/vanus/proto/pkg/cloudevents" ) func newBlock(ctx context.Context, r *record.Block) (*block, error) { @@ -56,6 +57,10 @@ func (s *block) Append(ctx context.Context, event *ce.Event) (int64, error) { return s.store.Append(ctx, s.id, event) } +func (s *block) AppendBatch(ctx context.Context, event *cloudevents.CloudEventBatch) (int64, error) { + return s.store.AppendBatch(ctx, s.id, event) +} + func (s *block) Read(ctx context.Context, offset int64, size int16, pollingTimeout uint32) ([]*ce.Event, error) { if offset < 0 { return nil, errors.ErrOffsetUnderflow diff --git a/go.mod b/go.mod index fefb22192..c0f3ed86d 100644 --- a/go.mod +++ b/go.mod @@ -3,13 +3,12 @@ module github.com/linkall-labs/vanus go 1.18 require ( - cloudevents.io/genproto v1.0.2 github.com/HdrHistogram/hdrhistogram-go v1.1.2 github.com/aws/aws-sdk-go-v2 v1.16.11 github.com/aws/aws-sdk-go-v2/credentials v1.12.13 github.com/aws/aws-sdk-go-v2/service/lambda v1.23.8 - github.com/cloudevents/sdk-go/sql/v2 v2.10.1 - github.com/cloudevents/sdk-go/v2 v2.11.0 + github.com/cloudevents/sdk-go/sql/v2 v2.12.0 + github.com/cloudevents/sdk-go/v2 v2.12.0 github.com/fatih/color v1.13.0 github.com/go-redis/redis/v8 v8.11.5 github.com/go-resty/resty/v2 v2.7.0 @@ -48,7 +47,7 @@ require ( golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 google.golang.org/api v0.102.0 google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c - google.golang.org/grpc v1.50.1 + google.golang.org/grpc v1.51.0 google.golang.org/protobuf v1.28.1 gopkg.in/yaml.v3 v3.0.1 k8s.io/apimachinery v0.25.0 @@ -68,6 +67,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.12.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -147,7 +147,6 @@ require ( ) replace ( - cloudevents.io/genproto => ./proto/include/cloudevents/pkg github.com/linkall-labs/vanus/client => ./client github.com/linkall-labs/vanus/observability => ./observability github.com/linkall-labs/vanus/pkg => ./pkg diff --git a/go.sum b/go.sum index a1018795f..600f415b9 100644 --- a/go.sum +++ b/go.sum @@ -50,7 +50,6 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5 github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 h1:MzBOUgng9orim59UnfUTLRjMpd09C5uEVQ6RPGeCaVI= github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129/go.mod h1:rFgpPQZYZ8vdbc+48xibu8ALc3yeyd64IhHS+PU6Yyg= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211221011931-643d94fcab96/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220209173558-ad29539cd2e9 h1:zvkJv+9Pxm1nnEMcKnShREt4qtduHKz4iw4AB4ul0Ao= github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220209173558-ad29539cd2e9/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= github.com/aws/aws-sdk-go-v2 v1.16.11 h1:xM1ZPSvty3xVmdxiGr7ay/wlqv+MWhH0rMlyLdbC0YQ= @@ -85,11 +84,12 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudevents/sdk-go/sql/v2 v2.10.1 h1:57d6xo9ZamM69Cfj/3uXSEQ9LZ6IQHJKUxtD0QvH66I= -github.com/cloudevents/sdk-go/sql/v2 v2.10.1/go.mod h1:XjZxSDaz9lziRkvFpmsZGz0P4BMIS1SnA4pyJR9A2Ok= -github.com/cloudevents/sdk-go/v2 v2.10.1/go.mod h1:GpCBmUj7DIRiDhVvsK5d6WCbgTWs8DxAWTRtAwQmIXs= -github.com/cloudevents/sdk-go/v2 v2.11.0 h1:pCb7Cdkb8XpUoil+miuw6PEzuCG9cc8Erj8y1/q3odo= -github.com/cloudevents/sdk-go/v2 v2.11.0/go.mod h1:xDmKfzNjM8gBvjaF8ijFjM1VYOVUEeUfapHMUX1T5To= +github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.12.0 h1:z8j1WETFfzlLxV9aRYykpLAAWh63QFmNCfN6sp2b16s= +github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.12.0/go.mod h1:MCeTV6OrQ8+ZNkAXhx/yUMS0ZAp2Ld8CjyG12+W/ou0= +github.com/cloudevents/sdk-go/sql/v2 v2.12.0 h1:QctEwYMiAvMkP/Un8gaLzEfPLFSmzgvOoUjhdDydqLU= +github.com/cloudevents/sdk-go/sql/v2 v2.12.0/go.mod h1:GIAna2yq5KZDe9QzSCmhHTHzYbB0XifZk1GX6yZe+8Q= +github.com/cloudevents/sdk-go/v2 v2.12.0 h1:p1k+ysVOZtNiXfijnwB3WqZNA3y2cGOiKQygWkUHCEI= +github.com/cloudevents/sdk-go/v2 v2.12.0/go.mod h1:xDmKfzNjM8gBvjaF8ijFjM1VYOVUEeUfapHMUX1T5To= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= @@ -227,7 +227,6 @@ github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -411,7 +410,6 @@ github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhso github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E= @@ -653,7 +651,6 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44= golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -788,8 +785,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/internal/gateway/proxy/proxy.go b/internal/gateway/proxy/proxy.go index a9f2b87c3..7d2b7728c 100644 --- a/internal/gateway/proxy/proxy.go +++ b/internal/gateway/proxy/proxy.go @@ -20,16 +20,20 @@ import ( "encoding/binary" "fmt" "net" + "net/http" "runtime/debug" + "strings" "sync" v2 "github.com/cloudevents/sdk-go/v2" + "github.com/cloudevents/sdk-go/v2/types" recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery" eb "github.com/linkall-labs/vanus/client" "github.com/linkall-labs/vanus/client/pkg/api" "github.com/linkall-labs/vanus/client/pkg/option" "github.com/linkall-labs/vanus/client/pkg/policy" "github.com/linkall-labs/vanus/internal/convert" + "github.com/linkall-labs/vanus/internal/primitive" "github.com/linkall-labs/vanus/internal/primitive/interceptor/errinterceptor" "github.com/linkall-labs/vanus/internal/primitive/vanus" "github.com/linkall-labs/vanus/internal/trigger/filter" @@ -38,6 +42,7 @@ import ( "github.com/linkall-labs/vanus/observability/tracing" "github.com/linkall-labs/vanus/pkg/cluster" "github.com/linkall-labs/vanus/pkg/errors" + "github.com/linkall-labs/vanus/proto/pkg/cloudevents" ctrlpb "github.com/linkall-labs/vanus/proto/pkg/controller" proxypb "github.com/linkall-labs/vanus/proto/pkg/proxy" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" @@ -68,6 +73,10 @@ type Config struct { GRPCReflectionEnable bool } +var ( + _ cloudevents.CloudEventsServer = &ControllerProxy{} +) + type ControllerProxy struct { cfg Config tracer *tracing.Tracer @@ -79,6 +88,65 @@ type ControllerProxy struct { ctrl cluster.Cluster } +func (cp *ControllerProxy) Send(ctx context.Context, batch *cloudevents.BatchEvent) (*emptypb.Empty, error) { + _ctx, span := cp.tracer.Start(ctx, "Send") + defer span.End() + + if batch.EventbusName == "" { + return nil, v2.NewHTTPResult(http.StatusBadRequest, "invalid eventbus name") + } + + for idx := range batch.Events.Events { + e := batch.Events.Events[idx] + err := checkExtension(e.Attributes) + if err != nil { + return nil, v2.NewHTTPResult(http.StatusBadRequest, err.Error()) + } + e.Attributes[primitive.XVanusEventbus] = &cloudevents.CloudEvent_CloudEventAttributeValue{ + Attr: &cloudevents.CloudEvent_CloudEventAttributeValue_CeString{CeString: batch.EventbusName}, + } + if eventTime, ok := e.Attributes[primitive.XVanusDeliveryTime]; ok { + // validate event time + if _, err := types.ParseTime(eventTime.String()); err != nil { + log.Error(_ctx, "invalid format of event time", map[string]interface{}{ + log.KeyError: err, + "eventTime": eventTime.String(), + }) + return nil, v2.NewHTTPResult(http.StatusBadRequest, "invalid delivery time") + } + // TODO process delay message + // ebName = primitive.TimerEventbusName + } + } + + err := cp.client.Eventbus(ctx, batch.GetEventbusName()).Writer().AppendBatch(_ctx, batch.GetEvents()) + if err != nil { + log.Warning(_ctx, "append to failed", map[string]interface{}{ + log.KeyError: err, + "eventbus": batch.EventbusName, + }) + return nil, v2.NewHTTPResult(http.StatusInternalServerError, err.Error()) + } + + return &emptypb.Empty{}, nil +} + +func checkExtension(extensions map[string]*cloudevents.CloudEvent_CloudEventAttributeValue) error { + if len(extensions) == 0 { + return nil + } + for name := range extensions { + if name == primitive.XVanusDeliveryTime { + continue + } + // event attribute can not prefix with vanus system use + if strings.HasPrefix(name, primitive.XVanus) { + return fmt.Errorf("invalid ce attribute [%s] perfix %s", name, primitive.XVanus) + } + } + return nil +} + func NewControllerProxy(cfg Config) *ControllerProxy { ctrl := cluster.NewClusterController(cfg.Endpoints, insecure.NewCredentials()) return &ControllerProxy{ @@ -122,6 +190,7 @@ func (cp *ControllerProxy) Start() error { } proxypb.RegisterControllerProxyServer(cp.grpcSrv, cp) + cloudevents.RegisterCloudEventsServer(cp.grpcSrv, cp) listen, err := net.Listen("tcp", fmt.Sprintf(":%d", cp.cfg.ProxyPort)) if err != nil { diff --git a/internal/store/schema/ce/convert/entry.go b/internal/store/schema/ce/convert/entry.go index 25f6652ba..d0a89da3a 100644 --- a/internal/store/schema/ce/convert/entry.go +++ b/internal/store/schema/ce/convert/entry.go @@ -21,7 +21,7 @@ import ( "time" // third-party libraries. - cepb "cloudevents.io/genproto/v1" + cepb "github.com/linkall-labs/vanus/proto/pkg/cloudevents" "google.golang.org/protobuf/proto" // first-party libraries. @@ -80,7 +80,7 @@ func (e *ceEntry) GetString(ordinal int) string { return "" } - var attr *cepb.CloudEventAttributeValue + var attr *cepb.CloudEvent_CloudEventAttributeValue switch ordinal { case ceschema.DataContentTypeOrdinal: attr = e.ce.Attributes[dataContentTypeAttr] @@ -192,22 +192,22 @@ func (e *ceEntry) ExtensionAttributeCount() int { return sz } -func attrValue(v *cepb.CloudEventAttributeValue) []byte { +func attrValue(v *cepb.CloudEvent_CloudEventAttributeValue) []byte { // FIXME(james.yin): support native types. switch val := v.GetAttr().(type) { - case *cepb.CloudEventAttributeValue_CeBoolean: + case *cepb.CloudEvent_CloudEventAttributeValue_CeBoolean: return []byte(strconv.FormatBool(val.CeBoolean)) - case *cepb.CloudEventAttributeValue_CeInteger: + case *cepb.CloudEvent_CloudEventAttributeValue_CeInteger: return []byte(strconv.FormatInt(int64(val.CeInteger), 10)) - case *cepb.CloudEventAttributeValue_CeString: + case *cepb.CloudEvent_CloudEventAttributeValue_CeString: return []byte(val.CeString) - case *cepb.CloudEventAttributeValue_CeBytes: + case *cepb.CloudEvent_CloudEventAttributeValue_CeBytes: return val.CeBytes - case *cepb.CloudEventAttributeValue_CeUri: + case *cepb.CloudEvent_CloudEventAttributeValue_CeUri: return []byte(val.CeUri) - case *cepb.CloudEventAttributeValue_CeUriRef: + case *cepb.CloudEvent_CloudEventAttributeValue_CeUriRef: return []byte(val.CeUriRef) - case *cepb.CloudEventAttributeValue_CeTimestamp: + case *cepb.CloudEvent_CloudEventAttributeValue_CeTimestamp: return []byte(val.CeTimestamp.AsTime().Format(time.RFC3339Nano)) } return nil diff --git a/internal/store/schema/ce/convert/protobuf.go b/internal/store/schema/ce/convert/protobuf.go index 3638187f7..6c5fceb43 100644 --- a/internal/store/schema/ce/convert/protobuf.go +++ b/internal/store/schema/ce/convert/protobuf.go @@ -19,7 +19,7 @@ import ( "time" // third-party libraries. - cepb "cloudevents.io/genproto/v1" + cepb "github.com/linkall-labs/vanus/proto/pkg/cloudevents" "google.golang.org/protobuf/types/known/timestamppb" // first-party libraries. @@ -89,51 +89,51 @@ func ToPb(e block.Entry) *cepb.CloudEvent { event.SpecVersion = w.SpecVersion() event.Type = w.Type() - event.Attributes = make(map[string]*cepb.CloudEventAttributeValue) + event.Attributes = make(map[string]*cepb.CloudEvent_CloudEventAttributeValue) if s := w.DataContentType(); s != "" { - event.Attributes[dataContentTypeAttr] = &cepb.CloudEventAttributeValue{ - Attr: &cepb.CloudEventAttributeValue_CeString{ + event.Attributes[dataContentTypeAttr] = &cepb.CloudEvent_CloudEventAttributeValue{ + Attr: &cepb.CloudEvent_CloudEventAttributeValue_CeString{ CeString: s, }, } } if s := w.DataSchema(); s != "" { - event.Attributes[dataSchemaAttr] = &cepb.CloudEventAttributeValue{ - Attr: &cepb.CloudEventAttributeValue_CeString{ + event.Attributes[dataSchemaAttr] = &cepb.CloudEvent_CloudEventAttributeValue{ + Attr: &cepb.CloudEvent_CloudEventAttributeValue_CeString{ CeString: s, }, } } if s := w.Subject(); s != "" { - event.Attributes[subjectAttr] = &cepb.CloudEventAttributeValue{ - Attr: &cepb.CloudEventAttributeValue_CeString{ + event.Attributes[subjectAttr] = &cepb.CloudEvent_CloudEventAttributeValue{ + Attr: &cepb.CloudEvent_CloudEventAttributeValue_CeString{ CeString: s, }, } } if t := w.Time(); !t.IsZero() { - event.Attributes[timeAttr] = &cepb.CloudEventAttributeValue{ - Attr: &cepb.CloudEventAttributeValue_CeTimestamp{ + event.Attributes[timeAttr] = &cepb.CloudEvent_CloudEventAttributeValue{ + Attr: &cepb.CloudEvent_CloudEventAttributeValue_CeTimestamp{ CeTimestamp: timestamppb.New(t), }, } } w.e.RangeExtensionAttributes(block.OnExtensionAttributeFunc(func(attr, val []byte) { // TODO(james.yin): support native type. - event.Attributes[string(attr)] = &cepb.CloudEventAttributeValue{ - Attr: &cepb.CloudEventAttributeValue_CeString{ + event.Attributes[string(attr)] = &cepb.CloudEvent_CloudEventAttributeValue{ + Attr: &cepb.CloudEvent_CloudEventAttributeValue_CeString{ CeString: string(val), }, } })) // Overwrite XVanusBlockOffset and XVanusStime if exists. - event.Attributes[segpb.XVanusBlockOffset] = &cepb.CloudEventAttributeValue{ - Attr: &cepb.CloudEventAttributeValue_CeInteger{ + event.Attributes[segpb.XVanusBlockOffset] = &cepb.CloudEvent_CloudEventAttributeValue{ + Attr: &cepb.CloudEvent_CloudEventAttributeValue_CeInteger{ CeInteger: int32(ceschema.SequenceNumber(e)), }, } - event.Attributes[segpb.XVanusStime] = &cepb.CloudEventAttributeValue{ - Attr: &cepb.CloudEventAttributeValue_CeTimestamp{ + event.Attributes[segpb.XVanusStime] = &cepb.CloudEvent_CloudEventAttributeValue{ + Attr: &cepb.CloudEvent_CloudEventAttributeValue_CeTimestamp{ CeTimestamp: timestamppb.New(time.UnixMilli(ceschema.Stime(e))), }, } diff --git a/internal/store/schema/ce/testing/event.go b/internal/store/schema/ce/testing/event.go index 92190dd1a..50c857b49 100644 --- a/internal/store/schema/ce/testing/event.go +++ b/internal/store/schema/ce/testing/event.go @@ -19,8 +19,8 @@ import ( "time" // third-party libraries. - cepb "cloudevents.io/genproto/v1" ce "github.com/cloudevents/sdk-go/v2" + cepb "github.com/linkall-labs/vanus/proto/pkg/cloudevents" . "github.com/smartystreets/goconvey/convey" "google.golang.org/protobuf/types/known/timestamppb" @@ -63,34 +63,34 @@ func MakeEvent1() *cepb.CloudEvent { Source: ceSource, SpecVersion: ceSpecVersion, Type: ceType, - Attributes: map[string]*cepb.CloudEventAttributeValue{ + Attributes: map[string]*cepb.CloudEvent_CloudEventAttributeValue{ "datacontenttype": { - Attr: &cepb.CloudEventAttributeValue_CeString{ + Attr: &cepb.CloudEvent_CloudEventAttributeValue_CeString{ CeString: ceDataContentType, }, }, "subject": { - Attr: &cepb.CloudEventAttributeValue_CeString{ + Attr: &cepb.CloudEvent_CloudEventAttributeValue_CeString{ CeString: ceSubject, }, }, "time": { - Attr: &cepb.CloudEventAttributeValue_CeTimestamp{ + Attr: &cepb.CloudEvent_CloudEventAttributeValue_CeTimestamp{ CeTimestamp: timestamppb.New(ceTime), }, }, "attr0": { - Attr: &cepb.CloudEventAttributeValue_CeString{ + Attr: &cepb.CloudEvent_CloudEventAttributeValue_CeString{ CeString: "value0", }, }, "attr1": { - Attr: &cepb.CloudEventAttributeValue_CeString{ + Attr: &cepb.CloudEvent_CloudEventAttributeValue_CeString{ CeString: "value1", }, }, "attr2": { - Attr: &cepb.CloudEventAttributeValue_CeString{ + Attr: &cepb.CloudEvent_CloudEventAttributeValue_CeString{ CeString: "value2", }, }, diff --git a/internal/store/segment/api.go b/internal/store/segment/api.go index 19773de34..d3acc5976 100644 --- a/internal/store/segment/api.go +++ b/internal/store/segment/api.go @@ -19,7 +19,7 @@ import ( "context" // third-party libraries. - cepb "cloudevents.io/genproto/v1" + cepb "github.com/linkall-labs/vanus/proto/pkg/cloudevents" "google.golang.org/protobuf/types/known/emptypb" // first-party libraries. diff --git a/internal/store/segment/api_test.go b/internal/store/segment/api_test.go index 151e2fed9..70cce0cde 100644 --- a/internal/store/segment/api_test.go +++ b/internal/store/segment/api_test.go @@ -19,9 +19,8 @@ import ( "context" "testing" - // third-party libraries. - cepb "cloudevents.io/genproto/v1" . "github.com/golang/mock/gomock" + cepb "github.com/linkall-labs/vanus/proto/pkg/cloudevents" . "github.com/smartystreets/goconvey/convey" "google.golang.org/protobuf/types/known/emptypb" diff --git a/internal/store/segment/mock_server.go b/internal/store/segment/mock_server.go index 6e4c32e29..c45a5299b 100644 --- a/internal/store/segment/mock_server.go +++ b/internal/store/segment/mock_server.go @@ -9,7 +9,7 @@ import ( net "net" reflect "reflect" - v1 "cloudevents.io/genproto/v1" + v1 "github.com/linkall-labs/vanus/proto/pkg/cloudevents" gomock "github.com/golang/mock/gomock" primitive "github.com/linkall-labs/vanus/internal/primitive" vanus "github.com/linkall-labs/vanus/internal/primitive/vanus" diff --git a/internal/store/segment/server.go b/internal/store/segment/server.go index 1a2997dc9..4017293d4 100644 --- a/internal/store/segment/server.go +++ b/internal/store/segment/server.go @@ -29,8 +29,8 @@ import ( "time" // third-party libraries. - cepb "cloudevents.io/genproto/v1" recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery" + cepb "github.com/linkall-labs/vanus/proto/pkg/cloudevents" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" diff --git a/internal/store/vsb/fragment_test.go b/internal/store/vsb/fragment_test.go index 3edc1b7e1..4d00637b4 100644 --- a/internal/store/vsb/fragment_test.go +++ b/internal/store/vsb/fragment_test.go @@ -22,10 +22,12 @@ import ( "time" // third-party libraries. - cepb "cloudevents.io/genproto/v1" . "github.com/golang/mock/gomock" . "github.com/smartystreets/goconvey/convey" + // first-party libraries. + cepb "github.com/linkall-labs/vanus/proto/pkg/cloudevents" + // this project. "github.com/linkall-labs/vanus/internal/store/block" ceschema "github.com/linkall-labs/vanus/internal/store/schema/ce" diff --git a/pkg/go.mod b/pkg/go.mod index aef7b364a..6450224eb 100644 --- a/pkg/go.mod +++ b/pkg/go.mod @@ -12,7 +12,6 @@ require ( ) replace ( - cloudevents.io/genproto => ../proto/include/cloudevents/pkg github.com/linkall-labs/vanus/observability => ../observability github.com/linkall-labs/vanus/proto => ../proto github.com/linkall-labs/vanus/raft => ../raft diff --git a/proto/go.mod b/proto/go.mod index c8480f357..818b9c93f 100644 --- a/proto/go.mod +++ b/proto/go.mod @@ -3,7 +3,6 @@ module github.com/linkall-labs/vanus/proto go 1.17 require ( - cloudevents.io/genproto v1.0.2 github.com/golang/mock v1.6.0 github.com/linkall-labs/vanus/raft v0.5.1 google.golang.org/grpc v1.49.0 @@ -11,7 +10,6 @@ require ( ) replace ( - cloudevents.io/genproto => ./include/cloudevents/pkg github.com/linkall-labs/vanus/raft => ../raft ) diff --git a/proto/include/cloudevents/buf.gen.yaml b/proto/include/cloudevents/buf.gen.yaml deleted file mode 100644 index 2ade1a164..000000000 --- a/proto/include/cloudevents/buf.gen.yaml +++ /dev/null @@ -1,6 +0,0 @@ -version: v1 -plugins: - - name: go - out: include/cloudevents/thirds - opt: - - module=cloudevents.io/genproto diff --git a/proto/include/cloudevents/cloudevents.proto b/proto/include/cloudevents/cloudevents.proto deleted file mode 100644 index 3067531aa..000000000 --- a/proto/include/cloudevents/cloudevents.proto +++ /dev/null @@ -1,67 +0,0 @@ -/** - * CloudEvent Protobuf Format - * - * - Required context attributes are explicity represented. - * - Optional and Extension context attributes are carried in a map structure. - * - Data may be represented as binary, text, or protobuf messages. - */ - -syntax = "proto3"; - -package io.cloudevents.v1; - -import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "CloudNative.CloudEvents.V1"; -option go_package = "cloudevents.io/genproto/v1"; -option java_package = "io.cloudevents.v1.proto"; -option java_multiple_files = true; -option php_namespace = "Io\\CloudEvents\\V1\\Proto"; -option ruby_package = "Io::CloudEvents::V1::Proto"; - -message CloudEvent { - // -- CloudEvent Context Attributes - - // Required Attributes - string id = 1; - string source = 2; // URI-reference - string spec_version = 3; - string type = 4; - - // Optional & Extension Attributes - map attributes = 5; - - // -- CloudEvent Data (Bytes, Text, or Proto) - oneof data { - bytes binary_data = 6; - string text_data = 7; - google.protobuf.Any proto_data = 8; - } -} - -/** - * The CloudEvent specification defines - * seven attribute value types... - */ - -message CloudEventAttributeValue { - oneof attr { - bool ce_boolean = 1; - int32 ce_integer = 2; - string ce_string = 3; - bytes ce_bytes = 4; - string ce_uri = 5; - string ce_uri_ref = 6; - google.protobuf.Timestamp ce_timestamp = 7; - } -} - -/** - * CloudEvent Protobuf Batch Format - * - */ - -message CloudEventBatch { - repeated CloudEvent events = 1; -} diff --git a/proto/include/cloudevents/pkg/go.mod b/proto/include/cloudevents/pkg/go.mod deleted file mode 100644 index bb06e51f8..000000000 --- a/proto/include/cloudevents/pkg/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module cloudevents.io/genproto - -go 1.17 - -require google.golang.org/protobuf v1.27.1 diff --git a/proto/include/cloudevents/pkg/go.sum b/proto/include/cloudevents/pkg/go.sum deleted file mode 100644 index 03b1917b5..000000000 --- a/proto/include/cloudevents/pkg/go.sum +++ /dev/null @@ -1,8 +0,0 @@ -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/proto/include/cloudevents/pkg/v1/cloudevents.pb.go b/proto/include/cloudevents/pkg/v1/cloudevents.pb.go deleted file mode 100644 index c943dd32f..000000000 --- a/proto/include/cloudevents/pkg/v1/cloudevents.pb.go +++ /dev/null @@ -1,547 +0,0 @@ -// -// CloudEvent Protobuf Format -// -// - Required context attributes are explicity represented. -// - Optional and Extension context attributes are carried in a map structure. -// - Data may be represented as binary, text, or protobuf messages. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc (unknown) -// source: cloudevents/cloudevents.proto - -package v1 - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - anypb "google.golang.org/protobuf/types/known/anypb" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type CloudEvent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Required Attributes - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"` // URI-reference - SpecVersion string `protobuf:"bytes,3,opt,name=spec_version,json=specVersion,proto3" json:"spec_version,omitempty"` - Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` - // Optional & Extension Attributes - Attributes map[string]*CloudEventAttributeValue `protobuf:"bytes,5,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // -- CloudEvent Data (Bytes, Text, or Proto) - // - // Types that are assignable to Data: - // *CloudEvent_BinaryData - // *CloudEvent_TextData - // *CloudEvent_ProtoData - Data isCloudEvent_Data `protobuf_oneof:"data"` -} - -func (x *CloudEvent) Reset() { - *x = CloudEvent{} - if protoimpl.UnsafeEnabled { - mi := &file_cloudevents_cloudevents_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CloudEvent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CloudEvent) ProtoMessage() {} - -func (x *CloudEvent) ProtoReflect() protoreflect.Message { - mi := &file_cloudevents_cloudevents_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CloudEvent.ProtoReflect.Descriptor instead. -func (*CloudEvent) Descriptor() ([]byte, []int) { - return file_cloudevents_cloudevents_proto_rawDescGZIP(), []int{0} -} - -func (x *CloudEvent) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *CloudEvent) GetSource() string { - if x != nil { - return x.Source - } - return "" -} - -func (x *CloudEvent) GetSpecVersion() string { - if x != nil { - return x.SpecVersion - } - return "" -} - -func (x *CloudEvent) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *CloudEvent) GetAttributes() map[string]*CloudEventAttributeValue { - if x != nil { - return x.Attributes - } - return nil -} - -func (m *CloudEvent) GetData() isCloudEvent_Data { - if m != nil { - return m.Data - } - return nil -} - -func (x *CloudEvent) GetBinaryData() []byte { - if x, ok := x.GetData().(*CloudEvent_BinaryData); ok { - return x.BinaryData - } - return nil -} - -func (x *CloudEvent) GetTextData() string { - if x, ok := x.GetData().(*CloudEvent_TextData); ok { - return x.TextData - } - return "" -} - -func (x *CloudEvent) GetProtoData() *anypb.Any { - if x, ok := x.GetData().(*CloudEvent_ProtoData); ok { - return x.ProtoData - } - return nil -} - -type isCloudEvent_Data interface { - isCloudEvent_Data() -} - -type CloudEvent_BinaryData struct { - BinaryData []byte `protobuf:"bytes,6,opt,name=binary_data,json=binaryData,proto3,oneof"` -} - -type CloudEvent_TextData struct { - TextData string `protobuf:"bytes,7,opt,name=text_data,json=textData,proto3,oneof"` -} - -type CloudEvent_ProtoData struct { - ProtoData *anypb.Any `protobuf:"bytes,8,opt,name=proto_data,json=protoData,proto3,oneof"` -} - -func (*CloudEvent_BinaryData) isCloudEvent_Data() {} - -func (*CloudEvent_TextData) isCloudEvent_Data() {} - -func (*CloudEvent_ProtoData) isCloudEvent_Data() {} - -type CloudEventAttributeValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Attr: - // *CloudEventAttributeValue_CeBoolean - // *CloudEventAttributeValue_CeInteger - // *CloudEventAttributeValue_CeString - // *CloudEventAttributeValue_CeBytes - // *CloudEventAttributeValue_CeUri - // *CloudEventAttributeValue_CeUriRef - // *CloudEventAttributeValue_CeTimestamp - Attr isCloudEventAttributeValue_Attr `protobuf_oneof:"attr"` -} - -func (x *CloudEventAttributeValue) Reset() { - *x = CloudEventAttributeValue{} - if protoimpl.UnsafeEnabled { - mi := &file_cloudevents_cloudevents_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CloudEventAttributeValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CloudEventAttributeValue) ProtoMessage() {} - -func (x *CloudEventAttributeValue) ProtoReflect() protoreflect.Message { - mi := &file_cloudevents_cloudevents_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CloudEventAttributeValue.ProtoReflect.Descriptor instead. -func (*CloudEventAttributeValue) Descriptor() ([]byte, []int) { - return file_cloudevents_cloudevents_proto_rawDescGZIP(), []int{1} -} - -func (m *CloudEventAttributeValue) GetAttr() isCloudEventAttributeValue_Attr { - if m != nil { - return m.Attr - } - return nil -} - -func (x *CloudEventAttributeValue) GetCeBoolean() bool { - if x, ok := x.GetAttr().(*CloudEventAttributeValue_CeBoolean); ok { - return x.CeBoolean - } - return false -} - -func (x *CloudEventAttributeValue) GetCeInteger() int32 { - if x, ok := x.GetAttr().(*CloudEventAttributeValue_CeInteger); ok { - return x.CeInteger - } - return 0 -} - -func (x *CloudEventAttributeValue) GetCeString() string { - if x, ok := x.GetAttr().(*CloudEventAttributeValue_CeString); ok { - return x.CeString - } - return "" -} - -func (x *CloudEventAttributeValue) GetCeBytes() []byte { - if x, ok := x.GetAttr().(*CloudEventAttributeValue_CeBytes); ok { - return x.CeBytes - } - return nil -} - -func (x *CloudEventAttributeValue) GetCeUri() string { - if x, ok := x.GetAttr().(*CloudEventAttributeValue_CeUri); ok { - return x.CeUri - } - return "" -} - -func (x *CloudEventAttributeValue) GetCeUriRef() string { - if x, ok := x.GetAttr().(*CloudEventAttributeValue_CeUriRef); ok { - return x.CeUriRef - } - return "" -} - -func (x *CloudEventAttributeValue) GetCeTimestamp() *timestamppb.Timestamp { - if x, ok := x.GetAttr().(*CloudEventAttributeValue_CeTimestamp); ok { - return x.CeTimestamp - } - return nil -} - -type isCloudEventAttributeValue_Attr interface { - isCloudEventAttributeValue_Attr() -} - -type CloudEventAttributeValue_CeBoolean struct { - CeBoolean bool `protobuf:"varint,1,opt,name=ce_boolean,json=ceBoolean,proto3,oneof"` -} - -type CloudEventAttributeValue_CeInteger struct { - CeInteger int32 `protobuf:"varint,2,opt,name=ce_integer,json=ceInteger,proto3,oneof"` -} - -type CloudEventAttributeValue_CeString struct { - CeString string `protobuf:"bytes,3,opt,name=ce_string,json=ceString,proto3,oneof"` -} - -type CloudEventAttributeValue_CeBytes struct { - CeBytes []byte `protobuf:"bytes,4,opt,name=ce_bytes,json=ceBytes,proto3,oneof"` -} - -type CloudEventAttributeValue_CeUri struct { - CeUri string `protobuf:"bytes,5,opt,name=ce_uri,json=ceUri,proto3,oneof"` -} - -type CloudEventAttributeValue_CeUriRef struct { - CeUriRef string `protobuf:"bytes,6,opt,name=ce_uri_ref,json=ceUriRef,proto3,oneof"` -} - -type CloudEventAttributeValue_CeTimestamp struct { - CeTimestamp *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=ce_timestamp,json=ceTimestamp,proto3,oneof"` -} - -func (*CloudEventAttributeValue_CeBoolean) isCloudEventAttributeValue_Attr() {} - -func (*CloudEventAttributeValue_CeInteger) isCloudEventAttributeValue_Attr() {} - -func (*CloudEventAttributeValue_CeString) isCloudEventAttributeValue_Attr() {} - -func (*CloudEventAttributeValue_CeBytes) isCloudEventAttributeValue_Attr() {} - -func (*CloudEventAttributeValue_CeUri) isCloudEventAttributeValue_Attr() {} - -func (*CloudEventAttributeValue_CeUriRef) isCloudEventAttributeValue_Attr() {} - -func (*CloudEventAttributeValue_CeTimestamp) isCloudEventAttributeValue_Attr() {} - -type CloudEventBatch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Events []*CloudEvent `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` -} - -func (x *CloudEventBatch) Reset() { - *x = CloudEventBatch{} - if protoimpl.UnsafeEnabled { - mi := &file_cloudevents_cloudevents_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CloudEventBatch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CloudEventBatch) ProtoMessage() {} - -func (x *CloudEventBatch) ProtoReflect() protoreflect.Message { - mi := &file_cloudevents_cloudevents_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CloudEventBatch.ProtoReflect.Descriptor instead. -func (*CloudEventBatch) Descriptor() ([]byte, []int) { - return file_cloudevents_cloudevents_proto_rawDescGZIP(), []int{2} -} - -func (x *CloudEventBatch) GetEvents() []*CloudEvent { - if x != nil { - return x.Events - } - return nil -} - -var File_cloudevents_cloudevents_proto protoreflect.FileDescriptor - -var file_cloudevents_cloudevents_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x63, 0x6c, - 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x11, 0x69, 0x6f, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, - 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa7, - 0x03, 0x0a, 0x0a, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, - 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x70, 0x65, 0x63, 0x5f, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x70, 0x65, - 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x4d, 0x0a, 0x0a, - 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x2d, 0x2e, 0x69, 0x6f, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, - 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x21, 0x0a, 0x0b, 0x62, - 0x69, 0x6e, 0x61, 0x72, 0x79, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, - 0x48, 0x00, 0x52, 0x0a, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1d, - 0x0a, 0x09, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x08, 0x74, 0x65, 0x78, 0x74, 0x44, 0x61, 0x74, 0x61, 0x12, 0x35, 0x0a, - 0x0a, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x44, 0x61, 0x74, 0x61, 0x1a, 0x6a, 0x0a, 0x0f, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x41, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x69, 0x6f, 0x2e, 0x63, 0x6c, - 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x6f, - 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x42, 0x06, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x9a, 0x02, 0x0a, 0x18, 0x43, 0x6c, 0x6f, - 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x63, 0x65, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, - 0x65, 0x61, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x63, 0x65, 0x42, - 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x12, 0x1f, 0x0a, 0x0a, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x74, - 0x65, 0x67, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x09, 0x63, 0x65, - 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x09, 0x63, 0x65, 0x5f, 0x73, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x63, 0x65, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x1b, 0x0a, 0x08, 0x63, 0x65, 0x5f, 0x62, 0x79, 0x74, - 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x07, 0x63, 0x65, 0x42, 0x79, - 0x74, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x06, 0x63, 0x65, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x63, 0x65, 0x55, 0x72, 0x69, 0x12, 0x1e, 0x0a, 0x0a, - 0x63, 0x65, 0x5f, 0x75, 0x72, 0x69, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x08, 0x63, 0x65, 0x55, 0x72, 0x69, 0x52, 0x65, 0x66, 0x12, 0x3f, 0x0a, 0x0c, - 0x63, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x48, 0x00, - 0x52, 0x0b, 0x63, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x06, 0x0a, - 0x04, 0x61, 0x74, 0x74, 0x72, 0x22, 0x48, 0x0a, 0x0f, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x35, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x69, 0x6f, 0x2e, 0x63, 0x6c, - 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x6f, - 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x42, - 0x8b, 0x01, 0x0a, 0x17, 0x69, 0x6f, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1a, 0x63, - 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x69, 0x6f, 0x2f, 0x67, 0x65, - 0x6e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x76, 0x31, 0xaa, 0x02, 0x1a, 0x43, 0x6c, 0x6f, 0x75, - 0x64, 0x4e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x17, 0x49, 0x6f, 0x5c, 0x43, 0x6c, 0x6f, 0x75, - 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0xea, 0x02, 0x1a, 0x49, 0x6f, 0x3a, 0x3a, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_cloudevents_cloudevents_proto_rawDescOnce sync.Once - file_cloudevents_cloudevents_proto_rawDescData = file_cloudevents_cloudevents_proto_rawDesc -) - -func file_cloudevents_cloudevents_proto_rawDescGZIP() []byte { - file_cloudevents_cloudevents_proto_rawDescOnce.Do(func() { - file_cloudevents_cloudevents_proto_rawDescData = protoimpl.X.CompressGZIP(file_cloudevents_cloudevents_proto_rawDescData) - }) - return file_cloudevents_cloudevents_proto_rawDescData -} - -var file_cloudevents_cloudevents_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_cloudevents_cloudevents_proto_goTypes = []interface{}{ - (*CloudEvent)(nil), // 0: io.cloudevents.v1.CloudEvent - (*CloudEventAttributeValue)(nil), // 1: io.cloudevents.v1.CloudEventAttributeValue - (*CloudEventBatch)(nil), // 2: io.cloudevents.v1.CloudEventBatch - nil, // 3: io.cloudevents.v1.CloudEvent.AttributesEntry - (*anypb.Any)(nil), // 4: google.protobuf.Any - (*timestamppb.Timestamp)(nil), // 5: google.protobuf.Timestamp -} -var file_cloudevents_cloudevents_proto_depIdxs = []int32{ - 3, // 0: io.cloudevents.v1.CloudEvent.attributes:type_name -> io.cloudevents.v1.CloudEvent.AttributesEntry - 4, // 1: io.cloudevents.v1.CloudEvent.proto_data:type_name -> google.protobuf.Any - 5, // 2: io.cloudevents.v1.CloudEventAttributeValue.ce_timestamp:type_name -> google.protobuf.Timestamp - 0, // 3: io.cloudevents.v1.CloudEventBatch.events:type_name -> io.cloudevents.v1.CloudEvent - 1, // 4: io.cloudevents.v1.CloudEvent.AttributesEntry.value:type_name -> io.cloudevents.v1.CloudEventAttributeValue - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name -} - -func init() { file_cloudevents_cloudevents_proto_init() } -func file_cloudevents_cloudevents_proto_init() { - if File_cloudevents_cloudevents_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cloudevents_cloudevents_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CloudEvent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cloudevents_cloudevents_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CloudEventAttributeValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cloudevents_cloudevents_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CloudEventBatch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_cloudevents_cloudevents_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*CloudEvent_BinaryData)(nil), - (*CloudEvent_TextData)(nil), - (*CloudEvent_ProtoData)(nil), - } - file_cloudevents_cloudevents_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*CloudEventAttributeValue_CeBoolean)(nil), - (*CloudEventAttributeValue_CeInteger)(nil), - (*CloudEventAttributeValue_CeString)(nil), - (*CloudEventAttributeValue_CeBytes)(nil), - (*CloudEventAttributeValue_CeUri)(nil), - (*CloudEventAttributeValue_CeUriRef)(nil), - (*CloudEventAttributeValue_CeTimestamp)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cloudevents_cloudevents_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_cloudevents_cloudevents_proto_goTypes, - DependencyIndexes: file_cloudevents_cloudevents_proto_depIdxs, - MessageInfos: file_cloudevents_cloudevents_proto_msgTypes, - }.Build() - File_cloudevents_cloudevents_proto = out.File - file_cloudevents_cloudevents_proto_rawDesc = nil - file_cloudevents_cloudevents_proto_goTypes = nil - file_cloudevents_cloudevents_proto_depIdxs = nil -} diff --git a/proto/pkg/cloudevents/cloudevents.pb.go b/proto/pkg/cloudevents/cloudevents.pb.go new file mode 100644 index 000000000..cb568409f --- /dev/null +++ b/proto/pkg/cloudevents/cloudevents.pb.go @@ -0,0 +1,723 @@ +//* +// CloudEvent Protobuf Format +// +// - Required context attributes are explicitly represented. +// - Optional and Extension context attributes are carried in a map structure. +// - Data may be represented as binary, text, or protobuf messages. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.19.4 +// source: cloudevents.proto + +package cloudevents + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + emptypb "google.golang.org/protobuf/types/known/emptypb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type CloudEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Required Attributes + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"` // URI-reference + SpecVersion string `protobuf:"bytes,3,opt,name=spec_version,json=specVersion,proto3" json:"spec_version,omitempty"` + Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` + // Optional & Extension Attributes + Attributes map[string]*CloudEvent_CloudEventAttributeValue `protobuf:"bytes,5,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // -- CloudEvent Data (Bytes, Text, or Proto) + // + // Types that are assignable to Data: + // *CloudEvent_BinaryData + // *CloudEvent_TextData + // *CloudEvent_ProtoData + Data isCloudEvent_Data `protobuf_oneof:"data"` +} + +func (x *CloudEvent) Reset() { + *x = CloudEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_cloudevents_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloudEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloudEvent) ProtoMessage() {} + +func (x *CloudEvent) ProtoReflect() protoreflect.Message { + mi := &file_cloudevents_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloudEvent.ProtoReflect.Descriptor instead. +func (*CloudEvent) Descriptor() ([]byte, []int) { + return file_cloudevents_proto_rawDescGZIP(), []int{0} +} + +func (x *CloudEvent) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *CloudEvent) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *CloudEvent) GetSpecVersion() string { + if x != nil { + return x.SpecVersion + } + return "" +} + +func (x *CloudEvent) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *CloudEvent) GetAttributes() map[string]*CloudEvent_CloudEventAttributeValue { + if x != nil { + return x.Attributes + } + return nil +} + +func (m *CloudEvent) GetData() isCloudEvent_Data { + if m != nil { + return m.Data + } + return nil +} + +func (x *CloudEvent) GetBinaryData() []byte { + if x, ok := x.GetData().(*CloudEvent_BinaryData); ok { + return x.BinaryData + } + return nil +} + +func (x *CloudEvent) GetTextData() string { + if x, ok := x.GetData().(*CloudEvent_TextData); ok { + return x.TextData + } + return "" +} + +func (x *CloudEvent) GetProtoData() *anypb.Any { + if x, ok := x.GetData().(*CloudEvent_ProtoData); ok { + return x.ProtoData + } + return nil +} + +type isCloudEvent_Data interface { + isCloudEvent_Data() +} + +type CloudEvent_BinaryData struct { + BinaryData []byte `protobuf:"bytes,6,opt,name=binary_data,json=binaryData,proto3,oneof"` +} + +type CloudEvent_TextData struct { + TextData string `protobuf:"bytes,7,opt,name=text_data,json=textData,proto3,oneof"` +} + +type CloudEvent_ProtoData struct { + ProtoData *anypb.Any `protobuf:"bytes,8,opt,name=proto_data,json=protoData,proto3,oneof"` +} + +func (*CloudEvent_BinaryData) isCloudEvent_Data() {} + +func (*CloudEvent_TextData) isCloudEvent_Data() {} + +func (*CloudEvent_ProtoData) isCloudEvent_Data() {} + +type CloudEventBatch struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Events []*CloudEvent `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` +} + +func (x *CloudEventBatch) Reset() { + *x = CloudEventBatch{} + if protoimpl.UnsafeEnabled { + mi := &file_cloudevents_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloudEventBatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloudEventBatch) ProtoMessage() {} + +func (x *CloudEventBatch) ProtoReflect() protoreflect.Message { + mi := &file_cloudevents_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloudEventBatch.ProtoReflect.Descriptor instead. +func (*CloudEventBatch) Descriptor() ([]byte, []int) { + return file_cloudevents_proto_rawDescGZIP(), []int{1} +} + +func (x *CloudEventBatch) GetEvents() []*CloudEvent { + if x != nil { + return x.Events + } + return nil +} + +type BatchEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + EventbusName string `protobuf:"bytes,1,opt,name=eventbus_name,json=eventbusName,proto3" json:"eventbus_name,omitempty"` + Events *CloudEventBatch `protobuf:"bytes,2,opt,name=events,proto3" json:"events,omitempty"` +} + +func (x *BatchEvent) Reset() { + *x = BatchEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_cloudevents_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BatchEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BatchEvent) ProtoMessage() {} + +func (x *BatchEvent) ProtoReflect() protoreflect.Message { + mi := &file_cloudevents_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BatchEvent.ProtoReflect.Descriptor instead. +func (*BatchEvent) Descriptor() ([]byte, []int) { + return file_cloudevents_proto_rawDescGZIP(), []int{2} +} + +func (x *BatchEvent) GetEventbusName() string { + if x != nil { + return x.EventbusName + } + return "" +} + +func (x *BatchEvent) GetEvents() *CloudEventBatch { + if x != nil { + return x.Events + } + return nil +} + +type CloudEvent_CloudEventAttributeValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Attr: + // *CloudEvent_CloudEventAttributeValue_CeBoolean + // *CloudEvent_CloudEventAttributeValue_CeInteger + // *CloudEvent_CloudEventAttributeValue_CeString + // *CloudEvent_CloudEventAttributeValue_CeBytes + // *CloudEvent_CloudEventAttributeValue_CeUri + // *CloudEvent_CloudEventAttributeValue_CeUriRef + // *CloudEvent_CloudEventAttributeValue_CeTimestamp + Attr isCloudEvent_CloudEventAttributeValue_Attr `protobuf_oneof:"attr"` +} + +func (x *CloudEvent_CloudEventAttributeValue) Reset() { + *x = CloudEvent_CloudEventAttributeValue{} + if protoimpl.UnsafeEnabled { + mi := &file_cloudevents_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloudEvent_CloudEventAttributeValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloudEvent_CloudEventAttributeValue) ProtoMessage() {} + +func (x *CloudEvent_CloudEventAttributeValue) ProtoReflect() protoreflect.Message { + mi := &file_cloudevents_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloudEvent_CloudEventAttributeValue.ProtoReflect.Descriptor instead. +func (*CloudEvent_CloudEventAttributeValue) Descriptor() ([]byte, []int) { + return file_cloudevents_proto_rawDescGZIP(), []int{0, 1} +} + +func (m *CloudEvent_CloudEventAttributeValue) GetAttr() isCloudEvent_CloudEventAttributeValue_Attr { + if m != nil { + return m.Attr + } + return nil +} + +func (x *CloudEvent_CloudEventAttributeValue) GetCeBoolean() bool { + if x, ok := x.GetAttr().(*CloudEvent_CloudEventAttributeValue_CeBoolean); ok { + return x.CeBoolean + } + return false +} + +func (x *CloudEvent_CloudEventAttributeValue) GetCeInteger() int32 { + if x, ok := x.GetAttr().(*CloudEvent_CloudEventAttributeValue_CeInteger); ok { + return x.CeInteger + } + return 0 +} + +func (x *CloudEvent_CloudEventAttributeValue) GetCeString() string { + if x, ok := x.GetAttr().(*CloudEvent_CloudEventAttributeValue_CeString); ok { + return x.CeString + } + return "" +} + +func (x *CloudEvent_CloudEventAttributeValue) GetCeBytes() []byte { + if x, ok := x.GetAttr().(*CloudEvent_CloudEventAttributeValue_CeBytes); ok { + return x.CeBytes + } + return nil +} + +func (x *CloudEvent_CloudEventAttributeValue) GetCeUri() string { + if x, ok := x.GetAttr().(*CloudEvent_CloudEventAttributeValue_CeUri); ok { + return x.CeUri + } + return "" +} + +func (x *CloudEvent_CloudEventAttributeValue) GetCeUriRef() string { + if x, ok := x.GetAttr().(*CloudEvent_CloudEventAttributeValue_CeUriRef); ok { + return x.CeUriRef + } + return "" +} + +func (x *CloudEvent_CloudEventAttributeValue) GetCeTimestamp() *timestamppb.Timestamp { + if x, ok := x.GetAttr().(*CloudEvent_CloudEventAttributeValue_CeTimestamp); ok { + return x.CeTimestamp + } + return nil +} + +type isCloudEvent_CloudEventAttributeValue_Attr interface { + isCloudEvent_CloudEventAttributeValue_Attr() +} + +type CloudEvent_CloudEventAttributeValue_CeBoolean struct { + CeBoolean bool `protobuf:"varint,1,opt,name=ce_boolean,json=ceBoolean,proto3,oneof"` +} + +type CloudEvent_CloudEventAttributeValue_CeInteger struct { + CeInteger int32 `protobuf:"varint,2,opt,name=ce_integer,json=ceInteger,proto3,oneof"` +} + +type CloudEvent_CloudEventAttributeValue_CeString struct { + CeString string `protobuf:"bytes,3,opt,name=ce_string,json=ceString,proto3,oneof"` +} + +type CloudEvent_CloudEventAttributeValue_CeBytes struct { + CeBytes []byte `protobuf:"bytes,4,opt,name=ce_bytes,json=ceBytes,proto3,oneof"` +} + +type CloudEvent_CloudEventAttributeValue_CeUri struct { + CeUri string `protobuf:"bytes,5,opt,name=ce_uri,json=ceUri,proto3,oneof"` +} + +type CloudEvent_CloudEventAttributeValue_CeUriRef struct { + CeUriRef string `protobuf:"bytes,6,opt,name=ce_uri_ref,json=ceUriRef,proto3,oneof"` +} + +type CloudEvent_CloudEventAttributeValue_CeTimestamp struct { + CeTimestamp *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=ce_timestamp,json=ceTimestamp,proto3,oneof"` +} + +func (*CloudEvent_CloudEventAttributeValue_CeBoolean) isCloudEvent_CloudEventAttributeValue_Attr() {} + +func (*CloudEvent_CloudEventAttributeValue_CeInteger) isCloudEvent_CloudEventAttributeValue_Attr() {} + +func (*CloudEvent_CloudEventAttributeValue_CeString) isCloudEvent_CloudEventAttributeValue_Attr() {} + +func (*CloudEvent_CloudEventAttributeValue_CeBytes) isCloudEvent_CloudEventAttributeValue_Attr() {} + +func (*CloudEvent_CloudEventAttributeValue_CeUri) isCloudEvent_CloudEventAttributeValue_Attr() {} + +func (*CloudEvent_CloudEventAttributeValue_CeUriRef) isCloudEvent_CloudEventAttributeValue_Attr() {} + +func (*CloudEvent_CloudEventAttributeValue_CeTimestamp) isCloudEvent_CloudEventAttributeValue_Attr() { +} + +var File_cloudevents_proto protoreflect.FileDescriptor + +var file_cloudevents_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, + 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0x19, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, + 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdf, 0x05, 0x0a, 0x0a, 0x43, 0x6c, 0x6f, 0x75, + 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x21, + 0x0a, 0x0c, 0x73, 0x70, 0x65, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x70, 0x65, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x55, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x21, 0x0a, 0x0b, + 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0c, 0x48, 0x00, 0x52, 0x0a, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, + 0x1d, 0x0a, 0x09, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x74, 0x65, 0x78, 0x74, 0x44, 0x61, 0x74, 0x61, 0x12, 0x35, + 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x44, 0x61, 0x74, 0x61, 0x1a, 0x7d, 0x0a, 0x0f, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x54, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x9a, 0x02, 0x0a, 0x18, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x63, 0x65, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x63, 0x65, 0x42, 0x6f, 0x6f, 0x6c, 0x65, + 0x61, 0x6e, 0x12, 0x1f, 0x0a, 0x0a, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x09, 0x63, 0x65, 0x49, 0x6e, 0x74, 0x65, + 0x67, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x09, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x63, 0x65, 0x53, 0x74, 0x72, 0x69, + 0x6e, 0x67, 0x12, 0x1b, 0x0a, 0x08, 0x63, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x07, 0x63, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, + 0x17, 0x0a, 0x06, 0x63, 0x65, 0x5f, 0x75, 0x72, 0x69, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x05, 0x63, 0x65, 0x55, 0x72, 0x69, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x65, 0x5f, 0x75, + 0x72, 0x69, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, + 0x63, 0x65, 0x55, 0x72, 0x69, 0x52, 0x65, 0x66, 0x12, 0x3f, 0x0a, 0x0c, 0x63, 0x65, 0x5f, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x48, 0x00, 0x52, 0x0b, 0x63, 0x65, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x06, 0x0a, 0x04, 0x61, 0x74, 0x74, + 0x72, 0x42, 0x06, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x50, 0x0a, 0x0f, 0x43, 0x6c, 0x6f, + 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3d, 0x0a, 0x06, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6c, + 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x6f, + 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x75, 0x0a, 0x0a, 0x42, + 0x61, 0x74, 0x63, 0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x62, 0x75, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x42, + 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, + 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, + 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, + 0x74, 0x73, 0x32, 0x54, 0x0a, 0x0b, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x73, 0x12, 0x45, 0x0a, 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x25, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0xa4, 0x01, 0x0a, 0x17, 0x69, 0x6f, 0x2e, + 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, + 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, + 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0xaa, 0x02, 0x1a, 0x43, 0x6c, + 0x6f, 0x75, 0x64, 0x4e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x17, 0x49, 0x6f, 0x5c, 0x43, 0x6c, + 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x31, 0x5c, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0xea, 0x02, 0x1a, 0x49, 0x6f, 0x3a, 0x3a, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x73, 0x3a, 0x3a, 0x56, 0x31, 0x3a, 0x3a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cloudevents_proto_rawDescOnce sync.Once + file_cloudevents_proto_rawDescData = file_cloudevents_proto_rawDesc +) + +func file_cloudevents_proto_rawDescGZIP() []byte { + file_cloudevents_proto_rawDescOnce.Do(func() { + file_cloudevents_proto_rawDescData = protoimpl.X.CompressGZIP(file_cloudevents_proto_rawDescData) + }) + return file_cloudevents_proto_rawDescData +} + +var file_cloudevents_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_cloudevents_proto_goTypes = []interface{}{ + (*CloudEvent)(nil), // 0: linkall.vanus.cloudevents.CloudEvent + (*CloudEventBatch)(nil), // 1: linkall.vanus.cloudevents.CloudEventBatch + (*BatchEvent)(nil), // 2: linkall.vanus.cloudevents.BatchEvent + nil, // 3: linkall.vanus.cloudevents.CloudEvent.AttributesEntry + (*CloudEvent_CloudEventAttributeValue)(nil), // 4: linkall.vanus.cloudevents.CloudEvent.CloudEventAttributeValue + (*anypb.Any)(nil), // 5: google.protobuf.Any + (*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp + (*emptypb.Empty)(nil), // 7: google.protobuf.Empty +} +var file_cloudevents_proto_depIdxs = []int32{ + 3, // 0: linkall.vanus.cloudevents.CloudEvent.attributes:type_name -> linkall.vanus.cloudevents.CloudEvent.AttributesEntry + 5, // 1: linkall.vanus.cloudevents.CloudEvent.proto_data:type_name -> google.protobuf.Any + 0, // 2: linkall.vanus.cloudevents.CloudEventBatch.events:type_name -> linkall.vanus.cloudevents.CloudEvent + 1, // 3: linkall.vanus.cloudevents.BatchEvent.events:type_name -> linkall.vanus.cloudevents.CloudEventBatch + 4, // 4: linkall.vanus.cloudevents.CloudEvent.AttributesEntry.value:type_name -> linkall.vanus.cloudevents.CloudEvent.CloudEventAttributeValue + 6, // 5: linkall.vanus.cloudevents.CloudEvent.CloudEventAttributeValue.ce_timestamp:type_name -> google.protobuf.Timestamp + 2, // 6: linkall.vanus.cloudevents.CloudEvents.Send:input_type -> linkall.vanus.cloudevents.BatchEvent + 7, // 7: linkall.vanus.cloudevents.CloudEvents.Send:output_type -> google.protobuf.Empty + 7, // [7:8] is the sub-list for method output_type + 6, // [6:7] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_cloudevents_proto_init() } +func file_cloudevents_proto_init() { + if File_cloudevents_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_cloudevents_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CloudEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cloudevents_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CloudEventBatch); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cloudevents_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BatchEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cloudevents_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CloudEvent_CloudEventAttributeValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_cloudevents_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*CloudEvent_BinaryData)(nil), + (*CloudEvent_TextData)(nil), + (*CloudEvent_ProtoData)(nil), + } + file_cloudevents_proto_msgTypes[4].OneofWrappers = []interface{}{ + (*CloudEvent_CloudEventAttributeValue_CeBoolean)(nil), + (*CloudEvent_CloudEventAttributeValue_CeInteger)(nil), + (*CloudEvent_CloudEventAttributeValue_CeString)(nil), + (*CloudEvent_CloudEventAttributeValue_CeBytes)(nil), + (*CloudEvent_CloudEventAttributeValue_CeUri)(nil), + (*CloudEvent_CloudEventAttributeValue_CeUriRef)(nil), + (*CloudEvent_CloudEventAttributeValue_CeTimestamp)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_cloudevents_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cloudevents_proto_goTypes, + DependencyIndexes: file_cloudevents_proto_depIdxs, + MessageInfos: file_cloudevents_proto_msgTypes, + }.Build() + File_cloudevents_proto = out.File + file_cloudevents_proto_rawDesc = nil + file_cloudevents_proto_goTypes = nil + file_cloudevents_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// CloudEventsClient is the client API for CloudEvents service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type CloudEventsClient interface { + Send(ctx context.Context, in *BatchEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) +} + +type cloudEventsClient struct { + cc grpc.ClientConnInterface +} + +func NewCloudEventsClient(cc grpc.ClientConnInterface) CloudEventsClient { + return &cloudEventsClient{cc} +} + +func (c *cloudEventsClient) Send(ctx context.Context, in *BatchEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/linkall.vanus.cloudevents.CloudEvents/Send", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CloudEventsServer is the server API for CloudEvents service. +type CloudEventsServer interface { + Send(context.Context, *BatchEvent) (*emptypb.Empty, error) +} + +// UnimplementedCloudEventsServer can be embedded to have forward compatible implementations. +type UnimplementedCloudEventsServer struct { +} + +func (*UnimplementedCloudEventsServer) Send(context.Context, *BatchEvent) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method Send not implemented") +} + +func RegisterCloudEventsServer(s *grpc.Server, srv CloudEventsServer) { + s.RegisterService(&_CloudEvents_serviceDesc, srv) +} + +func _CloudEvents_Send_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BatchEvent) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CloudEventsServer).Send(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.cloudevents.CloudEvents/Send", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CloudEventsServer).Send(ctx, req.(*BatchEvent)) + } + return interceptor(ctx, in, info, handler) +} + +var _CloudEvents_serviceDesc = grpc.ServiceDesc{ + ServiceName: "linkall.vanus.cloudevents.CloudEvents", + HandlerType: (*CloudEventsServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Send", + Handler: _CloudEvents_Send_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cloudevents.proto", +} diff --git a/proto/pkg/segment/segment.pb.go b/proto/pkg/segment/segment.pb.go index 5821d638b..3e5d80571 100644 --- a/proto/pkg/segment/segment.pb.go +++ b/proto/pkg/segment/segment.pb.go @@ -14,15 +14,19 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc (unknown) +// protoc-gen-go v1.26.0 +// protoc v3.19.4 // source: segment.proto package segment import ( - v1 "cloudevents.io/genproto/v1" + context "context" + cloudevents "github.com/linkall-labs/vanus/proto/pkg/cloudevents" config "github.com/linkall-labs/vanus/proto/pkg/config" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" @@ -567,8 +571,8 @@ type AppendToBlockRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - BlockId uint64 `protobuf:"varint,1,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` - Events *v1.CloudEventBatch `protobuf:"bytes,2,opt,name=events,proto3" json:"events,omitempty"` + BlockId uint64 `protobuf:"varint,1,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` + Events *cloudevents.CloudEventBatch `protobuf:"bytes,2,opt,name=events,proto3" json:"events,omitempty"` } func (x *AppendToBlockRequest) Reset() { @@ -610,7 +614,7 @@ func (x *AppendToBlockRequest) GetBlockId() uint64 { return 0 } -func (x *AppendToBlockRequest) GetEvents() *v1.CloudEventBatch { +func (x *AppendToBlockRequest) GetEvents() *cloudevents.CloudEventBatch { if x != nil { return x.Events } @@ -741,7 +745,7 @@ type ReadFromBlockResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Events *v1.CloudEventBatch `protobuf:"bytes,1,opt,name=events,proto3" json:"events,omitempty"` + Events *cloudevents.CloudEventBatch `protobuf:"bytes,1,opt,name=events,proto3" json:"events,omitempty"` // Don't use this now, just used to optimize cpu overhead of SegmentServer in // the future for backward compatibility Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` @@ -779,7 +783,7 @@ func (*ReadFromBlockResponse) Descriptor() ([]byte, []int) { return file_segment_proto_rawDescGZIP(), []int{15} } -func (x *ReadFromBlockResponse) GetEvents() *v1.CloudEventBatch { +func (x *ReadFromBlockResponse) GetEvents() *cloudevents.CloudEventBatch { if x != nil { return x.Events } @@ -947,165 +951,166 @@ var File_segment_proto protoreflect.FileDescriptor var file_segment_proto_rawDesc = []byte{ 0x0a, 0x0d, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, - 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x1d, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, - 0x6e, 0x74, 0x73, 0x2f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x74, 0x0a, 0x19, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, - 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, - 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, - 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x0a, 0x18, 0x53, 0x74, 0x6f, 0x70, 0x53, 0x65, 0x67, 0x6d, - 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x22, 0x1b, 0x0a, 0x19, 0x53, 0x74, 0x6f, 0x70, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x0a, - 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x24, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x22, 0x15, 0x0a, - 0x13, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x22, 0x16, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xfa, 0x01, 0x0a, - 0x16, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, - 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, - 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x72, 0x65, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x49, 0x64, 0x12, 0x57, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, - 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x63, + 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x11, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x74, 0x0a, 0x19, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x67, + 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x3a, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x22, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1b, 0x0a, + 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x53, 0x74, + 0x61, 0x72, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x0a, 0x18, 0x53, 0x74, 0x6f, 0x70, + 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x22, 0x1b, 0x0a, 0x19, 0x53, 0x74, 0x6f, 0x70, 0x53, 0x65, 0x67, 0x6d, + 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x38, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x24, 0x0a, 0x12, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, + 0x64, 0x22, 0x15, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x16, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0xfa, 0x01, 0x0a, 0x16, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x67, + 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0c, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x28, 0x0a, + 0x10, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x57, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, + 0x1a, 0x3b, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x19, 0x0a, + 0x17, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x0a, 0x18, 0x49, 0x6e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x1a, 0x3b, 0x0a, 0x0d, - 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x19, 0x0a, 0x17, 0x41, 0x63, 0x74, - 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x0a, 0x18, 0x49, 0x6e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, - 0x74, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x22, 0x1b, 0x0a, 0x19, 0x49, 0x6e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, - 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6d, 0x0a, - 0x14, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x64, - 0x12, 0x3a, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x22, 0x2e, 0x69, 0x6f, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, - 0x61, 0x74, 0x63, 0x68, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x31, 0x0a, 0x15, - 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x52, 0x07, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x22, - 0x8a, 0x01, 0x0a, 0x14, 0x52, 0x65, 0x61, 0x64, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x6c, 0x6f, 0x63, - 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x62, 0x6c, 0x6f, 0x63, - 0x6b, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x74, - 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x70, 0x6f, - 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x6d, 0x0a, 0x15, - 0x52, 0x65, 0x61, 0x64, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x69, 0x6f, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, - 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, - 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x4d, 0x0a, 0x1a, 0x4c, - 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x42, 0x6c, 0x6f, + 0x75, 0x65, 0x73, 0x74, 0x22, 0x1b, 0x0a, 0x19, 0x49, 0x6e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x75, 0x0a, 0x14, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x62, 0x6c, 0x6f, - 0x63, 0x6b, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x35, 0x0a, 0x1b, 0x4c, 0x6f, - 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x22, 0x28, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x32, 0xe4, 0x08, 0x0a, 0x0d, - 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x6c, 0x0a, - 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, - 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, - 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, - 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, - 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x04, 0x53, - 0x74, 0x6f, 0x70, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, - 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x74, 0x6f, 0x70, - 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, - 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x74, 0x6f, - 0x70, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x29, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, - 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x50, 0x0a, 0x0b, 0x52, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x29, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x63, 0x6b, 0x49, 0x64, 0x12, 0x42, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, + 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, + 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, + 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x31, 0x0a, 0x15, 0x41, 0x70, 0x70, 0x65, + 0x6e, 0x64, 0x54, 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x03, 0x52, 0x07, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x22, 0x8a, 0x01, 0x0a, 0x14, + 0x52, 0x65, 0x61, 0x64, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, + 0x27, 0x0a, 0x0f, 0x70, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, + 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x70, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, + 0x67, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x75, 0x0a, 0x15, 0x52, 0x65, 0x61, 0x64, + 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x42, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2a, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x43, 0x6c, + 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x06, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, + 0x4d, 0x0a, 0x1a, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, + 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, + 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x35, + 0x0a, 0x1b, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x6e, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0x28, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x32, + 0xe4, 0x08, 0x0a, 0x0d, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x12, 0x6c, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x30, 0x2e, 0x6c, 0x69, 0x6e, + 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6c, + 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, + 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x69, 0x0a, 0x04, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, - 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x67, 0x0a, 0x0c, 0x47, 0x65, - 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2a, 0x2e, 0x6c, 0x69, 0x6e, + 0x53, 0x74, 0x6f, 0x70, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x0b, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x29, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x50, 0x0a, 0x0b, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x29, 0x2e, 0x6c, 0x69, + 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, + 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x67, + 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2a, + 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, + 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, - 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x47, - 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x70, 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, - 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, - 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x41, - 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, - 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x63, - 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x11, 0x49, 0x6e, 0x61, 0x63, 0x74, 0x69, 0x76, - 0x61, 0x74, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x70, 0x0a, 0x0f, 0x41, 0x63, 0x74, 0x69, 0x76, + 0x61, 0x74, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x2e, 0x49, 0x6e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x67, - 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x12, 0x6a, 0x0a, 0x0d, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x42, + 0x6e, 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x11, 0x49, 0x6e, 0x61, + 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2f, + 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, + 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x49, 0x6e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, + 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x6a, 0x0a, 0x0d, 0x41, 0x70, 0x70, 0x65, 0x6e, + 0x64, 0x54, 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x2b, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x2e, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, + 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x70, + 0x70, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x0d, 0x52, 0x65, 0x61, 0x64, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x2b, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, - 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x70, 0x70, - 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x61, + 0x64, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, - 0x54, 0x6f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x6a, 0x0a, 0x0d, 0x52, 0x65, 0x61, 0x64, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x12, 0x2b, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x46, 0x72, 0x6f, - 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, - 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, - 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x46, 0x72, 0x6f, 0x6d, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7c, 0x0a, 0x13, 0x4c, + 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x46, 0x72, + 0x6f, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x7c, 0x0a, 0x13, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, + 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x42, 0x6c, 0x6f, - 0x63, 0x6b, 0x12, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, - 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, - 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, - 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4c, 0x6f, - 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x42, 0x6c, 0x6f, 0x63, - 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x06, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x25, 0x2e, 0x6c, 0x69, - 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, - 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x76, 0x61, - 0x6e, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, - 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x6e, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, + 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, + 0x25, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, + 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, + 0x73, 0x2f, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, + 0x67, 0x2f, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -1143,14 +1148,14 @@ var file_segment_proto_goTypes = []interface{}{ (*StatusResponse)(nil), // 18: linkall.vanus.segment.StatusResponse nil, // 19: linkall.vanus.segment.ActivateSegmentRequest.ReplicasEntry (*config.ServerConfig)(nil), // 20: linkall.vanus.config.ServerConfig - (*v1.CloudEventBatch)(nil), // 21: io.cloudevents.v1.CloudEventBatch + (*cloudevents.CloudEventBatch)(nil), // 21: linkall.vanus.cloudevents.CloudEventBatch (*emptypb.Empty)(nil), // 22: google.protobuf.Empty } var file_segment_proto_depIdxs = []int32{ 20, // 0: linkall.vanus.segment.StartSegmentServerRequest.config:type_name -> linkall.vanus.config.ServerConfig 19, // 1: linkall.vanus.segment.ActivateSegmentRequest.replicas:type_name -> linkall.vanus.segment.ActivateSegmentRequest.ReplicasEntry - 21, // 2: linkall.vanus.segment.AppendToBlockRequest.events:type_name -> io.cloudevents.v1.CloudEventBatch - 21, // 3: linkall.vanus.segment.ReadFromBlockResponse.events:type_name -> io.cloudevents.v1.CloudEventBatch + 21, // 2: linkall.vanus.segment.AppendToBlockRequest.events:type_name -> linkall.vanus.cloudevents.CloudEventBatch + 21, // 3: linkall.vanus.segment.ReadFromBlockResponse.events:type_name -> linkall.vanus.cloudevents.CloudEventBatch 0, // 4: linkall.vanus.segment.SegmentServer.Start:input_type -> linkall.vanus.segment.StartSegmentServerRequest 2, // 5: linkall.vanus.segment.SegmentServer.Stop:input_type -> linkall.vanus.segment.StopSegmentServerRequest 4, // 6: linkall.vanus.segment.SegmentServer.CreateBlock:input_type -> linkall.vanus.segment.CreateBlockRequest @@ -1434,3 +1439,443 @@ func file_segment_proto_init() { file_segment_proto_goTypes = nil file_segment_proto_depIdxs = nil } + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// SegmentServerClient is the client API for SegmentServer service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type SegmentServerClient interface { + Start(ctx context.Context, in *StartSegmentServerRequest, opts ...grpc.CallOption) (*StartSegmentServerResponse, error) + Stop(ctx context.Context, in *StopSegmentServerRequest, opts ...grpc.CallOption) (*StopSegmentServerResponse, error) + CreateBlock(ctx context.Context, in *CreateBlockRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + RemoveBlock(ctx context.Context, in *RemoveBlockRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + GetBlockInfo(ctx context.Context, in *GetBlockInfoRequest, opts ...grpc.CallOption) (*GetBlockInfoResponse, error) + ActivateSegment(ctx context.Context, in *ActivateSegmentRequest, opts ...grpc.CallOption) (*ActivateSegmentResponse, error) + InactivateSegment(ctx context.Context, in *InactivateSegmentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + AppendToBlock(ctx context.Context, in *AppendToBlockRequest, opts ...grpc.CallOption) (*AppendToBlockResponse, error) + ReadFromBlock(ctx context.Context, in *ReadFromBlockRequest, opts ...grpc.CallOption) (*ReadFromBlockResponse, error) + LookupOffsetInBlock(ctx context.Context, in *LookupOffsetInBlockRequest, opts ...grpc.CallOption) (*LookupOffsetInBlockResponse, error) + Status(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StatusResponse, error) +} + +type segmentServerClient struct { + cc grpc.ClientConnInterface +} + +func NewSegmentServerClient(cc grpc.ClientConnInterface) SegmentServerClient { + return &segmentServerClient{cc} +} + +func (c *segmentServerClient) Start(ctx context.Context, in *StartSegmentServerRequest, opts ...grpc.CallOption) (*StartSegmentServerResponse, error) { + out := new(StartSegmentServerResponse) + err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/Start", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *segmentServerClient) Stop(ctx context.Context, in *StopSegmentServerRequest, opts ...grpc.CallOption) (*StopSegmentServerResponse, error) { + out := new(StopSegmentServerResponse) + err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/Stop", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *segmentServerClient) CreateBlock(ctx context.Context, in *CreateBlockRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/CreateBlock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *segmentServerClient) RemoveBlock(ctx context.Context, in *RemoveBlockRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/RemoveBlock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *segmentServerClient) GetBlockInfo(ctx context.Context, in *GetBlockInfoRequest, opts ...grpc.CallOption) (*GetBlockInfoResponse, error) { + out := new(GetBlockInfoResponse) + err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/GetBlockInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *segmentServerClient) ActivateSegment(ctx context.Context, in *ActivateSegmentRequest, opts ...grpc.CallOption) (*ActivateSegmentResponse, error) { + out := new(ActivateSegmentResponse) + err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/ActivateSegment", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *segmentServerClient) InactivateSegment(ctx context.Context, in *InactivateSegmentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/InactivateSegment", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *segmentServerClient) AppendToBlock(ctx context.Context, in *AppendToBlockRequest, opts ...grpc.CallOption) (*AppendToBlockResponse, error) { + out := new(AppendToBlockResponse) + err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/AppendToBlock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *segmentServerClient) ReadFromBlock(ctx context.Context, in *ReadFromBlockRequest, opts ...grpc.CallOption) (*ReadFromBlockResponse, error) { + out := new(ReadFromBlockResponse) + err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/ReadFromBlock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *segmentServerClient) LookupOffsetInBlock(ctx context.Context, in *LookupOffsetInBlockRequest, opts ...grpc.CallOption) (*LookupOffsetInBlockResponse, error) { + out := new(LookupOffsetInBlockResponse) + err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/LookupOffsetInBlock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *segmentServerClient) Status(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StatusResponse, error) { + out := new(StatusResponse) + err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/Status", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SegmentServerServer is the server API for SegmentServer service. +type SegmentServerServer interface { + Start(context.Context, *StartSegmentServerRequest) (*StartSegmentServerResponse, error) + Stop(context.Context, *StopSegmentServerRequest) (*StopSegmentServerResponse, error) + CreateBlock(context.Context, *CreateBlockRequest) (*emptypb.Empty, error) + RemoveBlock(context.Context, *RemoveBlockRequest) (*emptypb.Empty, error) + GetBlockInfo(context.Context, *GetBlockInfoRequest) (*GetBlockInfoResponse, error) + ActivateSegment(context.Context, *ActivateSegmentRequest) (*ActivateSegmentResponse, error) + InactivateSegment(context.Context, *InactivateSegmentRequest) (*emptypb.Empty, error) + AppendToBlock(context.Context, *AppendToBlockRequest) (*AppendToBlockResponse, error) + ReadFromBlock(context.Context, *ReadFromBlockRequest) (*ReadFromBlockResponse, error) + LookupOffsetInBlock(context.Context, *LookupOffsetInBlockRequest) (*LookupOffsetInBlockResponse, error) + Status(context.Context, *emptypb.Empty) (*StatusResponse, error) +} + +// UnimplementedSegmentServerServer can be embedded to have forward compatible implementations. +type UnimplementedSegmentServerServer struct { +} + +func (*UnimplementedSegmentServerServer) Start(context.Context, *StartSegmentServerRequest) (*StartSegmentServerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Start not implemented") +} +func (*UnimplementedSegmentServerServer) Stop(context.Context, *StopSegmentServerRequest) (*StopSegmentServerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") +} +func (*UnimplementedSegmentServerServer) CreateBlock(context.Context, *CreateBlockRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateBlock not implemented") +} +func (*UnimplementedSegmentServerServer) RemoveBlock(context.Context, *RemoveBlockRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveBlock not implemented") +} +func (*UnimplementedSegmentServerServer) GetBlockInfo(context.Context, *GetBlockInfoRequest) (*GetBlockInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBlockInfo not implemented") +} +func (*UnimplementedSegmentServerServer) ActivateSegment(context.Context, *ActivateSegmentRequest) (*ActivateSegmentResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ActivateSegment not implemented") +} +func (*UnimplementedSegmentServerServer) InactivateSegment(context.Context, *InactivateSegmentRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method InactivateSegment not implemented") +} +func (*UnimplementedSegmentServerServer) AppendToBlock(context.Context, *AppendToBlockRequest) (*AppendToBlockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AppendToBlock not implemented") +} +func (*UnimplementedSegmentServerServer) ReadFromBlock(context.Context, *ReadFromBlockRequest) (*ReadFromBlockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReadFromBlock not implemented") +} +func (*UnimplementedSegmentServerServer) LookupOffsetInBlock(context.Context, *LookupOffsetInBlockRequest) (*LookupOffsetInBlockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LookupOffsetInBlock not implemented") +} +func (*UnimplementedSegmentServerServer) Status(context.Context, *emptypb.Empty) (*StatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") +} + +func RegisterSegmentServerServer(s *grpc.Server, srv SegmentServerServer) { + s.RegisterService(&_SegmentServer_serviceDesc, srv) +} + +func _SegmentServer_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StartSegmentServerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SegmentServerServer).Start(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.segment.SegmentServer/Start", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SegmentServerServer).Start(ctx, req.(*StartSegmentServerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SegmentServer_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StopSegmentServerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SegmentServerServer).Stop(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.segment.SegmentServer/Stop", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SegmentServerServer).Stop(ctx, req.(*StopSegmentServerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SegmentServer_CreateBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateBlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SegmentServerServer).CreateBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.segment.SegmentServer/CreateBlock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SegmentServerServer).CreateBlock(ctx, req.(*CreateBlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SegmentServer_RemoveBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveBlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SegmentServerServer).RemoveBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.segment.SegmentServer/RemoveBlock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SegmentServerServer).RemoveBlock(ctx, req.(*RemoveBlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SegmentServer_GetBlockInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBlockInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SegmentServerServer).GetBlockInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.segment.SegmentServer/GetBlockInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SegmentServerServer).GetBlockInfo(ctx, req.(*GetBlockInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SegmentServer_ActivateSegment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ActivateSegmentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SegmentServerServer).ActivateSegment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.segment.SegmentServer/ActivateSegment", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SegmentServerServer).ActivateSegment(ctx, req.(*ActivateSegmentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SegmentServer_InactivateSegment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InactivateSegmentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SegmentServerServer).InactivateSegment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.segment.SegmentServer/InactivateSegment", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SegmentServerServer).InactivateSegment(ctx, req.(*InactivateSegmentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SegmentServer_AppendToBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AppendToBlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SegmentServerServer).AppendToBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.segment.SegmentServer/AppendToBlock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SegmentServerServer).AppendToBlock(ctx, req.(*AppendToBlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SegmentServer_ReadFromBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReadFromBlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SegmentServerServer).ReadFromBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.segment.SegmentServer/ReadFromBlock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SegmentServerServer).ReadFromBlock(ctx, req.(*ReadFromBlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SegmentServer_LookupOffsetInBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LookupOffsetInBlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SegmentServerServer).LookupOffsetInBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.segment.SegmentServer/LookupOffsetInBlock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SegmentServerServer).LookupOffsetInBlock(ctx, req.(*LookupOffsetInBlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SegmentServer_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SegmentServerServer).Status(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.segment.SegmentServer/Status", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SegmentServerServer).Status(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +var _SegmentServer_serviceDesc = grpc.ServiceDesc{ + ServiceName: "linkall.vanus.segment.SegmentServer", + HandlerType: (*SegmentServerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Start", + Handler: _SegmentServer_Start_Handler, + }, + { + MethodName: "Stop", + Handler: _SegmentServer_Stop_Handler, + }, + { + MethodName: "CreateBlock", + Handler: _SegmentServer_CreateBlock_Handler, + }, + { + MethodName: "RemoveBlock", + Handler: _SegmentServer_RemoveBlock_Handler, + }, + { + MethodName: "GetBlockInfo", + Handler: _SegmentServer_GetBlockInfo_Handler, + }, + { + MethodName: "ActivateSegment", + Handler: _SegmentServer_ActivateSegment_Handler, + }, + { + MethodName: "InactivateSegment", + Handler: _SegmentServer_InactivateSegment_Handler, + }, + { + MethodName: "AppendToBlock", + Handler: _SegmentServer_AppendToBlock_Handler, + }, + { + MethodName: "ReadFromBlock", + Handler: _SegmentServer_ReadFromBlock_Handler, + }, + { + MethodName: "LookupOffsetInBlock", + Handler: _SegmentServer_LookupOffsetInBlock_Handler, + }, + { + MethodName: "Status", + Handler: _SegmentServer_Status_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "segment.proto", +} diff --git a/proto/pkg/segment/segment_grpc.pb.go b/proto/pkg/segment/segment_grpc.pb.go deleted file mode 100644 index 6a7b55f7d..000000000 --- a/proto/pkg/segment/segment_grpc.pb.go +++ /dev/null @@ -1,464 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) -// source: segment.proto - -package segment - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - emptypb "google.golang.org/protobuf/types/known/emptypb" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// SegmentServerClient is the client API for SegmentServer service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type SegmentServerClient interface { - Start(ctx context.Context, in *StartSegmentServerRequest, opts ...grpc.CallOption) (*StartSegmentServerResponse, error) - Stop(ctx context.Context, in *StopSegmentServerRequest, opts ...grpc.CallOption) (*StopSegmentServerResponse, error) - CreateBlock(ctx context.Context, in *CreateBlockRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - RemoveBlock(ctx context.Context, in *RemoveBlockRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - GetBlockInfo(ctx context.Context, in *GetBlockInfoRequest, opts ...grpc.CallOption) (*GetBlockInfoResponse, error) - ActivateSegment(ctx context.Context, in *ActivateSegmentRequest, opts ...grpc.CallOption) (*ActivateSegmentResponse, error) - InactivateSegment(ctx context.Context, in *InactivateSegmentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - AppendToBlock(ctx context.Context, in *AppendToBlockRequest, opts ...grpc.CallOption) (*AppendToBlockResponse, error) - ReadFromBlock(ctx context.Context, in *ReadFromBlockRequest, opts ...grpc.CallOption) (*ReadFromBlockResponse, error) - LookupOffsetInBlock(ctx context.Context, in *LookupOffsetInBlockRequest, opts ...grpc.CallOption) (*LookupOffsetInBlockResponse, error) - Status(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StatusResponse, error) -} - -type segmentServerClient struct { - cc grpc.ClientConnInterface -} - -func NewSegmentServerClient(cc grpc.ClientConnInterface) SegmentServerClient { - return &segmentServerClient{cc} -} - -func (c *segmentServerClient) Start(ctx context.Context, in *StartSegmentServerRequest, opts ...grpc.CallOption) (*StartSegmentServerResponse, error) { - out := new(StartSegmentServerResponse) - err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/Start", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *segmentServerClient) Stop(ctx context.Context, in *StopSegmentServerRequest, opts ...grpc.CallOption) (*StopSegmentServerResponse, error) { - out := new(StopSegmentServerResponse) - err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/Stop", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *segmentServerClient) CreateBlock(ctx context.Context, in *CreateBlockRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/CreateBlock", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *segmentServerClient) RemoveBlock(ctx context.Context, in *RemoveBlockRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/RemoveBlock", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *segmentServerClient) GetBlockInfo(ctx context.Context, in *GetBlockInfoRequest, opts ...grpc.CallOption) (*GetBlockInfoResponse, error) { - out := new(GetBlockInfoResponse) - err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/GetBlockInfo", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *segmentServerClient) ActivateSegment(ctx context.Context, in *ActivateSegmentRequest, opts ...grpc.CallOption) (*ActivateSegmentResponse, error) { - out := new(ActivateSegmentResponse) - err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/ActivateSegment", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *segmentServerClient) InactivateSegment(ctx context.Context, in *InactivateSegmentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/InactivateSegment", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *segmentServerClient) AppendToBlock(ctx context.Context, in *AppendToBlockRequest, opts ...grpc.CallOption) (*AppendToBlockResponse, error) { - out := new(AppendToBlockResponse) - err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/AppendToBlock", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *segmentServerClient) ReadFromBlock(ctx context.Context, in *ReadFromBlockRequest, opts ...grpc.CallOption) (*ReadFromBlockResponse, error) { - out := new(ReadFromBlockResponse) - err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/ReadFromBlock", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *segmentServerClient) LookupOffsetInBlock(ctx context.Context, in *LookupOffsetInBlockRequest, opts ...grpc.CallOption) (*LookupOffsetInBlockResponse, error) { - out := new(LookupOffsetInBlockResponse) - err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/LookupOffsetInBlock", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *segmentServerClient) Status(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StatusResponse, error) { - out := new(StatusResponse) - err := c.cc.Invoke(ctx, "/linkall.vanus.segment.SegmentServer/Status", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// SegmentServerServer is the server API for SegmentServer service. -// All implementations should embed UnimplementedSegmentServerServer -// for forward compatibility -type SegmentServerServer interface { - Start(context.Context, *StartSegmentServerRequest) (*StartSegmentServerResponse, error) - Stop(context.Context, *StopSegmentServerRequest) (*StopSegmentServerResponse, error) - CreateBlock(context.Context, *CreateBlockRequest) (*emptypb.Empty, error) - RemoveBlock(context.Context, *RemoveBlockRequest) (*emptypb.Empty, error) - GetBlockInfo(context.Context, *GetBlockInfoRequest) (*GetBlockInfoResponse, error) - ActivateSegment(context.Context, *ActivateSegmentRequest) (*ActivateSegmentResponse, error) - InactivateSegment(context.Context, *InactivateSegmentRequest) (*emptypb.Empty, error) - AppendToBlock(context.Context, *AppendToBlockRequest) (*AppendToBlockResponse, error) - ReadFromBlock(context.Context, *ReadFromBlockRequest) (*ReadFromBlockResponse, error) - LookupOffsetInBlock(context.Context, *LookupOffsetInBlockRequest) (*LookupOffsetInBlockResponse, error) - Status(context.Context, *emptypb.Empty) (*StatusResponse, error) -} - -// UnimplementedSegmentServerServer should be embedded to have forward compatible implementations. -type UnimplementedSegmentServerServer struct { -} - -func (UnimplementedSegmentServerServer) Start(context.Context, *StartSegmentServerRequest) (*StartSegmentServerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Start not implemented") -} -func (UnimplementedSegmentServerServer) Stop(context.Context, *StopSegmentServerRequest) (*StopSegmentServerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") -} -func (UnimplementedSegmentServerServer) CreateBlock(context.Context, *CreateBlockRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateBlock not implemented") -} -func (UnimplementedSegmentServerServer) RemoveBlock(context.Context, *RemoveBlockRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveBlock not implemented") -} -func (UnimplementedSegmentServerServer) GetBlockInfo(context.Context, *GetBlockInfoRequest) (*GetBlockInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetBlockInfo not implemented") -} -func (UnimplementedSegmentServerServer) ActivateSegment(context.Context, *ActivateSegmentRequest) (*ActivateSegmentResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ActivateSegment not implemented") -} -func (UnimplementedSegmentServerServer) InactivateSegment(context.Context, *InactivateSegmentRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method InactivateSegment not implemented") -} -func (UnimplementedSegmentServerServer) AppendToBlock(context.Context, *AppendToBlockRequest) (*AppendToBlockResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AppendToBlock not implemented") -} -func (UnimplementedSegmentServerServer) ReadFromBlock(context.Context, *ReadFromBlockRequest) (*ReadFromBlockResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReadFromBlock not implemented") -} -func (UnimplementedSegmentServerServer) LookupOffsetInBlock(context.Context, *LookupOffsetInBlockRequest) (*LookupOffsetInBlockResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LookupOffsetInBlock not implemented") -} -func (UnimplementedSegmentServerServer) Status(context.Context, *emptypb.Empty) (*StatusResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") -} - -// UnsafeSegmentServerServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to SegmentServerServer will -// result in compilation errors. -type UnsafeSegmentServerServer interface { - mustEmbedUnimplementedSegmentServerServer() -} - -func RegisterSegmentServerServer(s grpc.ServiceRegistrar, srv SegmentServerServer) { - s.RegisterService(&SegmentServer_ServiceDesc, srv) -} - -func _SegmentServer_Start_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StartSegmentServerRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SegmentServerServer).Start(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/linkall.vanus.segment.SegmentServer/Start", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SegmentServerServer).Start(ctx, req.(*StartSegmentServerRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SegmentServer_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StopSegmentServerRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SegmentServerServer).Stop(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/linkall.vanus.segment.SegmentServer/Stop", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SegmentServerServer).Stop(ctx, req.(*StopSegmentServerRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SegmentServer_CreateBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateBlockRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SegmentServerServer).CreateBlock(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/linkall.vanus.segment.SegmentServer/CreateBlock", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SegmentServerServer).CreateBlock(ctx, req.(*CreateBlockRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SegmentServer_RemoveBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RemoveBlockRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SegmentServerServer).RemoveBlock(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/linkall.vanus.segment.SegmentServer/RemoveBlock", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SegmentServerServer).RemoveBlock(ctx, req.(*RemoveBlockRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SegmentServer_GetBlockInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetBlockInfoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SegmentServerServer).GetBlockInfo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/linkall.vanus.segment.SegmentServer/GetBlockInfo", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SegmentServerServer).GetBlockInfo(ctx, req.(*GetBlockInfoRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SegmentServer_ActivateSegment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ActivateSegmentRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SegmentServerServer).ActivateSegment(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/linkall.vanus.segment.SegmentServer/ActivateSegment", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SegmentServerServer).ActivateSegment(ctx, req.(*ActivateSegmentRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SegmentServer_InactivateSegment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(InactivateSegmentRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SegmentServerServer).InactivateSegment(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/linkall.vanus.segment.SegmentServer/InactivateSegment", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SegmentServerServer).InactivateSegment(ctx, req.(*InactivateSegmentRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SegmentServer_AppendToBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AppendToBlockRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SegmentServerServer).AppendToBlock(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/linkall.vanus.segment.SegmentServer/AppendToBlock", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SegmentServerServer).AppendToBlock(ctx, req.(*AppendToBlockRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SegmentServer_ReadFromBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReadFromBlockRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SegmentServerServer).ReadFromBlock(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/linkall.vanus.segment.SegmentServer/ReadFromBlock", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SegmentServerServer).ReadFromBlock(ctx, req.(*ReadFromBlockRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SegmentServer_LookupOffsetInBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LookupOffsetInBlockRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SegmentServerServer).LookupOffsetInBlock(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/linkall.vanus.segment.SegmentServer/LookupOffsetInBlock", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SegmentServerServer).LookupOffsetInBlock(ctx, req.(*LookupOffsetInBlockRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SegmentServer_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(emptypb.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SegmentServerServer).Status(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/linkall.vanus.segment.SegmentServer/Status", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SegmentServerServer).Status(ctx, req.(*emptypb.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -// SegmentServer_ServiceDesc is the grpc.ServiceDesc for SegmentServer service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var SegmentServer_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "linkall.vanus.segment.SegmentServer", - HandlerType: (*SegmentServerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Start", - Handler: _SegmentServer_Start_Handler, - }, - { - MethodName: "Stop", - Handler: _SegmentServer_Stop_Handler, - }, - { - MethodName: "CreateBlock", - Handler: _SegmentServer_CreateBlock_Handler, - }, - { - MethodName: "RemoveBlock", - Handler: _SegmentServer_RemoveBlock_Handler, - }, - { - MethodName: "GetBlockInfo", - Handler: _SegmentServer_GetBlockInfo_Handler, - }, - { - MethodName: "ActivateSegment", - Handler: _SegmentServer_ActivateSegment_Handler, - }, - { - MethodName: "InactivateSegment", - Handler: _SegmentServer_InactivateSegment_Handler, - }, - { - MethodName: "AppendToBlock", - Handler: _SegmentServer_AppendToBlock_Handler, - }, - { - MethodName: "ReadFromBlock", - Handler: _SegmentServer_ReadFromBlock_Handler, - }, - { - MethodName: "LookupOffsetInBlock", - Handler: _SegmentServer_LookupOffsetInBlock_Handler, - }, - { - MethodName: "Status", - Handler: _SegmentServer_Status_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "segment.proto", -} diff --git a/proto/proto/cloudevents.proto b/proto/proto/cloudevents.proto new file mode 100644 index 000000000..78bda0bb2 --- /dev/null +++ b/proto/proto/cloudevents.proto @@ -0,0 +1,92 @@ +// Copyright 2022 Linkall Inc. +// +// 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. + +/** + * CloudEvent Protobuf Format + * + * - Required context attributes are explicitly represented. + * - Optional and Extension context attributes are carried in a map structure. + * - Data may be represented as binary, text, or protobuf messages. + */ + +syntax = "proto3"; + +package linkall.vanus.cloudevents; + +import "google/protobuf/any.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "CloudNative.CloudEvents.V1"; +option go_package = "github.com/linkall-labs/vanus/proto/pkg/cloudevents"; +option java_package = "io.cloudevents.v1.proto"; +option java_multiple_files = true; +option php_namespace = "Io\\CloudEvents\\V1\\Proto"; +option ruby_package = "Io::CloudEvents::V1::Proto"; + +message CloudEvent { + + // -- CloudEvent Context Attributes + + // Required Attributes + string id = 1; + string source = 2; // URI-reference + string spec_version = 3; + string type = 4; + + // Optional & Extension Attributes + map attributes = 5; + + // -- CloudEvent Data (Bytes, Text, or Proto) + oneof data { + bytes binary_data = 6; + string text_data = 7; + google.protobuf.Any proto_data = 8; + } + + /** + * The CloudEvent specification defines + * seven attribute value types... + */ + + message CloudEventAttributeValue { + oneof attr { + bool ce_boolean = 1; + int32 ce_integer = 2; + string ce_string = 3; + bytes ce_bytes = 4; + string ce_uri = 5; + string ce_uri_ref = 6; + google.protobuf.Timestamp ce_timestamp = 7; + } + } +} + +/** + * CloudEvent Protobuf Batch Format + * + */ + +message CloudEventBatch { + repeated CloudEvent events = 1; +} + +service CloudEvents { + rpc Send(BatchEvent) returns(google.protobuf.Empty); +} + +message BatchEvent { + string eventbus_name = 1; + CloudEventBatch events = 2; +} \ No newline at end of file diff --git a/proto/proto/segment.proto b/proto/proto/segment.proto index 9d9854147..1c0b05bc3 100644 --- a/proto/proto/segment.proto +++ b/proto/proto/segment.proto @@ -16,7 +16,7 @@ syntax = "proto3"; package linkall.vanus.segment; -import "cloudevents/cloudevents.proto"; +import "cloudevents.proto"; import "config.proto"; import "google/protobuf/empty.proto"; @@ -41,7 +41,7 @@ service SegmentServer { } message StartSegmentServerRequest { - linkall.vanus.config.ServerConfig config = 1; + config.ServerConfig config = 1; uint64 server_id = 2; } @@ -79,7 +79,7 @@ message InactivateSegmentResponse {} message AppendToBlockRequest { uint64 block_id = 1; - io.cloudevents.v1.CloudEventBatch events = 2; + cloudevents.CloudEventBatch events = 2; } message AppendToBlockResponse { @@ -95,7 +95,7 @@ message ReadFromBlockRequest { } message ReadFromBlockResponse { - io.cloudevents.v1.CloudEventBatch events = 1; + cloudevents.CloudEventBatch events = 1; // Don't use this now, just used to optimize cpu overhead of SegmentServer in // the future for backward compatibility bytes payload = 2; diff --git a/test/benchmark/command/component.go b/test/benchmark/command/component.go index f26aa6d0f..d98d5432c 100644 --- a/test/benchmark/command/component.go +++ b/test/benchmark/command/component.go @@ -26,12 +26,11 @@ import ( "sync/atomic" "time" - v1 "cloudevents.io/genproto/v1" "github.com/go-redis/redis/v8" - "github.com/linkall-labs/vanus/internal/primitive/vanus" "github.com/linkall-labs/vanus/internal/store" "github.com/linkall-labs/vanus/internal/store/segment" "github.com/linkall-labs/vanus/observability/log" + v1 "github.com/linkall-labs/vanus/proto/pkg/cloudevents" segpb "github.com/linkall-labs/vanus/proto/pkg/segment" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/spf13/cobra" diff --git a/test/e2e/append/main.go b/test/e2e/append/main.go index d567a6e3d..f4d4164f6 100644 --- a/test/e2e/append/main.go +++ b/test/e2e/append/main.go @@ -15,9 +15,10 @@ package main import ( - v1 "cloudevents.io/genproto/v1" "context" "fmt" + + "github.com/linkall-labs/vanus/proto/pkg/cloudevents" "github.com/linkall-labs/vanus/proto/pkg/segment" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" @@ -42,15 +43,15 @@ func TestAppend(cli segment.SegmentServerClient) { cnt++ _, err := cli.AppendToBlock(context.Background(), &segment.AppendToBlockRequest{ BlockId: id, - Events: &v1.CloudEventBatch{ - Events: []*v1.CloudEvent{ + Events: &cloudevents.CloudEventBatch{ + Events: []*cloudevents.CloudEvent{ { Id: "asdsadsadasdsadsadasdsadsad", Source: "asdsadsadasdsadsadasdsadsad", SpecVersion: "1.0", Type: "test1", Attributes: nil, - Data: &v1.CloudEvent_TextData{TextData: fmt.Sprintf("Hello DingJie %d", idx)}, + Data: &cloudevents.CloudEvent_TextData{TextData: fmt.Sprintf("Hello DingJie %d", idx)}, }, }, }, From 7abde9a57c05c5044912a33587614d2d29ae34e3 Mon Sep 17 00:00:00 2001 From: Jay Date: Wed, 28 Dec 2022 15:46:36 +0800 Subject: [PATCH 11/46] Update readme (#371) * docs: update README style Signed-off-by: Jie Ding * docs: update README style Signed-off-by: Jie Ding Signed-off-by: Jie Ding --- README.md | 95 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 73 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 3e07d5b02..3c3aeddae 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,79 @@ -# Vanus +
+

Vanus

+ +

+Vanus is an open-source message queue with built-in event processing capabilities. + +

+ +[![stars](https://img.shields.io/github/stars/linkall-labs/vanus.svg?style=flat&logo=github&colorB=blueviolet&label=stars)](https://github.com/linkall-labs/vanus) [![License](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/linkall-labs/vanus/blob/main/LICENSE) -[![Language](https://img.shields.io/badge/Language-Go-blue.svg)](https://golang.org/) [![codecov](https://codecov.io/gh/linkall-labs/vanus/branch/main/graph/badge.svg?token=RSXSIMEY4V)](https://codecov.io/gh/linkall-labs/vanus) - -## What is Vanus - -Vanus is a Serverless event platform for easily building Event-Driven Architecture (EDA) applications. -It provides enterprises and organizations an innovative platform for collecting, storing, distributing, and processing events at scale. - -## Quick Start - -See [quick-start](https://docs.linkall.com/getting-started/quick-start) +[![Language](https://img.shields.io/github/go-mod/go-version/linkall-labs/vanus?logo=go)](https://golang.org/) +[![playground](https://img.shields.io/badge/Playground-Try%20it%20%20free-red)](https://play.linkall.com) +[![playground](https://img.shields.io/badge/Docs-online-green)](https://linkall.com/docs) + + +

+ +   + + +   + + +   +

+ + +
+ +-------------------------------------------------- + +## Introduction + +Vanus helps users build event pipelines between SaaS, cloud services, and cloud functions in minutes. + +**1. Build the event-driven system** +- Get events from cloud services and SaaS, and deliver them to cloud functions or microservices. +- Synchronize changed data or transfer data to the data lake. +- Obtain events generated by SaaS and send them to other SaaS. + +**2. Out-of-the-box event computing capabilities** +- Real-time processing during event transmissions, such as filtering and transformation. +- Natively support the CloudEvents specification, and can directly send events to workloads that support CloudEvent. + +**3. 100% open source, Super easy to use** +- One-click deployment, the installation is completed within 1 minute, and developers without MQ experience can also use it. +- Message queues and connectors are 100% open source, a one-stop open-source solution. + +## Getting Started + +You can install Vanus with a single command within 1 minute. Check out our [website](https://linkall.com) for detailed information. + +```shell +kubectl apply -f https://download.linkall.com/all-in-one/v0.5.4.yml +``` + +We also provide an [interactive Kubernetes environment](https://play.linkall.com) to simply deploy and try Vanus in your browser. ## Community @@ -26,17 +88,6 @@ We have a few channels for contact: See [here](CONTRIBUTING.md) for how to contribute to Vanus. -## Understanding Vanus - -### Project Layout - -This Project follows [golang-standards/project-layout](https://github.com/golang-standards/project-layout), see the -project for understanding well vanus' codebase. - -### Architecture - -![architecture](docs/architecture.jpg) - ## License Vanus is under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details. From 7e5318dd5a072a63f03c4780a00a8e9765a75d5b Mon Sep 17 00:00:00 2001 From: James Yin Date: Tue, 27 Dec 2022 09:23:25 +0800 Subject: [PATCH 12/46] feat(store): raft support propose callback Signed-off-by: James Yin --- internal/store/block/block.go | 4 +- internal/store/block/raft/appender.go | 184 +++++------------------ internal/store/segment/mock_replica.go | 16 +- internal/store/segment/mock_server.go | 8 +- internal/store/segment/replica.go | 4 +- internal/store/segment/server.go | 29 +++- raft/inflight.go | 67 +++++++++ raft/log.go | 14 +- raft/log_unstable.go | 6 +- raft/node.go | 102 +++++-------- raft/propose.go | 103 +++++++++++++ raft/raft.go | 200 ++++++++++++++++--------- 12 files changed, 426 insertions(+), 311 deletions(-) create mode 100644 raft/inflight.go create mode 100644 raft/propose.go diff --git a/internal/store/block/block.go b/internal/store/block/block.go index b3cf909d4..900e601ae 100644 --- a/internal/store/block/block.go +++ b/internal/store/block/block.go @@ -44,8 +44,10 @@ type Reader interface { Read(ctx context.Context, seq int64, num int) ([]Entry, error) } +type AppendCallback = func(seqs []int64, err error) + type Appender interface { - Append(ctx context.Context, entries ...Entry) ([]int64, error) + Append(ctx context.Context, entries []Entry, cb AppendCallback) } type Block interface { diff --git a/internal/store/block/raft/appender.go b/internal/store/block/raft/appender.go index 0d7451623..11d124312 100644 --- a/internal/store/block/raft/appender.go +++ b/internal/store/block/raft/appender.go @@ -24,7 +24,6 @@ import ( "time" // third-party libraries. - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" // first-party libraries. @@ -67,11 +66,6 @@ type peer struct { type LeaderChangedListener func(block, leader vanus.ID, term uint64) -type commitWaiter struct { - offset int64 - c chan struct{} -} - type Appender interface { block.Appender @@ -86,11 +80,6 @@ type appender struct { actx block.AppendContext appendMu sync.RWMutex - waiters []commitWaiter - commitIndex uint64 - commitOffset int64 - waitMu sync.Mutex - leaderID vanus.ID listener LeaderChangedListener @@ -116,7 +105,6 @@ func NewAppender( a := &appender{ raw: raw, - waiters: make([]commitWaiter, 0), listener: listener, log: raftLog, host: host, @@ -126,7 +114,6 @@ func NewAppender( tracer: tracing.NewTracer("store.block.raft.appender", trace.SpanKindInternal), } a.actx = a.raw.NewAppendContext(nil) - a.commitOffset = a.actx.WriteOffset() a.log.SetSnapshotOperator(a) a.host.Register(a.ID().Uint64(), a) @@ -145,9 +132,6 @@ func NewAppender( } a.node = raft.RestartNode(c) - // Access Commit after raft.RestartNode to ensure raft state is initialized. - a.commitIndex = a.log.HardState().Commit - go a.run(ctx) return a @@ -207,13 +191,6 @@ func (a *appender) run(ctx context.Context) { case rd := <-a.node.Ready(): rCtx, span := a.tracer.Start(ctx, "RaftReady", trace.WithNewRoot()) - var partial bool - stateChanged := !raft.IsEmptyHardState(rd.HardState) - if stateChanged { - // Wake up fast before writing logs. - partial = a.wakeup(rCtx, rd.HardState.Commit) - } - if len(rd.Entries) != 0 { log.Debug(rCtx, "Append entries to raft log.", map[string]interface{}{ "node_id": a.ID(), @@ -238,11 +215,7 @@ func (a *appender) run(ctx context.Context) { }) } - if stateChanged { - // Wake up after writing logs. - if partial { - _ = a.wakeup(rCtx, rd.HardState.Commit) - } + if !raft.IsEmptyHardState(rd.HardState) { log.Debug(rCtx, "Persist raft hard state.", map[string]interface{}{ "node_id": a.ID(), "hard_state": rd.HardState, @@ -336,40 +309,6 @@ func (a *appender) applyEntries(ctx context.Context, committedEntries []raftpb.E return committedEntries[num-1].Index } -// wakeup wakes up append requests to the smaller of the committed or last index. -func (a *appender) wakeup(ctx context.Context, commit uint64) (partial bool) { - _, span := a.tracer.Start(ctx, "wakeup", trace.WithAttributes( - attribute.Int64("commit", int64(commit)))) - defer span.End() - - li, _ := a.log.LastIndex() - if commit > li { - commit = li - partial = true - } - - if commit <= a.commitIndex { - return - } - a.commitIndex = commit - - for off := commit; off > 0; off-- { - pbEntries, err := a.log.Entries(off, off+1, 0) - if err != nil { - return - } - - pbEntry := pbEntries[0] - if pbEntry.Type == raftpb.EntryNormal && len(pbEntry.Data) > 0 { - frag := block.NewFragment(pbEntry.Data) - a.doWakeup(ctx, frag.EndOffset()) - return - } - } - - return partial -} - func (a *appender) becomeLeader(ctx context.Context) { ctx, span := a.tracer.Start(ctx, "becomeLeader") defer span.End() @@ -459,65 +398,65 @@ func (a *appender) reset(ctx context.Context) { } // Append implements block.raw. -func (a *appender) Append(ctx context.Context, entries ...block.Entry) ([]int64, error) { +func (a *appender) Append(ctx context.Context, entries []block.Entry, cb block.AppendCallback) { ctx, span := a.tracer.Start(ctx, "Append") defer span.End() - seqs, offset, err := a.append(ctx, entries) - if err != nil { - if errors.Is(err, errors.ErrSegmentFull) { - _ = a.waitCommit(ctx, offset) - } - return nil, err - } - - // Wait until entries is committed. - err = a.waitCommit(ctx, offset) - if err != nil { - return nil, err - } - - return seqs, nil -} - -func (a *appender) append(ctx context.Context, entries []block.Entry) ([]int64, int64, error) { - ctx, span := a.tracer.Start(ctx, "append") - defer span.End() - span.AddEvent("Acquiring append lock") a.appendMu.Lock() span.AddEvent("Got append lock") - defer a.appendMu.Unlock() - if !a.isLeader() { - return nil, 0, errors.ErrNotLeader + a.appendMu.Unlock() + cb(nil, errors.ErrNotLeader) + return } if a.actx.Archived() { - return nil, a.actx.WriteOffset(), errors.ErrSegmentFull + a.appendMu.Unlock() + cb(nil, errors.ErrSegmentFull) + return } seqs, frag, enough, err := a.raw.PrepareAppend(ctx, a.actx, entries...) if err != nil { - return nil, 0, err + a.appendMu.Unlock() + cb(nil, err) + return } - off := a.actx.WriteOffset() data, _ := block.MarshalFragment(ctx, frag) - if err = a.node.Propose(ctx, data); err != nil { - return nil, 0, err - } + var pds []raft.ProposeData if enough { - if frag, err = a.raw.PrepareArchive(ctx, a.actx); err == nil { - data, _ := block.MarshalFragment(ctx, frag) - _ = a.node.Propose(ctx, data) + if frag, err := a.raw.PrepareArchive(ctx, a.actx); err == nil { + archivedData, _ := block.MarshalFragment(ctx, frag) + pds = make([]raft.ProposeData, 2) // FIXME(james.yin): revert archived if propose failed. + pds[1] = raft.ProposeData{ + Data: archivedData, + } + } else { + pds = make([]raft.ProposeData, 1) } + } else { + pds = make([]raft.ProposeData, 1) } - return seqs, off, nil + pds[0] = raft.ProposeData{ + Data: data, + Callback: func(err error) { + if err != nil { + cb(nil, err) + } else { + cb(seqs, nil) + } + }, + } + + a.node.Propose(ctx, pds...) + + a.appendMu.Unlock() } func (a *appender) doAppend(ctx context.Context, frags ...block.Fragment) { @@ -527,57 +466,6 @@ func (a *appender) doAppend(ctx context.Context, frags ...block.Fragment) { _, _ = a.raw.CommitAppend(ctx, frags...) } -func (a *appender) waitCommit(ctx context.Context, offset int64) error { - ctx, span := a.tracer.Start(ctx, "waitCommit") - defer span.End() - - span.AddEvent("Acquiring wait lock") - a.waitMu.Lock() - span.AddEvent("Got wait lock") - - if offset <= a.commitOffset { - a.waitMu.Unlock() - return nil - } - - ch := make(chan struct{}) - a.waiters = append(a.waiters, commitWaiter{ - offset: offset, - c: ch, - }) - - a.waitMu.Unlock() - - // FIXME(james.yin): lost leader - select { - case <-ch: - return nil - case <-ctx.Done(): - return ctx.Err() - } -} - -func (a *appender) doWakeup(ctx context.Context, commit int64) { - _, span := a.tracer.Start(ctx, "doWakeup") - defer span.End() - - span.AddEvent("Acquiring wait lock") - a.waitMu.Lock() - span.AddEvent("Got wait lock") - - defer a.waitMu.Unlock() - - for len(a.waiters) != 0 { - waiter := a.waiters[0] - if waiter.offset > commit { - break - } - close(waiter.c) - a.waiters = a.waiters[1:] - } - a.commitOffset = commit -} - func (a *appender) Status() ClusterStatus { leader, term := a.leaderInfo() return ClusterStatus{ diff --git a/internal/store/segment/mock_replica.go b/internal/store/segment/mock_replica.go index e03987e8f..8e3eef14b 100644 --- a/internal/store/segment/mock_replica.go +++ b/internal/store/segment/mock_replica.go @@ -39,23 +39,15 @@ func (m *MockReplica) EXPECT() *MockReplicaMockRecorder { } // Append mocks base method. -func (m *MockReplica) Append(ctx context.Context, entries ...block.Entry) ([]int64, error) { +func (m *MockReplica) Append(ctx context.Context, entries []block.Entry, cb block.AppendCallback) { m.ctrl.T.Helper() - varargs := []interface{}{ctx} - for _, a := range entries { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "Append", varargs...) - ret0, _ := ret[0].([]int64) - ret1, _ := ret[1].(error) - return ret0, ret1 + m.ctrl.Call(m, "Append", ctx, entries, cb) } // Append indicates an expected call of Append. -func (mr *MockReplicaMockRecorder) Append(ctx interface{}, entries ...interface{}) *gomock.Call { +func (mr *MockReplicaMockRecorder) Append(ctx, entries, cb interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx}, entries...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Append", reflect.TypeOf((*MockReplica)(nil).Append), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Append", reflect.TypeOf((*MockReplica)(nil).Append), ctx, entries, cb) } // Bootstrap mocks base method. diff --git a/internal/store/segment/mock_server.go b/internal/store/segment/mock_server.go index c45a5299b..9f28a85ca 100644 --- a/internal/store/segment/mock_server.go +++ b/internal/store/segment/mock_server.go @@ -9,10 +9,10 @@ import ( net "net" reflect "reflect" - v1 "github.com/linkall-labs/vanus/proto/pkg/cloudevents" gomock "github.com/golang/mock/gomock" primitive "github.com/linkall-labs/vanus/internal/primitive" vanus "github.com/linkall-labs/vanus/internal/primitive/vanus" + cloudevents "github.com/linkall-labs/vanus/proto/pkg/cloudevents" ) // MockServer is a mock of Server interface. @@ -53,7 +53,7 @@ func (mr *MockServerMockRecorder) ActivateSegment(ctx, logID, segID, replicas in } // AppendToBlock mocks base method. -func (m *MockServer) AppendToBlock(ctx context.Context, id vanus.ID, events []*v1.CloudEvent) ([]int64, error) { +func (m *MockServer) AppendToBlock(ctx context.Context, id vanus.ID, events []*cloudevents.CloudEvent) ([]int64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AppendToBlock", ctx, id, events) ret0, _ := ret[0].([]int64) @@ -125,10 +125,10 @@ func (mr *MockServerMockRecorder) LookupOffsetInBlock(ctx, id, stime interface{} } // ReadFromBlock mocks base method. -func (m *MockServer) ReadFromBlock(ctx context.Context, id vanus.ID, seq int64, num int, pollingTimeout uint32) ([]*v1.CloudEvent, error) { +func (m *MockServer) ReadFromBlock(ctx context.Context, id vanus.ID, seq int64, num int, pollingTimeout uint32) ([]*cloudevents.CloudEvent, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ReadFromBlock", ctx, id, seq, num, pollingTimeout) - ret0, _ := ret[0].([]*v1.CloudEvent) + ret0, _ := ret[0].([]*cloudevents.CloudEvent) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/internal/store/segment/replica.go b/internal/store/segment/replica.go index f950565a6..b1649a029 100644 --- a/internal/store/segment/replica.go +++ b/internal/store/segment/replica.go @@ -80,8 +80,8 @@ func (r *replica) Read(ctx context.Context, seq int64, num int) ([]block.Entry, return r.raw.Read(ctx, seq, num) } -func (r *replica) Append(ctx context.Context, entries ...block.Entry) ([]int64, error) { - return r.appender.Append(ctx, entries...) +func (r *replica) Append(ctx context.Context, entries []block.Entry, cb block.AppendCallback) { + r.appender.Append(ctx, entries, cb) } func (r *replica) Status() *metapb.SegmentHealthInfo { diff --git a/internal/store/segment/server.go b/internal/store/segment/server.go index 4017293d4..fdebd4378 100644 --- a/internal/store/segment/server.go +++ b/internal/store/segment/server.go @@ -30,7 +30,6 @@ import ( // third-party libraries. recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery" - cepb "github.com/linkall-labs/vanus/proto/pkg/cloudevents" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" @@ -46,6 +45,7 @@ import ( "github.com/linkall-labs/vanus/observability/tracing" "github.com/linkall-labs/vanus/pkg/cluster" "github.com/linkall-labs/vanus/pkg/util" + cepb "github.com/linkall-labs/vanus/proto/pkg/cloudevents" ctrlpb "github.com/linkall-labs/vanus/proto/pkg/controller" metapb "github.com/linkall-labs/vanus/proto/pkg/meta" raftpb "github.com/linkall-labs/vanus/proto/pkg/raft" @@ -134,6 +134,29 @@ type leaderInfo struct { term uint64 } +type appendResult struct { + seqs []int64 + err error +} + +type appendFuture chan appendResult + +func newAppendFuture() appendFuture { + return make(appendFuture, 1) +} + +func (af appendFuture) onAppended(seqs []int64, err error) { + af <- appendResult{ + seqs: seqs, + err: err, + } +} + +func (af appendFuture) wait() ([]int64, error) { + res := <-af + return res.seqs, res.err +} + type server struct { replicas sync.Map // vanus.ID, Replica @@ -667,7 +690,9 @@ func (s *server) AppendToBlock(ctx context.Context, id vanus.ID, events []*cepb. metrics.WriteTPSCounterVec.WithLabelValues(s.volumeIDStr, b.IDStr()).Add(float64(len(events))) metrics.WriteThroughputCounterVec.WithLabelValues(s.volumeIDStr, b.IDStr()).Add(float64(size)) - seqs, err := b.Append(ctx, entries...) + future := newAppendFuture() + b.Append(ctx, entries, future.onAppended) + seqs, err := future.wait() if err != nil { return nil, s.processAppendError(ctx, b, err) } diff --git a/raft/inflight.go b/raft/inflight.go new file mode 100644 index 000000000..9f590ba92 --- /dev/null +++ b/raft/inflight.go @@ -0,0 +1,67 @@ +// Copyright 2022 Linkall Inc. +// +// 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 raft + +import "sort" + +type waiter struct { + index uint64 + cb ProposeCallback +} + +type inflight struct { + waiters []waiter +} + +func (in *inflight) append(index uint64, cb ProposeCallback) { + in.waiters = append(in.waiters, waiter{ + index: index, + cb: cb, + }) +} + +func (in *inflight) commitTo(index uint64) { + size := len(in.waiters) + if size == 0 { + return + } + n := sort.Search(size, func(i int) bool { + return in.waiters[i].index > index + }) + committed := in.waiters[:n] + in.waiters = in.waiters[n:] + // TODO(james.yin): invoke callbacks in other goroutine + for _, w := range committed { + w.cb(nil) + } +} + +func (in *inflight) truncateFrom(index uint64) { + size := len(in.waiters) + if size == 0 { + return + } + n := sort.Search(size, func(i int) bool { + return in.waiters[i].index >= index + }) + if n < size { + dropped := append([]waiter{}, in.waiters[n:]...) + in.waiters = in.waiters[:n] + // TODO(james.yin): invoke callbacks in other goroutine + for _, w := range dropped { + w.cb(ErrProposalDropped) + } + } +} diff --git a/raft/log.go b/raft/log.go index 08a0bc6ee..c7ad8dc74 100644 --- a/raft/log.go +++ b/raft/log.go @@ -25,6 +25,8 @@ type raftLog struct { // storage contains all stable entries since the last snapshot. storage Storage + inflight *inflight + // unstable contains all unstable entries and snapshot. // they will be saved into storage. unstable unstable @@ -125,12 +127,17 @@ func (l *raftLog) append(ents ...pb.Entry) uint64 { if after := ents[0].Index - 1; after < l.committed { l.logger.Panicf("after(%d) is out of range [committed(%d)]", after, l.committed) } - l.unstable.truncateAndAppend(ents) + + li, truncated := l.unstable.truncateAndAppend(ents) + start := ents[0].Index + if truncated { + l.inflight.truncateFrom(start) + } // Reset pending when any entry being persisted is truncated. - if start := ents[0].Index; l.pending > start { + if l.pending > start { l.pending = start } - return l.lastIndex() + return li } // findConflict finds the index of the conflict. @@ -295,6 +302,7 @@ func (l *raftLog) localCommitTo(tocommit uint64) { // l.logger.Panicf("tocommit(%d) is out of range [lastIndex(%d)]. Was the raft log corrupted, truncated, or lost?", tocommit, li) // } l.localCommitted = tocommit + l.inflight.commitTo(tocommit) } } diff --git a/raft/log_unstable.go b/raft/log_unstable.go index d15aa1b47..93612421f 100644 --- a/raft/log_unstable.go +++ b/raft/log_unstable.go @@ -122,7 +122,7 @@ func (u *unstable) restore(s pb.Snapshot) { u.snapshot = &s } -func (u *unstable) truncateAndAppend(ents []pb.Entry) { +func (u *unstable) truncateAndAppend(ents []pb.Entry) (li uint64, truncated bool) { after := ents[0].Index switch { case after == u.offset+uint64(len(u.entries)): @@ -135,13 +135,17 @@ func (u *unstable) truncateAndAppend(ents []pb.Entry) { // portion, so set the offset and replace the entries u.offset = after u.entries = ents + truncated = true default: // truncate to after and copy to u.entries // then append u.logger.Infof("truncate the unstable entries before index %d", after) u.entries = append([]pb.Entry{}, u.slice(u.offset, after)...) u.entries = append(u.entries, ents...) + truncated = true } + li = ents[len(ents)-1].Index + return } func (u *unstable) slice(lo uint64, hi uint64) []pb.Entry { diff --git a/raft/node.go b/raft/node.go index e4910c9e9..cf13a5e07 100644 --- a/raft/node.go +++ b/raft/node.go @@ -139,9 +139,8 @@ type Node interface { Tick() // Campaign causes the Node to transition to candidate state and start campaigning to become leader. Campaign(ctx context.Context) error - // Propose proposes that data be appended to the log. Note that proposals can be lost without - // notice, therefore it is user's job to ensure proposal retries. - Propose(ctx context.Context, data []byte) error + // Propose proposes that data be appended to the log. + Propose(ctx context.Context, pds ...ProposeData) // ProposeConfChange proposes a configuration change. Like any proposal, the // configuration change may be dropped with or without an error being // returned. In particular, configuration changes are dropped unless the @@ -259,11 +258,6 @@ func RestartNode(c *Config) Node { return &n } -type msgWithResult struct { - m pb.Message - result chan error -} - type peersWithResult struct { peers []Peer result chan error @@ -271,7 +265,7 @@ type peersWithResult struct { // node is the canonical implementation of the Node interface type node struct { - propc chan msgWithResult + propc chan []ProposeData recvc chan pb.Message confc chan pb.ConfChangeV2 confstatec chan pb.ConfState @@ -290,7 +284,7 @@ type node struct { func newNode(rn *RawNode) node { return node{ - propc: make(chan msgWithResult), + propc: make(chan []ProposeData), recvc: make(chan pb.Message), confc: make(chan pb.ConfChangeV2), confstatec: make(chan pb.ConfState), @@ -330,7 +324,7 @@ func (n *node) Bootstrap(peers []Peer) error { } select { case ch <- bp: - //case <-ctx.Done(): + // case <-ctx.Done(): // return ctx.Err() case <-n.done: return ErrStopped @@ -340,7 +334,7 @@ func (n *node) Bootstrap(peers []Peer) error { if err != nil { return err } - //case <-ctx.Done(): + // case <-ctx.Done(): // return ctx.Err() case <-n.done: return ErrStopped @@ -349,7 +343,7 @@ func (n *node) Bootstrap(peers []Peer) error { } func (n *node) run() { - var propc chan msgWithResult + var propc chan []ProposeData var readyc chan Ready var advancec chan struct{} var rd Ready @@ -393,14 +387,8 @@ func (n *node) run() { // TODO: maybe buffer the config propose if there exists one (the way // described in raft dissertation) // Currently it is dropped in Step silently. - case pm := <-propc: - m := pm.m - m.From = r.id - err := r.Step(m) - if pm.result != nil { - pm.result <- err - close(pm.result) - } + case pds := <-propc: + r.Propose(pds...) case m := <-n.recvc: // filter out response message from unknown From. if pr := r.prs.Progress[m.From]; pr != nil || !IsResponseMsg(m.Type) { @@ -471,13 +459,33 @@ func (n *node) Tick() { } } -func (n *node) Campaign(ctx context.Context) error { return n.step(ctx, pb.Message{Type: pb.MsgHup}) } +func (n *node) Campaign(ctx context.Context) error { + return n.step(ctx, pb.Message{Type: pb.MsgHup}) +} -func (n *node) Propose(ctx context.Context, data []byte) error { - ctx, span := n.tracer.Start(ctx, "Propose") - defer span.End() +func (n *node) Propose(ctx context.Context, pds ...ProposeData) { + span := trace.SpanFromContext(ctx) + span.AddEvent("raft.node.Propose() Start") + defer span.AddEvent("raft.node.Propose() End") - return n.stepWait(ctx, pb.Message{Type: pb.MsgProp, Entries: []pb.Entry{{Data: data}}}) + select { + case n.propc <- pds: + case <-ctx.Done(): + err := ctx.Err() + for i := range pds { + pd := &pds[i] + if pd.Callback != nil { + pd.Callback(err) + } + } + case <-n.done: + for i := range pds { + pd := &pds[i] + if pd.Callback != nil { + pd.Callback(ErrStopped) + } + } + } } func (n *node) Step(ctx context.Context, m pb.Message) error { @@ -508,53 +516,17 @@ func (n *node) ProposeConfChange(ctx context.Context, cc pb.ConfChangeI) error { return n.Step(ctx, msg) } -func (n *node) step(ctx context.Context, m pb.Message) error { - return n.stepWithWaitOption(ctx, m, false) -} - -func (n *node) stepWait(ctx context.Context, m pb.Message) error { - return n.stepWithWaitOption(ctx, m, true) -} - // Step advances the state machine using msgs. The ctx.Err() will be returned, // if any. -func (n *node) stepWithWaitOption(ctx context.Context, m pb.Message, wait bool) error { - if m.Type != pb.MsgProp { - select { - case n.recvc <- m: - return nil - case <-ctx.Done(): - return ctx.Err() - case <-n.done: - return ErrStopped - } - } - ch := n.propc - pm := msgWithResult{m: m} - if wait { - pm.result = make(chan error, 1) - } - select { - case ch <- pm: - if !wait { - return nil - } - case <-ctx.Done(): - return ctx.Err() - case <-n.done: - return ErrStopped - } +func (n *node) step(ctx context.Context, m pb.Message) error { select { - case err := <-pm.result: - if err != nil { - return err - } + case n.recvc <- m: + return nil case <-ctx.Done(): return ctx.Err() case <-n.done: return ErrStopped } - return nil } func (n *node) Ready() <-chan Ready { return n.readyc } diff --git a/raft/propose.go b/raft/propose.go new file mode 100644 index 000000000..94680d76f --- /dev/null +++ b/raft/propose.go @@ -0,0 +1,103 @@ +// Copyright 2022 Linkall Inc. +// +// 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 raft + +import ( + // standard libraries. + "context" + + // this project. + pb "github.com/linkall-labs/vanus/raft/raftpb" +) + +type ProposeCallback = func(error) + +type ProposeData struct { + Type pb.EntryType + Data []byte + Callback ProposeCallback + NoWaitCommit bool +} + +type ProposeDataOption func(cfg *ProposeData) + +func Data(data []byte) ProposeDataOption { + return func(pd *ProposeData) { + pd.Data = data + } +} + +func Callback(cb ProposeCallback) ProposeDataOption { + return func(pd *ProposeData) { + pd.Callback = cb + } +} + +func NoWaitCommit() ProposeDataOption { + return func(pd *ProposeData) { + pd.NoWaitCommit = true + } +} + +type ProposeOption func(cfg *ProposeData) + +func WithData(opts ...ProposeDataOption) ProposeOption { + return func(cfg *ProposeData) { + for _, opt := range opts { + opt(cfg) + } + } +} + +func Propose(ctx context.Context, n Node, opts ...ProposeOption) { + pds := make([]ProposeData, len(opts)) + for i, opt := range opts { + opt(&pds[i]) + } + n.Propose(ctx, pds...) +} + +type proposeFuture chan error + +func newProposeFuture() proposeFuture { + return make(proposeFuture, 1) +} + +func (pr proposeFuture) onProposed(err error) { + if err != nil { + pr <- err + } + close(pr) +} + +func (pf proposeFuture) wait() error { + return <-pf +} + +func Propose0(ctx context.Context, n Node, data []byte) error { + future := newProposeFuture() + n.Propose(ctx, ProposeData{Data: data, Callback: future.onProposed}) + return future.wait() +} + +func Propose1(ctx context.Context, n Node, data []byte) error { + future := newProposeFuture() + n.Propose(ctx, ProposeData{Data: data, Callback: future.onProposed, NoWaitCommit: true}) + return future.wait() +} + +func Propose2(ctx context.Context, n Node, data []byte) { + n.Propose(ctx, ProposeData{Data: data}) +} diff --git a/raft/raft.go b/raft/raft.go index 980d52278..3033f70d3 100644 --- a/raft/raft.go +++ b/raft/raft.go @@ -32,8 +32,10 @@ import ( ) // None is a placeholder node ID used when there is no leader. -const None uint64 = 0 -const noLimit = math.MaxUint64 +const ( + None uint64 = 0 + noLimit = math.MaxUint64 +) // Possible values for StateType. const ( @@ -258,6 +260,8 @@ type raft struct { // TODO(tbg): rename to trk. prs tracker.ProgressTracker + inflight inflight + state StateType // isLearner is true if the local raft node is a learner. @@ -305,8 +309,9 @@ type raft struct { randomizedElectionTimeout int disableProposalForwarding bool - tick func() - step stepFunc + tick func() + step stepFunc + propose proposeFunc logger Logger @@ -343,6 +348,7 @@ func newRaft(c *Config) *raft { readOnly: newReadOnly(c.ReadOnlyOption), disableProposalForwarding: c.DisableProposalForwarding, } + raftlog.inflight = &r.inflight cfg, prs, err := confchange.Restore(confchange.Changer{ Tracker: r.prs, @@ -693,6 +699,7 @@ func (r *raft) tickHeartbeat() { } func (r *raft) becomeFollower(term uint64, lead uint64) { + r.propose = proposeFollower r.step = stepFollower r.reset(term) r.tick = r.tickElection @@ -706,6 +713,7 @@ func (r *raft) becomeCandidate() { if r.state == StateLeader { panic("invalid transition [leader -> candidate]") } + r.propose = proposeCandidate r.step = stepCandidate r.reset(r.Term + 1) r.tick = r.tickElection @@ -722,6 +730,7 @@ func (r *raft) becomePreCandidate() { // Becoming a pre-candidate changes our step functions and state, // but doesn't change anything else. In particular it does not increase // r.Term or change r.Vote. + r.propose = proposeCandidate r.step = stepCandidate r.prs.ResetVotes() r.tick = r.tickElection @@ -735,6 +744,7 @@ func (r *raft) becomeLeader() { if r.state == StateFollower { panic("invalid transition [follower -> leader]") } + r.propose = proposeLeader r.step = stepLeader r.reset(r.Term) r.tick = r.tickHeartbeat @@ -856,6 +866,116 @@ func (r *raft) poll(id uint64, t pb.MessageType, v bool) (granted int, rejected return r.prs.TallyVotes() } +func (r *raft) Propose(pds ...ProposeData) { + ents := make([]pb.Entry, len(pds)) + for i := range pds { + pd := &pds[i] + ents[i] = pb.Entry{ + Type: pd.Type, + Data: pd.Data, + } + } + err := r.propose(r, pb.Message{ + Type: pb.MsgProp, + From: r.id, + Entries: ents, + }) + for i := range pds { + pd := &pds[i] + if pd.Callback == nil { + continue + } + if err != nil { + pd.Callback(err) + } else if pd.NoWaitCommit { + pd.Callback(nil) + } else { + r.inflight.append(ents[i].Index, pd.Callback) + } + } +} + +type proposeFunc func(r *raft, m pb.Message) error + +func proposeLeader(r *raft, m pb.Message) error { + if len(m.Entries) == 0 { + r.logger.Panicf("%x stepped empty MsgProp", r.id) + } + if r.prs.Progress[r.id] == nil { + // If we are not currently a member of the range (i.e. this node + // was removed from the configuration while serving as leader), + // drop any new proposals. + return ErrProposalDropped + } + if r.leadTransferee != None { + r.logger.Debugf("%x [term %d] transfer leadership to %x is in progress; dropping proposal", r.id, r.Term, r.leadTransferee) + return ErrProposalDropped + } + + for i := range m.Entries { + e := &m.Entries[i] + var cc pb.ConfChangeI + if e.Type == pb.EntryConfChange { + var ccc pb.ConfChange + if err := ccc.Unmarshal(e.Data); err != nil { + panic(err) + } + cc = ccc + } else if e.Type == pb.EntryConfChangeV2 { + var ccc pb.ConfChangeV2 + if err := ccc.Unmarshal(e.Data); err != nil { + panic(err) + } + cc = ccc + } + if cc != nil { + alreadyPending := r.pendingConfIndex > r.raftLog.applied + alreadyJoint := len(r.prs.Config.Voters[1]) > 0 + wantsLeaveJoint := len(cc.AsV2().Changes) == 0 + + var refused string + if alreadyPending { + refused = fmt.Sprintf("possible unapplied conf change at index %d (applied to %d)", r.pendingConfIndex, r.raftLog.applied) + } else if alreadyJoint && !wantsLeaveJoint { + refused = "must transition out of joint config first" + } else if !alreadyJoint && wantsLeaveJoint { + refused = "not in joint state; refusing empty conf change" + } + + if refused != "" { + r.logger.Infof("%x ignoring conf change %v at config %s: %s", r.id, cc, r.prs.Config, refused) + m.Entries[i] = pb.Entry{Type: pb.EntryNormal} + } else { + r.pendingConfIndex = r.raftLog.lastIndex() + uint64(i) + 1 + } + } + } + + if !r.appendEntry(m.Entries...) { + return ErrProposalDropped + } + r.bcastAppend() + return nil +} + +func proposeCandidate(r *raft, m pb.Message) error { + r.logger.Infof("%x no leader at term %d; dropping proposal", r.id, r.Term) + return ErrProposalDropped +} + +func proposeFollower(r *raft, m pb.Message) error { + if r.lead == None { + r.logger.Infof("%x no leader at term %d; dropping proposal", r.id, r.Term) + return ErrProposalDropped + } else if r.disableProposalForwarding { + r.logger.Infof("%x not forwarding to leader %x at term %d; dropping proposal", r.id, r.lead, r.Term) + return ErrProposalDropped + } + m.To = r.lead + r.send(m) + return nil +} + func (r *raft) Step(m pb.Message) error { // Handle the message term, which may result in our stepping down to a follower. switch { @@ -1030,64 +1150,7 @@ func stepLeader(r *raft, m pb.Message) error { }) return nil case pb.MsgProp: - if len(m.Entries) == 0 { - r.logger.Panicf("%x stepped empty MsgProp", r.id) - } - if r.prs.Progress[r.id] == nil { - // If we are not currently a member of the range (i.e. this node - // was removed from the configuration while serving as leader), - // drop any new proposals. - return ErrProposalDropped - } - if r.leadTransferee != None { - r.logger.Debugf("%x [term %d] transfer leadership to %x is in progress; dropping proposal", r.id, r.Term, r.leadTransferee) - return ErrProposalDropped - } - - for i := range m.Entries { - e := &m.Entries[i] - var cc pb.ConfChangeI - if e.Type == pb.EntryConfChange { - var ccc pb.ConfChange - if err := ccc.Unmarshal(e.Data); err != nil { - panic(err) - } - cc = ccc - } else if e.Type == pb.EntryConfChangeV2 { - var ccc pb.ConfChangeV2 - if err := ccc.Unmarshal(e.Data); err != nil { - panic(err) - } - cc = ccc - } - if cc != nil { - alreadyPending := r.pendingConfIndex > r.raftLog.applied - alreadyJoint := len(r.prs.Config.Voters[1]) > 0 - wantsLeaveJoint := len(cc.AsV2().Changes) == 0 - - var refused string - if alreadyPending { - refused = fmt.Sprintf("possible unapplied conf change at index %d (applied to %d)", r.pendingConfIndex, r.raftLog.applied) - } else if alreadyJoint && !wantsLeaveJoint { - refused = "must transition out of joint config first" - } else if !alreadyJoint && wantsLeaveJoint { - refused = "not in joint state; refusing empty conf change" - } - - if refused != "" { - r.logger.Infof("%x ignoring conf change %v at config %s: %s", r.id, cc, r.prs.Config, refused) - m.Entries[i] = pb.Entry{Type: pb.EntryNormal} - } else { - r.pendingConfIndex = r.raftLog.lastIndex() + uint64(i) + 1 - } - } - } - - if !r.appendEntry(m.Entries...) { - return ErrProposalDropped - } - r.bcastAppend() - return nil + return proposeLeader(r, m) case pb.MsgLogResp: if r.raftLog.stableTo(m.Index, m.LogTerm) { r.prs.Progress[r.id].MaybeUpdate(m.Index) @@ -1410,8 +1473,7 @@ func stepCandidate(r *raft, m pb.Message) error { } switch m.Type { case pb.MsgProp: - r.logger.Infof("%x no leader at term %d; dropping proposal", r.id, r.Term) - return ErrProposalDropped + return proposeCandidate(r, m) case pb.MsgApp: r.becomeFollower(m.Term, m.From) // always m.Term == r.Term r.handleAppendEntries(m) @@ -1450,15 +1512,7 @@ func stepCandidate(r *raft, m pb.Message) error { func stepFollower(r *raft, m pb.Message) error { switch m.Type { case pb.MsgProp: - if r.lead == None { - r.logger.Infof("%x no leader at term %d; dropping proposal", r.id, r.Term) - return ErrProposalDropped - } else if r.disableProposalForwarding { - r.logger.Infof("%x not forwarding to leader %x at term %d; dropping proposal", r.id, r.lead, r.Term) - return ErrProposalDropped - } - m.To = r.lead - r.send(m) + return proposeFollower(r, m) case pb.MsgApp: r.electionElapsed = 0 r.lead = m.From From c61e5e9c1f36b479a4faeef7a9fdc004cb8f0ea2 Mon Sep 17 00:00:00 2001 From: James Yin Date: Fri, 30 Dec 2022 15:36:10 +0800 Subject: [PATCH 13/46] fix: raft local commit not advance Signed-off-by: James Yin --- raft/raft.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/raft/raft.go b/raft/raft.go index 3033f70d3..12ea42805 100644 --- a/raft/raft.go +++ b/raft/raft.go @@ -1157,6 +1157,8 @@ func stepLeader(r *raft, m pb.Message) error { if r.maybeCommit() { // TODO(james.yin): Send latest commit to follower nodes? // r.bcastAppend() + } else { + r.raftLog.localCommitTo(r.raftLog.committed) } } return nil From 4635b50f17a0c0649a74f87845befe0a605779dd Mon Sep 17 00:00:00 2001 From: James Yin Date: Tue, 3 Jan 2023 10:43:25 +0800 Subject: [PATCH 14/46] feat: async raft apply (#324) * revert: error of block layer Signed-off-by: James Yin * feat: async raft apply Signed-off-by: James Yin * perf: reduce tracing cost Signed-off-by: James Yin * refactor(store): wal Signed-off-by: James Yin * perf: vsb fragment Signed-off-by: James Yin Signed-off-by: James Yin --- client/go.mod | 32 +- client/go.sum | 366 +++++++-- cmd/store/main.go | 5 +- go.mod | 23 +- go.sum | 47 +- internal/raft/log/compaction.go | 16 +- internal/raft/log/log_storage.go | 16 +- internal/raft/log/log_test.go | 14 +- internal/raft/log/recovery.go | 8 +- internal/raft/log/snapshot_storage.go | 8 +- internal/raft/log/state_storage.go | 10 +- internal/raft/transport/host.go | 5 +- internal/store/block/block.go | 10 + internal/store/block/entry.go | 2 + internal/store/block/raft/appender.go | 156 ++-- internal/store/block/raw.go | 4 +- internal/store/block/raw/engine.go | 8 + internal/store/config.go | 113 +-- internal/store/config/async_store.go | 23 + internal/store/config/io.go | 50 ++ internal/store/config/io_linux.go | 31 + .../{config_other.go => config/io_other.go} | 6 +- internal/store/config/raft.go | 25 + internal/store/config/sync_store.go | 27 + internal/store/config/vsb.go | 39 + internal/store/config/wal.go | 74 ++ internal/store/config_test.go | 29 +- internal/store/io/block/buffer.go | 212 +++++ .../allocator.go => io/block/buffer_pool.go} | 27 +- .../block/buffer_pool_test.go} | 32 +- internal/store/io/block/buffer_test.go | 174 ++++ .../block/interface.go} | 18 +- internal/store/io/block/oneshot.go | 47 ++ .../io/{engine.go => engine/interface.go} | 27 +- internal/store/io/engine/psync/config.go | 55 ++ internal/store/io/engine/psync/psync.go | 83 ++ internal/store/io/engine/psync/psync_test.go | 42 + .../testing/engine.go} | 31 +- internal/store/io/{ => engine/uring}/uring.go | 17 +- .../store/io/{ => engine/uring}/uring_test.go | 9 +- internal/store/io/stream/pending_queue.go | 118 +++ internal/store/io/stream/scheduler.go | 116 +++ internal/store/io/stream/stream.go | 269 ++++++ internal/store/io/write.go | 2 +- internal/store/io/write_test.go | 2 +- internal/store/io/zone/file/file.go | 40 + .../file_test.go => io/zone/interface.go} | 10 +- .../store/io/zone/segmentedfile/compaction.go | 58 ++ .../store/io/zone/segmentedfile/config.go | 55 ++ .../store/io/zone/segmentedfile/recovery.go | 133 +++ .../store/io/zone/segmentedfile/segment.go | 68 ++ .../io/zone/segmentedfile/segmented_file.go | 172 ++++ .../segmentedfile/segmented_file_test.go} | 52 +- internal/store/meta/async.go | 20 +- internal/store/meta/async_test.go | 10 +- internal/store/meta/sync.go | 34 +- internal/store/meta/sync_test.go | 28 +- internal/store/segment/api_test.go | 5 +- internal/store/segment/recovery_test.go | 2 +- internal/store/segment/server.go | 63 +- internal/store/segment/server_test.go | 6 +- internal/store/vsb/block.go | 26 +- internal/store/vsb/block_append.go | 261 +++--- internal/store/vsb/block_append_test.go | 110 ++- internal/store/vsb/block_read.go | 13 +- internal/store/vsb/block_read_test.go | 9 +- internal/store/vsb/block_seek.go | 11 +- internal/store/vsb/block_snapshot.go | 2 +- internal/store/vsb/codec/cloud_event.go | 10 +- internal/store/vsb/codec/packet.go | 8 +- internal/store/vsb/config.go | 86 ++ internal/store/vsb/engine.go | 19 +- internal/store/vsb/engine_open.go | 37 +- internal/store/vsb/fragment.go | 12 +- internal/store/wal/appender.go | 119 +++ internal/store/wal/block/block.go | 179 ---- internal/store/wal/block/block_test.go | 149 ---- internal/store/wal/config.go | 22 +- internal/store/wal/config_linux.go | 12 +- internal/store/wal/config_other.go | 10 +- internal/store/wal/config_test.go | 6 +- internal/store/wal/file.go | 92 --- internal/store/wal/record/packing.go | 19 +- internal/store/wal/record/packing_test.go | 30 +- internal/store/wal/recovery.go | 235 ++++-- internal/store/wal/recovery_test.go | 22 +- internal/store/wal/stream.go | 371 --------- internal/store/wal/wal.go | 371 ++------- internal/store/wal/wal_bench_test.go | 4 +- internal/store/wal/wal_test.go | 35 +- observability/go.mod | 31 +- observability/go.sum | 51 +- pkg/go.mod | 25 +- pkg/go.sum | 123 +-- proto/go.mod | 22 +- proto/go.sum | 159 +--- raft/go.mod | 23 +- raft/go.sum | 769 +++++++++++++++++- raft/log.go | 37 +- raft/node.go | 35 +- raft/raft.go | 35 + raft/raftpb/raft.pb.go | 134 +-- raft/raftpb/raft.proto | 1 + raft/rawnode.go | 29 +- raft/rawnode_test.go | 95 ++- raft/storage.go | 2 +- raft/util.go | 7 +- test/benchmark/command/component.go | 40 +- 108 files changed, 4532 insertions(+), 2550 deletions(-) create mode 100644 internal/store/config/async_store.go create mode 100644 internal/store/config/io.go create mode 100644 internal/store/config/io_linux.go rename internal/store/{config_other.go => config/io_other.go} (81%) create mode 100644 internal/store/config/raft.go create mode 100644 internal/store/config/sync_store.go create mode 100644 internal/store/config/vsb.go create mode 100644 internal/store/config/wal.go create mode 100644 internal/store/io/block/buffer.go rename internal/store/{wal/block/allocator.go => io/block/buffer_pool.go} (72%) rename internal/store/{wal/block/allocator_test.go => io/block/buffer_pool_test.go} (65%) create mode 100644 internal/store/io/block/buffer_test.go rename internal/store/{config_linux.go => io/block/interface.go} (67%) create mode 100644 internal/store/io/block/oneshot.go rename internal/store/io/{engine.go => engine/interface.go} (67%) create mode 100644 internal/store/io/engine/psync/config.go create mode 100644 internal/store/io/engine/psync/psync.go create mode 100644 internal/store/io/engine/psync/psync_test.go rename internal/store/io/{engine_test.go => engine/testing/engine.go} (75%) rename internal/store/io/{ => engine/uring}/uring.go (87%) rename internal/store/io/{ => engine/uring}/uring_test.go (85%) create mode 100644 internal/store/io/stream/pending_queue.go create mode 100644 internal/store/io/stream/scheduler.go create mode 100644 internal/store/io/stream/stream.go create mode 100644 internal/store/io/zone/file/file.go rename internal/store/{wal/file_test.go => io/zone/interface.go} (84%) create mode 100644 internal/store/io/zone/segmentedfile/compaction.go create mode 100644 internal/store/io/zone/segmentedfile/config.go create mode 100644 internal/store/io/zone/segmentedfile/recovery.go create mode 100644 internal/store/io/zone/segmentedfile/segment.go create mode 100644 internal/store/io/zone/segmentedfile/segmented_file.go rename internal/store/{wal/stream_test.go => io/zone/segmentedfile/segmented_file_test.go} (50%) create mode 100644 internal/store/vsb/config.go create mode 100644 internal/store/wal/appender.go delete mode 100644 internal/store/wal/block/block.go delete mode 100644 internal/store/wal/block/block_test.go delete mode 100644 internal/store/wal/file.go delete mode 100644 internal/store/wal/stream.go diff --git a/client/go.mod b/client/go.mod index e9a214119..1aa246039 100644 --- a/client/go.mod +++ b/client/go.mod @@ -3,21 +3,22 @@ module github.com/linkall-labs/vanus/client go 1.18 require ( - github.com/cloudevents/sdk-go/v2 v2.11.0 + github.com/cloudevents/sdk-go/v2 v2.12.0 github.com/golang/mock v1.6.0 github.com/linkall-labs/vanus/observability v0.5.1 github.com/linkall-labs/vanus/pkg v0.5.1 github.com/linkall-labs/vanus/proto v0.5.1 github.com/scylladb/go-set v1.0.2 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel/trace v1.11.2 go.uber.org/atomic v1.9.0 - google.golang.org/grpc v1.50.1 + google.golang.org/grpc v1.51.0 google.golang.org/protobuf v1.28.1 ) require ( - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + cloud.google.com/go/compute/metadata v0.2.1 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect @@ -28,25 +29,24 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/sirupsen/logrus v1.9.0 // indirect - go.opentelemetry.io/otel v1.11.1 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0 // indirect - go.opentelemetry.io/otel/sdk v1.9.0 // indirect - go.opentelemetry.io/proto/otlp v0.18.0 // indirect + go.opentelemetry.io/otel v1.11.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 // indirect + go.opentelemetry.io/otel/sdk v1.11.2 // indirect + go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.uber.org/multierr v1.7.0 // indirect go.uber.org/zap v1.17.0 // indirect - golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect - golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094 // indirect - golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect - golang.org/x/text v0.3.7 // indirect + golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect + golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/text v0.4.0 // indirect golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect - google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f // indirect + google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) replace ( - cloud.google.com/go => cloud.google.com/go v0.100.2 github.com/linkall-labs/vanus/observability => ../observability github.com/linkall-labs/vanus/pkg => ../pkg github.com/linkall-labs/vanus/proto => ../proto diff --git a/client/go.sum b/client/go.sum index 15530f076..3a97269e8 100644 --- a/client/go.sum +++ b/client/go.sum @@ -1,25 +1,59 @@ -cloud.google.com/go v0.100.2 h1:t9Iw5QH5v4XtlEQaCtUY7x6sCABps8sW0acw7e2WQ6Y= -cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= -cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= -cloud.google.com/go/compute v1.7.0 h1:v/k9Eueb8aAJ0vZuxKMrgm6kPhCLZU9HxFU+AFDs9Uk= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/compute v1.12.1 h1:gKVJMEyqV5c/UnpzjjQbo3Rjvvqpr9B1DFSbJC4OXr0= +cloud.google.com/go/compute/metadata v0.2.1 h1:efOwf5ymceDhK6PKMnnrTHP4pppY5L22mle96M1yP48= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudevents/sdk-go/v2 v2.11.0 h1:pCb7Cdkb8XpUoil+miuw6PEzuCG9cc8Erj8y1/q3odo= -github.com/cloudevents/sdk-go/v2 v2.11.0/go.mod h1:xDmKfzNjM8gBvjaF8ijFjM1VYOVUEeUfapHMUX1T5To= +github.com/cloudevents/sdk-go/v2 v2.12.0 h1:p1k+ysVOZtNiXfijnwB3WqZNA3y2cGOiKQygWkUHCEI= +github.com/cloudevents/sdk-go/v2 v2.12.0/go.mod h1:xDmKfzNjM8gBvjaF8ijFjM1VYOVUEeUfapHMUX1T5To= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -28,14 +62,15 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/set v0.2.1 h1:nn2CaJyknWE/6txyUDGwysr3G5QC6xWB/PtVjPBbeaA= github.com/fatih/set v0.2.1/go.mod h1:+RKtMCH+favT2+3YecHGxcc0b4KyVWA1QWWJUs4E0CI= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -44,14 +79,24 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -63,31 +108,50 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= -github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -100,6 +164,7 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/scylladb/go-set v1.0.2 h1:SkvlMCKhP0wyyct6j+0IHJkBkSZL+TDzZ4E7f7BCcRE= github.com/scylladb/go-set v1.0.2/go.mod h1:DkpGd78rljTxKAnTDPFqXSGxvETQnJyuSOQwsHycqfs= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= @@ -109,48 +174,81 @@ github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hg github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4 h1:PRXhsszxTt5bbPriTjmaweWUsAnJYeWBhUMLRetUgBU= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4/go.mod h1:05eWWy6ZWzmpeImD3UowLTB3VjDMU1yxQ+ENuVWDM3c= -go.opentelemetry.io/otel v1.11.1 h1:4WLLAmcfkmDk2ukNXJyq3/kiz/3UzCaYq6PskJsaou4= -go.opentelemetry.io/otel v1.11.1/go.mod h1:1nNhXBbWSD0nsL38H6btgnFN2k4i0sNLHNNMZMSbUGE= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 h1:ggqApEjDKczicksfvZUCxuvoyDmR6Sbm56LwiK8DVR0= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0/go.mod h1:78XhIg8Ht9vR4tbLNUhXsiOnE2HOuSeKAiAcoVQEpOY= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 h1:NN90Cuna0CnBg8YNu1Q0V35i2E8LDByFOwHRCq/ZP9I= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0/go.mod h1:0EsCXjZAiiZGnLdEUXM9YjCKuuLZMYyglh2QDXcYKVA= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0 h1:M0/hqGuJBLeIEu20f89H74RGtqV2dn+SFWEz9ATAAwY= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0/go.mod h1:K5G92gbtCrYJ0mn6zj9Pst7YFsDFuvSYEhYKRMcufnM= -go.opentelemetry.io/otel/sdk v1.9.0 h1:LNXp1vrr83fNXTHgU8eO89mhzxb/bbWAsHG6fNf3qWo= -go.opentelemetry.io/otel/sdk v1.9.0/go.mod h1:AEZc8nt5bd2F7BC24J5R0mrjYnpEgYHyTcM/vrSple4= -go.opentelemetry.io/otel/trace v1.11.1 h1:ofxdnzsNrGBYXbP7t7zpUK281+go5rF7dvdIZXF8gdQ= -go.opentelemetry.io/otel/trace v1.11.1/go.mod h1:f/Q9G7vzk5u91PhbmKbg1Qn0rzH1LJ4vbPHFGkTPtOk= +go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= +go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 h1:htgM8vZIF8oPSCxa341e3IZ4yr/sKxgu8KZYllByiVY= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2/go.mod h1:rqbht/LlhVBgn5+k3M5QK96K5Xb0DvXpMJ5SFQpY6uw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 h1:fqR1kli93643au1RKo0Uma3d2aPQKT+WBKfTSBaKbOc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2/go.mod h1:5Qn6qvgkMsLDX+sYK64rHb1FPhpn0UtxF+ouX1uhyJE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 h1:ERwKPn9Aer7Gxsc0+ZlutlH1bEEAUXAUhqm3Y45ABbk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2/go.mod h1:jWZUM2MWhWCJ9J9xVbRx7tzK1mXKpAlze4CeulycwVY= +go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= +go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= +go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= +go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= -go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= +go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -158,105 +256,207 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220909164309-bea034e7d591 h1:D0B/7al0LLrVC8aWF4+oxpv/m8bc7ViFfVS8/gXGdqI= -golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b h1:tvrvnPFcdzp294diPnrdZZZ8XUt2Tyj7svb7X52iDuU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094 h1:2o1E+E8TpNLklK9nHiPiK1uzIYrIHt+cQx3ynCwq9V8= -golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 h1:nt+Q6cXKz4MosCSpnbMtqiQ8Oz0pxTef2B4Vca2lvfk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44= golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f h1:hJ/Y5SqPXbarffmAsApliUlcvMU+wScNGfyop4bZm8o= -google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c h1:QgY/XxIAIeccR+Ca/rDdKubLIU9rcJ3xfy1DC/Wd2Oo= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -265,14 +465,16 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -282,4 +484,12 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/cmd/store/main.go b/cmd/store/main.go index 33e1cfe90..5988c506e 100644 --- a/cmd/store/main.go +++ b/cmd/store/main.go @@ -29,6 +29,7 @@ import ( // this project. "github.com/linkall-labs/vanus/internal/primitive/vanus" "github.com/linkall-labs/vanus/internal/store" + "github.com/linkall-labs/vanus/internal/store/block/raw" "github.com/linkall-labs/vanus/internal/store/segment" ) @@ -89,6 +90,8 @@ func main() { return } - // TODO is it gracefully? + raw.CloseAllEngine() + + // TODO: is it gracefully? log.Info(ctx, "The SegmentServer has been shutdown.", nil) } diff --git a/go.mod b/go.mod index c0f3ed86d..010109cf0 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( github.com/ohler55/ojg v1.14.5 github.com/pkg/errors v0.9.1 github.com/prashantv/gostub v1.1.0 - github.com/prometheus/client_golang v1.13.0 + github.com/prometheus/client_golang v1.14.0 github.com/smartystreets/goconvey v1.7.2 github.com/sony/sonyflake v1.1.0 github.com/spf13/cobra v1.4.0 @@ -40,8 +40,8 @@ require ( go.etcd.io/etcd/client/v3 v3.6.0-alpha.0 go.mongodb.org/mongo-driver v1.11.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 go.uber.org/atomic v1.9.0 go.uber.org/ratelimit v0.2.0 golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 @@ -65,9 +65,8 @@ require ( github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12 // indirect github.com/aws/smithy-go v1.12.1 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.12.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -99,7 +98,7 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect github.com/rivo/uniseg v0.2.0 // indirect @@ -126,18 +125,18 @@ require ( go.etcd.io/etcd/raft/v3 v3.6.0-alpha.0 // indirect go.etcd.io/etcd/server/v3 v3.6.0-alpha.0 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0 // indirect - go.opentelemetry.io/otel/sdk v1.9.0 // indirect - go.opentelemetry.io/proto/otlp v0.18.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 // indirect + go.opentelemetry.io/otel/sdk v1.11.2 // indirect + go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.uber.org/multierr v1.7.0 // indirect go.uber.org/zap v1.17.0 // indirect golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.4.0 // indirect google.golang.org/appengine v1.6.7 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect diff --git a/go.sum b/go.sum index 600f415b9..4810c5efe 100644 --- a/go.sum +++ b/go.sum @@ -72,8 +72,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054 h1:uH66TXeswKn5PW5zdZ39xEwfS9an067BirqA+P4QaLI= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -84,8 +84,6 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.12.0 h1:z8j1WETFfzlLxV9aRYykpLAAWh63QFmNCfN6sp2b16s= -github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.12.0/go.mod h1:MCeTV6OrQ8+ZNkAXhx/yUMS0ZAp2Ld8CjyG12+W/ou0= github.com/cloudevents/sdk-go/sql/v2 v2.12.0 h1:QctEwYMiAvMkP/Un8gaLzEfPLFSmzgvOoUjhdDydqLU= github.com/cloudevents/sdk-go/sql/v2 v2.12.0/go.mod h1:GIAna2yq5KZDe9QzSCmhHTHzYbB0XifZk1GX6yZe+8Q= github.com/cloudevents/sdk-go/v2 v2.12.0 h1:p1k+ysVOZtNiXfijnwB3WqZNA3y2cGOiKQygWkUHCEI= @@ -338,13 +336,14 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= -github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= +github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= @@ -452,26 +451,26 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4 h1:PRXhsszxTt5bbPriTjmaweWUsAnJYeWBhUMLRetUgBU= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4/go.mod h1:05eWWy6ZWzmpeImD3UowLTB3VjDMU1yxQ+ENuVWDM3c= -go.opentelemetry.io/otel v1.11.1 h1:4WLLAmcfkmDk2ukNXJyq3/kiz/3UzCaYq6PskJsaou4= -go.opentelemetry.io/otel v1.11.1/go.mod h1:1nNhXBbWSD0nsL38H6btgnFN2k4i0sNLHNNMZMSbUGE= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 h1:ggqApEjDKczicksfvZUCxuvoyDmR6Sbm56LwiK8DVR0= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0/go.mod h1:78XhIg8Ht9vR4tbLNUhXsiOnE2HOuSeKAiAcoVQEpOY= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 h1:NN90Cuna0CnBg8YNu1Q0V35i2E8LDByFOwHRCq/ZP9I= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0/go.mod h1:0EsCXjZAiiZGnLdEUXM9YjCKuuLZMYyglh2QDXcYKVA= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0 h1:M0/hqGuJBLeIEu20f89H74RGtqV2dn+SFWEz9ATAAwY= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0/go.mod h1:K5G92gbtCrYJ0mn6zj9Pst7YFsDFuvSYEhYKRMcufnM= -go.opentelemetry.io/otel/sdk v1.9.0 h1:LNXp1vrr83fNXTHgU8eO89mhzxb/bbWAsHG6fNf3qWo= -go.opentelemetry.io/otel/sdk v1.9.0/go.mod h1:AEZc8nt5bd2F7BC24J5R0mrjYnpEgYHyTcM/vrSple4= -go.opentelemetry.io/otel/trace v1.11.1 h1:ofxdnzsNrGBYXbP7t7zpUK281+go5rF7dvdIZXF8gdQ= -go.opentelemetry.io/otel/trace v1.11.1/go.mod h1:f/Q9G7vzk5u91PhbmKbg1Qn0rzH1LJ4vbPHFGkTPtOk= +go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= +go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 h1:htgM8vZIF8oPSCxa341e3IZ4yr/sKxgu8KZYllByiVY= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2/go.mod h1:rqbht/LlhVBgn5+k3M5QK96K5Xb0DvXpMJ5SFQpY6uw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 h1:fqR1kli93643au1RKo0Uma3d2aPQKT+WBKfTSBaKbOc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2/go.mod h1:5Qn6qvgkMsLDX+sYK64rHb1FPhpn0UtxF+ouX1uhyJE= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 h1:ERwKPn9Aer7Gxsc0+ZlutlH1bEEAUXAUhqm3Y45ABbk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2/go.mod h1:jWZUM2MWhWCJ9J9xVbRx7tzK1mXKpAlze4CeulycwVY= +go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= +go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= +go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= +go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= -go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= +go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= @@ -634,8 +633,8 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/internal/raft/log/compaction.go b/internal/raft/log/compaction.go index c52b9145a..7573a714d 100644 --- a/internal/raft/log/compaction.go +++ b/internal/raft/log/compaction.go @@ -43,9 +43,10 @@ const ( // It is the application's responsibility to not attempt to compact an index // greater than raftLog.applied. func (l *Log) Compact(ctx context.Context, i uint64) error { - ctx, span := l.tracer.Start(ctx, "Compact", + span := trace.SpanFromContext(ctx) + span.AddEvent("raft.log.Log.Compact() Start", trace.WithAttributes(attribute.Int64("to_compact", int64(i)))) - defer span.End() + defer span.AddEvent("raft.log.Log.Compact() End") span.AddEvent("Acquiring lock") l.Lock() @@ -128,8 +129,9 @@ func (w *WAL) reserve(cb reserveCallback) error { } func (w *WAL) tryCompact(ctx context.Context, offset, last int64, nodeID vanus.ID, index, term uint64) { - _, span := w.tracer.Start(ctx, "tryCompact") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("raft.log.WAL.tryCompact() Start") + defer span.AddEvent("raft.log.WAL.tryCompact() End") w.updateC <- compactTask{ offset: offset, @@ -277,8 +279,10 @@ func (w *WAL) compact(cCtx *compactContext, compact compactTask) { } func (w *WAL) doCompact(ctx context.Context, cCtx *compactContext) { - ctx, span := w.tracer.Start(ctx, "doCompact") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("raft.log.WAL.doCompact() Start") + defer span.AddEvent("raft.log.WAL.doCompact() End") + if cCtx.stale() { log.Debug(ctx, "compact WAL of raft log.", map[string]interface{}{ "offset": cCtx.toCompact, diff --git a/internal/raft/log/log_storage.go b/internal/raft/log/log_storage.go index 61428ca70..872f3120a 100644 --- a/internal/raft/log/log_storage.go +++ b/internal/raft/log/log_storage.go @@ -193,9 +193,11 @@ type appendTask struct { type AppendCallback = func(AppendResult, error) // Append the new entries to storage. +// After the call returns, all entries are readable. After the AppendCallback cb fires, all entries are persisted. func (l *Log) Append(ctx context.Context, entries []raftpb.Entry, cb AppendCallback) { //nolint:funlen // ok - ctx, span := l.tracer.Start(ctx, "Append") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("raft.log.Log.Append() Start") + defer span.AddEvent("raft.log.Log.Append() End") if len(entries) == 0 { t := appendTask{ @@ -370,8 +372,9 @@ func (l *Log) runPostAppend() { } func (l *Log) prepareAppend(ctx context.Context, entries []raftpb.Entry) error { - ctx, span := l.tracer.Start(ctx, "prepareAppend") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("raft.log.Log.prepareAppend() Start") + defer span.AddEvent("raft.log.Log.prepareAppend() End") for i := 1; i < len(entries); i++ { entry, prev := &entries[i], &entries[i-1] @@ -399,9 +402,10 @@ func (l *Log) prepareAppend(ctx context.Context, entries []raftpb.Entry) error { } func (l *Log) appendToWAL(ctx context.Context, entries []raftpb.Entry, remark bool, cb func([]int64, error)) { - ctx, span := l.tracer.Start(ctx, "appendToWAL", + span := trace.SpanFromContext(ctx) + span.AddEvent("raft.log.Log.appendToWAL() Start", trace.WithAttributes(attribute.Int("entry_count", len(entries)), attribute.Bool("remark", remark))) - defer span.End() + defer span.AddEvent("raft.log.Log.appendToWAL() End") if remark { // TODO(james.yin): async diff --git a/internal/raft/log/log_test.go b/internal/raft/log/log_test.go index bd661724f..f2971af2e 100644 --- a/internal/raft/log/log_test.go +++ b/internal/raft/log/log_test.go @@ -30,7 +30,7 @@ import ( // this project. "github.com/linkall-labs/vanus/internal/primitive/vanus" - storecfg "github.com/linkall-labs/vanus/internal/store" + "github.com/linkall-labs/vanus/internal/store/config" "github.com/linkall-labs/vanus/internal/store/meta" walog "github.com/linkall-labs/vanus/internal/store/wal" ) @@ -38,18 +38,18 @@ import ( var ( blockSize uint64 = 4 * 1024 fileSize = 8 * blockSize - metaCfg = storecfg.SyncStoreConfig{ - WAL: storecfg.WALConfig{ + metaCfg = config.SyncStore{ + WAL: config.WAL{ FileSize: fileSize, }, } - offsetCfg = storecfg.AsyncStoreConfig{ - WAL: storecfg.WALConfig{ + offsetCfg = config.AsyncStore{ + WAL: config.WAL{ FileSize: fileSize, }, } - raftCfg = storecfg.RaftConfig{ - WAL: storecfg.WALConfig{ + raftCfg = config.Raft{ + WAL: config.WAL{ FileSize: fileSize, }, } diff --git a/internal/raft/log/recovery.go b/internal/raft/log/recovery.go index 24b7d9b45..7447776b9 100644 --- a/internal/raft/log/recovery.go +++ b/internal/raft/log/recovery.go @@ -26,18 +26,14 @@ import ( // this project. "github.com/linkall-labs/vanus/internal/primitive/vanus" - storecfg "github.com/linkall-labs/vanus/internal/store" + "github.com/linkall-labs/vanus/internal/store/config" "github.com/linkall-labs/vanus/internal/store/meta" walog "github.com/linkall-labs/vanus/internal/store/wal" "github.com/linkall-labs/vanus/observability/log" ) func RecoverLogsAndWAL( - ctx context.Context, - cfg storecfg.RaftConfig, - walDir string, - metaStore *meta.SyncStore, - offsetStore *meta.AsyncStore, + ctx context.Context, cfg config.Raft, walDir string, metaStore *meta.SyncStore, offsetStore *meta.AsyncStore, ) (map[vanus.ID]*Log, *WAL, error) { var compacted int64 if v, exist := metaStore.Load(walCompactKey); exist { diff --git a/internal/raft/log/snapshot_storage.go b/internal/raft/log/snapshot_storage.go index 7718c7edc..a6e882600 100644 --- a/internal/raft/log/snapshot_storage.go +++ b/internal/raft/log/snapshot_storage.go @@ -19,6 +19,9 @@ import ( // standard libraries. "context" + // third-party libraries. + "go.opentelemetry.io/otel/trace" + // first-party libraries. "github.com/linkall-labs/vanus/raft" "github.com/linkall-labs/vanus/raft/raftpb" @@ -76,8 +79,9 @@ func (l *Log) Snapshot() (raftpb.Snapshot, error) { // ApplySnapshot overwrites the contents of this Storage object with // those of the given snapshot. func (l *Log) ApplySnapshot(ctx context.Context, snap raftpb.Snapshot) error { - ctx, span := l.tracer.Start(ctx, "ApplySnapshot") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("raft.log.Log.ApplySnapshot() Start") + defer span.AddEvent("raft.log.Log.ApplySnapshot() End") l.Lock() defer l.Unlock() diff --git a/internal/raft/log/state_storage.go b/internal/raft/log/state_storage.go index 7dfc7d5d2..1ede7c9da 100644 --- a/internal/raft/log/state_storage.go +++ b/internal/raft/log/state_storage.go @@ -15,7 +15,12 @@ package log import ( + // standard libraries. "context" + + // third-party libraries. + "go.opentelemetry.io/otel/trace" + // first-party libraries. "github.com/linkall-labs/vanus/raft/raftpb" @@ -51,8 +56,9 @@ func (l *Log) HardState() raftpb.HardState { // SetHardState saves the current HardState. func (l *Log) SetHardState(ctx context.Context, hs raftpb.HardState) (err error) { - ctx, span := l.tracer.Start(ctx, "SetHardState") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("raft.log.Log.SetHardState() Start") + defer span.AddEvent("raft.log.Log.SetHardState() End") if hs.Term != l.prevHardSt.Term || hs.Vote != l.prevHardSt.Vote { var data []byte diff --git a/internal/raft/transport/host.go b/internal/raft/transport/host.go index f25b391fa..85135d78d 100644 --- a/internal/raft/transport/host.go +++ b/internal/raft/transport/host.go @@ -73,9 +73,10 @@ func (h *host) Stop() { } func (h *host) Send(ctx context.Context, msg *raftpb.Message, to uint64, endpoint string, cb SendCallback) { - ctx, span := h.tracer.Start(ctx, "Send", trace.WithAttributes( + span := trace.SpanFromContext(ctx) + span.AddEvent("raft.transport.host.Send() Start", trace.WithAttributes( attribute.Int64("to", int64(to)), attribute.String("endpoint", endpoint))) - defer span.End() + defer span.AddEvent("raft.transport.host.Send() End") mux := h.resolveMultiplexer(ctx, to, endpoint) if mux == nil { diff --git a/internal/store/block/block.go b/internal/store/block/block.go index 900e601ae..c850251cb 100644 --- a/internal/store/block/block.go +++ b/internal/store/block/block.go @@ -18,11 +18,21 @@ package block import ( // standard libraries. "context" + "errors" // this project. "github.com/linkall-labs/vanus/internal/primitive/vanus" ) +var ( + ErrNotEnoughSpace = errors.New("not enough space") + ErrFull = errors.New("full") + ErrNotLeader = errors.New("not leader") + ErrExceeded = errors.New("the offset exceeded") + ErrOnEnd = errors.New("the offset on end") + ErrNotSupported = errors.New("not supported") +) + type SeekKeyFlag uint64 const ( diff --git a/internal/store/block/entry.go b/internal/store/block/entry.go index 362f3b270..f206bca34 100644 --- a/internal/store/block/entry.go +++ b/internal/store/block/entry.go @@ -23,6 +23,8 @@ type ExtensionAttributeCallback interface { OnAttribute(attr, val []byte) } +// Entry is a record of data stored in a Block. +// An Entry has some optional attributes and arbitrary extension attributes. type Entry interface { Get(ordinal int) interface{} GetBytes(ordinal int) []byte diff --git a/internal/store/block/raft/appender.go b/internal/store/block/raft/appender.go index 11d124312..7d4bcba93 100644 --- a/internal/store/block/raft/appender.go +++ b/internal/store/block/raft/appender.go @@ -18,7 +18,7 @@ package raft import ( // standard libraries. "context" - stderr "errors" + "errors" "sort" "sync" "time" @@ -37,7 +37,6 @@ import ( raftlog "github.com/linkall-labs/vanus/internal/raft/log" "github.com/linkall-labs/vanus/internal/raft/transport" "github.com/linkall-labs/vanus/internal/store/block" - "github.com/linkall-labs/vanus/pkg/errors" ) const ( @@ -154,8 +153,9 @@ func (a *appender) Stop(ctx context.Context) { } func (a *appender) Bootstrap(ctx context.Context, blocks []Peer) error { - _, span := a.tracer.Start(ctx, "Bootstrap") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.block.raft.appender.Bootstrap() Start") + defer span.AddEvent("store.block.raft.appender.Bootstrap() End") peers := make([]raft.Peer, 0, len(blocks)) for _, ep := range blocks { @@ -172,8 +172,9 @@ func (a *appender) Bootstrap(ctx context.Context, blocks []Peer) error { } func (a *appender) Delete(ctx context.Context) { - ctx, span := a.tracer.Start(ctx, "Delete") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.block.raft.appender.Delete() Start") + defer span.AddEvent("store.block.raft.appender.Delete() End") a.Stop(ctx) a.log.Delete(ctx) @@ -192,27 +193,7 @@ func (a *appender) run(ctx context.Context) { rCtx, span := a.tracer.Start(ctx, "RaftReady", trace.WithNewRoot()) if len(rd.Entries) != 0 { - log.Debug(rCtx, "Append entries to raft log.", map[string]interface{}{ - "node_id": a.ID(), - "appended_index": rd.Entries[0].Index, - "entries_num": len(rd.Entries), - }) - a.log.Append(rCtx, rd.Entries, func(re raftlog.AppendResult, err error) { - if err != nil { - if stderr.Is(err, raftlog.ErrCompacted) || stderr.Is(err, raftlog.ErrTruncated) { - // FIXME(james.yin): report to raft? - return - } - panic(err) - } - - // Report entries has been persisted. - _ = a.node.Step(ctx, raftpb.Message{ - Type: raftpb.MsgLogResp, - LogTerm: re.Term, - Index: re.Index, - }) - }) + a.persistEntries(rCtx, rd.Entries) } if !raft.IsEmptyHardState(rd.HardState) { @@ -236,18 +217,13 @@ func (a *appender) run(ctx context.Context) { // NOTE: Messages to be sent AFTER HardState and Entries are committed to stable storage. a.send(rCtx, rd.Messages) + // TODO(james.yin): snapshot if !raft.IsEmptySnap(rd.Snapshot) { _ = a.log.ApplySnapshot(rCtx, rd.Snapshot) } if len(rd.CommittedEntries) != 0 { - applied := a.applyEntries(rCtx, rd.CommittedEntries) - log.Debug(rCtx, "Store applied offset.", map[string]interface{}{ - "node_id": a.ID(), - "applied_offset": applied, - }) - // FIXME(james.yin): persist applied after flush block. - a.log.SetApplied(rCtx, applied) + a.applyEntries(rCtx, rd.CommittedEntries) } // TODO(james.yin): optimize @@ -268,50 +244,87 @@ func (a *appender) run(ctx context.Context) { } } -func (a *appender) applyEntries(ctx context.Context, committedEntries []raftpb.Entry) uint64 { - ctx, span := a.tracer.Start(ctx, "applyEntries") - defer span.End() +func (a *appender) persistEntries(ctx context.Context, entries []raftpb.Entry) { + span := trace.SpanFromContext(ctx) + span.AddEvent("store.block.raft.appender.persistEntries() Start") + defer span.AddEvent("store.block.raft.appender.persistEntries() End") - num := len(committedEntries) - if num == 0 { - return 0 - } + log.Debug(ctx, "Append entries to raft log.", map[string]interface{}{ + "node_id": a.ID(), + "appended_index": entries[0].Index, + "entries_num": len(entries), + }) + + a.log.Append(ctx, entries, func(re raftlog.AppendResult, err error) { + if err != nil { + if errors.Is(err, raftlog.ErrCompacted) || errors.Is(err, raftlog.ErrTruncated) { + // FIXME(james.yin): report to raft? + return + } + panic(err) + } + + // Report entries has been persisted. + _ = a.node.ReportLogged(ctx, re.Index, re.Term) + }) +} + +func (a *appender) applyEntries(ctx context.Context, committedEntries []raftpb.Entry) { + span := trace.SpanFromContext(ctx) + span.AddEvent("store.block.raft.appender.applyEntries() Start") + defer span.AddEvent("store.block.raft.appender.applyEntries() End") var cs *raftpb.ConfState - frags := make([]block.Fragment, 0, num) - for i := range committedEntries { + for i := 0; i < len(committedEntries); i++ { pbEntry := &committedEntries[i] + index := pbEntry.Index if pbEntry.Type == raftpb.EntryNormal { - // Skip empty entry(raft heartbeat). + var frag block.Fragment if len(pbEntry.Data) != 0 { - frag := block.NewFragment(pbEntry.Data) - frags = append(frags, frag) + frag = block.NewFragment(pbEntry.Data) } + // FIXME(james.yin): do not pass frag with nil value? + a.raw.CommitAppend(ctx, frag, func() { + log.Debug(ctx, "Store applied offset.", map[string]interface{}{ + "node_id": a.ID(), + "applied_offset": index, + }) + a.onAppend(ctx, index) + }) continue } // Change membership. cs = a.applyConfChange(ctx, pbEntry) + ch := make(chan struct{}) + go func() { + if err := a.log.SetConfState(ctx, *cs); err != nil { + panic(err) + } + close(ch) + }() + // FIXME(james.yin): do not pass frag with nil value? + a.raw.CommitAppend(ctx, nil, func() { + <-ch + log.Debug(ctx, "Store applied offset for conf change.", map[string]interface{}{ + "node_id": a.ID(), + "applied_offset": index, + }) + a.onAppend(ctx, index) + }) } +} - if len(frags) != 0 { - a.doAppend(ctx, frags...) - } - - // ConfState is changed. - if cs != nil { - if err := a.log.SetConfState(ctx, *cs); err != nil { - panic(err) - } - } - - return committedEntries[num-1].Index +func (a *appender) onAppend(ctx context.Context, index uint64) { + a.log.SetApplied(ctx, index) + _ = a.node.ReportApplied(ctx, index) } func (a *appender) becomeLeader(ctx context.Context) { - ctx, span := a.tracer.Start(ctx, "becomeLeader") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.block.raft.appender.becomeLeader() Start") + defer span.AddEvent("store.block.raft.appender.becomeLeader() End") // Reset when become leader. a.reset(ctx) @@ -358,8 +371,9 @@ func (a *appender) applyConfChange(ctx context.Context, pbEntry *raftpb.Entry) * } func (a *appender) reset(ctx context.Context) { - _, span := a.tracer.Start(ctx, "reset") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.block.raft.appender.reset() Start") + defer span.AddEvent("store.block.raft.appender.reset() End") off, err := a.log.LastIndex() if err != nil { @@ -397,10 +411,11 @@ func (a *appender) reset(ctx context.Context) { } } -// Append implements block.raw. +// Append implements block.Appender. func (a *appender) Append(ctx context.Context, entries []block.Entry, cb block.AppendCallback) { - ctx, span := a.tracer.Start(ctx, "Append") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.block.raft.appender.Append() Start") + defer span.AddEvent("store.block.raft.appender.Append() End") span.AddEvent("Acquiring append lock") a.appendMu.Lock() @@ -408,13 +423,13 @@ func (a *appender) Append(ctx context.Context, entries []block.Entry, cb block.A if !a.isLeader() { a.appendMu.Unlock() - cb(nil, errors.ErrNotLeader) + cb(nil, block.ErrNotLeader) return } if a.actx.Archived() { a.appendMu.Unlock() - cb(nil, errors.ErrSegmentFull) + cb(nil, block.ErrFull) return } @@ -459,13 +474,6 @@ func (a *appender) Append(ctx context.Context, entries []block.Entry, cb block.A a.appendMu.Unlock() } -func (a *appender) doAppend(ctx context.Context, frags ...block.Fragment) { - if len(frags) == 0 { - return - } - _, _ = a.raw.CommitAppend(ctx, frags...) -} - func (a *appender) Status() ClusterStatus { leader, term := a.leaderInfo() return ClusterStatus{ diff --git a/internal/store/block/raw.go b/internal/store/block/raw.go index 56e2eae14..120e49f1d 100644 --- a/internal/store/block/raw.go +++ b/internal/store/block/raw.go @@ -30,11 +30,13 @@ type AppendContext interface { Archived() bool } +type CommitAppendCallback = func() + type TwoPCAppender interface { NewAppendContext(last Fragment) AppendContext PrepareAppend(ctx context.Context, appendCtx AppendContext, entries ...Entry) ([]int64, Fragment, bool, error) PrepareArchive(ctx context.Context, appendCtx AppendContext) (Fragment, error) - CommitAppend(ctx context.Context, frags ...Fragment) (bool, error) + CommitAppend(ctx context.Context, frag Fragment, cb CommitAppendCallback) } type Snapshoter interface { diff --git a/internal/store/block/raw/engine.go b/internal/store/block/raw/engine.go index 4d0b5e504..3bdf5f356 100644 --- a/internal/store/block/raw/engine.go +++ b/internal/store/block/raw/engine.go @@ -35,6 +35,8 @@ var ( ) type Engine interface { + Close() + Recover(ctx context.Context) (map[vanus.ID]block.Raw, error) Create(ctx context.Context, id vanus.ID, capacity int64) (block.Raw, error) @@ -59,3 +61,9 @@ func ResolveEngine(engine string) (Engine, error) { } return nil, ErrNotSupported } + +func CloseAllEngine() { + for _, e := range engines { + e.Close() + } +} diff --git a/internal/store/config.go b/internal/store/config.go index de327d75f..a3b846d2a 100644 --- a/internal/store/config.go +++ b/internal/store/config.go @@ -15,28 +15,13 @@ package store import ( - // standard libraries. - "fmt" - "time" - - // first-party project. - "github.com/linkall-labs/vanus/internal/primitive" + // first-party libraries. "github.com/linkall-labs/vanus/observability" "github.com/linkall-labs/vanus/pkg/util" // this project. - "github.com/linkall-labs/vanus/internal/store/io" - walog "github.com/linkall-labs/vanus/internal/store/wal" -) - -const ( - baseKB = 1024 - baseMB = 1024 * baseKB - ioEnginePsync = "psync" - baseWALBlockSize uint64 = 4 * baseKB - minMetaStoreWALFileSize uint64 = 4 * baseMB - minRaftLogWALFileSize uint64 = 32 * baseMB - minWALFlushTimeout = 200 * time.Microsecond + "github.com/linkall-labs/vanus/internal/primitive" + "github.com/linkall-labs/vanus/internal/store/config" ) type Config struct { @@ -44,20 +29,24 @@ type Config struct { IP string `yaml:"ip"` Port int `yaml:"port"` Volume VolumeInfo `yaml:"volume"` - MetaStore SyncStoreConfig `yaml:"meta_store"` - OffsetStore AsyncStoreConfig `yaml:"offset_store"` - Raft RaftConfig `yaml:"raft"` + MetaStore config.SyncStore `yaml:"meta_store"` + OffsetStore config.AsyncStore `yaml:"offset_store"` + Raft config.Raft `yaml:"raft"` + VSB config.VSB `yaml:"vsb"` Observability observability.Config `yaml:"observability"` } func (c *Config) Validate() error { - if err := c.MetaStore.validate(); err != nil { + if err := c.MetaStore.Validate(); err != nil { return err } - if err := c.OffsetStore.validate(); err != nil { + if err := c.OffsetStore.Validate(); err != nil { return err } - if err := c.Raft.validate(); err != nil { + if err := c.Raft.Validate(); err != nil { + return err + } + if err := c.VSB.Validate(); err != nil { return err } return nil @@ -69,82 +58,6 @@ type VolumeInfo struct { Capacity uint64 `json:"capacity"` } -type SyncStoreConfig struct { - WAL WALConfig `yaml:"wal"` -} - -func (c *SyncStoreConfig) validate() error { - return c.WAL.validate(minMetaStoreWALFileSize) -} - -type AsyncStoreConfig struct { - WAL WALConfig `yaml:"wal"` -} - -func (c *AsyncStoreConfig) validate() error { - return c.WAL.validate(minMetaStoreWALFileSize) -} - -type RaftConfig struct { - WAL WALConfig `yaml:"wal"` -} - -func (c *RaftConfig) validate() error { - return c.WAL.validate(minRaftLogWALFileSize) -} - -type WALConfig struct { - BlockSize uint64 `yaml:"block_size"` - FileSize uint64 `yaml:"file_size"` - FlushTimeout string `yaml:"flush_timeout"` - IO IOConfig `yaml:"io"` -} - -func (c *WALConfig) validate(minFileSize uint64) error { - if c.BlockSize != 0 && c.BlockSize%baseWALBlockSize != 0 { - return fmt.Errorf("wal block size must be a multiple of %dKB", baseWALBlockSize/baseKB) - } - if c.FileSize != 0 && c.FileSize < minFileSize { - return fmt.Errorf("wal file size must not less than %dMB", minFileSize/baseMB) - } - if c.FlushTimeout != "" { - d, err := time.ParseDuration(c.FlushTimeout) - if err != nil { - return err - } - if d < minWALFlushTimeout { - return fmt.Errorf("wal flush timeout must not less than %v", minWALFlushTimeout) - } - } - return nil -} - -type IOConfig struct { - Engine string `yaml:"engine"` -} - -func (c *WALConfig) Options() (opts []walog.Option) { - if c.BlockSize != 0 { - opts = append(opts, walog.WithBlockSize(int64(c.BlockSize))) - } - if c.FileSize != 0 { - opts = append(opts, walog.WithFileSize(int64(c.FileSize))) - } - if c.FlushTimeout != "" { - d, _ := time.ParseDuration(c.FlushTimeout) - opts = append(opts, walog.WithFlushTimeout(d)) - } - if c.IO.Engine != "" { - switch c.IO.Engine { - case ioEnginePsync: - opts = append(opts, walog.WithIOEngine(io.NewEngine())) - default: - opts = configWALIOEngineOptionEx(opts, c.IO) - } - } - return opts -} - func InitConfig(filename string) (*Config, error) { c := new(Config) if err := primitive.LoadConfig(filename, c); err != nil { diff --git a/internal/store/config/async_store.go b/internal/store/config/async_store.go new file mode 100644 index 000000000..a881f664b --- /dev/null +++ b/internal/store/config/async_store.go @@ -0,0 +1,23 @@ +// Copyright 2022 Linkall Inc. +// +// 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 config + +type AsyncStore struct { + WAL `yaml:"wal"` +} + +func (c *AsyncStore) Validate() error { + return c.WAL.Validate(minMetaStoreWALFileSize) +} diff --git a/internal/store/config/io.go b/internal/store/config/io.go new file mode 100644 index 000000000..23a8455bf --- /dev/null +++ b/internal/store/config/io.go @@ -0,0 +1,50 @@ +// Copyright 2022 Linkall Inc. +// +// 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 config + +import ( + // this project. + "github.com/linkall-labs/vanus/internal/store/io/engine" + "github.com/linkall-labs/vanus/internal/store/io/engine/psync" +) + +type IOEngineType string + +const ( + Psync IOEngineType = "psync" + Uring IOEngineType = "io_uring" +) + +type IO struct { + Engine IOEngineType `yaml:"engine"` + Parallel int `yaml:"parallel"` +} + +func buildIOEngine(cfg IO) engine.Interface { + switch cfg.Engine { + case Psync: + return buildPsyncEngine(cfg) + default: + return buildIOEngineEx(cfg) + } +} + +func buildPsyncEngine(cfg IO) engine.Interface { + var opts []psync.Option + if cfg.Parallel > 0 { + opts = append(opts, psync.WithParallel(cfg.Parallel)) + } + return psync.New(opts...) +} diff --git a/internal/store/config/io_linux.go b/internal/store/config/io_linux.go new file mode 100644 index 000000000..3fb4ffca8 --- /dev/null +++ b/internal/store/config/io_linux.go @@ -0,0 +1,31 @@ +// Copyright 2022 Linkall Inc. +// +// 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. + +//go:build linux +// +build linux + +package config + +import ( + // this project. + "github.com/linkall-labs/vanus/internal/store/io/engine" + "github.com/linkall-labs/vanus/internal/store/io/engine/uring" +) + +func buildIOEngineEx(cfg IO) engine.Interface { + if cfg.Engine == Uring { + return uring.New() + } + panic("io engine is not supported") +} diff --git a/internal/store/config_other.go b/internal/store/config/io_other.go similarity index 81% rename from internal/store/config_other.go rename to internal/store/config/io_other.go index 98c81e2f6..943db5c4c 100644 --- a/internal/store/config_other.go +++ b/internal/store/config/io_other.go @@ -15,13 +15,13 @@ //go:build !linux // +build !linux -package store +package config import ( // this project. - walog "github.com/linkall-labs/vanus/internal/store/wal" + "github.com/linkall-labs/vanus/internal/store/io/engine" ) -func configWALIOEngineOptionEx(opts []walog.Option, cfg IOConfig) []walog.Option { +func buildIOEngineEx(cfg IO) engine.Interface { panic("io engine is not supported") } diff --git a/internal/store/config/raft.go b/internal/store/config/raft.go new file mode 100644 index 000000000..e6ac190f0 --- /dev/null +++ b/internal/store/config/raft.go @@ -0,0 +1,25 @@ +// Copyright 2022 Linkall Inc. +// +// 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 config + +const minRaftLogWALFileSize uint64 = 32 * baseMB + +type Raft struct { + WAL `yaml:"wal"` +} + +func (c *Raft) Validate() error { + return c.WAL.Validate(minRaftLogWALFileSize) +} diff --git a/internal/store/config/sync_store.go b/internal/store/config/sync_store.go new file mode 100644 index 000000000..e73fe3fd0 --- /dev/null +++ b/internal/store/config/sync_store.go @@ -0,0 +1,27 @@ +// Copyright 2022 Linkall Inc. +// +// 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 config + +const ( + minMetaStoreWALFileSize uint64 = 4 * baseMB +) + +type SyncStore struct { + WAL `yaml:"wal"` +} + +func (c *SyncStore) Validate() error { + return c.WAL.Validate(minMetaStoreWALFileSize) +} diff --git a/internal/store/config/vsb.go b/internal/store/config/vsb.go new file mode 100644 index 000000000..a7b10c66a --- /dev/null +++ b/internal/store/config/vsb.go @@ -0,0 +1,39 @@ +// Copyright 2022 Linkall Inc. +// +// 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 config + +import ( + // this project. + "github.com/linkall-labs/vanus/internal/store/vsb" +) + +type VSB struct { + FlushBatchSize int `yaml:"flush_batch_size"` + IO `yaml:"io"` +} + +func (c *VSB) Validate() error { + return nil +} + +func (c *VSB) Options() (opts []vsb.Option) { + if c.FlushBatchSize != 0 { + opts = append(opts, vsb.WithFlushBatchSize(c.FlushBatchSize)) + } + if c.IO.Engine != "" { + opts = append(opts, vsb.WithIOEngine(buildIOEngine(c.IO))) + } + return opts +} diff --git a/internal/store/config/wal.go b/internal/store/config/wal.go new file mode 100644 index 000000000..f9a82795a --- /dev/null +++ b/internal/store/config/wal.go @@ -0,0 +1,74 @@ +// Copyright 2022 Linkall Inc. +// +// 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 config + +import ( + // standard libraries. + "fmt" + "time" + + // this project. + "github.com/linkall-labs/vanus/internal/store/wal" +) + +const ( + baseKB = 1024 + baseMB = 1024 * baseKB + baseWALBlockSize = 4 * baseKB + minWALFlushTimeout = 200 * time.Microsecond +) + +type WAL struct { + BlockSize int `yaml:"block_size"` + FileSize uint64 `yaml:"file_size"` + FlushTimeout string `yaml:"flush_timeout"` + IO `yaml:"io"` +} + +func (c *WAL) Validate(minFileSize uint64) error { + if c.BlockSize != 0 && c.BlockSize%baseWALBlockSize != 0 { + return fmt.Errorf("wal block size must be a multiple of %dKB", baseWALBlockSize/baseKB) + } + if c.FileSize != 0 && c.FileSize < minFileSize { + return fmt.Errorf("wal file size must not less than %dMB", minFileSize/baseMB) + } + if c.FlushTimeout != "" { + d, err := time.ParseDuration(c.FlushTimeout) + if err != nil { + return err + } + if d < minWALFlushTimeout { + return fmt.Errorf("wal flush timeout must not less than %v", minWALFlushTimeout) + } + } + return nil +} + +func (c *WAL) Options() (opts []wal.Option) { + if c.BlockSize != 0 { + opts = append(opts, wal.WithBlockSize(c.BlockSize)) + } + if c.FileSize != 0 { + opts = append(opts, wal.WithFileSize(int64(c.FileSize))) + } + if c.FlushTimeout != "" { + d, _ := time.ParseDuration(c.FlushTimeout) + opts = append(opts, wal.WithFlushTimeout(d)) + } + if c.IO.Engine != "" { + opts = append(opts, wal.WithIOEngine(buildIOEngine(c.IO))) + } + return opts +} diff --git a/internal/store/config_test.go b/internal/store/config_test.go index 42dc604f5..117d81f52 100644 --- a/internal/store/config_test.go +++ b/internal/store/config_test.go @@ -22,9 +22,14 @@ import ( // third-party libraries. . "github.com/smartystreets/goconvey/convey" + + // this project. + "github.com/linkall-labs/vanus/internal/store/config" ) -func TestWAL_AppendOne(t *testing.T) { +const fileSize = 4*1024*1024 - 1 + +func TestConfig(t *testing.T) { Convey("store configuration", t, func() { f, err := os.CreateTemp("", "store-*.yaml") So(err, ShouldBeNil) @@ -69,13 +74,13 @@ raft: So(cfg.Volume.Capacity, ShouldEqual, 536870912) So(cfg.MetaStore.WAL.FileSize, ShouldEqual, 4194304) - So(cfg.MetaStore.WAL.IO.Engine, ShouldEqual, "psync") + So(cfg.MetaStore.WAL.IO.Engine, ShouldEqual, config.Psync) So(len(cfg.MetaStore.WAL.Options()), ShouldEqual, 2) So(cfg.OffsetStore.WAL.IO.Engine, ShouldEqual, "") So(len(cfg.OffsetStore.WAL.Options()), ShouldEqual, 0) - So(cfg.Raft.WAL.IO.Engine, ShouldEqual, "io_uring") + So(cfg.Raft.WAL.IO.Engine, ShouldEqual, config.Uring) if runtime.GOOS == "linux" { So(len(cfg.Raft.WAL.Options()), ShouldEqual, 1) } else { @@ -87,9 +92,9 @@ raft: Convey("store config validation", t, func() { cfg := Config{ - MetaStore: SyncStoreConfig{ - WAL: WALConfig{ - FileSize: minMetaStoreWALFileSize - 1, + MetaStore: config.SyncStore{ + WAL: config.WAL{ + FileSize: fileSize, }, }, } @@ -97,9 +102,9 @@ raft: So(err, ShouldNotBeNil) cfg = Config{ - OffsetStore: AsyncStoreConfig{ - WAL: WALConfig{ - FileSize: minMetaStoreWALFileSize - 1, + OffsetStore: config.AsyncStore{ + WAL: config.WAL{ + FileSize: fileSize, }, }, } @@ -107,9 +112,9 @@ raft: So(err, ShouldNotBeNil) cfg = Config{ - Raft: RaftConfig{ - WAL: WALConfig{ - FileSize: minMetaStoreWALFileSize - 1, + Raft: config.Raft{ + WAL: config.WAL{ + FileSize: fileSize, }, }, } diff --git a/internal/store/io/block/buffer.go b/internal/store/io/block/buffer.go new file mode 100644 index 000000000..b42f99b99 --- /dev/null +++ b/internal/store/io/block/buffer.go @@ -0,0 +1,212 @@ +// Copyright 2022 Linkall Inc. +// +// 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 block + +import ( + // standard libraries. + "errors" + stdio "io" + "os" + "sync/atomic" + "unsafe" + + // this project. + "github.com/linkall-labs/vanus/internal/store/io" +) + +var ErrAlreadyFlushed = errors.New("already flushed") + +type flushTask struct { + b *Buffer + writer io.WriterAt + off int + cb FlushCallback + next *flushTask +} + +// Buffer is an append-only buffer for block IO. +// +// NOTE: calling Append and Flush is not thread-safe. +type Buffer struct { + base int64 + buf []byte + // wp is write pointer + wp int + // fp is flush pointer + fp int + // cp is commit pointer + cp int + // nf is next flush task + nf unsafe.Pointer +} + +// Make sure Buffer implements Interface. +var _ Interface = (*Buffer)(nil) + +func (b *Buffer) Base() int64 { + return b.base +} + +func (b *Buffer) Capacity() int { + return len(b.buf) +} + +func (b *Buffer) Size() int { + return b.wp +} + +func (b *Buffer) Committed() int { + return b.cp +} + +func (b *Buffer) Remaining() int { + return b.remaining(b.Size()) +} + +func (b *Buffer) remaining(offset int) int { + return b.Capacity() - offset +} + +func (b *Buffer) Full() bool { + return b.Remaining() == 0 +} + +func (b *Buffer) Empty() bool { + return b.Size() == 0 +} + +func (b *Buffer) Append(r stdio.Reader) (int, error) { + n, err := r.Read(b.buf[b.wp:]) + if err != nil && err != stdio.EOF { //nolint:errorlint // compare to EOF is ok. + return 0, err + } + b.wp += n + return b.wp, err +} + +// Flush flushes data in the buffer to storage by writer. +// Invoking callbacks for multiple flushes on the same Buffer is sequence. +func (b *Buffer) Flush(writer io.WriterAt, cb FlushCallback) { + // TODO(james.yin): Synchronization in concurrency. + + eo := b.wp + + // Already flush, skip. + if b.fp >= eo { + cb(b.fp, ErrAlreadyFlushed) + return + } + + so := b.fp + b.fp = eo + + p := atomic.LoadPointer(&b.nf) + + // Shortcut if it is final flush. + if eo == b.Capacity() && p == nil { + writer.WriteAt(b.buf, b.base, so, eo, func(_ int, err error) { + if err == nil { + b.cp = eo + } + cb(eo, err) + }) + return + } + + task := &flushTask{ + b: b, + writer: writer, + off: eo, + cb: cb, + next: (*flushTask)(p), + } + + for !atomic.CompareAndSwapPointer(&b.nf, p, unsafe.Pointer(task)) { + p = atomic.LoadPointer(&b.nf) + task.next = (*flushTask)(p) + } + + if p != nil { + return + } + + // partial flush + task.invoke(so) +} + +func (ft *flushTask) invoke(so int) { + b := ft.b + ft.writer.WriteAt(b.buf, b.base, so, ft.off, ft.onWrite) +} + +func (ft *flushTask) onWrite(_ int, err error) { + b := ft.b + offset := ft.off + + if err == nil { + b.cp = offset + } + + p, last := b.relocateFlushTask(ft) + + // NOTE: If it is final flush, DO NOT use b after invoke callback. + ft.invokeCallback(err) + + if last == nil { + if atomic.CompareAndSwapPointer(&b.nf, p, nil) { + return + } + + // reload + p, last = b.relocateFlushTask(ft) + } + + // truncate task list + last.next = nil + + // TODO(james.yin): optimize goroutine + go (*flushTask)(p).invoke(offset) +} + +func (b *Buffer) relocateFlushTask(ft *flushTask) (unsafe.Pointer, *flushTask) { + p := atomic.LoadPointer(&b.nf) + + var last *flushTask + if t := (*flushTask)(p); t != ft { + last = t + for last.next != ft { + last = last.next + } + } + + return p, last +} + +func (ft *flushTask) invokeCallback(err error) { + if ft.next != nil { + ft.next.invokeCallback(err) + } + ft.cb(ft.off, err) +} + +func (b *Buffer) RecoverFromFile(f *os.File, at int64, committed int) error { + if _, err := f.ReadAt(b.buf, at); err != nil { + return err + } + b.wp = committed + b.fp = committed + b.cp = committed + return nil +} diff --git a/internal/store/wal/block/allocator.go b/internal/store/io/block/buffer_pool.go similarity index 72% rename from internal/store/wal/block/allocator.go rename to internal/store/io/block/buffer_pool.go index 3db37a874..3323c09cc 100644 --- a/internal/store/wal/block/allocator.go +++ b/internal/store/io/block/buffer_pool.go @@ -22,17 +22,15 @@ import ( "github.com/ncw/directio" ) -type Allocator struct { +type BufferPool struct { size int - next int64 emptyBuf []byte pool sync.Pool } -func NewAllocator(size int, so int64) *Allocator { - a := &Allocator{ +func NewBufferPool(size int) *BufferPool { + a := &BufferPool{ size: size, - next: so, emptyBuf: make([]byte, size), } a.pool = sync.Pool{ @@ -43,31 +41,28 @@ func NewAllocator(size int, so int64) *Allocator { return a } -func (a *Allocator) BlockSize() int { +func (a *BufferPool) BufferSize() int { return a.size } -func (a *Allocator) rawAlloc() *Block { +func (a *BufferPool) rawAlloc() *Buffer { buf := directio.AlignedBlock(a.size) - return &Block{ - block: block{ - buf: buf, - }, + return &Buffer{ + buf: buf, } } -func (a *Allocator) Next() *Block { - b, _ := a.pool.Get().(*Block) +func (a *BufferPool) Get(base int64) *Buffer { + b, _ := a.pool.Get().(*Buffer) // Reset block. + b.base = base copy(b.buf, a.emptyBuf) b.wp = 0 b.fp = 0 b.cp = 0 - b.SO = a.next - a.next += int64(a.size) return b } -func (a *Allocator) Free(b *Block) { +func (a *BufferPool) Put(b *Buffer) { a.pool.Put(b) } diff --git a/internal/store/wal/block/allocator_test.go b/internal/store/io/block/buffer_pool_test.go similarity index 65% rename from internal/store/wal/block/allocator_test.go rename to internal/store/io/block/buffer_pool_test.go index 7b4cd5643..f3634f643 100644 --- a/internal/store/wal/block/allocator_test.go +++ b/internal/store/io/block/buffer_pool_test.go @@ -22,37 +22,37 @@ import ( . "github.com/smartystreets/goconvey/convey" ) -var emptyBuf = make([]byte, blockSize) +var emptyBuf = make([]byte, bufferSize) -func TestAllocator(t *testing.T) { - Convey("wal block allocator", t, func() { - allocator := NewAllocator(blockSize, blockSize) - So(allocator, ShouldNotBeNil) - So(allocator.BlockSize(), ShouldEqual, blockSize) +func TestBufferPool(t *testing.T) { + Convey("buffer pool", t, func() { + pool := NewBufferPool(bufferSize) + So(pool, ShouldNotBeNil) + So(pool.BufferSize(), ShouldEqual, bufferSize) - b0 := allocator.Next() - So(b0.Capacity(), ShouldEqual, blockSize) + b0 := pool.Get(0) + So(b0.Base(), ShouldEqual, 0) + So(b0.Capacity(), ShouldEqual, bufferSize) So(b0.Size(), ShouldEqual, 0) So(b0.Committed(), ShouldEqual, 0) - So(b0.SO, ShouldEqual, blockSize) So(b0.fp, ShouldEqual, 0) So(b0.buf, ShouldResemble, emptyBuf) - b1 := allocator.Next() - So(b1.Capacity(), ShouldEqual, blockSize) + b1 := pool.Get(bufferSize) + So(b1.Base(), ShouldEqual, bufferSize) + So(b1.Capacity(), ShouldEqual, bufferSize) So(b1.Size(), ShouldEqual, 0) So(b1.Committed(), ShouldEqual, 0) - So(b1.SO, ShouldEqual, 2*blockSize) So(b1.fp, ShouldEqual, 0) So(b1.buf, ShouldResemble, emptyBuf) - allocator.Free(b0) + pool.Put(b0) - b2 := allocator.Next() - So(b2.Capacity(), ShouldEqual, blockSize) + b2 := pool.Get(2 * bufferSize) + So(b2.Base(), ShouldEqual, 2*bufferSize) + So(b2.Capacity(), ShouldEqual, bufferSize) So(b2.Size(), ShouldEqual, 0) So(b2.Committed(), ShouldEqual, 0) - So(b2.SO, ShouldEqual, 3*blockSize) So(b2.fp, ShouldEqual, 0) So(b2.buf, ShouldResemble, emptyBuf) }) diff --git a/internal/store/io/block/buffer_test.go b/internal/store/io/block/buffer_test.go new file mode 100644 index 000000000..3e79edf69 --- /dev/null +++ b/internal/store/io/block/buffer_test.go @@ -0,0 +1,174 @@ +// Copyright 2022 Linkall Inc. +// +// 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 block + +import ( + // standard libraries. + "bytes" + "math/rand" + "sync" + "sync/atomic" + "testing" + "time" + + // third-party libraries. + . "github.com/smartystreets/goconvey/convey" + + // this project. + "github.com/linkall-labs/vanus/internal/store/io" +) + +const ( + bufferSize = 4 * 1024 +) + +func TestBuffer(t *testing.T) { + rand.Seed(time.Now().Unix()) + + Convey("buffer", t, func() { + b := Buffer{ + base: 4096, + buf: make([]byte, bufferSize), + } + + Convey("properties", func() { + So(b.Base(), ShouldEqual, 4096) + So(b.Capacity(), ShouldEqual, bufferSize) + So(b.Size(), ShouldEqual, 0) + So(b.Committed(), ShouldEqual, 0) + So(b.Remaining(), ShouldEqual, bufferSize) + So(b.Full(), ShouldBeFalse) + }) + + Convey("append", func() { + dataSize := bufferSize - 1 + data := make([]byte, bufferSize) + rand.Read(data) + r := bytes.NewBuffer(data[:dataSize]) + + n, err := b.Append(r) + + So(err, ShouldBeNil) + So(n, ShouldEqual, dataSize) + So(b.Size(), ShouldEqual, dataSize) + So(b.Committed(), ShouldEqual, 0) + So(b.Remaining(), ShouldEqual, 1) + So(b.Full(), ShouldBeFalse) + + Convey("flush", func() { + b.Flush(io.WriteAtFunc(func(b []byte, base int64, so, eo int, cb io.WriteCallback) { + So(b[:dataSize], ShouldResemble, data[:dataSize]) + So(b[dataSize:], ShouldResemble, []byte{0}) + So(base, ShouldEqual, 4096) + So(so, ShouldEqual, 0) + So(eo, ShouldEqual, dataSize) + + cb(len(b), nil) + }), func(off int, err error) { + So(err, ShouldBeNil) + So(off, ShouldEqual, dataSize) + }) + + So(b.Committed(), ShouldEqual, dataSize) + + b.Flush(nil, func(off int, err error) { + So(err, ShouldBeError, ErrAlreadyFlushed) + So(off, ShouldEqual, n) + }) + + n, err := b.Append(bytes.NewBuffer(data[dataSize:])) + So(err, ShouldBeNil) + So(n, ShouldEqual, bufferSize) + So(b.Size(), ShouldEqual, bufferSize) + So(b.Committed(), ShouldEqual, dataSize) + So(b.Remaining(), ShouldEqual, 0) + So(b.Full(), ShouldBeTrue) + + b.Flush(io.WriteAtFunc(func(b []byte, base int64, so, eo int, cb io.WriteCallback) { + So(b, ShouldResemble, data) + So(base, ShouldEqual, 4096) + So(so, ShouldEqual, dataSize) + So(eo, ShouldEqual, bufferSize) + + cb(len(b), nil) + }), func(off int, err error) { + So(err, ShouldBeNil) + So(off, ShouldEqual, bufferSize) + }) + }) + }) + + Convey("sequence flush", func() { + type writeTask struct { + so, eo int + cb io.WriteCallback + } + + var flushCount int64 + ch := make(chan writeTask, 16) + doWrite := func() { + for t := range ch { + time.Sleep(time.Duration(rand.Int63n(10)*100) * time.Microsecond) + t.cb(t.eo-t.so, nil) + atomic.AddInt64(&flushCount, 1) + } + } + go doWrite() + go doWrite() + + writer := io.WriteAtFunc(func(b []byte, base int64, so, eo int, cb io.WriteCallback) { + ch <- writeTask{ + so: so, + eo: eo, + cb: cb, + } + }) + + resultC := make(chan int, 100) + wg := sync.WaitGroup{} + wg.Add(100) + for i := 1; i <= 100; i++ { + time.Sleep(time.Duration(rand.Int63n(100)*10) * time.Microsecond) + b.Append(bytes.NewReader([]byte{byte(rand.Intn(256))})) + b.Flush(writer, func(off int, err error) { + if err == nil { + resultC <- off + } + wg.Done() + }) + } + wg.Wait() + close(ch) + + So(resultC, ShouldHaveLength, 100) + for i := 1; i <= 100; i++ { + So(<-resultC, ShouldEqual, i) + } + So(atomic.LoadInt64(&flushCount), ShouldBeLessThanOrEqualTo, 100) + }) + + Convey("append with too large data", func() { + dataSize := bufferSize + 1 + data := make([]byte, dataSize) + rand.Read(data) + r := bytes.NewBuffer(data) + + n, err := b.Append(r) + + So(err, ShouldBeNil) + So(n, ShouldEqual, bufferSize) + }) + }) +} diff --git a/internal/store/config_linux.go b/internal/store/io/block/interface.go similarity index 67% rename from internal/store/config_linux.go rename to internal/store/io/block/interface.go index 2964e4c62..c76e0b9b2 100644 --- a/internal/store/config_linux.go +++ b/internal/store/io/block/interface.go @@ -12,22 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build linux -// +build linux - -package store +package block import ( // this project. "github.com/linkall-labs/vanus/internal/store/io" - walog "github.com/linkall-labs/vanus/internal/store/wal" ) -const ioEngineUring = "io_uring" +type FlushCallback = func(off int, err error) + +type Interface interface { + Base() int64 + Capacity() int -func configWALIOEngineOptionEx(opts []walog.Option, cfg IOConfig) []walog.Option { - if cfg.Engine == ioEngineUring { - opts = append(opts, walog.WithIOEngine(io.NewURing())) - } - return opts + Flush(writer io.WriterAt, cb FlushCallback) } diff --git a/internal/store/io/block/oneshot.go b/internal/store/io/block/oneshot.go new file mode 100644 index 000000000..8ee2b4d28 --- /dev/null +++ b/internal/store/io/block/oneshot.go @@ -0,0 +1,47 @@ +// Copyright 2022 Linkall Inc. +// +// 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 block + +import ( + // this project. + "github.com/linkall-labs/vanus/internal/store/io" +) + +type oneshot struct { + base int64 + buf []byte +} + +// Make sure block implements Interface. +var _ Interface = (*oneshot)(nil) + +func Oneshot(base int64, data []byte) Interface { + return &oneshot{ + base: base, + buf: data, + } +} + +func (o *oneshot) Base() int64 { + return o.base +} + +func (o *oneshot) Capacity() int { + return len(o.buf) +} + +func (o *oneshot) Flush(writer io.WriterAt, cb FlushCallback) { + writer.WriteAt(o.buf, o.base, 0, o.Capacity(), cb) +} diff --git a/internal/store/io/engine.go b/internal/store/io/engine/interface.go similarity index 67% rename from internal/store/io/engine.go rename to internal/store/io/engine/interface.go index b6595f9c3..d294f08ea 100644 --- a/internal/store/io/engine.go +++ b/internal/store/io/engine/interface.go @@ -12,29 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -package io +package engine -import "os" +import ( + // this project. + "github.com/linkall-labs/vanus/internal/store/io" + "github.com/linkall-labs/vanus/internal/store/io/zone" +) -type Engine interface { +type Interface interface { Close() // WriteAt writes block b to the File starting at byte offset off. // If only partial data is changed, offset so and eo are used to hint it. // WriteCallback cb is called with the number of bytes written and an error when the operation completes. - WriteAt(f *os.File, b []byte, off int64, so, eo int, cb WriteCallback) -} - -type engine struct{} - -// Make sure engine implements Engine. -var _ Engine = (*engine)(nil) - -func NewEngine() Engine { - return &engine{} -} - -func (e *engine) Close() {} - -func (e *engine) WriteAt(f *os.File, b []byte, off int64, so, eo int, cb WriteCallback) { - cb(f.WriteAt(b, off)) + WriteAt(z zone.Interface, b []byte, off int64, so, eo int, cb io.WriteCallback) } diff --git a/internal/store/io/engine/psync/config.go b/internal/store/io/engine/psync/config.go new file mode 100644 index 000000000..4eae78033 --- /dev/null +++ b/internal/store/io/engine/psync/config.go @@ -0,0 +1,55 @@ +// Copyright 2022 Linkall Inc. +// +// 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 psync + +const ( + defaultWriteTaskBufferSize = 64 + defaultParallel = 4 +) + +type config struct { + writeTaskBufferSize int + parallel int +} + +func defaultConfig() config { + cfg := config{ + writeTaskBufferSize: defaultWriteTaskBufferSize, + parallel: defaultParallel, + } + return cfg +} + +type Option func(*config) + +func makeConfig(opts ...Option) config { + cfg := defaultConfig() + for _, opt := range opts { + opt(&cfg) + } + return cfg +} + +func WithWriteTaskBufferSize(size int) Option { + return func(cfg *config) { + cfg.writeTaskBufferSize = size + } +} + +func WithParallel(parallel int) Option { + return func(cfg *config) { + cfg.parallel = parallel + } +} diff --git a/internal/store/io/engine/psync/psync.go b/internal/store/io/engine/psync/psync.go new file mode 100644 index 000000000..056b0ec39 --- /dev/null +++ b/internal/store/io/engine/psync/psync.go @@ -0,0 +1,83 @@ +// Copyright 2022 Linkall Inc. +// +// 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 psync + +import ( + // standard libraries. + "os" + + // this project. + "github.com/linkall-labs/vanus/internal/store/io" + "github.com/linkall-labs/vanus/internal/store/io/engine" + "github.com/linkall-labs/vanus/internal/store/io/zone" +) + +type writeTask struct { + f *os.File + b []byte + off int64 + cb io.WriteCallback +} + +type psync struct { + taskC chan writeTask +} + +// Make sure engine implements engine.Interface. +var _ engine.Interface = (*psync)(nil) + +func New(opts ...Option) engine.Interface { + cfg := makeConfig(opts...) + return newPsync(cfg) +} + +func newPsync(cfg config) engine.Interface { + e := &psync{ + taskC: make(chan writeTask, cfg.writeTaskBufferSize), + } + + for i := 0; i < cfg.parallel; i++ { + go e.run() + } + + return e +} + +func (e *psync) Close() { + close(e.taskC) +} + +func (e *psync) WriteAt(z zone.Interface, b []byte, off int64, so, eo int, cb io.WriteCallback) { + // if eo != 0 && eo != len(b) { + // b = b[:eo] + // } + // if so != 0 { + // b = b[so:] + // off += int64(so) + // } + f, off := z.Raw(off) + e.taskC <- writeTask{f, b, off, cb} +} + +func (e *psync) run() { + for task := range e.taskC { + task.invoke() + } +} + +func (t *writeTask) invoke() { + // NOTE: data race is ok here. + t.cb(t.f.WriteAt(t.b, t.off)) +} diff --git a/internal/store/io/engine/psync/psync_test.go b/internal/store/io/engine/psync/psync_test.go new file mode 100644 index 000000000..59173079a --- /dev/null +++ b/internal/store/io/engine/psync/psync_test.go @@ -0,0 +1,42 @@ +// Copyright 2022 Linkall Inc. +// +// 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 psync + +import ( + // standard libraries. + "os" + "testing" + + // third-party libraries. + . "github.com/smartystreets/goconvey/convey" + + // this project. + enginetest "github.com/linkall-labs/vanus/internal/store/io/engine/testing" +) + +func TestPsync(t *testing.T) { + f, err := os.CreateTemp("", "wal-engine-*") + if err != nil { + t.Fatal(err) + } + defer os.Remove(f.Name()) + + e := New() + defer e.Close() + + Convey("psync", t, func() { + enginetest.DoEngineTest(e, f) + }) +} diff --git a/internal/store/io/engine_test.go b/internal/store/io/engine/testing/engine.go similarity index 75% rename from internal/store/io/engine_test.go rename to internal/store/io/engine/testing/engine.go index b154c3ab0..3650ea9b9 100644 --- a/internal/store/io/engine_test.go +++ b/internal/store/io/engine/testing/engine.go @@ -12,16 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -package io +package testing import ( // standard libraries. "os" "sync" - "testing" // third-party libraries. . "github.com/smartystreets/goconvey/convey" + + // this project. + "github.com/linkall-labs/vanus/internal/store/io/engine" + "github.com/linkall-labs/vanus/internal/store/io/zone/file" ) var ( @@ -29,14 +32,17 @@ var ( data1 = []byte{0x05, 0x06, 0x07} ) -func doEngineTest(e Engine, f *os.File) { +func DoEngineTest(e engine.Interface, f *os.File) { wg := sync.WaitGroup{} var rn int var rerr error + z, err := file.New(f) + So(err, ShouldBeNil) + wg.Add(1) - e.WriteAt(f, data0, 0, 0, 0, func(n int, err error) { + e.WriteAt(z, data0, 0, 0, 0, func(n int, err error) { rn = n rerr = err wg.Done() @@ -47,7 +53,7 @@ func doEngineTest(e Engine, f *os.File) { So(rn, ShouldEqual, len(data0)) wg.Add(1) - e.WriteAt(f, data1, 0, 0, 0, func(n int, err error) { + e.WriteAt(z, data1, 0, 0, 0, func(n int, err error) { rn = n rerr = err wg.Done() @@ -64,18 +70,3 @@ func doEngineTest(e Engine, f *os.File) { So(n, ShouldEqual, len(buf)) So(buf, ShouldResemble, []byte{0x05, 0x06, 0x07, 0x04}) } - -func TestEngine(t *testing.T) { - f, err := os.CreateTemp("", "wal-engine-*") - if err != nil { - t.Fatal(err) - } - defer os.Remove(f.Name()) - - e := NewEngine() - defer e.Close() - - Convey("engine", t, func() { - doEngineTest(e, f) - }) -} diff --git a/internal/store/io/uring.go b/internal/store/io/engine/uring/uring.go similarity index 87% rename from internal/store/io/uring.go rename to internal/store/io/engine/uring/uring.go index 2f07fb288..69066cca0 100644 --- a/internal/store/io/uring.go +++ b/internal/store/io/engine/uring/uring.go @@ -15,18 +15,20 @@ //go:build linux // +build linux -package io +package uring import ( // standard libraries. "context" - "os" "sort" // third-party libraries. "github.com/iceber/iouring-go" // this project. + "github.com/linkall-labs/vanus/internal/store/io" + "github.com/linkall-labs/vanus/internal/store/io/engine" + "github.com/linkall-labs/vanus/internal/store/io/zone" "github.com/linkall-labs/vanus/observability/log" ) @@ -42,10 +44,10 @@ type uRing struct { seq uint64 } -// Make sure uRing implements Engine. -var _ Engine = (*uRing)(nil) +// Make sure uRing implements engine.Interface. +var _ engine.Interface = (*uRing)(nil) -func NewURing() Engine { +func New() engine.Interface { ring, err := iouring.New(defaultResultBufferSize) if err != nil { log.Error(context.Background(), "Create iouring failed.", map[string]interface{}{ @@ -133,10 +135,11 @@ func (e *uRing) runCallback() { } } -func (e *uRing) WriteAt(f *os.File, b []byte, off int64, so, eo int, cb WriteCallback) { +func (e *uRing) WriteAt(z zone.Interface, b []byte, off int64, so, eo int, cb io.WriteCallback) { seq := e.generateSeq() - pr := iouring.Pwrite(int(f.Fd()), b, uint64(off)). + f, offset := z.Raw(off) + pr := iouring.Pwrite(int(f.Fd()), b, uint64(offset)). WithInfo(seq). WithCallback(func(result iouring.Result) error { cb(result.ReturnInt()) diff --git a/internal/store/io/uring_test.go b/internal/store/io/engine/uring/uring_test.go similarity index 85% rename from internal/store/io/uring_test.go rename to internal/store/io/engine/uring/uring_test.go index 7978ce7d8..3eb2598de 100644 --- a/internal/store/io/uring_test.go +++ b/internal/store/io/engine/uring/uring_test.go @@ -15,7 +15,7 @@ //go:build linux // +build linux -package io +package uring import ( // standard libraries. @@ -24,6 +24,9 @@ import ( // third-party libraries. . "github.com/smartystreets/goconvey/convey" + + // this project. + enginetest "github.com/linkall-labs/vanus/internal/store/io/engine/testing" ) func TestURing(t *testing.T) { @@ -33,10 +36,10 @@ func TestURing(t *testing.T) { } defer os.Remove(f.Name()) - e := NewURing() + e := New() defer e.Close() Convey("uRing", t, func() { - doEngineTest(e, f) + enginetest.DoEngineTest(e, f) }) } diff --git a/internal/store/io/stream/pending_queue.go b/internal/store/io/stream/pending_queue.go new file mode 100644 index 000000000..bc2ff9853 --- /dev/null +++ b/internal/store/io/stream/pending_queue.go @@ -0,0 +1,118 @@ +// Copyright 2022 Linkall Inc. +// +// 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 stream + +import ( + "sync" + "time" +) + +type PendingTask interface { + OnTimeout(pid PendingID) +} + +type PendingID interface{} + +type pendingNode struct { + task PendingTask + deadline time.Time + prev *pendingNode + next *pendingNode +} + +func (pn *pendingNode) onTimeout() { + pn.task.OnTimeout(pn) +} + +type pendingQueue struct { + mu sync.Mutex + tasks pendingNode + delay time.Duration +} + +func newPendingQueue(delay time.Duration) *pendingQueue { + pq := &pendingQueue{ + delay: delay, + } + pq.tasks.prev = &pq.tasks + pq.tasks.next = &pq.tasks + + go pq.run() + + return pq +} + +func (pq *pendingQueue) Close() { + // TODO(james.yin): close +} + +func (pq *pendingQueue) run() { + // TODO(james.yin): optimize + pq.mu.Lock() + for { + now := time.Now() + node := pq.tasks.next + if node == &pq.tasks { + pq.mu.Unlock() + time.Sleep(pq.delay) + pq.mu.Lock() + continue + } + if now.Before(node.deadline) { + pq.mu.Unlock() + time.Sleep(node.deadline.Sub(now)) + pq.mu.Lock() + continue + } + removeNode(node) + + pq.mu.Unlock() + node.onTimeout() + pq.mu.Lock() + } +} + +func (pq *pendingQueue) Push(t PendingTask) PendingID { + // TODO(james.yin): optimize lock + pq.mu.Lock() + defer pq.mu.Unlock() + node := &pendingNode{ + task: t, + deadline: time.Now().Add(pq.delay), + prev: pq.tasks.prev, + next: &pq.tasks, + } + pq.tasks.prev.next = node + pq.tasks.prev = node + return node +} + +func (pq *pendingQueue) Cancel(pid PendingID) { + node, _ := pid.(*pendingNode) + // TODO(james.yin): optimize lock + pq.mu.Lock() + defer pq.mu.Unlock() + removeNode(node) +} + +func removeNode(node *pendingNode) { + if node.next == node { + return + } + node.next.prev = node.prev + node.prev.next = node.next + node.next = node + node.prev = node +} diff --git a/internal/store/io/stream/scheduler.go b/internal/store/io/stream/scheduler.go new file mode 100644 index 000000000..e5060428c --- /dev/null +++ b/internal/store/io/stream/scheduler.go @@ -0,0 +1,116 @@ +// Copyright 2022 Linkall Inc. +// +// 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 stream + +import ( + // standard libraries. + "time" + + // this project. + "github.com/linkall-labs/vanus/internal/store/io" + "github.com/linkall-labs/vanus/internal/store/io/block" + "github.com/linkall-labs/vanus/internal/store/io/engine" + "github.com/linkall-labs/vanus/internal/store/io/zone" +) + +type Scheduler interface { + Close() + + Register(z zone.Interface, wo int64) Stream + Unregister(s Stream) +} + +type scheduler struct { + e engine.Interface + bp *block.BufferPool + pq *pendingQueue +} + +// Make sure scheduler implements Scheduler. +var _ Scheduler = (*scheduler)(nil) + +func NewScheduler(e engine.Interface, flushBatchSize int, flushDelayTime time.Duration) Scheduler { + bp := block.NewBufferPool(flushBatchSize) + pq := newPendingQueue(flushDelayTime) + s := &scheduler{ + e: e, + bp: bp, + pq: pq, + } + return s +} + +func (s *scheduler) Close() { + s.pq.Close() + s.e.Close() +} + +func (s *scheduler) Register(z zone.Interface, wo int64) Stream { + so := wo % int64(s.bp.BufferSize()) + base := wo - so + + var buf *block.Buffer + if so != 0 { + buf = s.getBuffer(base) + f, off := z.Raw(base) + if f == nil { + // TODO(james.yin) + panic("invalid zone") + } + if err := buf.RecoverFromFile(f, off, int(so)); err != nil { + panic(err) + } + // FIXME(james.yin): switch buf if it is full. + } + + ss := &stream{ + s: s, + z: z, + buf: buf, + off: base, + } + ss.pending.Store(base, &flushTask{ + ready: true, + }) + + return ss +} + +func (s *scheduler) Unregister(ss Stream) { +} + +func (s *scheduler) writeAt(z zone.Interface, b []byte, off int64, so, eo int, cb io.WriteCallback) { + s.e.WriteAt(z, b, off, so, eo, cb) +} + +func (s *scheduler) bufferSize() int { + return s.bp.BufferSize() +} + +func (s *scheduler) getBuffer(base int64) *block.Buffer { + return s.bp.Get(base) +} + +func (s *scheduler) putBuffer(b *block.Buffer) { + s.bp.Put(b) +} + +func (s *scheduler) delayFlush(ss *stream) PendingID { + return s.pq.Push(ss) +} + +func (s *scheduler) cancelFlushTask(pid PendingID) { + s.pq.Cancel(pid) +} diff --git a/internal/store/io/stream/stream.go b/internal/store/io/stream/stream.go new file mode 100644 index 000000000..e3a59df75 --- /dev/null +++ b/internal/store/io/stream/stream.go @@ -0,0 +1,269 @@ +// Copyright 2022 Linkall Inc. +// +// 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 stream + +import ( + // standard libraries. + stdio "io" + "sync" + + // this project. + "github.com/linkall-labs/vanus/internal/store/io" + "github.com/linkall-labs/vanus/internal/store/io/block" + "github.com/linkall-labs/vanus/internal/store/io/zone" +) + +type Stream interface { + // Zone() zone.Interface + WriteOffset() int64 + + Append(r stdio.Reader, cb io.WriteCallback) +} + +type flushTask struct { + ready bool + off int + cbs []io.WriteCallback +} + +type stream struct { + s *scheduler + z zone.Interface + + mu sync.Mutex + buf *block.Buffer + // off is the base offset of Buffer buf. + off int64 + // dirty is a flag to indicate whether the Buffer buf is dirty. + dirty bool + waiting []io.WriteCallback + + timer PendingID + + pending sync.Map +} + +// Make sure handle implements Stream and io.WriterAt. +var ( + _ Stream = (*stream)(nil) + _ io.WriterAt = (*stream)(nil) + _ PendingTask = (*stream)(nil) +) + +func (s *stream) Zone() zone.Interface { + return s.z +} + +func (s *stream) WriteOffset() int64 { + if s.buf == nil { + return s.off + } + return s.off + int64(s.buf.Size()) +} + +func (s *stream) Append(r stdio.Reader, cb io.WriteCallback) { + flushBatchSize := s.s.bufferSize() + + s.mu.Lock() + defer s.mu.Unlock() + + var n int + var err error + var last *block.Buffer + + for err == nil { + if s.buf == nil { + s.buf = s.s.getBuffer(s.off) + } + + n, err = s.buf.Append(r) + if err != nil && err != stdio.EOF { //nolint:errorlint // compare to EOF is ok + panic(err) + } + + if n == 0 { + continue + } + + if s.buf.Full() { + if s.dirty { + s.dirty = false + s.cancelFlushTimer() + } + + if last != nil { + s.flushBuffer(last, s.waiting) + s.waiting = nil + } + last = s.buf + + s.off += int64(flushBatchSize) + s.buf = nil + } + } + + empty := s.buf == nil || s.buf.Empty() + + if empty { + s.waiting = append(s.waiting, cb) + } + + if last != nil { + s.flushBuffer(last, s.waiting) + s.waiting = nil + } + + if !empty { + s.waiting = append(s.waiting, cb) + if !s.dirty { + s.dirty = true + s.startFlushTimer() + } + } +} + +func (s *stream) startFlushTimer() { + if s.timer != nil { + return + } + s.timer = s.s.delayFlush(s) +} + +func (s *stream) cancelFlushTimer() { + if s.timer == nil { + return + } + s.s.cancelFlushTask(s.timer) + s.timer = nil +} + +func (s *stream) OnTimeout(pid PendingID) { + s.mu.Lock() + defer s.mu.Unlock() + if s.timer == pid { + s.dirty = false + s.flushBlock(s.buf, s.waiting) + s.waiting = nil + s.timer = nil + } +} + +func (s *stream) flushBuffer(b *block.Buffer, cbs []io.WriteCallback) { + b.Flush(s, func(off int, err error) { + base := b.Base() + s.s.putBuffer(b) + if err != nil && err != block.ErrAlreadyFlushed { //nolint:errorlint // compare to ErrAlreadyFlushed is ok + panic(err) + } + s.onFlushed(base, off, cbs) + }) +} + +func (s *stream) flushBlock(b block.Interface, cbs []io.WriteCallback) { + base := b.Base() + b.Flush(s, func(off int, err error) { + if err != nil && err != block.ErrAlreadyFlushed { //nolint:errorlint // compare to ErrAlreadyFlushed is ok + panic(err) + } + s.onFlushed(base, off, cbs) + }) +} + +func (s *stream) onFlushed(base int64, off int, cbs []io.WriteCallback) { + var empty bool + v, loaded := s.pending.LoadAndDelete(base) + + // Wait previous block flushed. + if !loaded { + _, loaded = s.pending.LoadOrStore(base, &flushTask{ + off: off, + cbs: cbs, + }) + if !loaded { + return + } + } else { + ft, _ := v.(*flushTask) + if !ft.ready { + ft.off = off + ft.cbs = append(ft.cbs, cbs...) + // Write back + _, loaded = s.pending.LoadOrStore(base, ft) + if !loaded { + return + } + cbs = ft.cbs + } else { + empty = true + } + } + + // FIXME(james.yin): pass n + invokeCallbacks(cbs, 0, nil) + + flushBatchSize := s.s.bufferSize() + + // Partial flush. + if off != flushBatchSize { + if empty { + s.pending.Store(base, &flushTask{ + ready: true, + }) + } + return + } + + if !empty { + s.pending.Delete(base) + } + + for { + // Check next block. + base += int64(flushBatchSize) + + for { + _, loaded = s.pending.LoadOrStore(base, &flushTask{ + ready: true, + }) + if !loaded { + return + } + + v, _ = s.pending.LoadAndDelete(base) + ft, _ := v.(*flushTask) + + // FIXME(james.yin): pass n + invokeCallbacks(ft.cbs, 0, nil) + + if ft.off == flushBatchSize { + break + } + } + } +} + +func invokeCallbacks(cbs []io.WriteCallback, n int, err error) { + if len(cbs) == 0 { + return + } + + for _, cb := range cbs { + cb(n, err) + } +} + +func (s *stream) WriteAt(b []byte, off int64, so, eo int, cb io.WriteCallback) { + s.s.writeAt(s.z, b, off, so, eo, cb) +} diff --git a/internal/store/io/write.go b/internal/store/io/write.go index 53b03d587..5a071e8db 100644 --- a/internal/store/io/write.go +++ b/internal/store/io/write.go @@ -14,7 +14,7 @@ package io -type WriteCallback func(n int, err error) +type WriteCallback = func(n int, err error) type WriterAt interface { WriteAt(b []byte, off int64, so, eo int, cb WriteCallback) diff --git a/internal/store/io/write_test.go b/internal/store/io/write_test.go index e9e76a3a2..edb994302 100644 --- a/internal/store/io/write_test.go +++ b/internal/store/io/write_test.go @@ -33,7 +33,7 @@ func TestWriteAtFunc(t *testing.T) { w0.WriteAt(nil, 0, 0, 0, nil) buf := []byte{0x00} - var callback WriteCallback = func(n int, err error) {} + callback := func(n int, err error) {} var f1 WriteAtFunc = func(b []byte, off int64, so, eo int, cb WriteCallback) { So(b, ShouldResemble, buf) So(off, ShouldEqual, 1) diff --git a/internal/store/io/zone/file/file.go b/internal/store/io/zone/file/file.go new file mode 100644 index 000000000..c5a521334 --- /dev/null +++ b/internal/store/io/zone/file/file.go @@ -0,0 +1,40 @@ +// Copyright 2022 Linkall Inc. +// +// 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 file + +import ( + // standard libraries. + "os" + + // this project. + "github.com/linkall-labs/vanus/internal/store/io/zone" +) + +type file struct { + f *os.File +} + +// Make sure file implements zone.Interface. +var _ zone.Interface = (*file)(nil) + +func New(f *os.File) (zone.Interface, error) { + return &file{ + f: f, + }, nil +} + +func (f *file) Raw(off int64) (*os.File, int64) { + return f.f, off +} diff --git a/internal/store/wal/file_test.go b/internal/store/io/zone/interface.go similarity index 84% rename from internal/store/wal/file_test.go rename to internal/store/io/zone/interface.go index 536c71fc6..6519187a3 100644 --- a/internal/store/wal/file_test.go +++ b/internal/store/io/zone/interface.go @@ -12,4 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -package wal +package zone + +import "os" + +type Interface interface { + // TODO: Close? + + Raw(off int64) (*os.File, int64) +} diff --git a/internal/store/io/zone/segmentedfile/compaction.go b/internal/store/io/zone/segmentedfile/compaction.go new file mode 100644 index 000000000..a4d3cb1d6 --- /dev/null +++ b/internal/store/io/zone/segmentedfile/compaction.go @@ -0,0 +1,58 @@ +// Copyright 2022 Linkall Inc. +// +// 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 segmentedfile + +import ( + // standard libraries. + "os" +) + +// Compact compacts all segments whose end offset is not after off. +func (sf *SegmentedFile) Compact(off int64) error { + var compacted []*Segment + defer func() { + if compacted != nil { + go doCompact(compacted) + } + }() + + sf.mu.Lock() + defer sf.mu.Unlock() + + sz := len(sf.segments) + if sz <= 1 { + return nil + } + + for i, s := range sf.segments[:sz-1] { + if s.eo > off { + if i > 0 { + compacted = sf.segments[:i] + sf.segments = sf.segments[i:] + } + return nil + } + } + compacted = sf.segments[:sz-1] + sf.segments = sf.segments[sz-1:] + return nil +} + +func doCompact(segments []*Segment) { + for _, s := range segments { + _ = s.Close() + _ = os.Remove(s.path) + } +} diff --git a/internal/store/io/zone/segmentedfile/config.go b/internal/store/io/zone/segmentedfile/config.go new file mode 100644 index 000000000..95c7ba001 --- /dev/null +++ b/internal/store/io/zone/segmentedfile/config.go @@ -0,0 +1,55 @@ +// Copyright 2022 Linkall Inc. +// +// 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 segmentedfile + +const ( + defaultExt = "" + defaultSegmentSize = int64(64 * 1024 * 1024) +) + +type config struct { + ext string + segmentSize int64 +} + +func defaultConfig() config { + cfg := config{ + ext: defaultExt, + segmentSize: defaultSegmentSize, + } + return cfg +} + +type Option func(*config) + +func makeConfig(opts ...Option) config { + cfg := defaultConfig() + for _, opt := range opts { + opt(&cfg) + } + return cfg +} + +func WithSegmentSize(size int64) Option { + return func(cfg *config) { + cfg.segmentSize = size + } +} + +func WithExtension(ext string) Option { + return func(cfg *config) { + cfg.ext = ext + } +} diff --git a/internal/store/io/zone/segmentedfile/recovery.go b/internal/store/io/zone/segmentedfile/recovery.go new file mode 100644 index 000000000..60b130e13 --- /dev/null +++ b/internal/store/io/zone/segmentedfile/recovery.go @@ -0,0 +1,133 @@ +// Copyright 2022 Linkall Inc. +// +// 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 segmentedfile + +import ( + // standard libraries. + "context" + "os" + "path/filepath" + "strconv" + + // first-party libraries. + "github.com/linkall-labs/vanus/internal/store/io" + "github.com/linkall-labs/vanus/observability/log" +) + +const ( + defaultDirPerm = 0o755 +) + +// recoverSegments rebuilds segments from specified directory. +func recoverSegments(dir string, cfg config) ([]*Segment, error) { + // Make sure the directory exists. + if err := os.MkdirAll(dir, defaultDirPerm); err != nil { + return nil, err + } + + segments, discards, err := scanSegmentFiles(dir, cfg.ext, cfg.segmentSize) + if err != nil { + return nil, err + } + + // Delete discard files. + for _, s := range discards { + s.Close() + _ = os.Remove(s.path) + } + + return segments, nil +} + +func scanSegmentFiles(dir, ext string, segmentSize int64) (segments []*Segment, discards []*Segment, err error) { + files, err := os.ReadDir(dir) + if err != nil { + return nil, nil, err + } + files = filterRegularFiles(files, ext) + + // Rebuild log stream. + var last *Segment + for _, file := range files { + filename := file.Name() + so, err2 := strconv.ParseInt(filename[:len(filename)-len(ext)], 10, 64) + if err2 != nil { + return nil, nil, err2 + } + + if last != nil { + // discontinuous log file + if so != last.eo { + log.Warning(context.Background(), "Discontinuous segment, discard before.", + map[string]interface{}{ + "last_end": last.eo, + "next_start": so, + }) + discards = append(discards, segments...) + segments = nil + } + } + + info, err2 := file.Info() + if err2 != nil { + return nil, nil, err2 + } + + path := filepath.Join(dir, filename) + size := info.Size() + + if size%segmentSize != 0 { + // TODO(james.yin): return error + truncated := size - size%segmentSize + log.Warning(context.Background(), "The size of log file is not a multiple of blockSize, truncate it.", + map[string]interface{}{ + "file": path, + "origin_size": size, + "new_size": truncated, + }) + size = truncated + } + + f, err2 := io.OpenFile(path, false, true) + if err2 != nil { + return nil, nil, err2 + } + + last = newSegment(path, so, size, f) + segments = append(segments, last) + } + + return segments, discards, nil +} + +func filterRegularFiles(entries []os.DirEntry, ext string) []os.DirEntry { + if len(entries) == 0 { + return entries + } + + n := 0 + for _, entry := range entries { + if !entry.Type().IsRegular() { + continue + } + if filepath.Ext(entry.Name()) != ext { + continue + } + entries[n] = entry + n++ + } + entries = entries[:n] + return entries +} diff --git a/internal/store/io/zone/segmentedfile/segment.go b/internal/store/io/zone/segmentedfile/segment.go new file mode 100644 index 000000000..2b4a195b5 --- /dev/null +++ b/internal/store/io/zone/segmentedfile/segment.go @@ -0,0 +1,68 @@ +// Copyright 2022 Linkall Inc. +// +// 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 segmentedfile + +import ( + // standard libraries. + "os" +) + +type Segment struct { + // so is the start offset of the log file. + so int64 + // eo is the end offset of the log file. + eo int64 + f *os.File + + size int64 + path string +} + +func newSegment(path string, so int64, size int64, f *os.File) *Segment { + return &Segment{ + so: so, + eo: so + size, + f: f, + size: size, + path: path, + } +} + +func (s *Segment) Close() error { + if s.f == nil { + return nil + } + if err := s.f.Close(); err != nil { + return err + } + s.f = nil + return nil +} + +func (s *Segment) Size() int64 { + return s.size +} + +func (s *Segment) SO() int64 { + return s.so +} + +func (s *Segment) EO() int64 { + return s.eo +} + +func (s *Segment) File() *os.File { + return s.f +} diff --git a/internal/store/io/zone/segmentedfile/segmented_file.go b/internal/store/io/zone/segmentedfile/segmented_file.go new file mode 100644 index 000000000..edfeda03b --- /dev/null +++ b/internal/store/io/zone/segmentedfile/segmented_file.go @@ -0,0 +1,172 @@ +// Copyright 2022 Linkall Inc. +// +// 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 segmentedfile + +import ( + // standard libraries. + "context" + "fmt" + "os" + "path/filepath" + "sort" + "sync" + + // this project. + "github.com/linkall-labs/vanus/internal/store/io" + "github.com/linkall-labs/vanus/internal/store/io/zone" + "github.com/linkall-labs/vanus/observability/log" +) + +type SegmentedFile struct { + segments []*Segment + mu sync.RWMutex + + dir string + ext string + segmentSize int64 +} + +// Make sure file implements zone.Interface. +var _ zone.Interface = (*SegmentedFile)(nil) + +func Open(dir string, opts ...Option) (*SegmentedFile, error) { + cfg := makeConfig(opts...) + + segments, err := recoverSegments(dir, cfg) + if err != nil { + return nil, err + } + + sf := &SegmentedFile{ + segments: segments, + dir: dir, + ext: cfg.ext, + segmentSize: cfg.segmentSize, + } + return sf, nil +} + +func (sf *SegmentedFile) Close() { + for _, s := range sf.segments { + if err := s.Close(); err != nil { + log.Error(context.Background(), "Close segment failed.", map[string]interface{}{ + "path": s.path, + log.KeyError: err, + }) + } + } +} + +func (sf *SegmentedFile) Raw(off int64) (*os.File, int64) { + s := sf.SelectSegment(off, true) + if s == nil { + return nil, 0 + } + return s.f, off - s.so +} + +func (sf *SegmentedFile) SelectSegment(offset int64, autoCreate bool) *Segment { + sf.mu.RLock() + + sz := len(sf.segments) + if sz == 0 { + sf.mu.RUnlock() + + if offset == 0 { + if !autoCreate { + return nil + } + return sf.createNextSegment(nil) + } + panic("log stream not begin from 0") + } + + // Fast return for append. + if last := sf.lastSegment(); offset >= last.so { + sf.mu.RUnlock() + + if offset < last.eo { + return last + } + if offset == last.eo { + if !autoCreate { + return nil + } + return sf.createNextSegment(last) + } + panic("file segment overflow") + } + + defer sf.mu.RUnlock() + + first := sf.firstSegment() + if offset < first.so { + panic("file segment underflow") + } + + i := sort.Search(sz-1, func(i int) bool { + return sf.segments[i].eo > offset + }) + if i < sz-1 { + return sf.segments[i] + } + + panic("unreachable") +} + +func (sf *SegmentedFile) createNextSegment(last *Segment) *Segment { + var off int64 + if last != nil { + off = last.eo + } + + next, err := createSegment(sf.dir, sf.ext, off, sf.segmentSize, true) + if err != nil { + panic(err) + } + + sf.mu.Lock() + defer sf.mu.Unlock() + sf.segments = append(sf.segments, next) + + return next +} + +func createSegment(dir, ext string, so, size int64, sync bool) (*Segment, error) { + path := filepath.Join(dir, fmt.Sprintf("%020d%s", so, ext)) + f, err := io.CreateFile(path, size, true, sync) + if err != nil { + return nil, err + } + return newSegment(path, so, size, f), nil +} + +func (sf *SegmentedFile) firstSegment() *Segment { + return sf.segments[0] +} + +func (sf *SegmentedFile) lastSegment() *Segment { + return sf.segments[len(sf.segments)-1] +} + +func (sf *SegmentedFile) Dir() string { + return sf.dir +} + +func (sf *SegmentedFile) Len() int { + sf.mu.RLock() + defer sf.mu.RUnlock() + return len(sf.segments) +} diff --git a/internal/store/wal/stream_test.go b/internal/store/io/zone/segmentedfile/segmented_file_test.go similarity index 50% rename from internal/store/wal/stream_test.go rename to internal/store/io/zone/segmentedfile/segmented_file_test.go index 495efe4e2..6f7470bfa 100644 --- a/internal/store/wal/stream_test.go +++ b/internal/store/io/zone/segmentedfile/segmented_file_test.go @@ -12,11 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -package wal +package segmentedfile import ( // standard libraries. - "context" "os" "testing" @@ -24,65 +23,64 @@ import ( . "github.com/smartystreets/goconvey/convey" ) -func TestLogStream_SelectFile(t *testing.T) { - Convey("log stream", t, func() { - walDir, err := os.MkdirTemp("", "wal-*") +const fileSize = 32 * 1024 + +func TestSegmentedFile_SelectSegment(t *testing.T) { + Convey("segmented file", t, func() { + dir, err := os.MkdirTemp("", "sf-*") So(err, ShouldBeNil) - s := logStream{ - dir: walDir, - blockSize: defaultBlockSize, - fileSize: fileSize, - } + sf, err := Open(dir, WithSegmentSize(fileSize)) + So(err, ShouldBeNil) - Convey("select file", func() { - f := s.selectFile(context.Background(), 0, false) + Convey("select segment", func() { + f := sf.SelectSegment(0, false) So(f, ShouldBeNil) So(func() { - _ = s.selectFile(context.Background(), 1, false) + _ = sf.SelectSegment(1, false) }, ShouldPanic) - f0 := s.selectFile(context.Background(), 0, true) + f0 := sf.SelectSegment(0, true) So(f0, ShouldNotBeNil) - So(s.stream, ShouldHaveLength, 1) + So(sf.segments, ShouldHaveLength, 1) - f = s.selectFile(context.Background(), fileSize-1, false) + f = sf.SelectSegment(fileSize-1, false) So(f, ShouldEqual, f0) - f = s.selectFile(context.Background(), fileSize, false) + f = sf.SelectSegment(fileSize, false) So(f, ShouldBeNil) So(func() { - _ = s.selectFile(context.Background(), fileSize+1, false) + _ = sf.SelectSegment(fileSize+1, false) }, ShouldPanic) - f1 := s.selectFile(context.Background(), fileSize, true) + f1 := sf.SelectSegment(fileSize, true) So(f1, ShouldNotBeNil) - So(s.stream, ShouldHaveLength, 2) + So(sf.segments, ShouldHaveLength, 2) - f = s.selectFile(context.Background(), fileSize*2-1, false) + f = sf.SelectSegment(fileSize*2-1, false) So(f, ShouldEqual, f1) - f = s.selectFile(context.Background(), fileSize*2, false) + f = sf.SelectSegment(fileSize*2, false) So(f, ShouldBeNil) So(func() { - _ = s.selectFile(context.Background(), fileSize*2+1, false) + _ = sf.SelectSegment(fileSize*2+1, false) }, ShouldPanic) - f = s.selectFile(context.Background(), fileSize-1, false) + f = sf.SelectSegment(fileSize-1, false) So(f, ShouldEqual, f0) So(func() { - _ = s.selectFile(context.Background(), -1, false) + _ = sf.SelectSegment(-1, false) }, ShouldPanic) }) Reset(func() { - s.Close(context.Background()) + sf.Close() - err = os.RemoveAll(walDir) + err = os.RemoveAll(dir) So(err, ShouldBeNil) }) }) diff --git a/internal/store/meta/async.go b/internal/store/meta/async.go index 979554b3c..41642c296 100644 --- a/internal/store/meta/async.go +++ b/internal/store/meta/async.go @@ -27,7 +27,7 @@ import ( "github.com/linkall-labs/vanus/observability/tracing" // this project. - storecfg "github.com/linkall-labs/vanus/internal/store" + "github.com/linkall-labs/vanus/internal/store/config" walog "github.com/linkall-labs/vanus/internal/store/wal" ) @@ -96,15 +96,17 @@ func (s *AsyncStore) Load(key []byte) (interface{}, bool) { } func (s *AsyncStore) Store(ctx context.Context, key []byte, value interface{}) { - _, span := s.tracer.Start(ctx, "Store") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.meta.AsyncStore.Store() Start") + defer span.AddEvent("store.meta.AsyncStore.Store() End") _ = s.set(KVRange(key, value)) } func (s *AsyncStore) BatchStore(ctx context.Context, kvs Ranger) { - _, span := s.tracer.Start(ctx, "BatchStore") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.meta.AsyncStore.BatchStore() Start") + defer span.AddEvent("store.meta.AsyncStore.BatchStore() End") _ = s.set(kvs) } @@ -206,9 +208,11 @@ func merge(dst, src *skiplist.SkipList) { } } -func RecoverAsyncStore(ctx context.Context, cfg storecfg.AsyncStoreConfig, walDir string) (*AsyncStore, error) { - ctx, span := tracing.Start(ctx, "store.meta.async", "newAsyncStore") - defer span.End() +func RecoverAsyncStore(ctx context.Context, cfg config.AsyncStore, walDir string) (*AsyncStore, error) { + span := trace.SpanFromContext(ctx) + span.AddEvent("store.meta.RecoverAsyncStore() Start") + defer span.AddEvent("store.meta.RecoverAsyncStore() End") + committed, snapshot, err := recoverLatestSnapshot(ctx, walDir, defaultCodec) if err != nil { return nil, err diff --git a/internal/store/meta/async_test.go b/internal/store/meta/async_test.go index cdcd7c703..686db7c14 100644 --- a/internal/store/meta/async_test.go +++ b/internal/store/meta/async_test.go @@ -24,7 +24,7 @@ import ( . "github.com/smartystreets/goconvey/convey" // this project. - storecfg "github.com/linkall-labs/vanus/internal/store" + "github.com/linkall-labs/vanus/internal/store/config" ) func TestAsyncStore(t *testing.T) { @@ -35,7 +35,7 @@ func TestAsyncStore(t *testing.T) { So(err, ShouldBeNil) Convey("new empty AsyncStore by recovery", func() { - ss, err := RecoverAsyncStore(ctx, storecfg.AsyncStoreConfig{}, walDir) + ss, err := RecoverAsyncStore(ctx, config.AsyncStore{}, walDir) So(err, ShouldBeNil) So(ss, ShouldNotBeNil) @@ -44,14 +44,14 @@ func TestAsyncStore(t *testing.T) { }) Convey("setup AsyncStore", func() { - ss, err := RecoverAsyncStore(ctx, storecfg.AsyncStoreConfig{}, walDir) + ss, err := RecoverAsyncStore(ctx, config.AsyncStore{}, walDir) So(err, ShouldBeNil) ss.Store(ctx, key0, "value0") ss.Store(ctx, key1, "value1") ss.Close() Convey("recover AsyncStore", func() { - ss, err = RecoverAsyncStore(ctx, storecfg.AsyncStoreConfig{}, walDir) + ss, err = RecoverAsyncStore(ctx, config.AsyncStore{}, walDir) So(err, ShouldBeNil) value0, ok0 := ss.Load(key0) @@ -78,7 +78,7 @@ func TestAsyncStore(t *testing.T) { ss.Close() Convey("recover AsyncStore again", func() { - ss, err = RecoverAsyncStore(ctx, storecfg.AsyncStoreConfig{}, walDir) + ss, err = RecoverAsyncStore(ctx, config.AsyncStore{}, walDir) So(err, ShouldBeNil) value0, ok0 := ss.Load(key0) diff --git a/internal/store/meta/sync.go b/internal/store/meta/sync.go index 11a86d89d..2f18e4a41 100644 --- a/internal/store/meta/sync.go +++ b/internal/store/meta/sync.go @@ -25,7 +25,7 @@ import ( "go.opentelemetry.io/otel/trace" // this project. - storecfg "github.com/linkall-labs/vanus/internal/store" + "github.com/linkall-labs/vanus/internal/store/config" walog "github.com/linkall-labs/vanus/internal/store/wal" "github.com/linkall-labs/vanus/observability/tracing" ) @@ -63,8 +63,9 @@ func newSyncStore(ctx context.Context, wal *walog.WAL, } func (s *SyncStore) Close(ctx context.Context) { - _, span := s.tracer.Start(ctx, "Close") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.meta.SyncStore.Close() Start") + defer span.AddEvent("store.meta.SyncStore.Close() End") // Close WAL. s.wal.Close() @@ -83,8 +84,9 @@ func (s *SyncStore) Load(key []byte) (interface{}, bool) { } func (s *SyncStore) Store(ctx context.Context, key []byte, value interface{}) { - ctx, span := s.tracer.Start(ctx, "Store") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.meta.SyncStore.Store() Start") + defer span.AddEvent("store.meta.SyncStore.Store() End") if err := s.set(ctx, KVRange(key, value)); err != nil { panic(err) @@ -92,8 +94,9 @@ func (s *SyncStore) Store(ctx context.Context, key []byte, value interface{}) { } func (s *SyncStore) BatchStore(ctx context.Context, kvs Ranger) { - ctx, span := s.tracer.Start(ctx, "BatchStore") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.meta.SyncStore.BatchStore() Start") + defer span.AddEvent("store.meta.SyncStore.BatchStore() End") if err := s.set(ctx, kvs); err != nil { panic(err) @@ -101,8 +104,9 @@ func (s *SyncStore) BatchStore(ctx context.Context, kvs Ranger) { } func (s *SyncStore) Delete(ctx context.Context, key []byte) { - ctx, span := s.tracer.Start(ctx, "Delete") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.meta.SyncStore.Delete() Start") + defer span.AddEvent("store.meta.SyncStore.Delete() End") if err := s.set(ctx, KVRange(key, deletedMark)); err != nil { panic(err) @@ -110,8 +114,9 @@ func (s *SyncStore) Delete(ctx context.Context, key []byte) { } func (s *SyncStore) set(ctx context.Context, kvs Ranger) error { - _, span := s.tracer.Start(ctx, "set") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.meta.SyncStore.set() Start") + defer span.AddEvent("store.meta.SyncStore.set() End") entry, err := s.marshaler.Marshal(kvs) if err != nil { @@ -174,9 +179,10 @@ func (s *SyncStore) runSnapshot(ctx context.Context) { } } -func RecoverSyncStore(ctx context.Context, cfg storecfg.SyncStoreConfig, walDir string) (*SyncStore, error) { - ctx, span := tracing.Start(ctx, "store.meta.async", "RecoverSyncStore") - defer span.End() +func RecoverSyncStore(ctx context.Context, cfg config.SyncStore, walDir string) (*SyncStore, error) { + span := trace.SpanFromContext(ctx) + span.AddEvent("store.meta.RecoverSyncStore() Start") + defer span.AddEvent("store.meta.RecoverSyncStore() End") committed, snapshot, err := recoverLatestSnapshot(ctx, walDir, defaultCodec) if err != nil { diff --git a/internal/store/meta/sync_test.go b/internal/store/meta/sync_test.go index 390c47969..13155f768 100644 --- a/internal/store/meta/sync_test.go +++ b/internal/store/meta/sync_test.go @@ -15,8 +15,8 @@ package meta import ( - stdCtx "context" // standard libraries. + "context" "os" "testing" @@ -24,7 +24,7 @@ import ( . "github.com/smartystreets/goconvey/convey" // this project. - storecfg "github.com/linkall-labs/vanus/internal/store" + "github.com/linkall-labs/vanus/internal/store/config" ) var ( @@ -39,23 +39,23 @@ func TestSyncStore(t *testing.T) { So(err, ShouldBeNil) Convey("new empty SyncStore by recovery", func() { - ss, err := RecoverSyncStore(stdCtx.Background(), storecfg.SyncStoreConfig{}, walDir) + ss, err := RecoverSyncStore(context.Background(), config.SyncStore{}, walDir) So(err, ShouldBeNil) So(ss, ShouldNotBeNil) - ss.Close(stdCtx.Background()) + ss.Close(context.Background()) }) Convey("setup SyncStore", func() { - ss, err := RecoverSyncStore(stdCtx.Background(), storecfg.SyncStoreConfig{}, walDir) + ss, err := RecoverSyncStore(context.Background(), config.SyncStore{}, walDir) So(err, ShouldBeNil) - ss.Store(stdCtx.Background(), key0, "value0") - ss.Store(stdCtx.Background(), key1, "value1") - ss.Close(stdCtx.Background()) + ss.Store(context.Background(), key0, "value0") + ss.Store(context.Background(), key1, "value1") + ss.Close(context.Background()) Convey("recover SyncStore", func() { - ss, err = RecoverSyncStore(stdCtx.Background(), storecfg.SyncStoreConfig{}, walDir) + ss, err = RecoverSyncStore(context.Background(), config.SyncStore{}, walDir) So(err, ShouldBeNil) value0, ok0 := ss.Load(key0) @@ -70,19 +70,19 @@ func TestSyncStore(t *testing.T) { So(ok2, ShouldBeFalse) Convey("modify SyncStore", func() { - ss.Delete(stdCtx.Background(), key1) + ss.Delete(context.Background(), key1) _, ok1 = ss.Load(key1) So(ok1, ShouldBeFalse) - ss.Store(stdCtx.Background(), key2, "value2") + ss.Store(context.Background(), key2, "value2") value2, ok2 := ss.Load(key2) So(ok2, ShouldBeTrue) So(value2, ShouldResemble, "value2") - ss.Close(stdCtx.Background()) + ss.Close(context.Background()) Convey("recover SyncStore again", func() { - ss, err = RecoverSyncStore(stdCtx.Background(), storecfg.SyncStoreConfig{}, walDir) + ss, err = RecoverSyncStore(context.Background(), config.SyncStore{}, walDir) So(err, ShouldBeNil) value0, ok0 := ss.Load(key0) @@ -96,7 +96,7 @@ func TestSyncStore(t *testing.T) { So(ok2, ShouldBeTrue) So(value2, ShouldResemble, "value2") - ss.Close(stdCtx.Background()) + ss.Close(context.Background()) }) }) }) diff --git a/internal/store/segment/api_test.go b/internal/store/segment/api_test.go index 70cce0cde..df1e7c29e 100644 --- a/internal/store/segment/api_test.go +++ b/internal/store/segment/api_test.go @@ -25,12 +25,12 @@ import ( "google.golang.org/protobuf/types/known/emptypb" // first-party libraries. + "github.com/linkall-labs/vanus/pkg/errors" segpb "github.com/linkall-labs/vanus/proto/pkg/segment" // this project. "github.com/linkall-labs/vanus/internal/primitive" "github.com/linkall-labs/vanus/internal/primitive/vanus" - "github.com/linkall-labs/vanus/pkg/errors" ) func TestSegmentServer(t *testing.T) { @@ -185,7 +185,8 @@ func TestSegmentServer(t *testing.T) { Convey("ReadFromBlock()", func() { id := vanus.NewTestID() - srv.EXPECT().ReadFromBlock(Any(), Not(vanus.EmptyID()), Any(), Not(0), Any()).Return(make([]*cepb.CloudEvent, 1), nil) + srv.EXPECT().ReadFromBlock(Any(), Not(vanus.EmptyID()), Any(), Not(0), + Any()).Return(make([]*cepb.CloudEvent, 1), nil) srv.EXPECT().ReadFromBlock(Any(), Eq(vanus.EmptyID()), Any(), Any(), Any()).Return(nil, errors.ErrInvalidRequest) srv.EXPECT().ReadFromBlock(Any(), Any(), Any(), Eq(0), Any()).Return(nil, errors.ErrResourceNotFound) diff --git a/internal/store/segment/recovery_test.go b/internal/store/segment/recovery_test.go index 4d54cba52..74bdfc2f4 100644 --- a/internal/store/segment/recovery_test.go +++ b/internal/store/segment/recovery_test.go @@ -46,7 +46,7 @@ func TestServer_recover(t *testing.T) { }, }, } - err = srv.loadEngine(context.Background()) + err = srv.loadVSBEngine(context.Background(), srv.cfg.VSB) So(err, ShouldBeNil) err = srv.recover(context.Background()) diff --git a/internal/store/segment/server.go b/internal/store/segment/server.go index fdebd4378..93f97e527 100644 --- a/internal/store/segment/server.go +++ b/internal/store/segment/server.go @@ -44,6 +44,7 @@ import ( "github.com/linkall-labs/vanus/observability/metrics" "github.com/linkall-labs/vanus/observability/tracing" "github.com/linkall-labs/vanus/pkg/cluster" + "github.com/linkall-labs/vanus/pkg/errors" "github.com/linkall-labs/vanus/pkg/util" cepb "github.com/linkall-labs/vanus/proto/pkg/cloudevents" ctrlpb "github.com/linkall-labs/vanus/proto/pkg/controller" @@ -60,11 +61,11 @@ import ( "github.com/linkall-labs/vanus/internal/store" "github.com/linkall-labs/vanus/internal/store/block" "github.com/linkall-labs/vanus/internal/store/block/raft" + "github.com/linkall-labs/vanus/internal/store/config" "github.com/linkall-labs/vanus/internal/store/meta" ceschema "github.com/linkall-labs/vanus/internal/store/schema/ce" ceconv "github.com/linkall-labs/vanus/internal/store/schema/ce/convert" "github.com/linkall-labs/vanus/internal/store/vsb" - "github.com/linkall-labs/vanus/pkg/errors" ) const ( @@ -237,7 +238,8 @@ func (s *server) preGrpcStream(ctx context.Context, info *tap.Info) (context.Con } func (s *server) Initialize(ctx context.Context) error { - if err := s.loadEngine(ctx); err != nil { + // TODO(james.yin): how to organize block engine? + if err := s.loadVSBEngine(ctx, s.cfg.VSB); err != nil { return err } @@ -270,10 +272,12 @@ func (s *server) Initialize(ctx context.Context) error { return nil } -func (s *server) loadEngine(ctx context.Context) error { - // TODO(james.yin): how to organize engine? - return vsb.Initialize(filepath.Join(s.cfg.Volume.Dir, "block"), - block.ArchivedCallback(s.onBlockArchived)) +func (s *server) loadVSBEngine(ctx context.Context, cfg config.VSB) error { + dir := filepath.Join(s.cfg.Volume.Dir, "block") + opts := append([]vsb.Option{ + vsb.WithArchivedListener(block.ArchivedCallback(s.onBlockArchived)), + }, cfg.Options()...) + return vsb.Initialize(dir, opts...) } func (s *server) reconcileBlocks(ctx context.Context) error { @@ -708,13 +712,20 @@ func (s *server) processAppendError(ctx context.Context, b Replica, err error) e return err } - if errors.Is(err, errors.ErrSegmentFull) { + if stderr.Is(err, block.ErrFull) { log.Debug(ctx, "Append failed: block is full.", map[string]interface{}{ "block_id": b.ID(), }) return errors.ErrSegmentFull } + if stderr.Is(err, block.ErrNotLeader) { + log.Debug(ctx, "Append failed: block is not leader.", map[string]interface{}{ + "block_id": b.ID(), + }) + return errors.ErrNotLeader + } + log.Warning(ctx, "Append failed.", map[string]interface{}{ "block_id": b.ID(), log.KeyError: err, @@ -775,8 +786,8 @@ func (s *server) ReadFromBlock( if events, err := s.readEvents(ctx, b, seq, num); err == nil { return events, nil - } else if !errors.Is(err, errors.ErrOffsetOnEnd) || pollingTimeout == 0 { - return nil, err + } else if !stderr.Is(err, block.ErrOnEnd) || pollingTimeout == 0 { + return nil, s.processReadError(ctx, b, err) } doneC := s.pm.Add(ctx, id) @@ -790,7 +801,11 @@ func (s *server) ReadFromBlock( select { case <-doneC: // FIXME(james.yin) It can't read message immediately because of async apply. - return s.readEvents(ctx, b, seq, num) + events, err := s.readEvents(ctx, b, seq, num) + if err != nil { + return nil, s.processReadError(ctx, b, err) + } + return events, nil case <-t.C: return nil, errors.ErrOffsetOnEnd case <-ctx.Done(): @@ -818,6 +833,32 @@ func (s *server) readEvents(ctx context.Context, b Replica, seq int64, num int) return events, nil } +func (s *server) processReadError(ctx context.Context, b Replica, err error) error { + if stderr.As(err, &errors.ErrorType{}) { + return err + } + + if stderr.Is(err, block.ErrOnEnd) { + log.Debug(ctx, "Read: arrive segment end.", map[string]interface{}{ + "block_id": b.ID(), + }) + return errors.ErrOffsetOnEnd + } + + if stderr.Is(err, block.ErrExceeded) { + log.Debug(ctx, "Read failed: offset overflow.", map[string]interface{}{ + "block_id": b.ID(), + }) + return errors.ErrOffsetOverflow + } + + log.Warning(ctx, "Read failed.", map[string]interface{}{ + "block_id": b.ID(), + log.KeyError: err, + }) + return errors.ErrInternal.WithMessage("read from storage failed").Wrap(err) +} + func (s *server) LookupOffsetInBlock(ctx context.Context, id vanus.ID, stime int64) (int64, error) { ctx, span := s.tracer.Start(ctx, "LookupOffsetInBlock") defer span.End() @@ -836,7 +877,7 @@ func (s *server) LookupOffsetInBlock(ctx context.Context, id vanus.ID, stime int off, err := b.Seek(ctx, 0, ceschema.StimeKey(stime), block.SeekBeforeKey) if err != nil { - return -1, err + return -1, errors.ErrInternal.WithMessage("lookup offset failed").Wrap(err) } return off + 1, nil } diff --git a/internal/store/segment/server_test.go b/internal/store/segment/server_test.go index 0e15e782b..21da35ce1 100644 --- a/internal/store/segment/server_test.go +++ b/internal/store/segment/server_test.go @@ -128,7 +128,7 @@ func TestServer_ReadFromBlock(t *testing.T) { }) Convey("long-polling without timeout", func() { - b.EXPECT().Read(Any(), int64(0), 3).Return(nil, errors.ErrOffsetOnEnd) + b.EXPECT().Read(Any(), int64(0), 3).Return(nil, block.ErrOnEnd) b.EXPECT().Read(Any(), int64(0), 3).Return([]block.Entry{ent0, ent1}, nil) mgr := NewMockpollingManager(ctrl) @@ -152,7 +152,7 @@ func TestServer_ReadFromBlock(t *testing.T) { }) Convey("long-polling with timeout", func() { - b.EXPECT().Read(Any(), int64(0), 3).Return(nil, errors.ErrOffsetOnEnd) + b.EXPECT().Read(Any(), int64(0), 3).Return(nil, block.ErrOnEnd) mgr := NewMockpollingManager(ctrl) ch := make(chan struct{}) @@ -167,7 +167,7 @@ func TestServer_ReadFromBlock(t *testing.T) { }) Convey("long-polling with canceled request", func() { - b.EXPECT().Read(Any(), int64(0), 3).Return(nil, errors.ErrOffsetOnEnd) + b.EXPECT().Read(Any(), int64(0), 3).Return(nil, block.ErrOnEnd) mgr := NewMockpollingManager(ctrl) ch := make(chan struct{}) diff --git a/internal/store/vsb/block.go b/internal/store/vsb/block.go index 3a7038ffd..a471145a2 100644 --- a/internal/store/vsb/block.go +++ b/internal/store/vsb/block.go @@ -21,12 +21,11 @@ import ( "sync" "sync/atomic" - // first-party. - "github.com/linkall-labs/vanus/observability/tracing" - // this project. "github.com/linkall-labs/vanus/internal/primitive/vanus" "github.com/linkall-labs/vanus/internal/store/block" + "github.com/linkall-labs/vanus/internal/store/io/stream" + "github.com/linkall-labs/vanus/internal/store/io/zone" "github.com/linkall-labs/vanus/internal/store/vsb/codec" "github.com/linkall-labs/vanus/internal/store/vsb/index" ) @@ -64,9 +63,10 @@ type vsBlock struct { dec codec.EntryDecoder lis block.ArchivedListener - f *os.File - wg sync.WaitGroup - tracer *tracing.Tracer + f *os.File + z zone.Interface + s stream.Stream + wg sync.WaitGroup } // Make sure vsBlock implements block.File. @@ -82,12 +82,18 @@ func (b *vsBlock) Close(ctx context.Context) error { m, indexes := b.makeSnapshot() if b.indexOffset != m.writeOffset { - n, err := b.appendIndexEntry(ctx, indexes, m.writeOffset) - if err != nil { + ch := make(chan error) + b.appendIndexEntry(ctx, indexes, func(n int, err error) { + if err != nil { + ch <- err + } + b.indexOffset = m.writeOffset + b.indexLength = n + close(ch) + }) + if err := <-ch; err != nil { return err } - b.indexOffset = m.writeOffset - b.indexLength = n } // Flush metadata. diff --git a/internal/store/vsb/block_append.go b/internal/store/vsb/block_append.go index f4921f3c9..1a04d3136 100644 --- a/internal/store/vsb/block_append.go +++ b/internal/store/vsb/block_append.go @@ -1,5 +1,3 @@ -// Copyright 2022 Linkall Inc. -// // 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 @@ -16,23 +14,30 @@ package vsb import ( // standard libraries. + "bytes" "context" stderr "errors" + stdio "io" "sync/atomic" "time" + // third-party libraries. + "go.opentelemetry.io/otel/trace" + // first-party libraries. "github.com/linkall-labs/vanus/observability/log" - "go.opentelemetry.io/otel/attribute" // this project. "github.com/linkall-labs/vanus/internal/store/block" + "github.com/linkall-labs/vanus/internal/store/io" ceschema "github.com/linkall-labs/vanus/internal/store/schema/ce" "github.com/linkall-labs/vanus/internal/store/vsb/index" - "github.com/linkall-labs/vanus/pkg/errors" ) -var errCorruptedFragment = stderr.New("vsb: corrupted fragment") +var ( + errCorruptedFragment = stderr.New("vsb: corrupted fragment") + dummyReader = stdio.LimitReader(nil, 0) +) type appendContext struct { seq int64 @@ -80,8 +85,9 @@ func (b *vsBlock) NewAppendContext(last block.Fragment) block.AppendContext { func (b *vsBlock) PrepareAppend( ctx context.Context, appendCtx block.AppendContext, entries ...block.Entry, ) ([]int64, block.Fragment, bool, error) { - _, span := b.tracer.Start(ctx, "PrepareAppend") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.vsb.vsBlock.PrepareAppend() Start") + defer span.AddEvent("store.vsb.vsBlock.PrepareAppend() End") actx, _ := appendCtx.(*appendContext) @@ -106,8 +112,9 @@ func (b *vsBlock) PrepareAppend( } func (b *vsBlock) PrepareArchive(ctx context.Context, appendCtx block.AppendContext) (block.Fragment, error) { - _, span := b.tracer.Start(ctx, "PrepareArchive") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.vsb.vsBlock.PrepareArchive() Start") + defer span.AddEvent("store.vsb.vsBlock.PrepareArchive() End") actx, _ := appendCtx.(*appendContext) @@ -121,119 +128,107 @@ func (b *vsBlock) PrepareArchive(ctx context.Context, appendCtx block.AppendCont return frag, nil } -func (b *vsBlock) CommitAppend(ctx context.Context, frags ...block.Fragment) (bool, error) { - ctx, span := b.tracer.Start(ctx, "CommitAppend") - defer span.End() - - frags, err := b.trimFragments(ctx, frags) - if err != nil { - return false, err - } - - if len(frags) == 0 { - return false, nil - } - - if err = b.checkFragments(ctx, frags); err != nil { - return false, err - } - - var sz int - for _, frag := range frags { - sz += frag.Size() - } - data := make([]byte, sz) - base := frags[0].StartOffset() - for _, frag := range frags { - copy(data[frag.StartOffset()-base:], frag.Payload()) - } - - indexes, entryCount, archived, err := b.buildIndexes(ctx, base, data) - if err != nil { - return false, err - } - if !archived && len(indexes) == 0 { - return false, nil - } - - _, wSpan := b.tracer.Start(ctx, "writeFile") - entrySize, err := b.f.WriteAt(data[b.actx.offset-base:], b.actx.offset) - if err != nil { - wSpan.End() - return false, err - } - wSpan.End() - - span.AddEvent("Acquiring lock") - b.mu.Lock() - span.AddEvent("Got lock") - - span.SetAttributes( - attribute.Int("index_count", len(b.indexes)), - attribute.Int("index_capacity", cap(b.indexes)), - ) - - b.indexes = append(b.indexes, indexes...) - b.actx.seq += entryCount - b.actx.offset += int64(entrySize) - if archived { - atomic.StoreUint32(&b.actx.archived, 1) - } +func (b *vsBlock) CommitAppend(ctx context.Context, frag block.Fragment, cb block.CommitAppendCallback) { + span := trace.SpanFromContext(ctx) + span.AddEvent("store.vsb.vsBlock.CommitAppend() Start") + defer span.AddEvent("store.vsb.vsBlock.CommitAppend() End") + + if frag == nil { + b.s.Append(dummyReader, func(n int, err error) { + cb() + }) + return + } + + // TODO(james.yin): get offset from Stream or AppendContext? + off := b.s.WriteOffset() // b.actx.offset + if frag.EndOffset() <= off { + log.Info(ctx, "vsb: data of fragment has been written, skip this entry.", map[string]interface{}{ + "block_id": b.id, + "expected": off, + "fragment_start_offset": frag.StartOffset(), + "fragment_end_offset": frag.EndOffset(), + }) + // TODO(james.yin): invoke callback. + return + } + if frag.StartOffset() != off { + log.Error(ctx, "vsb: missing some fragments.", map[string]interface{}{ + "block_id": b.id, + "expected": off, + "found": frag.StartOffset(), + }) + // TODO(james.yin): invoke callback. + return + } + + indexes, seq, archived, _ := b.buildIndexes(ctx, b.actx.seq, frag) + + b.actx.seq = seq + b.actx.offset = frag.EndOffset() + + if !archived { + b.s.Append(bytes.NewReader(frag.Payload()), func(n int, err error) { + b.mu.Lock() + b.indexes = append(b.indexes, indexes...) + b.mu.Unlock() + + cb() + }) + return + } + + atomic.StoreUint32(&b.actx.archived, 1) + + b.wg.Add(1) + b.s.Append(bytes.NewReader(frag.Payload()), func(n int, err error) { + if len(indexes) != 0 { + b.mu.Lock() + b.indexes = append(b.indexes, indexes...) + b.mu.Unlock() + } - span.AddEvent("Release lock") - b.mu.Unlock() + cb() - if archived { m, i := makeSnapshot(b.actx, b.indexes) - b.wg.Add(1) - go func() { + b.appendIndexEntry(ctx, i, func(n int, err error) { defer b.wg.Done() - if n, err := b.appendIndexEntry(ctx, i, m.writeOffset); err == nil { - b.indexOffset = m.writeOffset - b.indexLength = n - } + b.indexOffset = m.writeOffset + b.indexLength = n _ = b.persistHeader(ctx, m) - }() + }) if b.lis != nil { b.lis.OnArchived(b.stat(m, i)) } - } - - span.SetAttributes( - attribute.Int("entry_count", int(entryCount)), - attribute.Int("entry_size", entrySize), - attribute.Bool("archived", archived)) - - return archived, nil + }) } -func (b *vsBlock) buildIndexes(ctx context.Context, base int64, data []byte) ([]index.Index, int64, bool, error) { - _, span := b.tracer.Start(ctx, "buildIndexes") - defer span.End() +func (b *vsBlock) buildIndexes( + ctx context.Context, expected int64, frag block.Fragment, +) ([]index.Index, int64, bool, error) { + span := trace.SpanFromContext(ctx) + span.AddEvent("store.vsb.vsBlock.buildIndexes() Start") + defer span.AddEvent("store.vsb.vsBlock.buildIndexes() End") - var archived bool - indexes := make([]index.Index, 0, 1) - expected := b.actx.seq + base := frag.StartOffset() + data := frag.Payload() + + var indexes []index.Index for off, sz := 0, len(data); off < sz; { n, entry, _ := b.dec.Unmarshal(data[off:]) - switch seq := ceschema.SequenceNumber(entry); { - case seq == expected: - expected++ - case seq < expected && len(indexes) == 0: - continue - default: + if seq := ceschema.SequenceNumber(entry); seq != expected { return nil, 0, false, errCorruptedFragment } + expected++ if ceschema.EntryType(entry) == ceschema.End { // End entry must be the last. if off+n != sz { return nil, 0, false, errCorruptedFragment } - archived = true - break + return indexes, expected, true, nil } idx := index.NewIndex(base+int64(off), int32(n), index.WithEntry(entry)) @@ -242,74 +237,18 @@ func (b *vsBlock) buildIndexes(ctx context.Context, base int64, data []byte) ([] off += n } - return indexes, expected - b.actx.seq, archived, nil + return indexes, expected, false, nil } -func (b *vsBlock) appendIndexEntry(ctx context.Context, indexes []index.Index, off int64) (int, error) { +func (b *vsBlock) appendIndexEntry(ctx context.Context, indexes []index.Index, cb io.WriteCallback) { entry := index.NewEntry(indexes) sz := b.enc.Size(entry) data := make([]byte, sz) if _, err := b.enc.MarshalTo(ctx, entry, data); err != nil { - return 0, err - } - - if _, err := b.f.WriteAt(data, off); err != nil { - return 0, err - } - - return sz, nil -} - -func (b *vsBlock) trimFragments(ctx context.Context, frags []block.Fragment) ([]block.Fragment, error) { - off := b.actx.offset - for i := 0; i < len(frags); i++ { - switch frag := frags[i]; { - case frag.EndOffset() <= off: - log.Info(ctx, "vsb: data of fragment has been written, skip this entry.", map[string]interface{}{ - "block_id": b.id, - "expected": off, - "fragment_start_offset": frag.StartOffset(), - "fragment_end_offset": frag.EndOffset(), - }) - continue - case frag.StartOffset() > off: - log.Error(ctx, "vsb: missing some fragments.", map[string]interface{}{ - "block_id": b.id, - "expected": off, - "found": frag.StartOffset(), - }) - return nil, errors.ErrInternal - } - if i != 0 { - return frags[i:], nil - } - return frags, nil - } - return nil, nil -} - -func (b *vsBlock) checkFragments(ctx context.Context, frags []block.Fragment) error { - // if firstSo := frags[0].StartOffset(); firstSo > int64(b.actx.offset) { - // log.Error(ctx, "vsb: missing some fragments.", map[string]interface{}{ - // "block_id": b.id, - // "expected": b.actx.offset, - // "found": firstSo, - // }) - // return errors.ErrInternal - // } - - for i := 1; i < len(frags); i++ { - prevEo := frags[i-1].EndOffset() - nextSo := frags[i].StartOffset() - if prevEo != nextSo { - log.Error(ctx, "vsb: fragments is discontinuous.", map[string]interface{}{ - "block_id": b.id, - "next_start_offset": nextSo, - "previous_end_offset": prevEo, - }) - return errors.ErrInternal - } + cb(0, err) + return } - return nil + b.s.Append(bytes.NewReader(data), cb) + // return sz, nil } diff --git a/internal/store/vsb/block_append_test.go b/internal/store/vsb/block_append_test.go index 5eddfe01a..444c0d444 100644 --- a/internal/store/vsb/block_append_test.go +++ b/internal/store/vsb/block_append_test.go @@ -26,6 +26,9 @@ import ( // this project. "github.com/linkall-labs/vanus/internal/store/block" + "github.com/linkall-labs/vanus/internal/store/io/engine/psync" + "github.com/linkall-labs/vanus/internal/store/io/stream" + "github.com/linkall-labs/vanus/internal/store/io/zone/file" cetest "github.com/linkall-labs/vanus/internal/store/schema/ce/testing" "github.com/linkall-labs/vanus/internal/store/vsb/codec" idxtest "github.com/linkall-labs/vanus/internal/store/vsb/index/testing" @@ -33,6 +36,11 @@ import ( ) func TestVSBlock_Append(t *testing.T) { + ctx := context.Background() + + scheduler := stream.NewScheduler(psync.New(), defaultFlushBatchSize, defaultFlushDelayTime) + defer scheduler.Close() + Convey("append context", t, func() { ctrl := NewController(t) defer ctrl.Finish() @@ -83,6 +91,11 @@ func TestVSBlock_Append(t *testing.T) { f, err := os.CreateTemp("", "*.vsb") So(err, ShouldBeNil) + z, err := file.New(f) + So(err, ShouldBeNil) + + s := scheduler.Register(z, headerBlockSize) + dec, _ := codec.NewDecoder(false, codec.IndexSize) b := &vsBlock{ capacity: vsbtest.EntrySize0 + vsbtest.EntrySize1, @@ -93,13 +106,15 @@ func TestVSBlock_Append(t *testing.T) { enc: codec.NewEncoder(), dec: dec, f: f, + s: s, } + ch := make(chan struct{}, 1) Convey("append single entry, commit single fragment", func() { actx := b.NewAppendContext(nil) So(actx, ShouldNotBeNil) - seqs, frag, full, err := b.PrepareAppend(context.Background(), actx, ent0) + seqs, frag, full, err := b.PrepareAppend(ctx, actx, ent0) So(err, ShouldBeNil) So(seqs, ShouldResemble, []int64{0}) So(frag.StartOffset(), ShouldEqual, headerBlockSize) @@ -111,9 +126,10 @@ func TestVSBlock_Append(t *testing.T) { So(stat.EntryNum, ShouldEqual, 0) So(stat.EntrySize, ShouldEqual, 0) - archived, err := b.CommitAppend(context.Background(), frag) - So(err, ShouldBeNil) - So(archived, ShouldBeFalse) + b.CommitAppend(ctx, frag, func() { + ch <- struct{}{} + }) + <-ch stat = b.status() So(stat.Archived, ShouldBeFalse) @@ -123,7 +139,7 @@ func TestVSBlock_Append(t *testing.T) { So(b.indexes, ShouldHaveLength, 1) idxtest.CheckIndex0(b.indexes[0], true) - seqs, frag, full, err = b.PrepareAppend(context.Background(), actx, ent1) + seqs, frag, full, err = b.PrepareAppend(ctx, actx, ent1) So(err, ShouldBeNil) So(seqs, ShouldResemble, []int64{1}) So(frag.StartOffset(), ShouldEqual, headerBlockSize+vsbtest.EntrySize0) @@ -135,51 +151,10 @@ func TestVSBlock_Append(t *testing.T) { So(stat.EntryNum, ShouldEqual, 1) So(stat.EntrySize, ShouldEqual, vsbtest.EntrySize0) - archived, err = b.CommitAppend(context.Background(), frag) - So(err, ShouldBeNil) - So(archived, ShouldBeFalse) - - stat = b.status() - So(stat.Archived, ShouldBeFalse) - So(stat.EntryNum, ShouldEqual, 2) - So(stat.EntrySize, ShouldEqual, vsbtest.EntrySize0+vsbtest.EntrySize1) - - So(b.indexes, ShouldHaveLength, 2) - idxtest.CheckIndex0(b.indexes[0], true) - idxtest.CheckIndex1(b.indexes[1], true) - }) - - Convey("append single entry, commit multiple fragments", func() { - actx := b.NewAppendContext(nil) - So(actx, ShouldNotBeNil) - - seqs, frag0, full, err := b.PrepareAppend(context.Background(), actx, ent0) - So(err, ShouldBeNil) - So(seqs, ShouldResemble, []int64{0}) - So(frag0.StartOffset(), ShouldEqual, headerBlockSize) - So(frag0.Size(), ShouldEqual, vsbtest.EntrySize0) - So(full, ShouldBeFalse) - - stat := b.status() - So(stat.Archived, ShouldBeFalse) - So(stat.EntryNum, ShouldEqual, 0) - So(stat.EntrySize, ShouldEqual, 0) - - seqs, frag1, full, err := b.PrepareAppend(context.Background(), actx, ent1) - So(err, ShouldBeNil) - So(seqs, ShouldResemble, []int64{1}) - So(frag1.StartOffset(), ShouldEqual, headerBlockSize+vsbtest.EntrySize0) - So(frag1.Size(), ShouldEqual, vsbtest.EntrySize1) - So(full, ShouldBeTrue) - - stat = b.status() - So(stat.Archived, ShouldBeFalse) - So(stat.EntryNum, ShouldEqual, 0) - So(stat.EntrySize, ShouldEqual, 0) - - archived, err := b.CommitAppend(context.Background(), frag0, frag1) - So(err, ShouldBeNil) - So(archived, ShouldBeFalse) + b.CommitAppend(ctx, frag, func() { + ch <- struct{}{} + }) + <-ch stat = b.status() So(stat.Archived, ShouldBeFalse) @@ -195,7 +170,7 @@ func TestVSBlock_Append(t *testing.T) { actx := b.NewAppendContext(nil) So(actx, ShouldNotBeNil) - seqs, frag, full, err := b.PrepareAppend(context.Background(), actx, ent0, ent1) + seqs, frag, full, err := b.PrepareAppend(ctx, actx, ent0, ent1) So(err, ShouldBeNil) So(seqs, ShouldResemble, []int64{0, 1}) So(frag.StartOffset(), ShouldEqual, headerBlockSize) @@ -207,9 +182,10 @@ func TestVSBlock_Append(t *testing.T) { So(stat.EntryNum, ShouldEqual, 0) So(stat.EntrySize, ShouldEqual, 0) - archived, err := b.CommitAppend(context.Background(), frag) - So(err, ShouldBeNil) - So(archived, ShouldBeFalse) + b.CommitAppend(ctx, frag, func() { + ch <- struct{}{} + }) + <-ch stat = b.status() So(stat.Archived, ShouldBeFalse) @@ -236,6 +212,8 @@ func TestVSBlock_Append(t *testing.T) { So(n1, ShouldEqual, vsbtest.EntrySize1) cetest.CheckEntry1(entry1, false, true) + scheduler.Unregister(s) + err = f.Close() So(err, ShouldBeNil) err = os.Remove(f.Name()) @@ -253,7 +231,14 @@ func TestVSBlock_Append(t *testing.T) { f, err := os.CreateTemp("", "*.vsb") So(err, ShouldBeNil) + z, err := file.New(f) + So(err, ShouldBeNil) + + s := scheduler.Register(z, headerBlockSize) + defer func() { + scheduler.Unregister(s) + err = f.Close() So(err, ShouldBeNil) err = os.Remove(f.Name()) @@ -271,19 +256,21 @@ func TestVSBlock_Append(t *testing.T) { enc: codec.NewEncoder(), dec: dec, f: f, + s: s, } + ch := make(chan struct{}, 2) actx := b.NewAppendContext(nil) So(actx, ShouldNotBeNil) - seqs, frag0, full, err := b.PrepareAppend(context.Background(), actx, ent0, ent1) + seqs, frag0, full, err := b.PrepareAppend(ctx, actx, ent0, ent1) So(err, ShouldBeNil) So(seqs, ShouldResemble, []int64{0, 1}) So(frag0.StartOffset(), ShouldEqual, vsbtest.EntryOffset0) So(frag0.Size(), ShouldEqual, vsbtest.EntrySize0+vsbtest.EntrySize1) So(full, ShouldBeTrue) - frag1, err := b.PrepareArchive(context.Background(), actx) + frag1, err := b.PrepareArchive(ctx, actx) So(err, ShouldBeNil) So(frag1.StartOffset(), ShouldEqual, vsbtest.EndEntryOffset) @@ -292,9 +279,14 @@ func TestVSBlock_Append(t *testing.T) { So(stat.EntryNum, ShouldEqual, 0) So(stat.EntrySize, ShouldEqual, 0) - archived, err := b.CommitAppend(context.Background(), frag0, frag1) - So(err, ShouldBeNil) - So(archived, ShouldBeTrue) + b.CommitAppend(ctx, frag0, func() { + ch <- struct{}{} + }) + b.CommitAppend(ctx, frag1, func() { + ch <- struct{}{} + }) + <-ch + <-ch stat = b.status() So(stat.Archived, ShouldBeTrue) diff --git a/internal/store/vsb/block_read.go b/internal/store/vsb/block_read.go index caf3df22f..4fad2401b 100644 --- a/internal/store/vsb/block_read.go +++ b/internal/store/vsb/block_read.go @@ -18,9 +18,11 @@ import ( // standard libraries. "context" + // third-party libraries. + "go.opentelemetry.io/otel/trace" + // this project. "github.com/linkall-labs/vanus/internal/store/block" - "github.com/linkall-labs/vanus/pkg/errors" ) // Make sure block implements block.Reader. @@ -28,8 +30,9 @@ var _ block.Reader = (*vsBlock)(nil) // Read date from file. func (b *vsBlock) Read(ctx context.Context, seq int64, num int) ([]block.Entry, error) { - _, span := b.tracer.Start(ctx, "Read") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.vsb.vsBlock.Read() Start") + defer span.AddEvent("store.vsb.vsBlock.Read() End") from, to, num, err := b.entryRange(int(seq), num) if err != nil { @@ -61,9 +64,9 @@ func (b *vsBlock) entryRange(start, num int) (int64, int64, int, error) { if start >= sz { if start == sz && !b.full() { - return -1, -1, 0, errors.ErrOffsetOnEnd + return -1, -1, 0, block.ErrOnEnd } - return -1, -1, 0, errors.ErrOffsetOverflow + return -1, -1, 0, block.ErrExceeded } end := start + num - 1 diff --git a/internal/store/vsb/block_read_test.go b/internal/store/vsb/block_read_test.go index 2cd9b76bc..e94007cdc 100644 --- a/internal/store/vsb/block_read_test.go +++ b/internal/store/vsb/block_read_test.go @@ -25,13 +25,12 @@ import ( . "github.com/smartystreets/goconvey/convey" // this project. - + "github.com/linkall-labs/vanus/internal/store/block" cetest "github.com/linkall-labs/vanus/internal/store/schema/ce/testing" "github.com/linkall-labs/vanus/internal/store/vsb/codec" "github.com/linkall-labs/vanus/internal/store/vsb/index" idxtest "github.com/linkall-labs/vanus/internal/store/vsb/index/testing" vsbtest "github.com/linkall-labs/vanus/internal/store/vsb/testing" - "github.com/linkall-labs/vanus/pkg/errors" ) func TestVSBlock_Read(t *testing.T) { @@ -86,16 +85,16 @@ func TestVSBlock_Read(t *testing.T) { cetest.CheckEntry1(entries[0], false, false) _, err = b.Read(context.Background(), 2, 1) - So(err, ShouldBeError, errors.ErrOffsetOnEnd) + So(err, ShouldBeError, block.ErrOnEnd) _, err = b.Read(context.Background(), 3, 1) - So(err, ShouldBeError, errors.ErrOffsetOverflow) + So(err, ShouldBeError, block.ErrExceeded) Convey("after block is full", func() { b.actx.archived = 1 _, err = b.Read(context.Background(), 2, 1) - So(err, ShouldBeError, errors.ErrOffsetOverflow) + So(err, ShouldBeError, block.ErrExceeded) }) }) } diff --git a/internal/store/vsb/block_seek.go b/internal/store/vsb/block_seek.go index 976a8799b..ff4528b9b 100644 --- a/internal/store/vsb/block_seek.go +++ b/internal/store/vsb/block_seek.go @@ -19,19 +19,22 @@ import ( "context" "sort" + // third-party libraries. + "go.opentelemetry.io/otel/trace" + // this project. "github.com/linkall-labs/vanus/internal/store/block" ceschema "github.com/linkall-labs/vanus/internal/store/schema/ce" "github.com/linkall-labs/vanus/internal/store/vsb/index" - "github.com/linkall-labs/vanus/pkg/errors" ) // Make sure block implements block.Reader. var _ block.Seeker = (*vsBlock)(nil) func (b *vsBlock) Seek(ctx context.Context, index int64, key block.Entry, flag block.SeekKeyFlag) (int64, error) { - _, span := b.tracer.Start(ctx, "Seek") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.vsb.vsBlock.Seek() Start") + defer span.AddEvent("store.vsb.vsBlock.Seek() End") b.mu.RLock() indexes := b.indexes @@ -49,7 +52,7 @@ func (b *vsBlock) Seek(ctx context.Context, index int64, key block.Entry, flag b case block.SeekBeforeKey: return b.seekBeforeKey(ctx, index, key, indexes) default: - return -1, errors.ErrBlockNotSupported + return -1, block.ErrNotSupported } } diff --git a/internal/store/vsb/block_snapshot.go b/internal/store/vsb/block_snapshot.go index c772b06e5..674ddeff7 100644 --- a/internal/store/vsb/block_snapshot.go +++ b/internal/store/vsb/block_snapshot.go @@ -40,7 +40,7 @@ func makeSnapshot(actx appendContext, indexes []index.Index) (meta, []index.Inde writeOffset: actx.offset, archived: actx.Archived(), } - if sz := len(indexes); sz > 0 { + if sz := len(indexes); sz != 0 { m.entryLength = indexes[sz-1].EndOffset() - indexes[0].StartOffset() m.entryNum = int64(sz) } diff --git a/internal/store/vsb/codec/cloud_event.go b/internal/store/vsb/codec/cloud_event.go index f27d5ee83..7637585e3 100644 --- a/internal/store/vsb/codec/cloud_event.go +++ b/internal/store/vsb/codec/cloud_event.go @@ -128,14 +128,7 @@ func (e *ceEntryEncoder) MarshalTo(entry block.Entry, buf []byte) (int, int, err copy(buf[nextAlloc:], val.(string)) nextAlloc += alignment(len(val.(string))) } - } - })) - binary.LittleEndian.PutUint64(buf[:8], bitmap<<16|uint64(extCnt)) - ext.RangeOptionalAttributes(block.OnOptionalAttributeFunc(func(ordinal int, val interface{}) { - switch ordinal { - case ceschema.SequenceNumberOrdinal, ceschema.StimeOrdinal, - ceschema.IDOrdinal, ceschema.SourceOrdinal, ceschema.SpecVersionOrdinal, - ceschema.TypeOrdinal, ceschema.DataOrdinal: + case ceschema.DataOrdinal: default: idx := doValueIndex(bitmap, 1<= offset { - cb(int64(b.fp), nil) - return - } - - fp := b.fp - b.fp = offset - - task := &flushTask{ - writer: writer, - offset: offset, - cb: cb, - } - - p := atomic.LoadPointer(&b.nf) - task.next = (*flushTask)(p) - for !atomic.CompareAndSwapPointer(&b.nf, p, unsafe.Pointer(task)) { - p = atomic.LoadPointer(&b.nf) - task.next = (*flushTask)(p) - } - - if p != nil { - return - } - - b.doFlush(task, base, fp) -} - -func (b *block) doFlush(task *flushTask, base int64, so int) { - offset := task.offset - task.writer.WriteAt(b.buf, base, so, offset, func(_ int, err error) { - if err == nil { - b.cp = offset - } - - p := atomic.LoadPointer(&b.nf) - ft := (*flushTask)(p) - - var last *flushTask - for ft.offset != offset { - last = ft - ft = ft.next - } - - ft.invokeCallback(err) - - if last == nil { - if atomic.CompareAndSwapPointer(&b.nf, p, nil) { - return - } - - // reload - p = atomic.LoadPointer(&b.nf) - last = (*flushTask)(p) - for last.next.offset != offset { - last = last.next - } - } - - // truncate task list - last.next = nil - - go b.doFlush((*flushTask)(p), base, offset) - }) -} - -func (b *block) RecoverFromFile(f *os.File, at int64, committed int) error { - if _, err := f.ReadAt(b.buf, at); err != nil { - return err - } - b.wp = committed - b.fp = committed - b.cp = committed - return nil -} - -type Block struct { - block - // SO is start offset - SO int64 -} - -func (b *Block) WriteOffset() int64 { - return b.SO + int64(b.Size()) -} diff --git a/internal/store/wal/block/block_test.go b/internal/store/wal/block/block_test.go deleted file mode 100644 index a5de38d0a..000000000 --- a/internal/store/wal/block/block_test.go +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright 2022 Linkall Inc. -// -// 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 block - -import ( - // standard libraries. - "math/rand" - "sync" - "sync/atomic" - "testing" - "time" - - // third-party libraries. - . "github.com/smartystreets/goconvey/convey" - - // this project. - "github.com/linkall-labs/vanus/internal/store/io" - "github.com/linkall-labs/vanus/internal/store/wal/record" -) - -const ( - blockSize = 4 * 1024 -) - -func TestBlock(t *testing.T) { - rand.Seed(time.Now().Unix()) - - Convey("wal block", t, func() { - b := Block{ - block: block{ - buf: make([]byte, blockSize), - }, - SO: 4096, - } - - Convey("properties", func() { - So(b.Capacity(), ShouldEqual, blockSize) - So(b.Size(), ShouldEqual, 0) - So(b.Committed(), ShouldEqual, 0) - So(b.Remaining(), ShouldEqual, blockSize) - So(b.Full(), ShouldBeFalse) - So(b.WriteOffset(), ShouldEqual, 4096) - }) - - Convey("append", func() { - dataSize := blockSize - record.HeaderSize*2 + 1 - records := record.Pack(make([]byte, dataSize), dataSize+record.HeaderSize, 0) - r := records[0] - - n, err := b.Append(r) - - So(err, ShouldBeNil) - So(n, ShouldEqual, r.Size()) - So(b.Full(), ShouldBeTrue) - So(b.FullWithOffset(n-1), ShouldBeFalse) - So(b.Committed(), ShouldEqual, 0) - So(b.WriteOffset(), ShouldEqual, 4096+b.Size()) - - Convey("flush", func() { - b.Flush(io.WriteAtFunc(func(b []byte, base int64, so, eo int, cb io.WriteCallback) { - So(b[:n], ShouldResemble, r.Marshal()) - So(base, ShouldEqual, 0) - - cb(len(b), nil) - }), n, 0, func(commit int64, err error) { - So(err, ShouldBeNil) - So(commit, ShouldEqual, n) - }) - - So(b.Committed(), ShouldEqual, n) - - b.Flush(nil, 0, 0, func(commit int64, err error) { - So(err, ShouldBeNil) - So(commit, ShouldEqual, n) - }) - }) - - Convey("partial flush", func() { - type writeTask struct { - so, eo int - cb io.WriteCallback - } - - var flushCount int64 - ch := make(chan writeTask, 16) - doWrite := func() { - for t := range ch { - time.Sleep(time.Duration(rand.Int63n(10)*100) * time.Microsecond) - t.cb(t.eo-t.so, nil) - atomic.AddInt64(&flushCount, 1) - } - } - go doWrite() - go doWrite() - - writer := io.WriteAtFunc(func(b []byte, base int64, so, eo int, cb io.WriteCallback) { - ch <- writeTask{ - so: so, - eo: eo, - cb: cb, - } - }) - - resultC := make(chan int64, 100) - wg := sync.WaitGroup{} - wg.Add(100) - for i := 1; i <= 100; i++ { - time.Sleep(time.Duration(rand.Int63n(100)*10) * time.Microsecond) - b.Flush(writer, i, 0, func(off int64, err error) { - if err == nil { - resultC <- off - } - wg.Done() - }) - } - wg.Wait() - close(ch) - - So(resultC, ShouldHaveLength, 100) - for i := 1; i <= 100; i++ { - So(<-resultC, ShouldEqual, i) - } - So(atomic.LoadInt64(&flushCount), ShouldBeLessThanOrEqualTo, 100) - }) - }) - - Convey("append with too large data", func() { - dataSize := blockSize - record.HeaderSize + 1 - records := record.Pack(make([]byte, dataSize), dataSize+record.HeaderSize, 0) - r := records[0] - - _, err := b.Append(r) - - So(err, ShouldNotBeNil) - }) - }) -} diff --git a/internal/store/wal/config.go b/internal/store/wal/config.go index 64dfceb24..03d05a2ce 100644 --- a/internal/store/wal/config.go +++ b/internal/store/wal/config.go @@ -19,14 +19,14 @@ import ( "time" // this project. - "github.com/linkall-labs/vanus/internal/store/io" + ioengine "github.com/linkall-labs/vanus/internal/store/io/engine" "github.com/linkall-labs/vanus/internal/store/wal/record" ) const ( defaultBlockSize = 4 * 1024 defaultFileSize = 128 * 1024 * 1024 - defaultFlushTimeout = 200 * time.Microsecond + defaultFlushTimeout = 3 * time.Millisecond defaultAppendBufferSize = 64 defaultFlushBufferSize = 64 defaultWakeupBufferSize = defaultFlushBufferSize * 2 @@ -35,17 +35,17 @@ const ( type config struct { pos int64 cb OnEntryCallback - blockSize int64 + blockSize int fileSize int64 flushTimeout time.Duration appendBufferSize int callbackBufferSize int flushBufferSize int wakeupBufferSize int - engine io.Engine + engine ioengine.Interface } -func defaultWALConfig() config { +func defaultConfig() config { cfg := config{ blockSize: defaultBlockSize, fileSize: defaultFileSize, @@ -54,7 +54,6 @@ func defaultWALConfig() config { callbackBufferSize: (defaultBlockSize + record.HeaderSize - 1) / record.HeaderSize, flushBufferSize: defaultFlushBufferSize, wakeupBufferSize: defaultWakeupBufferSize, - engine: defaultIOEngine(), } return cfg } @@ -62,10 +61,13 @@ func defaultWALConfig() config { type Option func(*config) func makeConfig(opts ...Option) config { - cfg := defaultWALConfig() + cfg := defaultConfig() for _, opt := range opts { opt(&cfg) } + if cfg.engine == nil { + cfg.engine = defaultIOEngine() + } return cfg } @@ -81,10 +83,10 @@ func WithRecoveryCallback(cb OnEntryCallback) Option { } } -func WithBlockSize(blockSize int64) Option { +func WithBlockSize(blockSize int) Option { return func(cfg *config) { cfg.blockSize = blockSize - cfg.callbackBufferSize = int((blockSize + record.HeaderSize - 1) / record.HeaderSize) + cfg.callbackBufferSize = (blockSize + record.HeaderSize - 1) / record.HeaderSize } } @@ -124,7 +126,7 @@ func WithWakeupBufferSize(size int) Option { } } -func WithIOEngine(engine io.Engine) Option { +func WithIOEngine(engine ioengine.Interface) Option { return func(cfg *config) { cfg.engine = engine } diff --git a/internal/store/wal/config_linux.go b/internal/store/wal/config_linux.go index 3a129ccbe..b19889d06 100644 --- a/internal/store/wal/config_linux.go +++ b/internal/store/wal/config_linux.go @@ -17,9 +17,13 @@ package wal -import "github.com/linkall-labs/vanus/internal/store/io" +import ( + // this project. + "github.com/linkall-labs/vanus/internal/store/io/engine" + "github.com/linkall-labs/vanus/internal/store/io/engine/psync" +) -func defaultIOEngine() io.Engine { - // return io.NewURing() - return io.NewEngine() +func defaultIOEngine() engine.Interface { + // return uring.New() + return psync.New() } diff --git a/internal/store/wal/config_other.go b/internal/store/wal/config_other.go index 81016eb33..35e0cd6b8 100644 --- a/internal/store/wal/config_other.go +++ b/internal/store/wal/config_other.go @@ -17,8 +17,12 @@ package wal -import "github.com/linkall-labs/vanus/internal/store/io" +import ( + // this project. + "github.com/linkall-labs/vanus/internal/store/io/engine" + "github.com/linkall-labs/vanus/internal/store/io/engine/psync" +) -func defaultIOEngine() io.Engine { - return io.NewEngine() +func defaultIOEngine() engine.Interface { + return psync.New() } diff --git a/internal/store/wal/config_test.go b/internal/store/wal/config_test.go index 192f61525..719075dec 100644 --- a/internal/store/wal/config_test.go +++ b/internal/store/wal/config_test.go @@ -23,12 +23,14 @@ import ( . "github.com/smartystreets/goconvey/convey" // this project. - "github.com/linkall-labs/vanus/internal/store/io" + "github.com/linkall-labs/vanus/internal/store/io/engine/psync" ) func TestConfig(t *testing.T) { Convey("wal config", t, func() { - engine := io.NewEngine() + engine := psync.New() + defer engine.Close() + cfg := makeConfig( FromPosition(1024), WithBlockSize(1024), diff --git a/internal/store/wal/file.go b/internal/store/wal/file.go deleted file mode 100644 index 72bc779b7..000000000 --- a/internal/store/wal/file.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2022 Linkall Inc. -// -// 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 wal - -import ( - // standard libraries. - "fmt" - "os" - "path/filepath" - - // this project. - "github.com/linkall-labs/vanus/internal/store/io" -) - -const logFileExt = ".log" - -type logFile struct { - // so is the start offset of the log file. - so int64 - // eo is the end offset of the log file. - eo int64 - - size int64 - path string - - f *os.File -} - -func newLogFile(path string, so int64, size int64, f *os.File) *logFile { - return &logFile{ - so: so, - eo: so + size, - size: size, - path: path, - f: f, - } -} - -func (l *logFile) Close() error { - if l.f == nil { - return nil - } - if err := l.f.Close(); err != nil { - return err - } - l.f = nil - return nil -} - -func (l *logFile) Open(wronly bool) error { - if l.f != nil { - return nil - } - f, err := io.OpenFile(l.path, wronly, true) - if err != nil { - return err - } - l.f = f - return nil -} - -func (l *logFile) WriteAt(e io.Engine, b []byte, off int64, so, eo int, cb io.WriteCallback) { - if off < l.so { - panic("underflow") - } - if off+int64(len(b)) > l.eo { - panic("overflow") - } - - e.WriteAt(l.f, b, off-l.so, so, eo, cb) -} - -func createLogFile(dir string, so, size int64, sync bool) (*logFile, error) { - path := filepath.Join(dir, fmt.Sprintf("%020d%s", so, logFileExt)) - f, err := io.CreateFile(path, size, true, sync) - if err != nil { - return nil, err - } - return newLogFile(path, so, size, f), nil -} diff --git a/internal/store/wal/record/packing.go b/internal/store/wal/record/packing.go index c690c73ae..04b4d5487 100644 --- a/internal/store/wal/record/packing.go +++ b/internal/store/wal/record/packing.go @@ -14,10 +14,15 @@ package record -func Pack(entry []byte, firstSize, otherSize int) []Record { +func Pack(entry []byte, firstSize, otherSize int) ([]Record, int) { num := calPacketNum(entry, firstSize, otherSize) if num == 1 { - return []Record{makePacket(Full, entry)} + packet := makePacket(Full, entry) + padding := firstSize - packet.Size() + if padding > HeaderSize { + padding = 0 + } + return []Record{packet}, padding } packets := make([]Record, 0, num) @@ -34,9 +39,15 @@ func Pack(entry []byte, firstSize, otherSize int) []Record { } // last packet - packets = append(packets, makePacket(Last, entry[fo:])) + last := makePacket(Last, entry[fo:]) + packets = append(packets, last) - return packets + padding := otherSize - last.Size() + if padding > HeaderSize { + padding = 0 + } + + return packets, padding } func calPacketNum(entry []byte, firstSize, otherSize int) int { diff --git a/internal/store/wal/record/packing_test.go b/internal/store/wal/record/packing_test.go index 3bf286b0c..0a5e1a3c2 100644 --- a/internal/store/wal/record/packing_test.go +++ b/internal/store/wal/record/packing_test.go @@ -29,8 +29,19 @@ const ( func TestPack(t *testing.T) { Convey("pack with enough space in first block", t, func() { - records := Pack(rawData, blockSize, blockSize) - So(len(records), ShouldEqual, 1) + records, padding := Pack(rawData, blockSize, blockSize) + So(records, ShouldHaveLength, 1) + So(padding, ShouldEqual, 0) + r0 := &records[0] + So(r0.Type, ShouldEqual, Full) + So(r0.Length, ShouldEqual, len(rawData)) + So(bytes.Equal(r0.Data, rawData), ShouldBeTrue) + }) + + Convey("pack with just enough space in first block", t, func() { + records, padding := Pack(rawData, HeaderSize*2+len(rawData), blockSize) + So(records, ShouldHaveLength, 1) + So(padding, ShouldEqual, HeaderSize) r0 := &records[0] So(r0.Type, ShouldEqual, Full) So(r0.Length, ShouldEqual, len(rawData)) @@ -38,8 +49,9 @@ func TestPack(t *testing.T) { }) Convey("pack with not enough space in first block", t, func() { - records := Pack(rawData, HeaderSize+1, blockSize) - So(len(records), ShouldEqual, 2) + records, padding := Pack(rawData, HeaderSize+1, blockSize) + So(records, ShouldHaveLength, 2) + So(padding, ShouldEqual, 0) r0 := &records[0] So(r0.Type, ShouldEqual, First) So(r0.Length, ShouldEqual, 1) @@ -51,8 +63,9 @@ func TestPack(t *testing.T) { }) Convey("pack with no space in first block", t, func() { - records := Pack(rawData, HeaderSize, blockSize) - So(len(records), ShouldEqual, 2) + records, padding := Pack(rawData, HeaderSize, blockSize) + So(records, ShouldHaveLength, 2) + So(padding, ShouldEqual, 0) r0 := &records[0] So(r0.Type, ShouldEqual, First) So(r0.Length, ShouldEqual, 0) @@ -70,8 +83,9 @@ func TestPack(t *testing.T) { } bigData := []byte(str) - records := Pack(bigData, blockSize, blockSize) - So(len(records), ShouldEqual, 3) + records, padding := Pack(bigData, blockSize, blockSize) + So(records, ShouldHaveLength, 3) + So(padding, ShouldEqual, 0) r0 := &records[0] So(r0.Type, ShouldEqual, First) So(r0.Length, ShouldEqual, blockSize-HeaderSize) diff --git a/internal/store/wal/recovery.go b/internal/store/wal/recovery.go index b39d93edb..a30c9d9bb 100644 --- a/internal/store/wal/recovery.go +++ b/internal/store/wal/recovery.go @@ -16,123 +16,188 @@ package wal import ( // standard libraries. + "bytes" "context" - "os" - "path/filepath" - "strconv" + "errors" // third-party project. - "go.opentelemetry.io/otel/trace" + "github.com/ncw/directio" // first-party project. "github.com/linkall-labs/vanus/observability/log" - "github.com/linkall-labs/vanus/observability/tracing" -) -const ( - defaultDirPerm = 0o755 + // this project. + "github.com/linkall-labs/vanus/internal/store/io/zone/segmentedfile" + "github.com/linkall-labs/vanus/internal/store/wal/record" ) -// recoverLogStream rebuilds log stream from specified directory. -func recoverLogStream(ctx context.Context, dir string, cfg config) (*logStream, error) { - // Make sure the WAL directory exists. - if err := os.MkdirAll(dir, defaultDirPerm); err != nil { - return nil, err - } +type OnEntryCallback = func(entry []byte, r Range) error - files, err := scanLogFiles(ctx, dir, cfg.blockSize) - if err != nil { - return nil, err - } +var ( + ErrOutOfRange = errors.New("WAL: out of range") + errEndOfLog = errors.New("WAL: end of log") +) - stream := &logStream{ - stream: files, - dir: dir, - blockSize: cfg.blockSize, - fileSize: cfg.fileSize, - tracer: tracing.NewTracer("store.wal.logStream", trace.SpanKindInternal), +func scanLogEntries(sf *segmentedfile.SegmentedFile, blockSize int, from int64, cb OnEntryCallback) (int64, error) { + s := sf.SelectSegment(from, false) + if s == nil { + if from == 0 { + return 0, nil + } + return -1, ErrOutOfRange } - return stream, nil -} -func scanLogFiles(ctx context.Context, dir string, blockSize int64) (stream []*logFile, err error) { - files, err := os.ReadDir(dir) - if err != nil { - return nil, err + sc := scanner{ + blockSize: int64(blockSize), + buf: directio.AlignedBlock(blockSize), + buffer: bytes.NewBuffer(nil), + last: record.Zero, + eo: from, + from: from, + cb: cb, } - files = filterRegularLog(files) - - // Rebuild log stream. - var discards []*logFile - var last *logFile - for _, file := range files { - filename := file.Name() - so, err2 := strconv.ParseInt(filename[:len(filename)-len(logFileExt)], 10, 64) - if err2 != nil { - return nil, err2 + + for { + err := sc.scanSegmentFile(s) + if err == nil { + s = sf.SelectSegment(s.EO(), false) + if s == nil { + break + } + continue } - if last != nil { - // discontinuous log file - if so != last.eo { - log.Warning(ctx, "Discontinuous log file, discard before.", + if errors.Is(err, errEndOfLog) { + // TODO(james.yin): has empty log file(s). + // if i != len(s.stream)-1 { + // panic("has empty log file") + // } + + // TODO(james.yin): Has incomplete entry, truncate it. + if sc.last.IsNonTerminal() { + log.Info(context.Background(), "Found incomplete entry, truncate it.", map[string]interface{}{ - "last_end": last.eo, - "next_start": so, + "last_type": sc.last, }) - discards = append(discards, stream...) - stream = nil } - } - info, err2 := file.Info() - if err2 != nil { - return nil, err2 + return sc.eo, nil } - path := filepath.Join(dir, filename) - size := info.Size() - - if size%blockSize != 0 { - // TODO(james.yin): return error - truncated := size - size%blockSize - log.Warning(context.Background(), "The size of log file is not a multiple of blockSize, truncate it.", - map[string]interface{}{ - "file": path, - "origin_size": size, - "new_size": truncated, - }) - size = truncated + return -1, err + } + + return 0, nil +} + +type scanner struct { + blockSize int64 + buf []byte + buffer *bytes.Buffer + last record.Type + eo int64 // end offset of entry + from int64 + cb OnEntryCallback +} + +func (sc *scanner) scanSegmentFile(s *segmentedfile.Segment) (err error) { + f := s.File() + for at := sc.firstBlockOffset(s); at < s.Size(); at += sc.blockSize { + if _, err = f.ReadAt(sc.buf, at); err != nil { + return err } - last = newLogFile(path, so, size, nil) - stream = append(stream, last) - } + bso := s.SO() + at + for so := sc.firstRecordOffset(bso); so <= sc.blockSize-record.HeaderSize; { + r, err2 := record.Unmarshal(sc.buf[so:]) + if err2 != nil { + // TODO(james.yin): handle parse error + err = err2 + return + } - // Delete discard files. - for _, f := range discards { - _ = os.Remove(f.path) + // no new record + if r.Type == record.Zero { + err = errEndOfLog + return + } + + // TODO(james.yin): check crc + + sz := int64(r.Size()) + reo := bso + so + sz + if err = onRecord(sc, r, reo); err != nil { + return err + } + so += sz + } } - return stream, nil + return nil } -func filterRegularLog(entries []os.DirEntry) []os.DirEntry { - if len(entries) == 0 { - return entries +func (sc *scanner) firstBlockOffset(s *segmentedfile.Segment) int64 { + if s.SO() < sc.from { + if s.EO() <= sc.from { + panic("WAL: so is out of range.") + } + off := sc.from - s.SO() + off -= off % sc.blockSize + return off } + return 0 +} - n := 0 - for _, entry := range entries { - if !entry.Type().IsRegular() { - continue +func (sc *scanner) firstRecordOffset(so int64) int64 { + if so < sc.from { + if sc.from-so >= sc.blockSize { + panic("WAL: so is out of range.") } - if filepath.Ext(entry.Name()) != logFileExt { - continue + return sc.from % sc.blockSize + } + return 0 +} + +func onRecord(ctx *scanner, r record.Record, eo int64) error { + switch r.Type { + case record.Full: + if !ctx.last.IsTerminal() && ctx.last != record.Zero { + // TODO(james.yin): unexpected state + panic("WAL: unexpected state") + } + if err := ctx.cb(r.Data, Range{SO: ctx.eo, EO: eo}); err != nil { + return err + } + case record.First: + if !ctx.last.IsTerminal() && ctx.last != record.Zero { + // TODO(james.yin): unexpected state + panic("WAL: unexpected state") + } + ctx.buffer.Write(r.Data) + case record.Middle: + if !ctx.last.IsNonTerminal() { + // TODO(james.yin): unexpected state + panic("WAL: unexpected state") + } + ctx.buffer.Write(r.Data) + case record.Last: + if !ctx.last.IsNonTerminal() { + // TODO(james.yin): unexpected state + panic("WAL: unexpected state") } - entries[n] = entry - n++ + ctx.buffer.Write(r.Data) + if err := ctx.cb(ctx.buffer.Bytes(), Range{SO: ctx.eo, EO: eo}); err != nil { + return err + } + ctx.buffer.Reset() + case record.Zero: + panic("WAL: unexpected state") + } + + ctx.last = r.Type + if ctx.last.IsTerminal() { + ctx.eo = eo } - entries = entries[:n] - return entries + + return nil } diff --git a/internal/store/wal/recovery_test.go b/internal/store/wal/recovery_test.go index edbd66576..0ba59825a 100644 --- a/internal/store/wal/recovery_test.go +++ b/internal/store/wal/recovery_test.go @@ -15,8 +15,8 @@ package wal import ( - stdCtx "context" // standard libraries. + "context" "os" "testing" @@ -25,13 +25,15 @@ import ( ) func TestOpen(t *testing.T) { + ctx := context.Background() + Convey("open wal in recover mode", t, func() { walDir, err := os.MkdirTemp("", "wal-*") So(err, ShouldBeNil) Convey("create empty wal", func() { var entryNum int - wal, err := Open(stdCtx.Background(), walDir, WithRecoveryCallback(func(entry []byte, r Range) error { + wal, err := Open(ctx, walDir, WithRecoveryCallback(func(entry []byte, r Range) error { entryNum++ return nil }), WithFileSize(fileSize)) @@ -45,16 +47,16 @@ func TestOpen(t *testing.T) { }) Convey("recover wal", func() { - wal, err := Open(stdCtx.Background(), walDir, WithFileSize(fileSize)) + wal, err := Open(ctx, walDir, WithFileSize(fileSize)) So(err, ShouldBeNil) - wal.AppendOne(stdCtx.Background(), data0).Wait() - wal.AppendOne(stdCtx.Background(), data1).Wait() + wal.AppendOne(ctx, data0).Wait() + wal.AppendOne(ctx, data1).Wait() wal.Close() wal.Wait() Convey("recover entire wal", func() { entries := make([][]byte, 0, 2) - wal, err = Open(stdCtx.Background(), walDir, WithRecoveryCallback(func(entry []byte, r Range) error { + wal, err = Open(ctx, walDir, WithRecoveryCallback(func(entry []byte, r Range) error { entries = append(entries, entry) return nil }), WithFileSize(fileSize)) @@ -70,7 +72,7 @@ func TestOpen(t *testing.T) { Convey("recover wal with compacted", func() { entries := make([][]byte, 0, 1) - wal, err = Open(stdCtx.Background(), walDir, FromPosition(10), WithRecoveryCallback(func(entry []byte, r Range) error { + wal, err = Open(ctx, walDir, FromPosition(10), WithRecoveryCallback(func(entry []byte, r Range) error { entries = append(entries, entry) return nil }), WithFileSize(fileSize)) @@ -87,14 +89,14 @@ func TestOpen(t *testing.T) { Convey("recover large data", func() { data := make([]byte, fileSize) - wal, err := Open(stdCtx.Background(), walDir, WithFileSize(fileSize)) + wal, err := Open(ctx, walDir, WithFileSize(fileSize)) So(err, ShouldBeNil) - wal.AppendOne(stdCtx.Background(), data).Wait() + wal.AppendOne(ctx, data).Wait() wal.Close() wal.Wait() entries := make([][]byte, 0, 1) - wal, err = Open(stdCtx.Background(), walDir, WithRecoveryCallback(func(entry []byte, r Range) error { + wal, err = Open(ctx, walDir, WithRecoveryCallback(func(entry []byte, r Range) error { entries = append(entries, entry) return nil }), WithFileSize(fileSize)) diff --git a/internal/store/wal/stream.go b/internal/store/wal/stream.go deleted file mode 100644 index 46424c9dd..000000000 --- a/internal/store/wal/stream.go +++ /dev/null @@ -1,371 +0,0 @@ -// Copyright 2022 Linkall Inc. -// -// 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 wal - -import ( - // standard libraries. - "bytes" - "context" - stderr "errors" - "os" - "sort" - "sync" - - // third-party libraries. - "github.com/ncw/directio" - - // first-party libraries. - "github.com/linkall-labs/vanus/observability/log" - "github.com/linkall-labs/vanus/observability/tracing" - "github.com/linkall-labs/vanus/pkg/errors" - - // this project. - "github.com/linkall-labs/vanus/internal/store/io" - "github.com/linkall-labs/vanus/internal/store/wal/record" -) - -var ( - ErrOutOfRange = stderr.New("WAL: out of range") - errEndOfLog = stderr.New("WAL: end of log") -) - -type OnEntryCallback func(entry []byte, r Range) error - -type logStream struct { - stream []*logFile - dir string - blockSize int64 - fileSize int64 - mu sync.RWMutex - tracer *tracing.Tracer -} - -func (s *logStream) Close(ctx context.Context) { - for _, f := range s.stream { - if err := f.Close(); err != nil { - log.Error(ctx, "Close log file failed.", map[string]interface{}{ - "path": f.path, - log.KeyError: err, - }) - } - } -} - -func (s *logStream) firstFile() *logFile { - return s.stream[0] -} - -func (s *logStream) lastFile() *logFile { - return s.stream[len(s.stream)-1] -} - -func (s *logStream) selectFile(ctx context.Context, offset int64, autoCreate bool) *logFile { - ctx, span := s.tracer.Start(ctx, "selectFile") - defer span.End() - - s.mu.RLock() - - sz := len(s.stream) - if sz == 0 { - s.mu.RUnlock() - - if offset == 0 { - if !autoCreate { - return nil - } - return s.createNextFile(ctx, nil) - } - panic("log stream not begin from 0") - } - - // Fast return for append. - if last := s.lastFile(); offset >= last.so { - s.mu.RUnlock() - - if offset < last.eo { - return last - } - if offset == last.eo { - if !autoCreate { - return nil - } - return s.createNextFile(ctx, last) - } - panic("log stream overflow") - } - - defer s.mu.RUnlock() - - first := s.firstFile() - if offset < first.so { - panic("log stream underflow") - } - - i := sort.Search(sz-1, func(i int) bool { - return s.stream[i].eo > offset - }) - if i < len(s.stream)-1 { - return s.stream[i] - } - - panic("unreachable") -} - -func (s *logStream) createNextFile(ctx context.Context, last *logFile) *logFile { - _, span := s.tracer.Start(ctx, "createNextFile") - defer span.End() - - var off int64 - if last != nil { - off = last.eo - } - - next, err := createLogFile(s.dir, off, s.fileSize, true) - if err != nil { - panic(err) - } - - s.mu.Lock() - defer s.mu.Unlock() - s.stream = append(s.stream, next) - - return next -} - -type scanContext struct { - buf []byte - buffer *bytes.Buffer - last record.Type - eo int64 // end offset of entry - from int64 - cb OnEntryCallback -} - -func (s *logStream) Range(ctx context.Context, from int64, cb OnEntryCallback) (int64, error) { - if len(s.stream) == 0 { - if from == 0 { - return 0, nil - } - return -1, ErrOutOfRange - } - if from < s.firstFile().so || from > s.lastFile().eo { - return -1, ErrOutOfRange - } - - sCtx := scanContext{ - buf: directio.AlignedBlock(int(s.blockSize)), - buffer: bytes.NewBuffer(nil), - last: record.Zero, - eo: from, - from: from, - cb: cb, - } - - for i, f := range s.stream { - // log file is compacted, skip. - if f.eo <= from { - continue - } - - err := s.scanFile(ctx, &sCtx, f) - if err == nil { - continue - } - - if stderr.Is(err, errEndOfLog) { - // TODO(james.yin): has empty log file(s). - if i != len(s.stream)-1 { - panic("has empty log file") - } - - // TODO(james.yin): Has incomplete entry, truncate it. - if sCtx.last.IsNonTerminal() { - log.Info(context.Background(), "Found incomplete entry, truncate it.", - map[string]interface{}{ - "last_type": sCtx.last, - }) - } - - return sCtx.eo, nil - } - - return -1, err - } - - panic("WAL: no zero record, the WAL is incomplete.") -} - -func (s *logStream) scanFile(ctx context.Context, sCtx *scanContext, lf *logFile) (err error) { - _, span := s.tracer.Start(ctx, "scanFile") - defer span.End() - - f, err := io.OpenFile(lf.path, false, false) - if err != nil { - return err - } - - defer func() { - if err2 := f.Close(); err2 != nil { - log.Error(context.Background(), "Close file failed.", map[string]interface{}{ - "path": lf.path, - log.KeyError: err2, - }) - err = errors.Chain(err, err2) - } - }() - - for at := s.firstBlockOffset(lf.so, lf.size, sCtx.from); at < lf.size; at += s.blockSize { - if _, err = f.ReadAt(sCtx.buf, at); err != nil { - return err - } - - bso := lf.so + at - for so := s.firstRecordOffset(lf.so+at, sCtx.from); so <= s.blockSize-record.HeaderSize; { - r, err2 := record.Unmarshal(sCtx.buf[so:]) - if err2 != nil { - // TODO(james.yin): handle parse error - err = err2 - return - } - - // no new record - if r.Type == record.Zero { - err = errEndOfLog - return - } - - // TODO(james.yin): check crc - - sz := int64(r.Size()) - reo := bso + so + sz - if err = onRecord(sCtx, r, reo); err != nil { - return err - } - so += sz - } - } - - return nil -} - -func onRecord(ctx *scanContext, r record.Record, eo int64) error { - switch r.Type { - case record.Full: - if !ctx.last.IsTerminal() && ctx.last != record.Zero { - // TODO(james.yin): unexcepted state - panic("WAL: unexcepted state") - } - if err := ctx.cb(r.Data, Range{SO: ctx.eo, EO: eo}); err != nil { - return err - } - case record.First: - if !ctx.last.IsTerminal() && ctx.last != record.Zero { - // TODO(james.yin): unexcepted state - panic("WAL: unexcepted state") - } - ctx.buffer.Write(r.Data) - case record.Middle: - if !ctx.last.IsNonTerminal() { - // TODO(james.yin): unexcepted state - panic("WAL: unexcepted state") - } - ctx.buffer.Write(r.Data) - case record.Last: - if !ctx.last.IsNonTerminal() { - // TODO(james.yin): unexcepted state - panic("WAL: unexcepted state") - } - ctx.buffer.Write(r.Data) - if err := ctx.cb(ctx.buffer.Bytes(), Range{SO: ctx.eo, EO: eo}); err != nil { - return err - } - ctx.buffer.Reset() - case record.Zero: - panic("WAL: unexcepted state") - } - - ctx.last = r.Type - if ctx.last.IsTerminal() { - ctx.eo = eo - } - - return nil -} - -func (s *logStream) firstBlockOffset(so, size, from int64) int64 { - if so < from { - if so+size <= from { - panic("WAL: so is out of range.") - } - off := from - so - off -= off % s.blockSize - return off - } - return 0 -} - -func (s *logStream) firstRecordOffset(so, from int64) int64 { - if so < from { - if from-so >= s.blockSize { - panic("WAL: so is out of range.") - } - return from % s.blockSize - } - return 0 -} - -// compact compacts all log files whose end offset is not after off. -func (s *logStream) compact(ctx context.Context, off int64) error { - _, span := s.tracer.Start(ctx, "compact") - defer span.End() - - var compacted []*logFile - defer func() { - if compacted != nil { - go doCompact(compacted) - } - }() - - span.AddEvent("Acquiring lock") - s.mu.Lock() - span.AddEvent("Got lock") - - defer s.mu.Unlock() - - sz := len(s.stream) - if sz <= 1 { - return nil - } - - for i, f := range s.stream[:sz-1] { - if f.eo > off { - if i > 0 { - compacted = s.stream[:i] - s.stream = s.stream[i:] - } - return nil - } - } - compacted = s.stream[:sz-1] - s.stream = s.stream[sz-1:] - return nil -} - -func doCompact(files []*logFile) { - for _, f := range files { - _ = f.Close() - _ = os.Remove(f.path) - } -} diff --git a/internal/store/wal/wal.go b/internal/store/wal/wal.go index c9efcec88..e187b4615 100644 --- a/internal/store/wal/wal.go +++ b/internal/store/wal/wal.go @@ -19,20 +19,22 @@ import ( "context" "errors" "sync" - "time" // third-party project. - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" // first-party project. - "github.com/linkall-labs/vanus/observability/metrics" + "github.com/linkall-labs/vanus/observability/log" "github.com/linkall-labs/vanus/observability/tracing" // this project. - "github.com/linkall-labs/vanus/internal/store/io" - "github.com/linkall-labs/vanus/internal/store/wal/block" - "github.com/linkall-labs/vanus/internal/store/wal/record" + "github.com/linkall-labs/vanus/internal/store/io/engine" + "github.com/linkall-labs/vanus/internal/store/io/stream" + "github.com/linkall-labs/vanus/internal/store/io/zone/segmentedfile" +) + +const ( + logFileExt = ".log" ) var ( @@ -77,36 +79,27 @@ func WithCallback(callback AppendCallback) AppendOption { } } -type flushTask struct { - ctx context.Context - block *block.Block - offset int - own bool -} - type callbackTask struct { - ctx context.Context - callback AppendCallback - ranges []Range - threshold int64 + ctx context.Context + callback AppendCallback + ranges []Range } // WAL is write-ahead log. type WAL struct { - allocator *block.Allocator - // wb is the block currently being written to. - wb *block.Block + sf *segmentedfile.SegmentedFile + s stream.Stream + + engine engine.Interface + scheduler stream.Scheduler - stream *logStream - engine io.Engine + blockSize int appendC chan appendTask callbackC chan callbackTask - flushC chan flushTask - wakeupC chan int64 - closeMu sync.RWMutex - flushWg sync.WaitGroup + closeMu sync.RWMutex + appendWg sync.WaitGroup closeC chan struct{} doneC chan struct{} @@ -122,64 +115,49 @@ func Open(ctx context.Context, dir string, opts ...Option) (*WAL, error) { } func open(ctx context.Context, dir string, cfg config) (*WAL, error) { - stream, err := recoverLogStream(ctx, dir, cfg) + log.Info(ctx, "Open wal.", map[string]interface{}{ + "dir": dir, + "pos": cfg.pos, + }) + + sf, err := segmentedfile.Open(dir, segmentedfile.WithExtension(logFileExt), + segmentedfile.WithSegmentSize(cfg.fileSize)) if err != nil { return nil, err } // Check wal entries from pos. - off, err := stream.Range(ctx, cfg.pos, cfg.cb) + off, err := scanLogEntries(sf, cfg.blockSize, cfg.pos, cfg.cb) if err != nil { return nil, err } - // Start offset of writable block. - so := off - so -= off % cfg.blockSize + scheduler := stream.NewScheduler(cfg.engine, cfg.blockSize, cfg.flushTimeout) + s := scheduler.Register(sf, off) w := &WAL{ - allocator: block.NewAllocator(int(cfg.blockSize), so), - stream: stream, + sf: sf, + s: s, + engine: cfg.engine, + scheduler: scheduler, + blockSize: cfg.blockSize, + appendC: make(chan appendTask, cfg.appendBufferSize), callbackC: make(chan callbackTask, cfg.callbackBufferSize), - flushC: make(chan flushTask, cfg.flushBufferSize), - wakeupC: make(chan int64, cfg.wakeupBufferSize), closeC: make(chan struct{}), doneC: make(chan struct{}), tracer: tracing.NewTracer("store.wal.walog", trace.SpanKindInternal), } - w.wb = w.allocator.Next() - - // Recover write block - if off > 0 { - f := w.stream.selectFile(ctx, w.wb.SO, false) - if f == nil { - return nil, ErrNotFoundLogFile - } - if err := f.Open(false); err != nil { - return nil, err - } - if err := w.wb.RecoverFromFile(f.f, w.wb.SO-f.so, int(off-w.wb.SO)); err != nil { - return nil, err - } - if w.wb.Full() { - // switch to next block - w.allocator.Free(w.wb) - w.wb = w.allocator.Next() - } - } - go w.runCallback() //nolint:contextcheck // wrong advice - go w.runFlush() - go w.runAppend(cfg.flushTimeout) + go w.runAppend() return w, nil } func (w *WAL) Dir() string { - return w.stream.dir + return w.sf.Dir() } func (w *WAL) Close() { @@ -190,15 +168,13 @@ func (w *WAL) Close() { case <-w.closeC: default: close(w.closeC) + close(w.appendC) } } func (w *WAL) doClose() { - ctx, span := w.tracer.Start(context.Background(), "doClose") - defer span.End() - w.engine.Close() - w.stream.Close(ctx) + w.sf.Close() close(w.doneC) } @@ -229,8 +205,9 @@ func (f AppendFuture) Wait() ([]Range, error) { // Append appends entries to WAL. func (w *WAL) Append(ctx context.Context, entries [][]byte, opts ...AppendOption) AppendFuture { - _, span := w.tracer.Start(ctx, "Append") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("store.wal.WAL.Append() Start") + defer span.AddEvent("store.wal.WAL.Append() End") task := appendTask{ ctx: ctx, @@ -271,267 +248,29 @@ func (w *WAL) Append(ctx context.Context, entries [][]byte, opts ...AppendOption return ch } -func (w *WAL) runAppend(flushTimeout time.Duration) { - // Create flush timer. - timer := time.NewTimer(flushTimeout) - running, waiting := true, false - var start time.Time - - aCtx := context.Background() - for { - select { - case task := <-w.appendC: - aCtx = task.ctx - full, goahead := w.doAppend(aCtx, task.entries, task.callback) - switch { - case full || !task.batching: - if !full { - w.flushWritableBlock(aCtx, false) - } - // stop timer - trace.SpanFromContext(aCtx).AddEvent("Discard flush timer") - waiting = false - case goahead || !waiting: - // reset timer - waiting = true - start = time.Now() - if !running { - trace.SpanFromContext(aCtx).AddEvent("Start flush timer") - timer.Reset(flushTimeout) - running = true - } - } - case <-timer.C: - // timer stopped - if !waiting { - running = false - break - } - - d := time.Since(start) - if d < flushTimeout { - timer.Reset(flushTimeout - d) - break - } - - // timeout, flush - w.flushWritableBlock(aCtx, true) - waiting = false - running = false - case <-w.closeC: - if running { - timer.Stop() - } - // flush, then stop - if waiting { - w.flushWritableBlock(aCtx, false) - } - close(w.flushC) - return - } - } -} - -func (w *WAL) flushWritableBlock(ctx context.Context, timeout bool) { - span := trace.SpanFromContext(ctx) - - span.AddEvent("Publishing flush task", trace.WithAttributes(attribute.Bool("timeout", timeout))) - w.flushC <- flushTask{ - ctx: ctx, - block: w.wb, - offset: w.wb.Size(), - own: false, - } - span.AddEvent("Notified flush task") -} - -// doAppend writes entries to block(s). And return two flags: full and goahead. -// The full flag indicate last written block is full, and the -// goahead flag indicate switching to a new block. -func (w *WAL) doAppend(ctx context.Context, entries [][]byte, callback AppendCallback) (bool, bool) { - _, span := w.tracer.Start(ctx, "doAppend") - defer span.End() - - var entrySize, recordCount, recordSize int - - var full, goahead bool - ranges := make([]Range, len(entries)) - for i, entry := range entries { - ranges[i].SO = w.wb.WriteOffset() - records := record.Pack(entry, w.wb.Remaining(), w.allocator.BlockSize()) - for j, record := range records { - n, err := w.wb.Append(record) - if err != nil { - callback(Result{nil, err}) - return full, goahead - } - if j == len(records)-1 { - offset := w.wb.SO + int64(n) - ranges[i].EO = offset - if i == len(entries)-1 { - // register callback - w.callbackC <- callbackTask{ - ctx: ctx, - callback: callback, - ranges: ranges, - threshold: offset, - } - } - } - if full = w.wb.FullWithOffset(n); full { - // notify to flush - span.AddEvent("Publishing flush task", - trace.WithAttributes(attribute.Bool("timeout", false))) - w.flushC <- flushTask{ - ctx: ctx, - block: w.wb, - offset: w.wb.Capacity(), - own: true, - } - span.AddEvent("Notified flush task") - - // switch wb - w.wb = w.allocator.Next() - goahead = true - } - - recordSize += record.Size() - } - - recordCount += len(records) - entrySize += len(entry) - } - - metrics.WALEntryWriteCounter.Add(float64(len(entries))) - metrics.WALEntryWriteSizeCounter.Add(float64(entrySize)) - metrics.WALRecordWriteCounter.Add(float64(recordCount)) - metrics.WALRecordWriteSizeCounter.Add(float64(recordSize)) - - span.SetAttributes( - attribute.Int("entry_count", len(entries)), - attribute.Int("entry_size", entrySize), - attribute.Int("record_count", recordCount), - attribute.Int("record_size", recordSize)) - - return full, goahead -} - -func (w *WAL) runFlush() { - for task := range w.flushC { - ctx, span := w.tracer.Start(task.ctx, "doFlush") - - // Copy - fb := task.block - own := task.own - - writer := w.logWriter(ctx, fb.SO) - - w.flushWg.Add(1) - fb.Flush(writer, task.offset, fb.SO, func(off int64, err error) { - span.End() - - if err != nil { - panic(err) - } - - // Wakeup callbacks. - w.wakeupC <- fb.SO + off - - w.flushWg.Done() - - if own { - w.allocator.Free(fb) - } - }) +func (w *WAL) runAppend() { + for task := range w.appendC { + w.appendWg.Add(1) + w.newAppender(task.ctx, task.entries, task.callback).invoke() } - // Wait in-flight flush tasks. - w.flushWg.Wait() - - close(w.wakeupC) -} - -func (w *WAL) logWriter(ctx context.Context, offset int64) io.WriterAt { - f := w.stream.selectFile(ctx, offset, true) - - return io.WriteAtFunc(func(b []byte, off int64, so, eo int, cb io.WriteCallback) { - span := trace.SpanFromContext(ctx) - span.SetAttributes( - attribute.Int("real_so", so), - attribute.Int("real_eo", eo), - attribute.Int("real_size", eo-so), - attribute.Int("block_size", len(b)), - attribute.Bool("block_full", eo == 0 || eo == len(b))) - - f.WriteAt(w.engine, b, off, so, eo, cb) - }) + w.appendWg.Wait() + close(w.callbackC) } func (w *WAL) runCallback() { - var task *callbackTask - for offset := range w.wakeupC { - // NOTE: write cb to callbackC before writing offset to wakeupC. - if task == nil { - task = w.nextCallbackTask() - } - for task != nil { - if task.threshold > offset { - break - } - - _, span := w.tracer.Start(task.ctx, "doCallback") - task.callback(Result{ - Ranges: task.ranges, - }) - span.End() - - task = w.nextCallbackTask() - } - } - - // Wakeup in-flight append tasks. - w.wakeupPendingTasks(task) - - w.doClose() -} - -func (w *WAL) wakeupPendingTasks(task *callbackTask) { - if task != nil { + for task := range w.callbackC { + span := trace.SpanFromContext(task.ctx) + span.AddEvent("store.wal.WAL.doCallback() Start") task.callback(Result{ - Err: ErrClosed, + Ranges: task.ranges, }) + span.AddEvent("store.wal.WAL.doCallback() End") } - for { - task = w.nextCallbackTask() - if task == nil { - break - } - task.callback(Result{ - Err: ErrClosed, - }) - } - for { - select { - case at := <-w.appendC: - at.callback(Result{ - Err: ErrClosed, - }) - continue - default: - } - break - } -} -func (w *WAL) nextCallbackTask() *callbackTask { - select { - case c := <-w.callbackC: - return &c - default: - return nil - } + w.doClose() } func (w *WAL) Compact(ctx context.Context, off int64) error { - return w.stream.compact(ctx, off) + return w.sf.Compact(off) } diff --git a/internal/store/wal/wal_bench_test.go b/internal/store/wal/wal_bench_test.go index b90a4f16f..133136911 100644 --- a/internal/store/wal/wal_bench_test.go +++ b/internal/store/wal/wal_bench_test.go @@ -126,9 +126,9 @@ func BenchmarkWAL_AppendOneWithCallback(b *testing.B) { // {size: 128}, // {size: 256}, // {size: 512}, - // {size: 1024}, + {size: 1024}, // {size: 2048}, - {size: 4096}, + // {size: 4096}, // {size: 8192}, } for i := range testCases { diff --git a/internal/store/wal/wal_test.go b/internal/store/wal/wal_test.go index e7c1f257a..2c7666429 100644 --- a/internal/store/wal/wal_test.go +++ b/internal/store/wal/wal_test.go @@ -58,8 +58,8 @@ func TestWAL_AppendOne(t *testing.T) { // Invoke callback of append data0, before append data1 return. So(done, ShouldBeTrue) So(n.EO, ShouldEqual, 21) - So(wal.wb.Size(), ShouldEqual, 21) - So(wal.wb.Committed(), ShouldEqual, 21) + So(wal.s.WriteOffset(), ShouldEqual, 21) + // So(wal.wb.Committed(), ShouldEqual, 21) filePath := filepath.Join(walDir, fmt.Sprintf("%020d.log", 0)) data, err2 := os.ReadFile(filePath) @@ -80,7 +80,7 @@ func TestWAL_AppendOne(t *testing.T) { So(err, ShouldBeNil) So(n.EO, ShouldEqual, fileSize+9*record.HeaderSize) - So(len(wal.stream.stream), ShouldEqual, 2) + So(wal.sf.Len(), ShouldEqual, 2) }) Reset(func() { @@ -115,6 +115,7 @@ func TestWAL_AppendOne(t *testing.T) { So(t0, ShouldHappenBefore, startTime.Add(flushTimeout)) So(t1, ShouldHappenAfter, startTime.Add(flushTimeout)) + So(t1, ShouldHappenAfter, t0) So(t2, ShouldHappenAfter, t1) wal.Close() @@ -128,7 +129,8 @@ func TestWAL_AppendOne(t *testing.T) { walDir, err := os.MkdirTemp("", "wal-*") So(err, ShouldBeNil) - wal, err := Open(ctx, walDir, WithFileSize(fileSize)) + flushTimeout := 100 * time.Millisecond + wal, err := Open(ctx, walDir, WithFileSize(fileSize), WithFlushTimeout(flushTimeout)) So(err, ShouldBeNil) var inflight int32 = 100 @@ -174,8 +176,8 @@ func TestWAL_Append(t *testing.T) { So(len(ranges), ShouldEqual, 2) So(ranges[0].EO, ShouldEqual, 10) So(ranges[1].EO, ShouldEqual, 21) - So(wal.wb.Size(), ShouldEqual, 21) - So(wal.wb.Committed(), ShouldEqual, 21) + So(wal.s.WriteOffset(), ShouldEqual, 21) + // So(wal.wb.Committed(), ShouldEqual, 21) filePath := filepath.Join(walDir, fmt.Sprintf("%020d.log", 0)) data, err2 := os.ReadFile(filePath) @@ -189,15 +191,6 @@ func TestWAL_Append(t *testing.T) { }) }) - Convey("append without entry", func() { - ranges, err := wal.Append(ctx, [][]byte{}).Wait() - - So(err, ShouldBeNil) - So(len(ranges), ShouldEqual, 0) - So(wal.wb.Size(), ShouldEqual, 0) - So(wal.wb.Committed(), ShouldEqual, 0) - }) - Reset(func() { wal.Close() wal.Wait() @@ -222,20 +215,20 @@ func TestWAL_Compact(t *testing.T) { _, err = wal.Append(ctx, [][]byte{data, data, data, data, data, data, data, data}).Wait() So(err, ShouldBeNil) - So(wal.stream.stream, ShouldHaveLength, 1) + So(wal.sf.Len(), ShouldEqual, 1) r, err := wal.AppendOne(ctx, data).Wait() So(err, ShouldBeNil) So(r, ShouldResemble, Range{SO: fileSize, EO: fileSize + defaultBlockSize}) - So(wal.stream.stream, ShouldHaveLength, 2) + So(wal.sf.Len(), ShouldEqual, 2) err = wal.Compact(ctx, r.SO) So(err, ShouldBeNil) - So(wal.stream.stream, ShouldHaveLength, 1) + So(wal.sf.Len(), ShouldEqual, 1) err = wal.Compact(ctx, r.EO) So(err, ShouldBeNil) - So(wal.stream.stream, ShouldHaveLength, 1) + So(wal.sf.Len(), ShouldEqual, 1) ranges, err := wal.Append(ctx, [][]byte{ data, data, data, data, data, data, data, data, @@ -243,11 +236,11 @@ func TestWAL_Compact(t *testing.T) { }).Wait() So(err, ShouldBeNil) So(ranges[len(ranges)-1].EO, ShouldEqual, fileSize*3+defaultBlockSize) - So(wal.stream.stream, ShouldHaveLength, 3) + So(wal.sf.Len(), ShouldEqual, 3) err = wal.Compact(ctx, fileSize*2) So(err, ShouldBeNil) - So(wal.stream.stream, ShouldHaveLength, 2) + So(wal.sf.Len(), ShouldEqual, 2) wal.Close() wal.Wait() diff --git a/observability/go.mod b/observability/go.mod index 1246c3521..f10b42161 100644 --- a/observability/go.mod +++ b/observability/go.mod @@ -3,34 +3,33 @@ module github.com/linkall-labs/vanus/observability go 1.18 require ( - github.com/prometheus/client_golang v1.13.0 + github.com/prometheus/client_golang v1.14.0 github.com/sirupsen/logrus v1.9.0 - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/exporters/jaeger v1.9.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 - google.golang.org/grpc v1.49.0 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 + google.golang.org/grpc v1.51.0 ) require ( github.com/beorn7/perks v1.0.1 // indirect - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 // indirect - go.opentelemetry.io/proto/otlp v0.18.0 // indirect - golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect - golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect - golang.org/x/text v0.3.7 // indirect - google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 // indirect + go.opentelemetry.io/proto/otlp v0.19.0 // indirect + golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/text v0.4.0 // indirect + google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/observability/go.sum b/observability/go.sum index 429cb72ca..ea864381d 100644 --- a/observability/go.sum +++ b/observability/go.sum @@ -44,8 +44,7 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -133,7 +132,7 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -189,13 +188,12 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= -github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= @@ -218,14 +216,13 @@ github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0 github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -234,24 +231,15 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/otel v1.9.0 h1:8WZNQFIB2a71LnANS9JeyidJKKGOOremcUtb/OtHISw= -go.opentelemetry.io/otel v1.9.0/go.mod h1:np4EoPGzoPs3O67xUVNoPPcmSvsfOxNlNA4F4AC+0Eo= -go.opentelemetry.io/otel/exporters/jaeger v1.9.0 h1:gAEgEVGDWwFjcis9jJTOJqZNxDzoZfR12WNIxr7g9Ww= -go.opentelemetry.io/otel/exporters/jaeger v1.9.0/go.mod h1:hquezOLVAybNW6vanIxkdLXTXvzlj2Vn3wevSP15RYs= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 h1:ggqApEjDKczicksfvZUCxuvoyDmR6Sbm56LwiK8DVR0= -go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0/go.mod h1:78XhIg8Ht9vR4tbLNUhXsiOnE2HOuSeKAiAcoVQEpOY= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 h1:NN90Cuna0CnBg8YNu1Q0V35i2E8LDByFOwHRCq/ZP9I= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0/go.mod h1:0EsCXjZAiiZGnLdEUXM9YjCKuuLZMYyglh2QDXcYKVA= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0 h1:M0/hqGuJBLeIEu20f89H74RGtqV2dn+SFWEz9ATAAwY= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0/go.mod h1:K5G92gbtCrYJ0mn6zj9Pst7YFsDFuvSYEhYKRMcufnM= -go.opentelemetry.io/otel/sdk v1.9.0 h1:LNXp1vrr83fNXTHgU8eO89mhzxb/bbWAsHG6fNf3qWo= -go.opentelemetry.io/otel/sdk v1.9.0/go.mod h1:AEZc8nt5bd2F7BC24J5R0mrjYnpEgYHyTcM/vrSple4= -go.opentelemetry.io/otel/trace v1.9.0 h1:oZaCNJUjWcg60VXWee8lJKlqhPbXAPB51URuR47pQYc= -go.opentelemetry.io/otel/trace v1.9.0/go.mod h1:2737Q0MuG8q1uILYm2YYVkAyLtOofiTNGg6VODnOiPo= +go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 h1:htgM8vZIF8oPSCxa341e3IZ4yr/sKxgu8KZYllByiVY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 h1:fqR1kli93643au1RKo0Uma3d2aPQKT+WBKfTSBaKbOc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 h1:ERwKPn9Aer7Gxsc0+ZlutlH1bEEAUXAUhqm3Y45ABbk= +go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= +go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= -go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -319,8 +307,8 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b h1:tvrvnPFcdzp294diPnrdZZZ8XUt2Tyj7svb7X52iDuU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -378,8 +366,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -389,8 +377,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -490,8 +478,8 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c h1:QgY/XxIAIeccR+Ca/rDdKubLIU9rcJ3xfy1DC/Wd2Oo= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -508,8 +496,7 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw= -google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -537,8 +524,8 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/go.mod b/pkg/go.mod index 6450224eb..b9a10d0c6 100644 --- a/pkg/go.mod +++ b/pkg/go.mod @@ -3,29 +3,30 @@ module github.com/linkall-labs/vanus/pkg go 1.18 require ( + github.com/golang/mock v1.6.0 github.com/linkall-labs/vanus/observability v0.5.1 github.com/linkall-labs/vanus/proto v0.5.1 github.com/pkg/errors v0.9.1 github.com/smartystreets/goconvey v1.7.2 - google.golang.org/grpc v1.49.0 + google.golang.org/grpc v1.51.0 google.golang.org/protobuf v1.28.1 ) -replace ( - github.com/linkall-labs/vanus/observability => ../observability - github.com/linkall-labs/vanus/proto => ../proto - github.com/linkall-labs/vanus/raft => ../raft -) - require ( - github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect github.com/jtolds/gls v4.20.0+incompatible // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/smartystreets/assertions v1.2.0 // indirect - golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect - golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect - golang.org/x/text v0.3.7 // indirect - google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f // indirect + github.com/stretchr/testify v1.8.1 // indirect + golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/text v0.4.0 // indirect + google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect +) + +replace ( + github.com/linkall-labs/vanus/observability => ../observability + github.com/linkall-labs/vanus/proto => ../proto + github.com/linkall-labs/vanus/raft => ../raft ) diff --git a/pkg/go.sum b/pkg/go.sum index f2559e807..4e8d6c4b4 100644 --- a/pkg/go.sum +++ b/pkg/go.sum @@ -1,64 +1,21 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= @@ -66,105 +23,47 @@ github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYl github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg= github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220909164309-bea034e7d591 h1:D0B/7al0LLrVC8aWF4+oxpv/m8bc7ViFfVS8/gXGdqI= -golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b h1:tvrvnPFcdzp294diPnrdZZZ8XUt2Tyj7svb7X52iDuU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f h1:hJ/Y5SqPXbarffmAsApliUlcvMU+wScNGfyop4bZm8o= -google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw= -google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c h1:QgY/XxIAIeccR+Ca/rDdKubLIU9rcJ3xfy1DC/Wd2Oo= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/proto/go.mod b/proto/go.mod index 818b9c93f..392e168a0 100644 --- a/proto/go.mod +++ b/proto/go.mod @@ -1,23 +1,25 @@ module github.com/linkall-labs/vanus/proto -go 1.17 +go 1.18 require ( github.com/golang/mock v1.6.0 github.com/linkall-labs/vanus/raft v0.5.1 - google.golang.org/grpc v1.49.0 + google.golang.org/grpc v1.51.0 google.golang.org/protobuf v1.28.1 ) -replace ( - github.com/linkall-labs/vanus/raft => ../raft -) - require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.2 // indirect - golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect - golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect - golang.org/x/text v0.3.7 // indirect - google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f // indirect + github.com/google/go-cmp v0.5.9 // indirect + golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/text v0.4.0 // indirect + google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect +) + +replace ( + github.com/linkall-labs/vanus/observability => ../observability + github.com/linkall-labs/vanus/raft => ../raft ) diff --git a/proto/go.sum b/proto/go.sum index 59a8e2162..701d1c922 100644 --- a/proto/go.sum +++ b/proto/go.sum @@ -1,153 +1,47 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= -github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo= -github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= -github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.etcd.io/etcd/client/pkg/v3 v3.6.0-alpha.0/go.mod h1:Vl/FkH40bHqmBFwhr8WVKtV47neyts36zl1voccRq8s= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220909164309-bea034e7d591 h1:D0B/7al0LLrVC8aWF4+oxpv/m8bc7ViFfVS8/gXGdqI= -golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b h1:tvrvnPFcdzp294diPnrdZZZ8XUt2Tyj7svb7X52iDuU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -156,45 +50,10 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f h1:hJ/Y5SqPXbarffmAsApliUlcvMU+wScNGfyop4bZm8o= -google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw= -google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c h1:QgY/XxIAIeccR+Ca/rDdKubLIU9rcJ3xfy1DC/Wd2Oo= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/raft/go.mod b/raft/go.mod index 81d43be16..86ec49132 100644 --- a/raft/go.mod +++ b/raft/go.mod @@ -6,22 +6,39 @@ require ( github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5 github.com/gogo/protobuf v1.3.2 github.com/golang/protobuf v1.5.2 + github.com/linkall-labs/vanus/observability v0.5.1 go.etcd.io/etcd/client/pkg/v3 v3.6.0-alpha.0 + go.opentelemetry.io/otel/trace v1.11.2 ) require ( + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054 // indirect github.com/cockroachdb/errors v1.2.4 // indirect github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/getsentry/raven-go v0.2.0 // indirect - github.com/google/go-cmp v0.5.8 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/kr/pretty v0.2.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/testify v1.8.0 // indirect + github.com/sirupsen/logrus v1.9.0 // indirect + github.com/stretchr/testify v1.8.1 // indirect + go.opentelemetry.io/otel v1.11.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 // indirect + go.opentelemetry.io/otel/sdk v1.11.2 // indirect + go.opentelemetry.io/proto/otlp v0.19.0 // indirect + golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/text v0.4.0 // indirect + google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c // indirect + google.golang.org/grpc v1.51.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -32,3 +49,5 @@ require ( replace go.etcd.io/etcd => ./FORBIDDEN_DEPENDENCY replace go.etcd.io/etcd/v3 => ./FORBIDDEN_DEPENDENCY + +replace github.com/linkall-labs/vanus/observability => ../observability diff --git a/raft/go.sum b/raft/go.sum index 9f261947d..5ffd03af4 100644 --- a/raft/go.sum +++ b/raft/go.sum @@ -1,6 +1,278 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= +cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= +cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM= +cloud.google.com/go/accessapproval v1.4.0/go.mod h1:zybIuC3KpDOvotz59lFe5qxRZx6C75OtwbisN56xYB4= +cloud.google.com/go/accesscontextmanager v1.3.0/go.mod h1:TgCBehyr5gNMz7ZaH9xubp+CE8dkrszb4oK9CWyvD4o= +cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= +cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= +cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= +cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4= +cloud.google.com/go/apigateway v1.3.0/go.mod h1:89Z8Bhpmxu6AmUxuVRg/ECRGReEdiP3vQtk4Z1J9rJk= +cloud.google.com/go/apigeeconnect v1.3.0/go.mod h1:G/AwXFAKo0gIXkPTVfZDd2qA1TxBXJ3MgMRBQkIi9jc= +cloud.google.com/go/appengine v1.4.0/go.mod h1:CS2NhuBuDXM9f+qscZ6V86m1MIIqPj3WC/UoEuR1Sno= +cloud.google.com/go/area120 v0.5.0/go.mod h1:DE/n4mp+iqVyvxHN41Vf1CR602GiHQjFPusMFW6bGR4= +cloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0= +cloud.google.com/go/artifactregistry v1.6.0/go.mod h1:IYt0oBPSAGYj/kprzsBjZ/4LnG/zOcHyFHjWPCi6SAQ= +cloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk= +cloud.google.com/go/artifactregistry v1.8.0/go.mod h1:w3GQXkJX8hiKN0v+at4b0qotwijQbYUqF2GWkZzAhC0= +cloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o= +cloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s= +cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjbytpUaW0= +cloud.google.com/go/asset v1.9.0/go.mod h1:83MOE6jEJBMqFKadM9NLRcs80Gdw76qGuHn8m3h8oHQ= +cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= +cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= +cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= +cloud.google.com/go/assuredworkloads v1.8.0/go.mod h1:AsX2cqyNCOvEQC8RMPnoc0yEarXQk6WEKkxYfL6kGIo= +cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= +cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= +cloud.google.com/go/automl v1.7.0/go.mod h1:RL9MYCCsJEOmt0Wf3z9uzG0a7adTT1fe+aObgSpkCt8= +cloud.google.com/go/baremetalsolution v0.3.0/go.mod h1:XOrocE+pvK1xFfleEnShBlNAXf+j5blPPxrhjKgnIFc= +cloud.google.com/go/batch v0.3.0/go.mod h1:TR18ZoAekj1GuirsUsR1ZTKN3FC/4UDnScjT8NXImFE= +cloud.google.com/go/beyondcorp v0.2.0/go.mod h1:TB7Bd+EEtcw9PCPQhCJtJGjk/7TC6ckmnSFS+xwTfm4= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= +cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= +cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= +cloud.google.com/go/billing v1.6.0/go.mod h1:WoXzguj+BeHXPbKfNWkqVtDdzORazmCjraY+vrxcyvI= +cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM= +cloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI= +cloud.google.com/go/binaryauthorization v1.3.0/go.mod h1:lRZbKgjDIIQvzYQS1p99A7/U1JqvqeZg0wiI5tp6tg0= +cloud.google.com/go/certificatemanager v1.3.0/go.mod h1:n6twGDvcUBFu9uBgt4eYvvf3sQ6My8jADcOVwHmzadg= +cloud.google.com/go/channel v1.8.0/go.mod h1:W5SwCXDJsq/rg3tn3oG0LOxpAo6IMxNa09ngphpSlnk= +cloud.google.com/go/cloudbuild v1.3.0/go.mod h1:WequR4ULxlqvMsjDEEEFnOG5ZSRSgWOywXYDb1vPE6U= +cloud.google.com/go/clouddms v1.3.0/go.mod h1:oK6XsCDdW4Ib3jCCBugx+gVjevp2TMXFtgxvPSee3OM= +cloud.google.com/go/cloudtasks v1.5.0/go.mod h1:fD92REy1x5woxkKEkLdvavGnPJGEn8Uic9nWuLzqCpY= +cloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI= +cloud.google.com/go/cloudtasks v1.7.0/go.mod h1:ImsfdYWwlWNJbdgPIIGJWC+gemEGTBK/SunNQQNCAb4= +cloud.google.com/go/contactcenterinsights v1.3.0/go.mod h1:Eu2oemoePuEFc/xKFPjbTuPSj0fYJcPls9TFlPNnHHY= +cloud.google.com/go/container v1.6.0/go.mod h1:Xazp7GjJSeUYo688S+6J5V+n/t+G5sKBTFkKNudGRxg= +cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= +cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= +cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= +cloud.google.com/go/datacatalog v1.5.0/go.mod h1:M7GPLNQeLfWqeIm3iuiruhPzkt65+Bx8dAKvScX8jvs= +cloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc= +cloud.google.com/go/datacatalog v1.7.0/go.mod h1:9mEl4AuDYWw81UGc41HonIHH7/sn52H0/tc8f8ZbZIE= +cloud.google.com/go/dataflow v0.6.0/go.mod h1:9QwV89cGoxjjSR9/r7eFDqqjtvbKxAK2BaYU6PVk9UM= +cloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ= +cloud.google.com/go/dataform v0.3.0/go.mod h1:cj8uNliRlHpa6L3yVhDOBrUXH+BPAO1+KFMQQNSThKo= +cloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE= +cloud.google.com/go/datafusion v1.4.0/go.mod h1:1Zb6VN+W6ALo85cXnM1IKiPw+yQMKMhB9TsTSRDo/38= +cloud.google.com/go/datalabeling v0.5.0/go.mod h1:TGcJ0G2NzcsXSE/97yWjIZO0bXj0KbVlINXMG9ud42I= +cloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ= +cloud.google.com/go/dataplex v1.3.0/go.mod h1:hQuRtDg+fCiFgC8j0zV222HvzFQdRd+SVX8gdmFcZzA= +cloud.google.com/go/dataproc v1.7.0/go.mod h1:CKAlMjII9H90RXaMpSxQ8EU6dQx6iAYNPcYPOkSbi8s= +cloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4cK3vbhkeo= +cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo= +cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ= +cloud.google.com/go/datastream v1.4.0/go.mod h1:h9dpzScPhDTs5noEMQVWP8Wx8AFBRyS0s8KWPx/9r0g= +cloud.google.com/go/deploy v1.4.0/go.mod h1:5Xghikd4VrmMLNaF6FiRFDlHb59VM59YoDQnOUdsH/c= +cloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4= +cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0= +cloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8= +cloud.google.com/go/dialogflow v1.18.0/go.mod h1:trO7Zu5YdyEuR+BhSNOqJezyFQ3aUzz0njv7sMx/iek= +cloud.google.com/go/dlp v1.6.0/go.mod h1:9eyB2xIhpU0sVwUixfBubDoRwP+GjeUoxxeueZmqvmM= +cloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU= +cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU= +cloud.google.com/go/documentai v1.9.0/go.mod h1:FS5485S8R00U10GhgBC0aNGrJxBP8ZVpEeJ7PQDZd6k= +cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y= +cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg= +cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk= +cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w= +cloud.google.com/go/essentialcontacts v1.3.0/go.mod h1:r+OnHa5jfj90qIfZDO/VztSFqbQan7HV75p8sA+mdGI= +cloud.google.com/go/eventarc v1.7.0/go.mod h1:6ctpF3zTnaQCxUjHUdcfgcA1A2T309+omHZth7gDfmc= +cloud.google.com/go/filestore v1.3.0/go.mod h1:+qbvHGvXU1HaKX2nD0WEPo92TP/8AQuCVEBXNY9z0+w= +cloud.google.com/go/functions v1.6.0/go.mod h1:3H1UA3qiIPRWD7PeZKLvHZ9SaQhR26XIJcC0A5GbvAk= +cloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg= +cloud.google.com/go/functions v1.8.0/go.mod h1:RTZ4/HsQjIqIYP9a9YPbU+QFoQsAlYgrwOXJWHn1POY= +cloud.google.com/go/gaming v1.5.0/go.mod h1:ol7rGcxP/qHTRQE/RO4bxkXq+Fix0j6D4LFPzYTIrDM= +cloud.google.com/go/gaming v1.6.0/go.mod h1:YMU1GEvA39Qt3zWGyAVA9bpYz/yAhTvaQ1t2sK4KPUA= +cloud.google.com/go/gaming v1.7.0/go.mod h1:LrB8U7MHdGgFG851iHAfqUdLcKBdQ55hzXy9xBJz0+w= +cloud.google.com/go/gkebackup v0.2.0/go.mod h1:XKvv/4LfG829/B8B7xRkk8zRrOEbKtEam6yNfuQNH60= +cloud.google.com/go/gkeconnect v0.5.0/go.mod h1:c5lsNAg5EwAy7fkqX/+goqFsU1Da/jQFqArp+wGNr/o= +cloud.google.com/go/gkeconnect v0.6.0/go.mod h1:Mln67KyU/sHJEBY8kFZ0xTeyPtzbq9StAVvEULYK16A= +cloud.google.com/go/gkehub v0.9.0/go.mod h1:WYHN6WG8w9bXU0hqNxt8rm5uxnk8IH+lPY9J2TV7BK0= +cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y977wO+hBH0= +cloud.google.com/go/gkemulticloud v0.3.0/go.mod h1:7orzy7O0S+5kq95e4Hpn7RysVA7dPs8W/GgfUtsPbrA= +cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= +cloud.google.com/go/gsuiteaddons v1.3.0/go.mod h1:EUNK/J1lZEZO8yPtykKxLXI6JSVN2rg9bN8SXOa0bgM= +cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= +cloud.google.com/go/iam v0.6.0/go.mod h1:+1AH33ueBne5MzYccyMHtEKqLE4/kJOibtffMHDMFMc= +cloud.google.com/go/iap v1.4.0/go.mod h1:RGFwRJdihTINIe4wZ2iCP0zF/qu18ZwyKxrhMhygBEc= +cloud.google.com/go/ids v1.1.0/go.mod h1:WIuwCaYVOzHIj2OhN9HAwvW+DBdmUAdcWlFxRl+KubM= +cloud.google.com/go/iot v1.3.0/go.mod h1:r7RGh2B61+B8oz0AGE+J72AhA0G7tdXItODWsaA2oLs= +cloud.google.com/go/kms v1.5.0/go.mod h1:QJS2YY0eJGBg3mnDfuaCyLauWwBJiHRboYxJ++1xJNg= +cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= +cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= +cloud.google.com/go/language v1.7.0/go.mod h1:DJ6dYN/W+SQOjF8e1hLQXMF21AkH2w9wiPzPCJa2MIE= +cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= +cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= +cloud.google.com/go/longrunning v0.1.1/go.mod h1:UUFxuDWkv22EuY93jjmDMFT5GPQKeFVJBIF6QlTqdsE= +cloud.google.com/go/managedidentities v1.3.0/go.mod h1:UzlW3cBOiPrzucO5qWkNkh0w33KFtBJU281hacNvsdE= +cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= +cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= +cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= +cloud.google.com/go/memcache v1.5.0/go.mod h1:dk3fCK7dVo0cUU2c36jKb4VqKPS22BTkf81Xq617aWM= +cloud.google.com/go/memcache v1.6.0/go.mod h1:XS5xB0eQZdHtTuTF9Hf8eJkKtR3pVRCcvJwtm68T3rA= +cloud.google.com/go/metastore v1.5.0/go.mod h1:2ZNrDcQwghfdtCwJ33nM0+GrBGlVuh8rakL3vdPY3XY= +cloud.google.com/go/metastore v1.6.0/go.mod h1:6cyQTls8CWXzk45G55x57DVQ9gWg7RiH65+YgPsNh9s= +cloud.google.com/go/metastore v1.7.0/go.mod h1:s45D0B4IlsINu87/AsWiEVYbLaIMeUSoxlKKDqBGFS8= +cloud.google.com/go/monitoring v1.7.0/go.mod h1:HpYse6kkGo//7p6sT0wsIC6IBDET0RhIsnmlA53dvEk= +cloud.google.com/go/networkconnectivity v1.4.0/go.mod h1:nOl7YL8odKyAOtzNX73/M5/mGZgqqMeryi6UPZTk/rA= +cloud.google.com/go/networkconnectivity v1.5.0/go.mod h1:3GzqJx7uhtlM3kln0+x5wyFvuVH1pIBJjhCpjzSt75o= +cloud.google.com/go/networkconnectivity v1.6.0/go.mod h1:OJOoEXW+0LAxHh89nXd64uGG+FbQoeH8DtxCHVOMlaM= +cloud.google.com/go/networkmanagement v1.4.0/go.mod h1:Q9mdLLRn60AsOrPc8rs8iNV6OHXaGcDdsIQe1ohekq8= +cloud.google.com/go/networksecurity v0.5.0/go.mod h1:xS6fOCoqpVC5zx15Z/MqkfDwH4+m/61A3ODiDV1xmiQ= +cloud.google.com/go/networksecurity v0.6.0/go.mod h1:Q5fjhTr9WMI5mbpRYEbiexTzROf7ZbDzvzCrNl14nyU= +cloud.google.com/go/notebooks v1.2.0/go.mod h1:9+wtppMfVPUeJ8fIWPOq1UnATHISkGXGqTkxeieQ6UY= +cloud.google.com/go/notebooks v1.3.0/go.mod h1:bFR5lj07DtCPC7YAAJ//vHskFBxA5JzYlH68kXVdk34= +cloud.google.com/go/notebooks v1.4.0/go.mod h1:4QPMngcwmgb6uw7Po99B2xv5ufVoIQ7nOGDyL4P8AgA= +cloud.google.com/go/optimization v1.1.0/go.mod h1:5po+wfvX5AQlPznyVEZjGJTMr4+CAkJf2XSTQOOl9l4= +cloud.google.com/go/orchestration v1.3.0/go.mod h1:Sj5tq/JpWiB//X/q3Ngwdl5K7B7Y0KZ7bfv0wL6fqVA= +cloud.google.com/go/orgpolicy v1.4.0/go.mod h1:xrSLIV4RePWmP9P3tBl8S93lTmlAxjm06NSm2UTmKvE= +cloud.google.com/go/osconfig v1.7.0/go.mod h1:oVHeCeZELfJP7XLxcBGTMBvRO+1nQ5tFG9VQTmYS2Fs= +cloud.google.com/go/osconfig v1.8.0/go.mod h1:EQqZLu5w5XA7eKizepumcvWx+m8mJUhEwiPqWiZeEdg= +cloud.google.com/go/osconfig v1.9.0/go.mod h1:Yx+IeIZJ3bdWmzbQU4fxNl8xsZ4amB+dygAwFPlvnNo= +cloud.google.com/go/oslogin v1.4.0/go.mod h1:YdgMXWRaElXz/lDk1Na6Fh5orF7gvmJ0FGLIs9LId4E= +cloud.google.com/go/oslogin v1.5.0/go.mod h1:D260Qj11W2qx/HVF29zBg+0fd6YCSjSqLUkY/qEenQU= +cloud.google.com/go/oslogin v1.6.0/go.mod h1:zOJ1O3+dTU8WPlGEkFSh7qeHPPSoxrcMbbK1Nm2iX70= +cloud.google.com/go/phishingprotection v0.5.0/go.mod h1:Y3HZknsK9bc9dMi+oE8Bim0lczMU6hrX0UpADuMefr0= +cloud.google.com/go/phishingprotection v0.6.0/go.mod h1:9Y3LBLgy0kDTcYET8ZH3bq/7qni15yVUoAxiFxnlSUA= +cloud.google.com/go/policytroubleshooter v1.3.0/go.mod h1:qy0+VwANja+kKrjlQuOzmlvscn4RNsAc0e15GGqfMxg= +cloud.google.com/go/privatecatalog v0.5.0/go.mod h1:XgosMUvvPyxDjAVNDYxJ7wBW8//hLDDYmnsNcMGq1K0= +cloud.google.com/go/privatecatalog v0.6.0/go.mod h1:i/fbkZR0hLN29eEWiiwue8Pb+GforiEIBnV9yrRUOKI= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4= +cloud.google.com/go/recaptchaenterprise/v2 v2.1.0/go.mod h1:w9yVqajwroDNTfGuhmOjPDN//rZGySaf6PtFVcSCa7o= +cloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk= +cloud.google.com/go/recaptchaenterprise/v2 v2.3.0/go.mod h1:O9LwGCjrhGHBQET5CA7dd5NwwNQUErSgEDit1DLNTdo= +cloud.google.com/go/recaptchaenterprise/v2 v2.4.0/go.mod h1:Am3LHfOuBstrLrNCBrlI5sbwx9LBg3te2N6hGvHn2mE= +cloud.google.com/go/recommendationengine v0.5.0/go.mod h1:E5756pJcVFeVgaQv3WNpImkFP8a+RptV6dDLGPILjvg= +cloud.google.com/go/recommendationengine v0.6.0/go.mod h1:08mq2umu9oIqc7tDy8sx+MNJdLG0fUi3vaSVbztHgJ4= +cloud.google.com/go/recommender v1.5.0/go.mod h1:jdoeiBIVrJe9gQjwd759ecLJbxCDED4A6p+mqoqDvTg= +cloud.google.com/go/recommender v1.6.0/go.mod h1:+yETpm25mcoiECKh9DEScGzIRyDKpZ0cEhWGo+8bo+c= +cloud.google.com/go/recommender v1.7.0/go.mod h1:XLHs/W+T8olwlGOgfQenXBTbIseGclClff6lhFVe9Bs= +cloud.google.com/go/redis v1.7.0/go.mod h1:V3x5Jq1jzUcg+UNsRvdmsfuFnit1cfe3Z/PGyq/lm4Y= +cloud.google.com/go/redis v1.8.0/go.mod h1:Fm2szCDavWzBk2cDKxrkmWBqoCiL1+Ctwq7EyqBCA/A= +cloud.google.com/go/redis v1.9.0/go.mod h1:HMYQuajvb2D0LvMgZmLDZW8V5aOC/WxstZHiy4g8OiA= +cloud.google.com/go/resourcemanager v1.3.0/go.mod h1:bAtrTjZQFJkiWTPDb1WBjzvc6/kifjj4QBYuKCCoqKA= +cloud.google.com/go/resourcesettings v1.3.0/go.mod h1:lzew8VfESA5DQ8gdlHwMrqZs1S9V87v3oCnKCWoOuQU= +cloud.google.com/go/retail v1.8.0/go.mod h1:QblKS8waDmNUhghY2TI9O3JLlFk8jybHeV4BF19FrE4= +cloud.google.com/go/retail v1.9.0/go.mod h1:g6jb6mKuCS1QKnH/dpu7isX253absFl6iE92nHwlBUY= +cloud.google.com/go/retail v1.10.0/go.mod h1:2gDk9HsL4HMS4oZwz6daui2/jmKvqShXKQuB2RZ+cCc= +cloud.google.com/go/run v0.2.0/go.mod h1:CNtKsTA1sDcnqqIFR3Pb5Tq0usWxJJvsWOCPldRU3Do= +cloud.google.com/go/scheduler v1.4.0/go.mod h1:drcJBmxF3aqZJRhmkHQ9b3uSSpQoltBPGPxGAWROx6s= +cloud.google.com/go/scheduler v1.5.0/go.mod h1:ri073ym49NW3AfT6DZi21vLZrG07GXr5p3H1KxN5QlI= +cloud.google.com/go/scheduler v1.6.0/go.mod h1:SgeKVM7MIwPn3BqtcBntpLyrIJftQISRrYB5ZtT+KOk= +cloud.google.com/go/secretmanager v1.6.0/go.mod h1:awVa/OXF6IiyaU1wQ34inzQNc4ISIDIrId8qE5QGgKA= +cloud.google.com/go/secretmanager v1.8.0/go.mod h1:hnVgi/bN5MYHd3Gt0SPuTPPp5ENina1/LxM+2W9U9J4= +cloud.google.com/go/security v1.5.0/go.mod h1:lgxGdyOKKjHL4YG3/YwIL2zLqMFCKs0UbQwgyZmfJl4= +cloud.google.com/go/security v1.7.0/go.mod h1:mZklORHl6Bg7CNnnjLH//0UlAlaXqiG7Lb9PsPXLfD0= +cloud.google.com/go/security v1.8.0/go.mod h1:hAQOwgmaHhztFhiQ41CjDODdWP0+AE1B3sX4OFlq+GU= +cloud.google.com/go/security v1.9.0/go.mod h1:6Ta1bO8LXI89nZnmnsZGp9lVoVWXqsVbIq/t9dzI+2Q= +cloud.google.com/go/securitycenter v1.13.0/go.mod h1:cv5qNAqjY84FCN6Y9z28WlkKXyWsgLO832YiWwkCWcU= +cloud.google.com/go/securitycenter v1.14.0/go.mod h1:gZLAhtyKv85n52XYWt6RmeBdydyxfPeTrpToDPw4Auc= +cloud.google.com/go/securitycenter v1.15.0/go.mod h1:PeKJ0t8MoFmmXLXWm41JidyzI3PJjd8sXWaVqg43WWk= +cloud.google.com/go/servicecontrol v1.4.0/go.mod h1:o0hUSJ1TXJAmi/7fLJAedOovnujSEvjKCAFNXPQ1RaU= +cloud.google.com/go/servicedirectory v1.4.0/go.mod h1:gH1MUaZCgtP7qQiI+F+A+OpeKF/HQWgtAddhTbhL2bs= +cloud.google.com/go/servicedirectory v1.5.0/go.mod h1:QMKFL0NUySbpZJ1UZs3oFAmdvVxhhxB6eJ/Vlp73dfg= +cloud.google.com/go/servicedirectory v1.6.0/go.mod h1:pUlbnWsLH9c13yGkxCmfumWEPjsRs1RlmJ4pqiNjVL4= +cloud.google.com/go/servicemanagement v1.4.0/go.mod h1:d8t8MDbezI7Z2R1O/wu8oTggo3BI2GKYbdG4y/SJTco= +cloud.google.com/go/serviceusage v1.3.0/go.mod h1:Hya1cozXM4SeSKTAgGXgj97GlqUvF5JaoXacR1JTP/E= +cloud.google.com/go/shell v1.3.0/go.mod h1:VZ9HmRjZBsjLGXusm7K5Q5lzzByZmJHf1d0IWHEN5X4= +cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM= +cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ= +cloud.google.com/go/speech v1.8.0/go.mod h1:9bYIl1/tjsAnMgKGHKmBZzXKEkGgtU+MpdDPTE9f7y0= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= +cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= +cloud.google.com/go/storagetransfer v1.5.0/go.mod h1:dxNzUopWy7RQevYFHewchb29POFv3/AaBgnhqzqiK0w= +cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= +cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= +cloud.google.com/go/talent v1.3.0/go.mod h1:CmcxwJ/PKfRgd1pBjQgU6W3YBwiewmUzQYH5HHmSCmM= +cloud.google.com/go/texttospeech v1.4.0/go.mod h1:FX8HQHA6sEpJ7rCMSfXuzBcysDAuWusNNNvN9FELDd8= +cloud.google.com/go/tpu v1.3.0/go.mod h1:aJIManG0o20tfDQlRIej44FcwGGl/cD0oiRyMKG19IQ= +cloud.google.com/go/trace v1.3.0/go.mod h1:FFUE83d9Ca57C+K8rDl/Ih8LwOzWIV1krKgxg6N0G28= +cloud.google.com/go/translate v1.3.0/go.mod h1:gzMUwRjvOqj5i69y/LYLd8RrNQk+hOmIXTi9+nb3Djs= +cloud.google.com/go/video v1.8.0/go.mod h1:sTzKFc0bUSByE8Yoh8X0mn8bMymItVGPfTuUBUyRgxk= +cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= +cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4= +cloud.google.com/go/videointelligence v1.8.0/go.mod h1:dIcCn4gVDdS7yte/w+koiXn5dWVplOZkE+xwG9FgK+M= +cloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0= +cloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo= +cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo= +cloud.google.com/go/vision/v2 v2.4.0/go.mod h1:VtI579ll9RpVTrdKdkMzckdnwMyX2JILb+MhPqRbPsY= +cloud.google.com/go/vmmigration v1.2.0/go.mod h1:IRf0o7myyWFSmVR1ItrBSFLFD/rJkfDCUTO4vLlJvsE= +cloud.google.com/go/vpcaccess v1.4.0/go.mod h1:aQHVbTWDYUR1EbTApSVvMq1EnT57ppDmQzZ3imqIk4w= +cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE= +cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= +cloud.google.com/go/webrisk v1.6.0/go.mod h1:65sW9V9rOosnc9ZY7A7jsy1zoHS5W9IAXv6dGqhMQMc= +cloud.google.com/go/websecurityscanner v1.3.0/go.mod h1:uImdKm2wyeXQevQJXeh8Uun/Ym1VqworNDlBXQevGMo= +cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= +cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= +cloud.google.com/go/workflows v1.8.0/go.mod h1:ysGhmEajwZxGn1OhGOGKsTXc5PyxOc0vfKf5Af+to4M= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054 h1:uH66TXeswKn5PW5zdZ39xEwfS9an067BirqA+P4QaLI= github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5 h1:xD/lrqdvwsc+O2bjSSi3YqY73Ke3LAiSCx49aCesA0E= github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5/go.mod h1:h6jFvWxBdQXxjopDMZyH2UVceIRfR84bdzbkoKrsWNo= github.com/cockroachdb/errors v1.2.4 h1:Lap807SXTH5tri2TivECb/4abUkMZC9zRoLarvcKDqs= @@ -8,76 +280,569 @@ github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoC github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/getsentry/raven-go v0.2.0 h1:no+xWJRb5ZI7eE8TWgIq1jLulQiIoLG0IfYxv5JYMGs= github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= +github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= +github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/etcd/client/pkg/v3 v3.6.0-alpha.0 h1:2UyRzFWbZZzgu/xzxoRukgixvafiJtGyxO+3IKUyJ6c= +go.etcd.io/etcd/client/pkg/v3 v3.6.0-alpha.0/go.mod h1:Vl/FkH40bHqmBFwhr8WVKtV47neyts36zl1voccRq8s= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= +go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 h1:htgM8vZIF8oPSCxa341e3IZ4yr/sKxgu8KZYllByiVY= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 h1:fqR1kli93643au1RKo0Uma3d2aPQKT+WBKfTSBaKbOc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 h1:ERwKPn9Aer7Gxsc0+ZlutlH1bEEAUXAUhqm3Y45ABbk= +go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= +go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= +go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b h1:tvrvnPFcdzp294diPnrdZZZ8XUt2Tyj7svb7X52iDuU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= +golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.77.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g= +google.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= +google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= +google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI= +google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.99.0/go.mod h1:1YOf74vkVndF7pG6hIHuINsM7eWwpVTAfNMNiL91A08= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220722212130-b98a9ff5e252/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE= +google.golang.org/genproto v0.0.0-20220801145646-83ce21fca29f/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= +google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220817144833-d7fd3f11b9b1/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220829144015-23454907ede3/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220913154956-18f8339a66a5/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220914142337-ca0e39ece12f/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220916172020-2692e8806bfa/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw= +google.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= +google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= +google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= +google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= +google.golang.org/genproto v0.0.0-20221024153911-1573dae28c9c/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= +google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c h1:QgY/XxIAIeccR+Ca/rDdKubLIU9rcJ3xfy1DC/Wd2Oo= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/raft/log.go b/raft/log.go index c7ad8dc74..1cbd75991 100644 --- a/raft/log.go +++ b/raft/log.go @@ -31,16 +31,18 @@ type raftLog struct { // they will be saved into storage. unstable unstable - pending uint64 + persisting uint64 // committed is the highest log position that is known to be in // stable storage on a quorum of nodes. // Invariant: committed < unstable.offset + len(unstable.entries) committed uint64 // Invariant: localCommitted = min(committed, unstable.offset) localCommitted uint64 + // Invariant: applying <= localCommitted + applying uint64 // applied is the highest log position that the application has // been instructed to apply to its state machine. - // Invariant: applied <= localCommitted + // Invariant: applied <= applying applied uint64 // compacted is the highest log position that the application can // delete safety. @@ -82,10 +84,11 @@ func newLogWithSize(storage Storage, logger Logger, maxNextEntsSize uint64) *raf } log.unstable.offset = lastIndex + 1 log.unstable.logger = logger - log.pending = lastIndex + 1 + log.persisting = lastIndex + 1 // Initialize our committed and applied pointers to the time of the last compaction. log.committed = firstIndex - 1 log.localCommitted = firstIndex - 1 + log.applying = firstIndex - 1 log.applied = firstIndex - 1 log.compacted = firstIndex - 1 @@ -134,8 +137,8 @@ func (l *raftLog) append(ents ...pb.Entry) uint64 { l.inflight.truncateFrom(start) } // Reset pending when any entry being persisted is truncated. - if l.pending > start { - l.pending = start + if l.persisting > start { + l.persisting = start } return li } @@ -201,7 +204,7 @@ func (l *raftLog) unstableEntries() []pb.Entry { } func (l *raftLog) pendingEntries() []pb.Entry { - so := int(l.pending - l.unstable.offset) + so := int(l.persisting - l.unstable.offset) if so >= len(l.unstable.entries) { return nil } @@ -212,7 +215,7 @@ func (l *raftLog) pendingEntries() []pb.Entry { // If applied is smaller than the index of snapshot, it returns all committed // entries after the index of snapshot. func (l *raftLog) nextEnts() (ents []pb.Entry) { - lo := max(l.applied+1, l.firstIndex()) + lo := max(l.applying+1, l.firstIndex()) if hi := l.localCommitted + 1; hi > lo { ents, err := l.slice(lo, hi, l.maxNextEntsSize) if err != nil { @@ -226,7 +229,7 @@ func (l *raftLog) nextEnts() (ents []pb.Entry) { // hasNextEnts returns if there is any available entries for execution. This // is a fast check without heavy raftLog.slice() in raftLog.nextEnts(). func (l *raftLog) hasNextEnts() bool { - off := max(l.applied+1, l.firstIndex()) + off := max(l.applying+1, l.firstIndex()) return l.localCommitted+1 > off } @@ -286,12 +289,22 @@ func (l *raftLog) appliedTo(i uint64) { if i == 0 { return } - if l.localCommitted < i || i < l.applied { - l.logger.Panicf("applied(%d) is out of range [prevApplied(%d), localCommitted(%d)]", i, l.applied, l.localCommitted) + if l.applying < i || i < l.applied { + l.logger.Panicf("applied(%d) is out of range [prevApplied(%d), applying(%d)]", i, l.applied, l.applying) } l.applied = i } +func (l *raftLog) applyingTo(i uint64) { + if i == 0 { + return + } + if l.localCommitted < i || i < l.applying { + l.logger.Panicf("applied(%d) is out of range [prevApplying(%d), localCommitted(%d)]", i, l.applying, l.localCommitted) + } + l.applying = i +} + func (l *raftLog) localCommitTo(tocommit uint64) { if tocommit >= l.unstable.offset { tocommit = l.unstable.offset - 1 @@ -325,7 +338,7 @@ func (l *raftLog) persistingTo(i, t uint64) { // if i < offset, term is matched with the snapshot // only update the pending if term is matched with an unstable entry. if gt == t && i >= l.unstable.offset { - l.pending = i + 1 + l.persisting = i + 1 } } @@ -446,7 +459,7 @@ func (l *raftLog) restore(s pb.Snapshot) { l.localCommitted = s.Metadata.Index // NOTE: applied and compacted will be reset in raft.advance(). l.unstable.restore(s) - l.pending = l.unstable.offset + l.persisting = l.unstable.offset } // slice returns a slice of log entries from lo through hi-1, inclusive. diff --git a/raft/node.go b/raft/node.go index cf13a5e07..f2c75462f 100644 --- a/raft/node.go +++ b/raft/node.go @@ -22,9 +22,6 @@ import ( // third-party libraries. "go.opentelemetry.io/otel/trace" - // first-party libraries. - "github.com/linkall-labs/vanus/observability/tracing" - // this project. pb "github.com/linkall-labs/vanus/raft/raftpb" ) @@ -123,7 +120,7 @@ func (rd Ready) containsUpdates() bool { // applied (once the Ready is confirmed via Advance). If no information is // contained in the Ready, returns zero. func (rd Ready) appliedCursor() uint64 { - if n := len(rd.CommittedEntries); n > 0 { + if n := len(rd.CommittedEntries); n != 0 { return rd.CommittedEntries[n-1].Index } if index := rd.Snapshot.Metadata.Index; index > 0 { @@ -185,6 +182,9 @@ type Node interface { // snapshots. ApplyConfChange(cc pb.ConfChangeI) *pb.ConfState + ReportLogged(ctx context.Context, index uint64, term uint64) error + ReportApplied(ctx context.Context, index uint64) error + // TransferLeadership attempts to transfer leadership to the given transferee. TransferLeadership(ctx context.Context, lead, transferee uint64) @@ -278,8 +278,6 @@ type node struct { status chan chan Status rn *RawNode - - tracer *tracing.Tracer } func newNode(rn *RawNode) node { @@ -299,7 +297,6 @@ func newNode(rn *RawNode) node { stop: make(chan struct{}), status: make(chan chan Status), rn: rn, - tracer: tracing.NewTracer("raft.node", trace.SpanKindInternal), } } @@ -324,8 +321,6 @@ func (n *node) Bootstrap(peers []Peer) error { } select { case ch <- bp: - // case <-ctx.Done(): - // return ctx.Err() case <-n.done: return ErrStopped } @@ -334,8 +329,6 @@ func (n *node) Bootstrap(peers []Peer) error { if err != nil { return err } - // case <-ctx.Done(): - // return ctx.Err() case <-n.done: return ErrStopped } @@ -489,8 +482,9 @@ func (n *node) Propose(ctx context.Context, pds ...ProposeData) { } func (n *node) Step(ctx context.Context, m pb.Message) error { - ctx, span := n.tracer.Start(ctx, "Step") - defer span.End() + span := trace.SpanFromContext(ctx) + span.AddEvent("raft.node.Step() Start") + defer span.AddEvent("raft.node.Step() End") // ignore unexpected local messages receiving over network if IsLocalMsg(m.Type) { @@ -551,6 +545,21 @@ func (n *node) ApplyConfChange(cc pb.ConfChangeI) *pb.ConfState { return &cs } +func (n *node) ReportLogged(ctx context.Context, index uint64, term uint64) error { + return n.step(ctx, pb.Message{ + Type: pb.MsgLogResp, + LogTerm: term, + Index: index, + }) +} + +func (n *node) ReportApplied(ctx context.Context, index uint64) error { + return n.step(ctx, pb.Message{ + Type: pb.MsgApplyResp, + Index: index, + }) +} + func (n *node) Status() Status { c := make(chan Status) select { diff --git a/raft/raft.go b/raft/raft.go index 12ea42805..063a74551 100644 --- a/raft/raft.go +++ b/raft/raft.go @@ -363,6 +363,7 @@ func newRaft(c *Config) *raft { r.loadState(hs) } if c.Applied > 0 { + raftlog.applyingTo(c.Applied) raftlog.appliedTo(c.Applied) } if c.Compacted > 0 { @@ -1162,6 +1163,34 @@ func stepLeader(r *raft, m pb.Message) error { } } return nil + case pb.MsgApplyResp: + // TODO(james.yin): reduce uncommitted size + + newApplied := m.Index + oldApplied := r.raftLog.applied + r.raftLog.appliedTo(m.Index) + + // Config change + if r.prs.Config.AutoLeave && oldApplied <= r.pendingConfIndex && newApplied >= r.pendingConfIndex { + // If the current (and most recent, at least for this leader's term) + // configuration should be auto-left, initiate that now. We use a + // nil Data which unmarshals into an empty ConfChangeV2 and has the + // benefit that appendEntry can never refuse it based on its size + // (which registers as zero). + ent := pb.Entry{ + Type: pb.EntryConfChangeV2, + Data: nil, + } + // There's no way in which this proposal should be able to be rejected. + if !r.appendEntry(ent) { + panic("refused un-refusable auto-leaving ConfChangeV2") + } + r.pendingConfIndex = r.raftLog.lastIndex() + r.logger.Infof("initiating automatic transition out of joint configuration %s", r.prs.Config) + } + + r.maybeCompact() + return nil case pb.MsgReadIndex: // only one voting member (the leader) in the cluster if r.prs.IsSingleton() { @@ -1483,6 +1512,9 @@ func stepCandidate(r *raft, m pb.Message) error { if r.raftLog.stableTo(m.Index, m.LogTerm) { r.raftLog.localCommitTo(r.raftLog.committed) } + case pb.MsgApplyResp: + // TODO(james.yin): + r.raftLog.appliedTo(m.Index) case pb.MsgHeartbeat: r.becomeFollower(m.Term, m.From) // always m.Term == r.Term r.handleHeartbeat(m) @@ -1524,6 +1556,9 @@ func stepFollower(r *raft, m pb.Message) error { r.raftLog.localCommitTo(r.raftLog.committed) r.send(pb.Message{To: r.lead, Type: pb.MsgAppResp, Index: m.Index}) } + case pb.MsgApplyResp: + // TODO(james.yin): + r.raftLog.appliedTo(m.Index) case pb.MsgHeartbeat: r.electionElapsed = 0 r.lead = m.From diff --git a/raft/raftpb/raft.pb.go b/raft/raftpb/raft.pb.go index 05ec31c5b..7490c966a 100644 --- a/raft/raftpb/raft.pb.go +++ b/raft/raftpb/raft.pb.go @@ -77,6 +77,7 @@ const ( MsgPreVote MessageType = 17 MsgPreVoteResp MessageType = 18 MsgLogResp MessageType = 19 + MsgApplyResp MessageType = 20 ) var MessageType_name = map[int32]string{ @@ -100,6 +101,7 @@ var MessageType_name = map[int32]string{ 17: "MsgPreVote", 18: "MsgPreVoteResp", 19: "MsgLogResp", + 20: "MsgApplyResp", } var MessageType_value = map[string]int32{ @@ -123,6 +125,7 @@ var MessageType_value = map[string]int32{ "MsgPreVote": 17, "MsgPreVoteResp": 18, "MsgLogResp": 19, + "MsgApplyResp": 20, } func (x MessageType) String() string { @@ -642,75 +645,76 @@ func init() { func init() { proto.RegisterFile("raftpb/raft.proto", fileDescriptor_f652ee94e728864d) } var fileDescriptor_f652ee94e728864d = []byte{ - // 1086 bytes of a gzipped FileDescriptorProto + // 1096 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcf, 0x4f, 0xe3, 0x46, 0x14, 0x8e, 0x9d, 0x90, 0x1f, 0x2f, 0x21, 0x0c, 0x03, 0xa5, 0xee, 0x76, 0x1b, 0xd2, 0xac, 0x56, 0x4b, 0x91, 0x16, 0xa4, 0x54, 0xaa, 0xaa, 0xaa, 0x17, 0x60, 0x57, 0x82, 0x96, 0xb0, 0x5b, 0xc3, 0x72, 0xd8, 0x4b, 0x34, 0xb1, 0x07, 0xc7, 0x5d, 0xdb, 0x63, 0x8d, 0x27, 0x14, 0xae, 0xed, 0x1f, - 0xd0, 0x1e, 0x7b, 0xac, 0x7a, 0xee, 0x1f, 0xc2, 0x91, 0x63, 0x4f, 0xa8, 0x0b, 0xff, 0x48, 0x35, - 0x3f, 0x9c, 0x38, 0x88, 0x56, 0xda, 0x53, 0xe6, 0x7d, 0xef, 0xf3, 0xbc, 0xef, 0x7d, 0x33, 0x6f, - 0x14, 0x58, 0xe6, 0xe4, 0x4c, 0xa4, 0xa3, 0x6d, 0xf9, 0xb3, 0x95, 0x72, 0x26, 0x18, 0xae, 0x6a, - 0xe8, 0xd1, 0x6a, 0xc0, 0x02, 0xa6, 0xa0, 0x6d, 0xb9, 0xd2, 0xd9, 0xde, 0x9f, 0x16, 0x2c, 0xbc, - 0x4c, 0x04, 0xbf, 0xc4, 0x18, 0x2a, 0x82, 0xf2, 0xd8, 0xb1, 0xbb, 0xd6, 0x46, 0xc5, 0x55, 0x6b, - 0xbc, 0x0a, 0x0b, 0x61, 0xe2, 0xd3, 0x0b, 0xa7, 0xac, 0x40, 0x1d, 0xe0, 0xa7, 0x50, 0x11, 0x97, - 0x29, 0x75, 0xac, 0xae, 0xb5, 0xd1, 0xee, 0x2f, 0x6f, 0xe9, 0x02, 0x5b, 0x6a, 0x9b, 0x93, 0xcb, - 0x94, 0xba, 0x2a, 0x2d, 0x37, 0xf4, 0x89, 0x20, 0x4e, 0xa5, 0x6b, 0x6d, 0xb4, 0x5c, 0xb5, 0xc6, - 0x1f, 0x43, 0x2d, 0x61, 0x3e, 0x1d, 0x86, 0xbe, 0xb3, 0xa0, 0xb6, 0xac, 0xca, 0xf0, 0xc0, 0xc7, - 0x9f, 0x42, 0x23, 0xe5, 0xf4, 0x7c, 0xa8, 0x24, 0x54, 0x55, 0xaa, 0x2e, 0x81, 0x13, 0xca, 0xe3, - 0x9e, 0x00, 0x74, 0x9c, 0x90, 0x34, 0x1b, 0x33, 0x31, 0xa0, 0x82, 0xa8, 0x9d, 0xbe, 0x02, 0xf0, - 0x58, 0x72, 0x36, 0xcc, 0x04, 0x11, 0x5a, 0x4a, 0x73, 0x26, 0x65, 0x8f, 0x25, 0x67, 0xc7, 0x32, - 0xb1, 0x5b, 0xb9, 0xba, 0x59, 0x2f, 0xb9, 0x0d, 0x2f, 0x07, 0x66, 0x2d, 0xd9, 0xc5, 0x96, 0xf2, - 0xe6, 0xcb, 0xb3, 0xe6, 0x7b, 0x6f, 0xa1, 0x9e, 0x57, 0x9d, 0xf6, 0x62, 0x15, 0x7a, 0xf9, 0x06, - 0xea, 0xb1, 0x51, 0xa3, 0x36, 0x6b, 0xf6, 0x9d, 0xbc, 0xfe, 0x7d, 0xb5, 0x46, 0xc6, 0x94, 0xdf, - 0xfb, 0xa5, 0x0c, 0xb5, 0x01, 0xcd, 0x32, 0x12, 0x50, 0xfc, 0x6c, 0xce, 0xce, 0x95, 0x7c, 0x0f, - 0x93, 0x2e, 0x18, 0xda, 0x06, 0x5b, 0x30, 0xa3, 0xdb, 0x16, 0x4c, 0x8a, 0x3a, 0xe3, 0x6c, 0x2a, - 0x5a, 0xae, 0xa7, 0x8d, 0x54, 0x0a, 0xa7, 0xf8, 0x09, 0xd4, 0x23, 0x16, 0x68, 0x6b, 0xb5, 0xeb, - 0xb5, 0x88, 0x05, 0x27, 0x73, 0x07, 0x5c, 0x2d, 0xba, 0xf1, 0x1c, 0x6a, 0x34, 0x11, 0x3c, 0xa4, - 0x99, 0x53, 0xeb, 0x96, 0x37, 0x9a, 0xfd, 0xc5, 0xb9, 0x33, 0x36, 0xdd, 0xe4, 0x1c, 0xbc, 0x06, - 0x55, 0x8f, 0xc5, 0x71, 0x28, 0x9c, 0xba, 0x3e, 0x53, 0x1d, 0x61, 0x07, 0x6a, 0x1e, 0x8b, 0x53, - 0xe2, 0x09, 0x67, 0x51, 0x97, 0x35, 0x21, 0xee, 0x43, 0x3d, 0x33, 0x16, 0x39, 0x0d, 0x65, 0x1d, - 0xba, 0x6f, 0x5d, 0x6e, 0x59, 0xce, 0x93, 0x55, 0x38, 0xfd, 0x91, 0x7a, 0xc2, 0x81, 0xae, 0xb5, - 0x51, 0x77, 0x4d, 0x84, 0xd7, 0xa1, 0xa9, 0x57, 0xc3, 0x71, 0x98, 0x08, 0xa7, 0xa9, 0x2a, 0x81, - 0x86, 0xf6, 0xc3, 0xc4, 0xc8, 0x48, 0x04, 0xbd, 0x10, 0x4e, 0x4b, 0x1d, 0x5f, 0x1e, 0xf6, 0xbe, - 0x87, 0xc6, 0x3e, 0xe1, 0xbe, 0xbe, 0x18, 0xb9, 0x73, 0x56, 0xc1, 0x39, 0x0c, 0x95, 0x73, 0x26, - 0x68, 0x3e, 0x13, 0x72, 0x5d, 0xe8, 0xb6, 0x5c, 0xec, 0xb6, 0xf7, 0x97, 0x05, 0x8d, 0xe9, 0xbd, - 0x93, 0x2c, 0xc9, 0xe6, 0x99, 0x63, 0x75, 0xcb, 0x92, 0xa5, 0x23, 0xfc, 0x08, 0xea, 0x11, 0x25, - 0x3c, 0x91, 0x19, 0x5b, 0x65, 0xa6, 0x31, 0x7e, 0x06, 0x4b, 0x9a, 0x35, 0x64, 0x13, 0x11, 0xb0, - 0x30, 0x09, 0x9c, 0xb2, 0xa2, 0xb4, 0x35, 0xfc, 0xca, 0xa0, 0xf8, 0x09, 0x2c, 0xe6, 0x1f, 0x0d, - 0x13, 0xd9, 0x57, 0x45, 0xd1, 0x5a, 0x39, 0x78, 0x44, 0x2f, 0x04, 0xfe, 0x0c, 0x80, 0x4c, 0x04, - 0x1b, 0x46, 0x94, 0x9c, 0x53, 0x75, 0xee, 0x75, 0xb7, 0x21, 0x91, 0x43, 0x09, 0xf4, 0x7e, 0xb5, - 0x00, 0xa4, 0xdc, 0xbd, 0x31, 0x49, 0x02, 0x8a, 0x37, 0xcd, 0x25, 0xb4, 0xd5, 0x25, 0x5c, 0x2b, - 0x0e, 0x92, 0x66, 0x14, 0xee, 0xe1, 0x93, 0xd9, 0x10, 0x2b, 0x0b, 0x76, 0xe1, 0xf6, 0x66, 0xbd, - 0x7a, 0x24, 0x07, 0xf9, 0xc5, 0x74, 0xa0, 0x0b, 0xae, 0x57, 0xe6, 0x5c, 0xc7, 0x6b, 0x60, 0x87, - 0xbe, 0xb6, 0x79, 0xb7, 0x7a, 0x7b, 0xb3, 0x6e, 0x1f, 0xbc, 0x70, 0xed, 0xd0, 0xef, 0x79, 0x80, - 0x66, 0xe5, 0x8e, 0xc3, 0x24, 0x88, 0x66, 0xb2, 0xac, 0x0f, 0x93, 0x65, 0xff, 0x97, 0xac, 0xde, - 0x1f, 0x16, 0xb4, 0x66, 0x5f, 0x9f, 0xf6, 0xf1, 0xb7, 0x00, 0x82, 0x93, 0x24, 0x0b, 0x45, 0xc8, - 0x12, 0x53, 0xe7, 0xf1, 0x03, 0x75, 0xa6, 0x1c, 0xb7, 0xc0, 0xc7, 0x5f, 0x43, 0xcd, 0x53, 0x79, - 0x7d, 0x9a, 0x85, 0x27, 0xe0, 0x7e, 0x2b, 0xf9, 0xd0, 0x18, 0x7a, 0xd1, 0x9f, 0xf2, 0x9c, 0x3f, - 0x9b, 0xfb, 0xd0, 0x98, 0x3e, 0xa5, 0x78, 0x09, 0x9a, 0x2a, 0x38, 0x62, 0x3c, 0x26, 0x11, 0x2a, - 0xe1, 0x15, 0x58, 0x52, 0xc0, 0x6c, 0x7f, 0x64, 0xe1, 0x8f, 0x60, 0xf9, 0x1e, 0x78, 0xda, 0x47, - 0xf6, 0xe6, 0x9d, 0x0d, 0xcd, 0xc2, 0x33, 0x82, 0x01, 0xaa, 0x83, 0x2c, 0xd8, 0x9f, 0xa4, 0xa8, - 0x84, 0x9b, 0x50, 0x1b, 0x64, 0xc1, 0x2e, 0x25, 0x02, 0x59, 0x26, 0x78, 0xcd, 0x59, 0x8a, 0x6c, - 0xc3, 0xda, 0x49, 0x53, 0x54, 0xc6, 0x6d, 0x00, 0xbd, 0x76, 0x69, 0x96, 0xa2, 0x8a, 0x21, 0x9e, - 0x32, 0x41, 0xd1, 0x82, 0xd4, 0x66, 0x02, 0x95, 0xad, 0x9a, 0xac, 0x9c, 0x60, 0x54, 0xc3, 0x08, - 0x5a, 0xb2, 0x18, 0x25, 0x5c, 0x8c, 0x64, 0x95, 0x3a, 0x5e, 0x05, 0x54, 0x44, 0xd4, 0x47, 0x0d, - 0x8c, 0xa1, 0x3d, 0xc8, 0x82, 0x37, 0x09, 0xa7, 0xc4, 0x1b, 0x93, 0x51, 0x44, 0x11, 0xe0, 0x65, - 0x58, 0x34, 0x1b, 0xc9, 0x69, 0x9a, 0x64, 0xa8, 0x69, 0x68, 0x7b, 0x63, 0xea, 0xbd, 0xfb, 0x61, - 0xc2, 0xf8, 0x24, 0x46, 0x2d, 0xd9, 0xf6, 0x20, 0x0b, 0xd4, 0xd1, 0x9c, 0x51, 0x7e, 0x48, 0x89, - 0x4f, 0x39, 0x5a, 0x34, 0x5f, 0x9f, 0x84, 0x31, 0x65, 0x13, 0x71, 0xc4, 0x7e, 0x42, 0x6d, 0x23, - 0xc6, 0xa5, 0xc4, 0x3f, 0x90, 0x2f, 0x1c, 0x5a, 0x32, 0x62, 0xa6, 0x88, 0x12, 0x83, 0x4c, 0xbf, - 0xaf, 0x39, 0x55, 0x2d, 0x2e, 0x9b, 0xaa, 0x26, 0x56, 0x1c, 0x6c, 0x38, 0x87, 0x2c, 0x50, 0xf1, - 0xca, 0xe6, 0xcf, 0x16, 0xac, 0x3e, 0x74, 0x51, 0xf0, 0x63, 0x70, 0x1e, 0xc2, 0x77, 0x26, 0x82, - 0xa1, 0x12, 0x7e, 0x0a, 0x9f, 0x3f, 0x94, 0xfd, 0x8e, 0x85, 0x89, 0x38, 0x88, 0xd3, 0x28, 0xf4, - 0x42, 0x79, 0x34, 0xff, 0x47, 0x7b, 0x79, 0x61, 0x68, 0xf6, 0xe6, 0x25, 0xb4, 0xe7, 0x87, 0x42, - 0x9a, 0x33, 0x43, 0x76, 0x7c, 0x5f, 0x0e, 0x02, 0x2a, 0x61, 0xa7, 0x28, 0xd6, 0xa5, 0x31, 0x3b, - 0xa7, 0x2a, 0x63, 0xcd, 0x67, 0xde, 0xa4, 0x3e, 0x11, 0x3a, 0x63, 0xcf, 0x37, 0xb2, 0xe3, 0xfb, - 0x87, 0xfa, 0x9d, 0x51, 0xd9, 0xf2, 0xee, 0xab, 0xab, 0xf7, 0x9d, 0xd2, 0xf5, 0xfb, 0x4e, 0xe9, - 0xea, 0xb6, 0x63, 0x5d, 0xdf, 0x76, 0xac, 0x7f, 0x6e, 0x3b, 0xd6, 0x6f, 0x77, 0x9d, 0xd2, 0xef, - 0x77, 0x9d, 0xd2, 0xf5, 0x5d, 0xa7, 0xf4, 0xf7, 0x5d, 0xa7, 0xf4, 0xf6, 0x8b, 0x20, 0x14, 0xe3, - 0xc9, 0x68, 0xcb, 0x63, 0xf1, 0x76, 0x14, 0x26, 0xef, 0x48, 0x14, 0x3d, 0x8f, 0xc8, 0x28, 0xdb, - 0x3e, 0x27, 0xc9, 0x24, 0x53, 0x7f, 0x58, 0xb6, 0xf5, 0xe8, 0x8c, 0xaa, 0xea, 0xaf, 0xc9, 0x97, - 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xff, 0x8c, 0xad, 0xd0, 0xcd, 0x08, 0x00, 0x00, + 0xd0, 0x1e, 0x7b, 0xac, 0x7a, 0xee, 0x1f, 0xc2, 0x91, 0x63, 0x4f, 0xa8, 0x0b, 0x7f, 0x43, 0xef, + 0xd5, 0xfc, 0x70, 0xe2, 0x20, 0x5a, 0xa9, 0xa7, 0xcc, 0xfb, 0xde, 0xe7, 0x79, 0xdf, 0xfb, 0x66, + 0xde, 0x28, 0xb0, 0xcc, 0xc9, 0x99, 0x48, 0x47, 0xdb, 0xf2, 0x67, 0x2b, 0xe5, 0x4c, 0x30, 0x5c, + 0xd5, 0xd0, 0xa3, 0xd5, 0x80, 0x05, 0x4c, 0x41, 0xdb, 0x72, 0xa5, 0xb3, 0xbd, 0xdf, 0x2d, 0x58, + 0x78, 0x99, 0x08, 0x7e, 0x89, 0x31, 0x54, 0x04, 0xe5, 0xb1, 0x63, 0x77, 0xad, 0x8d, 0x8a, 0xab, + 0xd6, 0x78, 0x15, 0x16, 0xc2, 0xc4, 0xa7, 0x17, 0x4e, 0x59, 0x81, 0x3a, 0xc0, 0x4f, 0xa1, 0x22, + 0x2e, 0x53, 0xea, 0x58, 0x5d, 0x6b, 0xa3, 0xdd, 0x5f, 0xde, 0xd2, 0x05, 0xb6, 0xd4, 0x36, 0x27, + 0x97, 0x29, 0x75, 0x55, 0x5a, 0x6e, 0xe8, 0x13, 0x41, 0x9c, 0x4a, 0xd7, 0xda, 0x68, 0xb9, 0x6a, + 0x8d, 0x3f, 0x84, 0x5a, 0xc2, 0x7c, 0x3a, 0x0c, 0x7d, 0x67, 0x41, 0x6d, 0x59, 0x95, 0xe1, 0x81, + 0x8f, 0x3f, 0x86, 0x46, 0xca, 0xe9, 0xf9, 0x50, 0x49, 0xa8, 0xaa, 0x54, 0x5d, 0x02, 0x27, 0x94, + 0xc7, 0x3d, 0x01, 0xe8, 0x38, 0x21, 0x69, 0x36, 0x66, 0x62, 0x40, 0x05, 0x51, 0x3b, 0x7d, 0x01, + 0xe0, 0xb1, 0xe4, 0x6c, 0x98, 0x09, 0x22, 0xb4, 0x94, 0xe6, 0x4c, 0xca, 0x1e, 0x4b, 0xce, 0x8e, + 0x65, 0x62, 0xb7, 0x72, 0x75, 0xb3, 0x5e, 0x72, 0x1b, 0x5e, 0x0e, 0xcc, 0x5a, 0xb2, 0x8b, 0x2d, + 0xe5, 0xcd, 0x97, 0x67, 0xcd, 0xf7, 0xde, 0x42, 0x3d, 0xaf, 0x3a, 0xed, 0xc5, 0x2a, 0xf4, 0xf2, + 0x15, 0xd4, 0x63, 0xa3, 0x46, 0x6d, 0xd6, 0xec, 0x3b, 0x79, 0xfd, 0xfb, 0x6a, 0x8d, 0x8c, 0x29, + 0xbf, 0xf7, 0x53, 0x19, 0x6a, 0x03, 0x9a, 0x65, 0x24, 0xa0, 0xf8, 0xd9, 0x9c, 0x9d, 0x2b, 0xf9, + 0x1e, 0x26, 0x5d, 0x30, 0xb4, 0x0d, 0xb6, 0x60, 0x46, 0xb7, 0x2d, 0x98, 0x14, 0x75, 0xc6, 0xd9, + 0x54, 0xb4, 0x5c, 0x4f, 0x1b, 0xa9, 0x14, 0x4e, 0xf1, 0x23, 0xa8, 0x47, 0x2c, 0xd0, 0xd6, 0x6a, + 0xd7, 0x6b, 0x11, 0x0b, 0x4e, 0xe6, 0x0e, 0xb8, 0x5a, 0x74, 0xe3, 0x39, 0xd4, 0x68, 0x22, 0x78, + 0x48, 0x33, 0xa7, 0xd6, 0x2d, 0x6f, 0x34, 0xfb, 0x8b, 0x73, 0x67, 0x6c, 0xba, 0xc9, 0x39, 0x78, + 0x0d, 0xaa, 0x1e, 0x8b, 0xe3, 0x50, 0x38, 0x75, 0x7d, 0xa6, 0x3a, 0xc2, 0x0e, 0xd4, 0x3c, 0x16, + 0xa7, 0xc4, 0x13, 0xce, 0xa2, 0x2e, 0x6b, 0x42, 0xdc, 0x87, 0x7a, 0x66, 0x2c, 0x72, 0x1a, 0xca, + 0x3a, 0x74, 0xdf, 0xba, 0xdc, 0xb2, 0x9c, 0x27, 0xab, 0x70, 0xfa, 0x3d, 0xf5, 0x84, 0x03, 0x5d, + 0x6b, 0xa3, 0xee, 0x9a, 0x08, 0xaf, 0x43, 0x53, 0xaf, 0x86, 0xe3, 0x30, 0x11, 0x4e, 0x53, 0x55, + 0x02, 0x0d, 0xed, 0x87, 0x89, 0x91, 0x91, 0x08, 0x7a, 0x21, 0x9c, 0x96, 0x3a, 0xbe, 0x3c, 0xec, + 0x7d, 0x0b, 0x8d, 0x7d, 0xc2, 0x7d, 0x7d, 0x31, 0x72, 0xe7, 0xac, 0x82, 0x73, 0x18, 0x2a, 0xe7, + 0x4c, 0xd0, 0x7c, 0x26, 0xe4, 0xba, 0xd0, 0x6d, 0xb9, 0xd8, 0x6d, 0xef, 0x0f, 0x0b, 0x1a, 0xd3, + 0x7b, 0x27, 0x59, 0x92, 0xcd, 0x33, 0xc7, 0xea, 0x96, 0x25, 0x4b, 0x47, 0xf8, 0x11, 0xd4, 0x23, + 0x4a, 0x78, 0x22, 0x33, 0xb6, 0xca, 0x4c, 0x63, 0xfc, 0x0c, 0x96, 0x34, 0x6b, 0xc8, 0x26, 0x22, + 0x60, 0x61, 0x12, 0x38, 0x65, 0x45, 0x69, 0x6b, 0xf8, 0x95, 0x41, 0xf1, 0x13, 0x58, 0xcc, 0x3f, + 0x1a, 0x26, 0xb2, 0xaf, 0x8a, 0xa2, 0xb5, 0x72, 0xf0, 0x88, 0x5e, 0x08, 0xfc, 0x09, 0x00, 0x99, + 0x08, 0x36, 0x8c, 0x28, 0x39, 0xa7, 0xea, 0xdc, 0xeb, 0x6e, 0x43, 0x22, 0x87, 0x12, 0xe8, 0xfd, + 0x6c, 0x01, 0x48, 0xb9, 0x7b, 0x63, 0x92, 0x04, 0x14, 0x6f, 0x9a, 0x4b, 0x68, 0xab, 0x4b, 0xb8, + 0x56, 0x1c, 0x24, 0xcd, 0x28, 0xdc, 0xc3, 0x27, 0xb3, 0x21, 0x56, 0x16, 0xec, 0xc2, 0xed, 0xcd, + 0x7a, 0xf5, 0x48, 0x0e, 0xf2, 0x8b, 0xe9, 0x40, 0x17, 0x5c, 0xaf, 0xcc, 0xb9, 0x8e, 0xd7, 0xc0, + 0x0e, 0x7d, 0x6d, 0xf3, 0x6e, 0xf5, 0xf6, 0x66, 0xdd, 0x3e, 0x78, 0xe1, 0xda, 0xa1, 0xdf, 0xf3, + 0x00, 0xcd, 0xca, 0x1d, 0x87, 0x49, 0x10, 0xcd, 0x64, 0x59, 0xff, 0x4f, 0x96, 0xfd, 0x6f, 0xb2, + 0x7a, 0xbf, 0x59, 0xd0, 0x9a, 0x7d, 0x7d, 0xda, 0xc7, 0x5f, 0x03, 0x08, 0x4e, 0x92, 0x2c, 0x14, + 0x21, 0x4b, 0x4c, 0x9d, 0xc7, 0x0f, 0xd4, 0x99, 0x72, 0xdc, 0x02, 0x1f, 0x7f, 0x09, 0x35, 0x4f, + 0xe5, 0xf5, 0x69, 0x16, 0x9e, 0x80, 0xfb, 0xad, 0xe4, 0x43, 0x63, 0xe8, 0x45, 0x7f, 0xca, 0x73, + 0xfe, 0x6c, 0xee, 0x43, 0x63, 0xfa, 0x94, 0xe2, 0x25, 0x68, 0xaa, 0xe0, 0x88, 0xf1, 0x98, 0x44, + 0xa8, 0x84, 0x57, 0x60, 0x49, 0x01, 0xb3, 0xfd, 0x91, 0x85, 0x3f, 0x80, 0xe5, 0x7b, 0xe0, 0x69, + 0x1f, 0xd9, 0x9b, 0x7f, 0xdb, 0xd0, 0x2c, 0x3c, 0x23, 0x18, 0xa0, 0x3a, 0xc8, 0x82, 0xfd, 0x49, + 0x8a, 0x4a, 0xb8, 0x09, 0xb5, 0x41, 0x16, 0xec, 0x52, 0x22, 0x90, 0x65, 0x82, 0xd7, 0x9c, 0xa5, + 0xc8, 0x36, 0xac, 0x9d, 0x34, 0x45, 0x65, 0xdc, 0x06, 0xd0, 0x6b, 0x97, 0x66, 0x29, 0xaa, 0x18, + 0xe2, 0x29, 0x13, 0x14, 0x2d, 0x48, 0x6d, 0x26, 0x50, 0xd9, 0xaa, 0xc9, 0xca, 0x09, 0x46, 0x35, + 0x8c, 0xa0, 0x25, 0x8b, 0x51, 0xc2, 0xc5, 0x48, 0x56, 0xa9, 0xe3, 0x55, 0x40, 0x45, 0x44, 0x7d, + 0xd4, 0xc0, 0x18, 0xda, 0x83, 0x2c, 0x78, 0x93, 0x70, 0x4a, 0xbc, 0x31, 0x19, 0x45, 0x14, 0x01, + 0x5e, 0x86, 0x45, 0xb3, 0x91, 0x9c, 0xa6, 0x49, 0x86, 0x9a, 0x86, 0xb6, 0x37, 0xa6, 0xde, 0xbb, + 0xef, 0x26, 0x8c, 0x4f, 0x62, 0xd4, 0x92, 0x6d, 0x0f, 0xb2, 0x40, 0x1d, 0xcd, 0x19, 0xe5, 0x87, + 0x94, 0xf8, 0x94, 0xa3, 0x45, 0xf3, 0xf5, 0x49, 0x18, 0x53, 0x36, 0x11, 0x47, 0xec, 0x07, 0xd4, + 0x36, 0x62, 0x5c, 0x4a, 0xfc, 0x03, 0xf9, 0xc2, 0xa1, 0x25, 0x23, 0x66, 0x8a, 0x28, 0x31, 0xc8, + 0xf4, 0xfb, 0x9a, 0x53, 0xd5, 0xe2, 0xb2, 0xa9, 0x6a, 0x62, 0xc5, 0xc1, 0x86, 0x73, 0xc8, 0x02, + 0x15, 0xaf, 0x98, 0xbd, 0x77, 0xd2, 0x34, 0xba, 0x54, 0xc8, 0xea, 0xe6, 0x8f, 0x16, 0xac, 0x3e, + 0x74, 0x75, 0xf0, 0x63, 0x70, 0x1e, 0xc2, 0x77, 0x26, 0x82, 0xa1, 0x12, 0x7e, 0x0a, 0x9f, 0x3e, + 0x94, 0xfd, 0x86, 0x85, 0x89, 0x38, 0x88, 0xd3, 0x28, 0xf4, 0x42, 0x79, 0x58, 0xff, 0x45, 0x7b, + 0x79, 0x61, 0x68, 0xf6, 0xe6, 0x25, 0xb4, 0xe7, 0xc7, 0x44, 0xda, 0x35, 0x43, 0x76, 0x7c, 0x5f, + 0x8e, 0x06, 0x2a, 0x61, 0xa7, 0x28, 0xd6, 0xa5, 0x31, 0x3b, 0xa7, 0x2a, 0x63, 0xcd, 0x67, 0xde, + 0xa4, 0x3e, 0x11, 0x3a, 0x63, 0xcf, 0x37, 0xb2, 0xe3, 0xfb, 0x87, 0xfa, 0xe5, 0x51, 0xd9, 0xf2, + 0xee, 0xab, 0xab, 0xf7, 0x9d, 0xd2, 0xf5, 0xfb, 0x4e, 0xe9, 0xea, 0xb6, 0x63, 0x5d, 0xdf, 0x76, + 0xac, 0xbf, 0x6e, 0x3b, 0xd6, 0x2f, 0x77, 0x9d, 0xd2, 0xaf, 0x77, 0x9d, 0xd2, 0xf5, 0x5d, 0xa7, + 0xf4, 0xe7, 0x5d, 0xa7, 0xf4, 0xf6, 0xb3, 0x20, 0x14, 0xe3, 0xc9, 0x68, 0xcb, 0x63, 0xf1, 0x76, + 0x14, 0x26, 0xef, 0x48, 0x14, 0x3d, 0x8f, 0xc8, 0x28, 0xdb, 0x3e, 0x27, 0xc9, 0x24, 0x53, 0x7f, + 0x61, 0xb6, 0xf5, 0x30, 0x8d, 0xaa, 0xea, 0xcf, 0xca, 0xe7, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, + 0xca, 0xa3, 0x22, 0x3a, 0xdf, 0x08, 0x00, 0x00, } func (m *Entry) Marshal() (dAtA []byte, err error) { diff --git a/raft/raftpb/raft.proto b/raft/raftpb/raft.proto index 3e903eec6..b6d527edf 100644 --- a/raft/raftpb/raft.proto +++ b/raft/raftpb/raft.proto @@ -63,6 +63,7 @@ enum MessageType { MsgPreVote = 17; MsgPreVoteResp = 18; MsgLogResp = 19; + MsgApplyResp = 20; } message Message { diff --git a/raft/rawnode.go b/raft/rawnode.go index 6a8f5f59b..9843e2f94 100644 --- a/raft/rawnode.go +++ b/raft/rawnode.go @@ -87,7 +87,8 @@ func (rn *RawNode) Propose(data []byte) error { From: rn.raft.id, Entries: []pb.Entry{ {Data: data}, - }}) + }, + }) } // ProposeConfChange proposes a config change. See (Node).ProposeConfChange for @@ -146,10 +147,14 @@ func (rn *RawNode) acceptReady(rd Ready) { if len(rd.ReadStates) != 0 { rn.raft.readStates = nil } - if len(rd.Entries) > 0 { - e := rd.Entries[len(rd.Entries)-1] + if n := len(rd.Entries); n != 0 { + e := rd.Entries[n-1] rn.raft.raftLog.persistingTo(e.Index, e.Term) } + if n := len(rd.CommittedEntries); n != 0 { + e := rd.CommittedEntries[n-1] + rn.raft.raftLog.applyingTo(e.Index) + } rn.raft.msgs = nil } @@ -187,7 +192,23 @@ func (rn *RawNode) Advance(rd Ready) { if rd.Compact != 0 { rn.prevCompact = rd.Compact } - rn.raft.advance(rd) + // FIXME(james.yin): stableSnapTo + // rn.raft.advance(rd) +} + +func (rn *RawNode) ReportLogged(index uint64, term uint64) error { + return rn.raft.Step(pb.Message{ + Type: pb.MsgLogResp, + LogTerm: term, + Index: index, + }) +} + +func (rn *RawNode) ReportApplied(index uint64) error { + return rn.raft.Step(pb.Message{ + Type: pb.MsgApplyResp, + Index: index, + }) } // Status returns the current status of the given group. This allocates, see diff --git a/raft/rawnode_test.go b/raft/rawnode_test.go index bc7ee72c4..0ad599fb0 100644 --- a/raft/rawnode_test.go +++ b/raft/rawnode_test.go @@ -57,19 +57,33 @@ func (a *rawNodeAdapter) Ready() <-chan Ready { return nil } // Node takes more contexts. Easy enough to fix. func (a *rawNodeAdapter) Campaign(context.Context) error { return a.RawNode.Campaign() } + func (a *rawNodeAdapter) ReadIndex(_ context.Context, rctx []byte) error { a.RawNode.ReadIndex(rctx) // RawNode swallowed the error in ReadIndex, it probably should not do that. return nil } -func (a *rawNodeAdapter) Step(_ context.Context, m pb.Message) error { return a.RawNode.Step(m) } + +func (a *rawNodeAdapter) Step(_ context.Context, m pb.Message) error { + return a.RawNode.Step(m) +} + func (a *rawNodeAdapter) Propose(_ context.Context, data []byte) error { return a.RawNode.Propose(data) } + func (a *rawNodeAdapter) ProposeConfChange(_ context.Context, cc pb.ConfChangeI) error { return a.RawNode.ProposeConfChange(cc) } +func (a *rawNodeAdapter) ReportLogged(_ context.Context, index uint64, term uint64) error { + return a.RawNode.ReportLogged(index, term) +} + +func (a *rawNodeAdapter) ReportApplied(_ context.Context, index uint64) error { + return a.RawNode.ReportApplied(index) +} + // TestRawNodeStep ensures that RawNode.Step ignore local message. func TestRawNodeStep(t *testing.T) { for i, msgn := range pb.MessageType_name { @@ -126,27 +140,30 @@ func TestRawNodeProposeAndConfChange(t *testing.T) { // Proposing the same as a V2 change works just the same, without entering // a joint config. { - pb.ConfChangeV2{Changes: []pb.ConfChangeSingle{ - {Type: pb.ConfChangeAddNode, NodeID: 2}, - }, + pb.ConfChangeV2{ + Changes: []pb.ConfChangeSingle{ + {Type: pb.ConfChangeAddNode, NodeID: 2}, + }, }, pb.ConfState{Voters: []uint64{1, 2}}, nil, }, // Ditto if we add it as a learner instead. { - pb.ConfChangeV2{Changes: []pb.ConfChangeSingle{ - {Type: pb.ConfChangeAddLearnerNode, NodeID: 2}, - }, + pb.ConfChangeV2{ + Changes: []pb.ConfChangeSingle{ + {Type: pb.ConfChangeAddLearnerNode, NodeID: 2}, + }, }, pb.ConfState{Voters: []uint64{1}, Learners: []uint64{2}}, nil, }, // We can ask explicitly for joint consensus if we want it. { - pb.ConfChangeV2{Changes: []pb.ConfChangeSingle{ - {Type: pb.ConfChangeAddLearnerNode, NodeID: 2}, - }, + pb.ConfChangeV2{ + Changes: []pb.ConfChangeSingle{ + {Type: pb.ConfChangeAddLearnerNode, NodeID: 2}, + }, Transition: pb.ConfChangeTransitionJointExplicit, }, pb.ConfState{Voters: []uint64{1}, VotersOutgoing: []uint64{1}, Learners: []uint64{2}}, @@ -154,9 +171,10 @@ func TestRawNodeProposeAndConfChange(t *testing.T) { }, // Ditto, but with implicit transition (the harness checks this). { - pb.ConfChangeV2{Changes: []pb.ConfChangeSingle{ - {Type: pb.ConfChangeAddLearnerNode, NodeID: 2}, - }, + pb.ConfChangeV2{ + Changes: []pb.ConfChangeSingle{ + {Type: pb.ConfChangeAddLearnerNode, NodeID: 2}, + }, Transition: pb.ConfChangeTransitionJointImplicit, }, pb.ConfState{ @@ -168,11 +186,12 @@ func TestRawNodeProposeAndConfChange(t *testing.T) { // Add a new node and demote n1. This exercises the interesting case in // which we really need joint config changes and also need LearnersNext. { - pb.ConfChangeV2{Changes: []pb.ConfChangeSingle{ - {NodeID: 2, Type: pb.ConfChangeAddNode}, - {NodeID: 1, Type: pb.ConfChangeAddLearnerNode}, - {NodeID: 3, Type: pb.ConfChangeAddLearnerNode}, - }, + pb.ConfChangeV2{ + Changes: []pb.ConfChangeSingle{ + {NodeID: 2, Type: pb.ConfChangeAddNode}, + {NodeID: 1, Type: pb.ConfChangeAddLearnerNode}, + {NodeID: 3, Type: pb.ConfChangeAddLearnerNode}, + }, }, pb.ConfState{ Voters: []uint64{2}, @@ -185,11 +204,12 @@ func TestRawNodeProposeAndConfChange(t *testing.T) { }, // Ditto explicit. { - pb.ConfChangeV2{Changes: []pb.ConfChangeSingle{ - {NodeID: 2, Type: pb.ConfChangeAddNode}, - {NodeID: 1, Type: pb.ConfChangeAddLearnerNode}, - {NodeID: 3, Type: pb.ConfChangeAddLearnerNode}, - }, + pb.ConfChangeV2{ + Changes: []pb.ConfChangeSingle{ + {NodeID: 2, Type: pb.ConfChangeAddNode}, + {NodeID: 1, Type: pb.ConfChangeAddLearnerNode}, + {NodeID: 3, Type: pb.ConfChangeAddLearnerNode}, + }, Transition: pb.ConfChangeTransitionJointExplicit, }, pb.ConfState{ @@ -377,9 +397,10 @@ func TestRawNodeProposeAndConfChange(t *testing.T) { // TestRawNodeJointAutoLeave tests the configuration change auto leave even leader // lost leadership. func TestRawNodeJointAutoLeave(t *testing.T) { - testCc := pb.ConfChangeV2{Changes: []pb.ConfChangeSingle{ - {Type: pb.ConfChangeAddLearnerNode, NodeID: 2}, - }, + testCc := pb.ConfChangeV2{ + Changes: []pb.ConfChangeSingle{ + {Type: pb.ConfChangeAddLearnerNode, NodeID: 2}, + }, Transition: pb.ConfChangeTransitionJointImplicit, } expCs := pb.ConfState{ @@ -868,17 +889,17 @@ func TestRawNodeStatus(t *testing.T) { // TestNodeCommitPaginationAfterRestart. The anomaly here was even worse as the // Raft group would forget to apply entries: // -// - node learns that index 11 is committed -// - nextEnts returns index 1..10 in CommittedEntries (but index 10 already -// exceeds maxBytes), which isn't noticed internally by Raft -// - Commit index gets bumped to 10 -// - the node persists the HardState, but crashes before applying the entries -// - upon restart, the storage returns the same entries, but `slice` takes a -// different code path and removes the last entry. -// - Raft does not emit a HardState, but when the app calls Advance(), it bumps -// its internal applied index cursor to 10 (when it should be 9) -// - the next Ready asks the app to apply index 11 (omitting index 10), losing a -// write. +// - node learns that index 11 is committed +// - nextEnts returns index 1..10 in CommittedEntries (but index 10 already +// exceeds maxBytes), which isn't noticed internally by Raft +// - Commit index gets bumped to 10 +// - the node persists the HardState, but crashes before applying the entries +// - upon restart, the storage returns the same entries, but `slice` takes a +// different code path and removes the last entry. +// - Raft does not emit a HardState, but when the app calls Advance(), it bumps +// its internal applied index cursor to 10 (when it should be 9) +// - the next Ready asks the app to apply index 11 (omitting index 10), losing a +// write. func TestRawNodeCommitPaginationAfterRestart(t *testing.T) { s := &ignoreSizeHintMemStorage{ MemoryStorage: newTestMemoryStorage(withPeers(1)), diff --git a/raft/storage.go b/raft/storage.go index f23cd2380..4fc8969b9 100644 --- a/raft/storage.go +++ b/raft/storage.go @@ -185,7 +185,7 @@ func (ms *MemoryStorage) ApplySnapshot(snap pb.Snapshot) error { ms.Lock() defer ms.Unlock() - //handle check for old snapshot being applied + // handle check for old snapshot being applied msIndex := ms.snapshot.Metadata.Index snapIndex := snap.Metadata.Index if msIndex >= snapIndex { diff --git a/raft/util.go b/raft/util.go index 7ab88a731..4e5afaf94 100644 --- a/raft/util.go +++ b/raft/util.go @@ -41,12 +41,13 @@ func max(a, b uint64) uint64 { } func IsLocalMsg(msgt pb.MessageType) bool { - return msgt == pb.MsgHup || msgt == pb.MsgBeat || msgt == pb.MsgUnreachable || - msgt == pb.MsgSnapStatus || msgt == pb.MsgCheckQuorum + return msgt == pb.MsgHup || msgt == pb.MsgBeat || msgt == pb.MsgUnreachable || msgt == pb.MsgSnapStatus || + msgt == pb.MsgCheckQuorum || msgt == pb.MsgLogResp || msgt == pb.MsgApplyResp } func IsResponseMsg(msgt pb.MessageType) bool { - return msgt == pb.MsgAppResp || msgt == pb.MsgVoteResp || msgt == pb.MsgHeartbeatResp || msgt == pb.MsgUnreachable || msgt == pb.MsgPreVoteResp + return msgt == pb.MsgAppResp || msgt == pb.MsgVoteResp || msgt == pb.MsgHeartbeatResp || + msgt == pb.MsgUnreachable || msgt == pb.MsgPreVoteResp } // voteResponseType maps vote and prevote message types to their corresponding responses. diff --git a/test/benchmark/command/component.go b/test/benchmark/command/component.go index d98d5432c..0717d3131 100644 --- a/test/benchmark/command/component.go +++ b/test/benchmark/command/component.go @@ -21,22 +21,26 @@ import ( "math/rand" "net" "net/http" + _ "net/http/pprof" "os" "sync" "sync/atomic" "time" "github.com/go-redis/redis/v8" - "github.com/linkall-labs/vanus/internal/store" - "github.com/linkall-labs/vanus/internal/store/segment" - "github.com/linkall-labs/vanus/observability/log" - v1 "github.com/linkall-labs/vanus/proto/pkg/cloudevents" - segpb "github.com/linkall-labs/vanus/proto/pkg/segment" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/spf13/cobra" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" - _ "net/http/pprof" + + "github.com/linkall-labs/vanus/observability/log" + v1 "github.com/linkall-labs/vanus/proto/pkg/cloudevents" + segpb "github.com/linkall-labs/vanus/proto/pkg/segment" + + "github.com/linkall-labs/vanus/internal/primitive/vanus" + "github.com/linkall-labs/vanus/internal/store" + "github.com/linkall-labs/vanus/internal/store/config" + "github.com/linkall-labs/vanus/internal/store/segment" ) const ( @@ -91,24 +95,24 @@ func runStoreCommand() *cobra.Command { Dir: fmt.Sprintf("/Users/wenfeng/tmp/data/test/vanus/store-%d", uint16(volumeID)), Capacity: 1073741824, }, - MetaStore: store.SyncStoreConfig{ - WAL: store.WALConfig{ - IO: store.IOConfig{ + MetaStore: config.SyncStore{ + WAL: config.WAL{ + IO: config.IO{ Engine: "psync", }, }, }, - OffsetStore: store.AsyncStoreConfig{ - WAL: store.WALConfig{ - IO: store.IOConfig{ + OffsetStore: config.AsyncStore{ + WAL: config.WAL{ + IO: config.IO{ Engine: "psync", }, }, }, - Raft: store.RaftConfig{ - WAL: store.WALConfig{ + Raft: config.Raft{ + WAL: config.WAL{ BlockSize: 32 * 1024, - IO: store.IOConfig{ + IO: config.IO{ Engine: "psync", }, }, @@ -198,7 +202,8 @@ func createBlockCommand() *cobra.Command { cmd.Flags().IntVar(&segmentNumbers, "number", 1, "") cmd.Flags().IntVar(&replicaNum, "replicas", 3, "") cmd.Flags().StringArrayVar(&storeAddrs, "store-address", []string{ - "127.0.0.1:2149", "127.0.0.1:2150", "127.0.0.1:2151"}, "") + "127.0.0.1:2149", "127.0.0.1:2150", "127.0.0.1:2151", + }, "") return cmd } @@ -227,7 +232,8 @@ func sendCommand() *cobra.Command { br := BlockRecord{} _ = json.Unmarshal([]byte(sCmd.Val()), &br) brs[i] = br - fmt.Printf("found a block, ID: %s, addr: %s\n", vanus.ID(br.LeaderID).String(), br.LeaderAddr) + fmt.Printf("found a block, ID: %s, addr: %s\n", + vanus.ID(br.LeaderID).String(), br.LeaderAddr) } conns := make(map[string]*grpc.ClientConn, 0) From 7f990d39f21195be66d380e222e0c3dbdc086d46 Mon Sep 17 00:00:00 2001 From: Chris <33193104+Jesministrator@users.noreply.github.com> Date: Tue, 3 Jan 2023 17:51:32 +0800 Subject: [PATCH 15/46] docs: Update CONTRIBUTING.md (#380) --- CONTRIBUTING.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 700a64b2b..027077a79 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,7 +29,7 @@ resources to make it easier to get your contribution accepted. ## Before you get started ### Sign the CLA -Click [here](https://cla-assistant.io/linkall-labs/) to sign the CLA, and click the `Sign in with GitHub to agree` button to sign. +Click [here](https://cla-assistant.io/linkall-labs/vanus) to sign the CLA, and click the `Sign in with GitHub to agree` button to sign. What is [CLA](https://en.wikipedia.org/wiki/Contributor_License_Agreement). @@ -51,7 +51,7 @@ assigned to someone. #### First Contribution You can start by finding existing issues with the -[good-first-issue](https://github.com/linkall-labs/vanus/issues?q=is%3Aopen+is%3Aissue+label%3Agood-first-issue) label. +[good-first-issue](https://github.com/linkall-labs/vanus/issues?q=is%3Aopen+is%3Aissue+label%3A"good+first+issue") label. These issues are well suited for a new contributor. #### Further Contributions @@ -113,6 +113,3 @@ There are some automated tasks to ensure each PR's reach high quality in Vanus. ### Code Review The Code Review can be started until all checking were passed. Each PR will automatically assign reviewers. After getting at least one `Approve` from reviewers, the PR can be merged. - -## Reward -Once your PR has been merged, you become a Vanus Contributor. Thanks for your contribution! please fill the [form](#) to get you reward \ No newline at end of file From 9900716b9e4af6e6e68cd17f89201c0df931ffa3 Mon Sep 17 00:00:00 2001 From: delu Date: Wed, 4 Jan 2023 22:26:33 +0800 Subject: [PATCH 16/46] feat: subscription support disable and resume (#378) * feat: support subscription pause Signed-off-by: xdlbdy * feat: support subscription pause Signed-off-by: xdlbdy * feat: support subscription pause Signed-off-by: xdlbdy * feat: support subscription pause Signed-off-by: xdlbdy * feat: vsctl add subscription pause Signed-off-by: xdlbdy * feat: vsctl add reset offset command Signed-off-by: xdlbdy * feat: vsctl add reset offset command Signed-off-by: xdlbdy * feat: vsctl add reset offset command Signed-off-by: xdlbdy Signed-off-by: xdlbdy --- cmd/controller/main.go | 2 +- internal/controller/config.go | 1 + internal/controller/trigger/config.go | 2 + internal/controller/trigger/controller.go | 102 +- .../controller/trigger/controller_test.go | 30 +- internal/controller/trigger/metadata/info.go | 16 +- .../trigger/subscription/mock_subscription.go | 30 + .../controller/trigger/subscription/offset.go | 139 ++ .../trigger/subscription/offset/offset.go | 2 +- .../trigger/subscription/offset_test.go | 184 +++ .../trigger/subscription/subscription.go | 34 +- .../trigger/subscription/subscription_test.go | 49 +- .../controller/trigger/worker/mock_worker.go | 20 +- .../controller/trigger/worker/scheduler.go | 13 +- internal/controller/trigger/worker/worker.go | 36 +- .../controller/trigger/worker/worker_test.go | 19 +- internal/convert/convert.go | 5 +- internal/gateway/proxy/direct.go | 15 + internal/trigger/mock_worker.go | 14 - internal/trigger/reader/mock_reader.go | 17 - internal/trigger/reader/reader.go | 73 +- internal/trigger/reader/reader_test.go | 116 +- internal/trigger/server.go | 16 - internal/trigger/server_test.go | 10 - internal/trigger/trigger/mock_trigger.go | 15 - internal/trigger/trigger/trigger.go | 30 +- internal/trigger/trigger/trigger_test.go | 20 - internal/trigger/worker.go | 45 - internal/trigger/worker_test.go | 33 - pkg/cluster/raw_client/trigger.go | 22 +- proto/pkg/controller/controller.pb.go | 1144 ++++++++++------- proto/pkg/controller/mock_controller.go | 78 +- proto/pkg/proxy/proxy.pb.go | 287 +++-- proto/pkg/trigger/mock_trigger.go | 36 - proto/pkg/trigger/trigger.pb.go | 414 +++--- proto/proto/controller.proto | 21 +- proto/proto/proxy.proto | 6 + proto/proto/trigger.proto | 8 - test/e2e/sink/main.go | 11 +- vsctl/command/flag.go | 1 + vsctl/command/subscription.go | 119 ++ 41 files changed, 1863 insertions(+), 1372 deletions(-) create mode 100644 internal/controller/trigger/subscription/offset.go create mode 100644 internal/controller/trigger/subscription/offset_test.go diff --git a/cmd/controller/main.go b/cmd/controller/main.go index e12ccd013..154bcc407 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -94,7 +94,7 @@ func main() { } //trigger controller - triggerCtrlStv := trigger.NewController(cfg.GetTriggerConfig(), cfg.GetControllerAddrs(), etcd) + triggerCtrlStv := trigger.NewController(cfg.GetTriggerConfig(), etcd) if err = triggerCtrlStv.Start(); err != nil { log.Error(ctx, "start trigger controller fail", map[string]interface{}{ log.KeyError: err, diff --git a/internal/controller/config.go b/internal/controller/config.go index 3fd4fb90d..6dc759b03 100644 --- a/internal/controller/config.go +++ b/internal/controller/config.go @@ -86,6 +86,7 @@ func (c *Config) GetTriggerConfig() trigger.Config { ServerList: c.EtcdEndpoints, }, SecretEncryptionSalt: c.SecretEncryptionSalt, + ControllerAddr: c.GetControllerAddrs(), } } diff --git a/internal/controller/trigger/config.go b/internal/controller/trigger/config.go index 8471d1c07..810ce39ff 100644 --- a/internal/controller/trigger/config.go +++ b/internal/controller/trigger/config.go @@ -23,4 +23,6 @@ type Config struct { Storage primitive.KvStorageConfig SecretEncryptionSalt string + + ControllerAddr []string } diff --git a/internal/controller/trigger/controller.go b/internal/controller/trigger/controller.go index 150d4e427..863907028 100644 --- a/internal/controller/trigger/controller.go +++ b/internal/controller/trigger/controller.go @@ -17,12 +17,14 @@ package trigger import ( "context" stdErr "errors" + "fmt" "io" "os" "sync" "time" embedetcd "github.com/linkall-labs/embed-etcd" + eb "github.com/linkall-labs/vanus/client" "github.com/linkall-labs/vanus/internal/controller/trigger/metadata" "github.com/linkall-labs/vanus/internal/controller/trigger/secret" "github.com/linkall-labs/vanus/internal/controller/trigger/storage" @@ -51,13 +53,14 @@ const ( defaultGcSubscriptionInterval = time.Second * 10 ) -func NewController(config Config, controllerAddr []string, member embedetcd.Member) *controller { +func NewController(config Config, member embedetcd.Member) *controller { ctrl := &controller{ config: config, member: member, needCleanSubscription: map[vanus.ID]string{}, state: primitive.ServerStateCreated, - cl: cluster.NewClusterController(controllerAddr, insecure.NewCredentials()), + cl: cluster.NewClusterController(config.ControllerAddr, insecure.NewCredentials()), + ebClient: eb.Connect(config.ControllerAddr), } ctrl.ctx, ctrl.stopFunc = context.WithCancel(context.Background()) return ctrl @@ -79,6 +82,7 @@ type controller struct { stopFunc context.CancelFunc state primitive.ServerState cl cluster.Cluster + ebClient eb.Client } func (ctrl *controller) CommitOffset(ctx context.Context, @@ -106,7 +110,7 @@ func (ctrl *controller) CommitOffset(ctx context.Context, } func (ctrl *controller) ResetOffsetToTimestamp(ctx context.Context, - request *ctrlpb.ResetOffsetToTimestampRequest) (*emptypb.Empty, error) { + request *ctrlpb.ResetOffsetToTimestampRequest) (*ctrlpb.ResetOffsetToTimestampResponse, error) { if ctrl.state != primitive.ServerStateRunning { return nil, errors.ErrServerNotStart } @@ -118,18 +122,16 @@ func (ctrl *controller) ResetOffsetToTimestamp(ctx context.Context, if sub == nil { return nil, errors.ErrResourceNotFound.WithMessage("subscription not exist") } - if sub.Phase != metadata.SubscriptionPhaseRunning { - return nil, errors.ErrResourceCanNotOp.WithMessage("subscription is not running") + if sub.Phase != metadata.SubscriptionPhaseStopped { + return nil, errors.ErrResourceCanNotOp.WithMessage("subscription must be disable can reset offset") } - tWorker := ctrl.workerManager.GetTriggerWorker(sub.TriggerWorker) - if tWorker == nil { - return nil, errors.ErrInternal.WithMessage("trigger worker is not running") - } - err := tWorker.ResetOffsetToTimestamp(subID, request.Timestamp) + offsets, err := ctrl.subscriptionManager.ResetOffsetByTimestamp(ctx, subID, request.Timestamp) if err != nil { - return nil, err + return nil, errors.ErrInternal.WithMessage("reset offset by timestamp error").Wrap(err) } - return &emptypb.Empty{}, nil + return &ctrlpb.ResetOffsetToTimestampResponse{ + Offsets: convert.ToPbOffsetInfos(offsets), + }, nil } func (ctrl *controller) CreateSubscription(ctx context.Context, @@ -151,12 +153,18 @@ func (ctrl *controller) CreateSubscription(ctx context.Context, if err != nil { return nil, err } - sub.Phase = metadata.SubscriptionPhaseCreated + if request.Subscription.Disable { + sub.Phase = metadata.SubscriptionPhaseStopped + } else { + sub.Phase = metadata.SubscriptionPhaseCreated + } err = ctrl.subscriptionManager.AddSubscription(ctx, sub) if err != nil { return nil, err } - ctrl.scheduler.EnqueueNormalSubscription(sub.ID) + if !request.Subscription.Disable { + ctrl.scheduler.EnqueueNormalSubscription(sub.ID) + } resp := convert.ToPbSubscription(sub, nil) return resp, nil } @@ -171,6 +179,9 @@ func (ctrl *controller) UpdateSubscription(ctx context.Context, if sub == nil { return nil, errors.ErrResourceNotFound.WithMessage("subscription not exist") } + if sub.Phase != metadata.SubscriptionPhaseStopped { + return nil, errors.ErrResourceCanNotOp.WithMessage("subscription must be disabled can update") + } if err := validation.ValidateSubscriptionRequest(ctx, request.Subscription); err != nil { return nil, err } @@ -194,14 +205,12 @@ func (ctrl *controller) UpdateSubscription(ctx context.Context, return nil, errors.ErrInvalidRequest.WithMessage("no change") } sub.UpdatedAt = time.Now() - sub.Phase = metadata.SubscriptionPhasePending if err := ctrl.subscriptionManager.UpdateSubscription(ctx, sub); err != nil { return nil, err } if transChange != 0 { metrics.SubscriptionTransformerGauge.WithLabelValues(sub.EventBus).Add(float64(transChange)) } - ctrl.scheduler.EnqueueNormalSubscription(sub.ID) resp := convert.ToPbSubscription(sub, nil) return resp, nil } @@ -231,6 +240,53 @@ func (ctrl *controller) DeleteSubscription(ctx context.Context, return &emptypb.Empty{}, nil } +func (ctrl *controller) DisableSubscription(ctx context.Context, + request *ctrlpb.DisableSubscriptionRequest) (*emptypb.Empty, error) { + if ctrl.state != primitive.ServerStateRunning { + return nil, errors.ErrServerNotStart + } + subID := vanus.ID(request.Id) + sub := ctrl.subscriptionManager.GetSubscription(ctx, subID) + if sub == nil { + return nil, errors.ErrResourceNotFound.WithMessage(fmt.Sprintf("subscrption %d not exist", subID)) + } + if sub.Phase == metadata.SubscriptionPhaseStopped { + return nil, errors.ErrResourceCanNotOp.WithMessage("subscription is disable") + } + if sub.Phase == metadata.SubscriptionPhaseStopping { + return nil, errors.ErrResourceCanNotOp.WithMessage("subscription is disabling") + } + sub.Phase = metadata.SubscriptionPhaseStopping + err := ctrl.subscriptionManager.UpdateSubscription(ctx, sub) + if err != nil { + return nil, err + } + ctrl.scheduler.EnqueueSubscription(sub.ID) + return &emptypb.Empty{}, nil +} + +func (ctrl *controller) ResumeSubscription(ctx context.Context, + request *ctrlpb.ResumeSubscriptionRequest) (*emptypb.Empty, error) { + if ctrl.state != primitive.ServerStateRunning { + return nil, errors.ErrServerNotStart + } + subID := vanus.ID(request.Id) + sub := ctrl.subscriptionManager.GetSubscription(ctx, subID) + if sub == nil { + return nil, errors.ErrResourceNotFound.WithMessage(fmt.Sprintf("subscrption %d not exist", subID)) + } + if sub.Phase != metadata.SubscriptionPhaseStopped { + return nil, errors.ErrResourceCanNotOp.WithMessage("subscription is not disable") + } + sub.Phase = metadata.SubscriptionPhasePending + err := ctrl.subscriptionManager.UpdateSubscription(ctx, sub) + if err != nil { + return nil, err + } + ctrl.scheduler.EnqueueSubscription(sub.ID) + return &emptypb.Empty{}, nil +} + func (ctrl *controller) GetSubscription(ctx context.Context, request *ctrlpb.GetSubscriptionRequest) (*meta.Subscription, error) { if ctrl.state != primitive.ServerStateRunning { @@ -360,7 +416,10 @@ func (ctrl *controller) ListSubscription(ctx context.Context, func (ctrl *controller) gcSubscription(ctx context.Context, id vanus.ID, addr string) error { tWorker := ctrl.workerManager.GetTriggerWorker(addr) if tWorker != nil { - tWorker.UnAssignSubscription(id) + err := tWorker.UnAssignSubscription(id) + if err != nil { + return err + } } err := ctrl.subscriptionManager.DeleteSubscription(ctx, id) if err != nil { @@ -420,7 +479,7 @@ func (ctrl *controller) init(ctx context.Context) error { switch sub.Phase { case metadata.SubscriptionPhaseCreated: ctrl.scheduler.EnqueueNormalSubscription(sub.ID) - case metadata.SubscriptionPhasePending: + case metadata.SubscriptionPhasePending, metadata.SubscriptionPhaseStopping: ctrl.scheduler.EnqueueSubscription(sub.ID) case metadata.SubscriptionPhaseToDelete: ctrl.needCleanSubscription[sub.ID] = sub.TriggerWorker @@ -438,7 +497,7 @@ func (ctrl *controller) membershipChangedProcessor(ctx context.Context, if ctrl.isLeader { return nil } - log.Info(context.TODO(), "become leader", nil) + log.Info(context.TODO(), "trigger become leader", nil) err := ctrl.init(ctx) if err != nil { _err := ctrl.stop(ctx) @@ -447,6 +506,9 @@ func (ctrl *controller) membershipChangedProcessor(ctx context.Context, log.KeyError: _err, }) } + log.Error(ctx, "controller init has error", map[string]interface{}{ + log.KeyError: err, + }) return err } ctrl.workerManager.Start() @@ -493,7 +555,7 @@ func (ctrl *controller) Start() error { return err } ctrl.secretStorage = secretStorage - ctrl.subscriptionManager = subscription.NewSubscriptionManager(ctrl.storage, ctrl.secretStorage) + ctrl.subscriptionManager = subscription.NewSubscriptionManager(ctrl.storage, ctrl.secretStorage, ctrl.ebClient) ctrl.workerManager = worker.NewTriggerWorkerManager(worker.Config{}, ctrl.storage, ctrl.subscriptionManager, ctrl.requeueSubscription) ctrl.scheduler = worker.NewSubscriptionScheduler(ctrl.workerManager, ctrl.subscriptionManager) diff --git a/internal/controller/trigger/controller_test.go b/internal/controller/trigger/controller_test.go index bbab6edbf..1b865242e 100644 --- a/internal/controller/trigger/controller_test.go +++ b/internal/controller/trigger/controller_test.go @@ -38,7 +38,7 @@ func TestController_CommitOffset(t *testing.T) { Convey("test reset offset", t, func() { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - ctrl := NewController(Config{}, nil, nil) + ctrl := NewController(Config{}, nil) ctx := context.Background() workerManager := worker.NewMockManager(mockCtrl) ctrl.workerManager = workerManager @@ -77,14 +77,13 @@ func TestController_ResetOffsetToTimestamp(t *testing.T) { Convey("test reset offset", t, func() { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - ctrl := NewController(Config{}, nil, nil) + ctrl := NewController(Config{}, nil) ctx := context.Background() workerManager := worker.NewMockManager(mockCtrl) ctrl.workerManager = workerManager subManager := subscription.NewMockManager(mockCtrl) ctrl.subscriptionManager = subManager - addr := "test" subID := vanus.NewTestID() ctrl.state = primitive.ServerStateRunning Convey("reset offset subscription not exist", func() { @@ -97,14 +96,11 @@ func TestController_ResetOffsetToTimestamp(t *testing.T) { }) Convey("reset offset subscription exist", func() { sub := &metadata.Subscription{ - ID: subID, - Phase: metadata.SubscriptionPhaseRunning, - TriggerWorker: addr, + ID: subID, + Phase: metadata.SubscriptionPhaseStopped, } subManager.EXPECT().GetSubscription(gomock.Any(), gomock.Eq(subID)).AnyTimes().Return(sub) - tWorker := worker.NewMockTriggerWorker(mockCtrl) - tWorker.EXPECT().ResetOffsetToTimestamp(gomock.Eq(subID), gomock.Any()).Return(nil) - workerManager.EXPECT().GetTriggerWorker(addr).Return(tWorker) + subManager.EXPECT().ResetOffsetByTimestamp(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, nil) _, err := ctrl.ResetOffsetToTimestamp(ctx, &ctrlpb.ResetOffsetToTimestampRequest{ SubscriptionId: subID.Uint64(), Timestamp: uint64(time.Now().Unix()), @@ -118,7 +114,7 @@ func TestController_CreateSubscription(t *testing.T) { Convey("test create subscription", t, func() { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - ctrl := NewController(Config{}, nil, nil) + ctrl := NewController(Config{}, nil) ctx := context.Background() workerManager := worker.NewMockManager(mockCtrl) ctrl.workerManager = workerManager @@ -154,7 +150,7 @@ func TestController_UpdateSubscription(t *testing.T) { Convey("test update subscription", t, func() { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - ctrl := NewController(Config{}, nil, nil) + ctrl := NewController(Config{}, nil) ctx := context.Background() workerManager := worker.NewMockManager(mockCtrl) ctrl.workerManager = workerManager @@ -177,7 +173,7 @@ func TestController_UpdateSubscription(t *testing.T) { }) sub := metadata.Subscription{ ID: subID, - Phase: metadata.SubscriptionPhaseRunning, + Phase: metadata.SubscriptionPhaseStopped, TriggerWorker: "test-addr", EventBus: "test-eb", Sink: "test-sink", @@ -355,7 +351,7 @@ func TestController_DeleteSubscription(t *testing.T) { Convey("test delete subscription", t, func() { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - ctrl := NewController(Config{}, nil, nil) + ctrl := NewController(Config{}, nil) ctx := context.Background() workerManager := worker.NewMockManager(mockCtrl) ctrl.workerManager = workerManager @@ -383,7 +379,7 @@ func TestController_DeleteSubscription(t *testing.T) { subManager.EXPECT().GetSubscription(gomock.Any(), gomock.Eq(subID)).Return(sub) subManager.EXPECT().UpdateSubscription(gomock.Any(), gomock.Any()).Return(nil) workerManager.EXPECT().GetTriggerWorker(addr).Return(tWorker) - tWorker.EXPECT().UnAssignSubscription(gomock.Eq(subID)).Return() + tWorker.EXPECT().UnAssignSubscription(gomock.Eq(subID)).Return(nil) Convey("delete subscription success", func() { subManager.EXPECT().DeleteSubscription(gomock.Any(), gomock.Eq(subID)).Return(nil) _, err := ctrl.DeleteSubscription(ctx, request) @@ -414,7 +410,7 @@ func TestController_GetSubscription(t *testing.T) { Convey("test get subscription", t, func() { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - ctrl := NewController(Config{}, nil, nil) + ctrl := NewController(Config{}, nil) ctx := context.Background() workerManager := worker.NewMockManager(mockCtrl) ctrl.workerManager = workerManager @@ -451,7 +447,7 @@ func TestController_ListSubscription(t *testing.T) { Convey("test list subscription", t, func() { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - ctrl := NewController(Config{}, nil, nil) + ctrl := NewController(Config{}, nil) ctx := context.Background() workerManager := worker.NewMockManager(mockCtrl) ctrl.workerManager = workerManager @@ -476,7 +472,7 @@ func TestController_TriggerWorkerHeartbeat(t *testing.T) { Convey("test trigger worker heartbeat", t, func() { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() - ctrl := NewController(Config{}, nil, nil) + ctrl := NewController(Config{}, nil) ctx := context.Background() workerManager := worker.NewMockManager(mockCtrl) ctrl.workerManager = workerManager diff --git a/internal/controller/trigger/metadata/info.go b/internal/controller/trigger/metadata/info.go index 6c5ce1d95..cf8fed938 100644 --- a/internal/controller/trigger/metadata/info.go +++ b/internal/controller/trigger/metadata/info.go @@ -55,11 +55,12 @@ func (tw *TriggerWorkerInfo) String() string { type SubscriptionPhase string const ( - SubscriptionPhaseCreated = "created" - SubscriptionPhasePending = "pending" - SubscriptionPhaseScheduled = "scheduled" - SubscriptionPhaseRunning = "running" - SubscriptionPhaseToDelete = "toDelete" + SubscriptionPhaseCreated = "created" + SubscriptionPhasePending = "pending" + SubscriptionPhaseRunning = "running" + SubscriptionPhaseStopping = "stopping" + SubscriptionPhaseStopped = "stopped" + SubscriptionPhaseToDelete = "toDelete" ) type Subscription struct { @@ -76,7 +77,6 @@ type Subscription struct { EventBus string `json:"eventbus"` Transformer *primitive.Transformer `json:"transformer,omitempty"` Name string `json:"name"` - Disable bool `json:"disable"` Description string `json:"description"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` @@ -98,10 +98,6 @@ func (s *Subscription) Update(update *Subscription) bool { change = true s.Description = update.Description } - if s.Disable != update.Disable { - change = true - s.Disable = update.Disable - } if !reflect.DeepEqual(s.Types, update.Types) { change = true s.Types = update.Types diff --git a/internal/controller/trigger/subscription/mock_subscription.go b/internal/controller/trigger/subscription/mock_subscription.go index 6b9c47e81..bfee26f78 100644 --- a/internal/controller/trigger/subscription/mock_subscription.go +++ b/internal/controller/trigger/subscription/mock_subscription.go @@ -81,6 +81,21 @@ func (mr *MockManagerMockRecorder) GetOffset(ctx, id interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOffset", reflect.TypeOf((*MockManager)(nil).GetOffset), ctx, id) } +// GetOrSaveOffset mocks base method. +func (m *MockManager) GetOrSaveOffset(ctx context.Context, id vanus.ID) (info.ListOffsetInfo, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetOrSaveOffset", ctx, id) + ret0, _ := ret[0].(info.ListOffsetInfo) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetOrSaveOffset indicates an expected call of GetOrSaveOffset. +func (mr *MockManagerMockRecorder) GetOrSaveOffset(ctx, id interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrSaveOffset", reflect.TypeOf((*MockManager)(nil).GetOrSaveOffset), ctx, id) +} + // GetSubscription mocks base method. func (m *MockManager) GetSubscription(ctx context.Context, id vanus.ID) *metadata.Subscription { m.ctrl.T.Helper() @@ -137,6 +152,21 @@ func (mr *MockManagerMockRecorder) ListSubscription(ctx interface{}) *gomock.Cal return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSubscription", reflect.TypeOf((*MockManager)(nil).ListSubscription), ctx) } +// ResetOffsetByTimestamp mocks base method. +func (m *MockManager) ResetOffsetByTimestamp(ctx context.Context, id vanus.ID, timestamp uint64) (info.ListOffsetInfo, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResetOffsetByTimestamp", ctx, id, timestamp) + ret0, _ := ret[0].(info.ListOffsetInfo) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ResetOffsetByTimestamp indicates an expected call of ResetOffsetByTimestamp. +func (mr *MockManagerMockRecorder) ResetOffsetByTimestamp(ctx, id, timestamp interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetOffsetByTimestamp", reflect.TypeOf((*MockManager)(nil).ResetOffsetByTimestamp), ctx, id, timestamp) +} + // SaveOffset mocks base method. func (m *MockManager) SaveOffset(ctx context.Context, id vanus.ID, offsets info.ListOffsetInfo, commit bool) error { m.ctrl.T.Helper() diff --git a/internal/controller/trigger/subscription/offset.go b/internal/controller/trigger/subscription/offset.go new file mode 100644 index 000000000..ecd924619 --- /dev/null +++ b/internal/controller/trigger/subscription/offset.go @@ -0,0 +1,139 @@ +// Copyright 2022 Linkall Inc. +// +// 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 subscription + +import ( + "context" + + "github.com/linkall-labs/vanus/internal/primitive" + "github.com/linkall-labs/vanus/internal/primitive/info" + "github.com/linkall-labs/vanus/internal/primitive/vanus" + "github.com/linkall-labs/vanus/observability/log" +) + +func (m *manager) SaveOffset(ctx context.Context, id vanus.ID, offsets info.ListOffsetInfo, commit bool) error { + subscription := m.GetSubscription(ctx, id) + if subscription == nil { + return nil + } + return m.offsetManager.Offset(ctx, id, offsets, commit) +} + +func (m *manager) ResetOffsetByTimestamp(ctx context.Context, id vanus.ID, + timestamp uint64) (info.ListOffsetInfo, error) { + subscription := m.GetSubscription(ctx, id) + if subscription == nil { + return nil, ErrSubscriptionNotExist + } + offsets, err := m.getOffsetFromCli(ctx, subscription.EventBus, primitive.SubscriptionConfig{ + OffsetTimestamp: ×tamp, + OffsetType: primitive.Timestamp, + }, false) + if err != nil { + return nil, err + } + err = m.offsetManager.Offset(ctx, id, offsets, true) + if err != nil { + return nil, err + } + log.Info(ctx, "reset offset by timestamp", map[string]interface{}{ + "offsets": offsets, + }) + return offsets, err +} + +func (m *manager) GetOffset(ctx context.Context, id vanus.ID) (info.ListOffsetInfo, error) { + subscription := m.GetSubscription(ctx, id) + if subscription == nil { + return info.ListOffsetInfo{}, ErrSubscriptionNotExist + } + offsets, err := m.offsetManager.GetOffset(ctx, id) + if err != nil { + return nil, err + } + // todo filter retry eventlog + return offsets, nil +} + +func (m *manager) GetOrSaveOffset(ctx context.Context, id vanus.ID) (info.ListOffsetInfo, error) { + subscription := m.GetSubscription(ctx, id) + if subscription == nil { + return info.ListOffsetInfo{}, ErrSubscriptionNotExist + } + offsets, err := m.offsetManager.GetOffset(ctx, id) + if err != nil { + return nil, err + } + if len(offsets) > 0 { + return offsets, nil + } + + offsets, err = m.getOffsetFromCli(ctx, subscription.EventBus, subscription.Config, false) + if err != nil { + return nil, err + } + // get retry eb offset. + retryOffset, err := m.getOffsetFromCli(ctx, primitive.RetryEventbusName, primitive.SubscriptionConfig{ + OffsetType: primitive.LatestOffset, + }, true) + if err != nil { + return nil, err + } + offsets = append(offsets, retryOffset...) + err = m.offsetManager.Offset(ctx, id, offsets, true) + if err != nil { + return nil, err + } + log.Info(ctx, "save offset from cli", map[string]interface{}{ + "offsets": offsets, + }) + return offsets, nil +} + +func (m *manager) getOffsetFromCli(ctx context.Context, eventbus string, + config primitive.SubscriptionConfig, retryEventBus bool) (info.ListOffsetInfo, error) { + logs, err := m.ebCli.Eventbus(ctx, eventbus).ListLog(ctx) + if err != nil { + return nil, err + } + offsets := make(info.ListOffsetInfo, len(logs)) + for i, l := range logs { + var v int64 + switch config.OffsetType { + case primitive.EarliestOffset: + if v, err = l.EarliestOffset(ctx); err != nil { + return nil, err + } + case primitive.Timestamp: + t := config.OffsetTimestamp + if v, err = l.QueryOffsetByTime(ctx, int64(*t)); err != nil { + return nil, err + } + default: + if v, err = l.LatestOffset(ctx); err != nil { + return nil, err + } + } + // fix offset is negative which convert to uint64 is big. + if v < 0 { + v = 0 + } + offsets[i] = info.OffsetInfo{ + EventLogID: vanus.NewIDFromUint64(l.ID()), + Offset: uint64(v), + } + } + return offsets, nil +} diff --git a/internal/controller/trigger/subscription/offset/offset.go b/internal/controller/trigger/subscription/offset/offset.go index 2f8e2eca0..7a2b910c7 100644 --- a/internal/controller/trigger/subscription/offset/offset.go +++ b/internal/controller/trigger/subscription/offset/offset.go @@ -255,7 +255,7 @@ func (o *eventLogOffset) commitOffset(ctx context.Context, storage storage.Offse if err != nil { return err } - log.Debug(ctx, "create offset", map[string]interface{}{ + log.Info(ctx, "create offset", map[string]interface{}{ log.KeySubscriptionID: o.subscriptionID, log.KeyEventlogID: o.eventLogID, "offset": offset, diff --git a/internal/controller/trigger/subscription/offset_test.go b/internal/controller/trigger/subscription/offset_test.go new file mode 100644 index 000000000..fd1a51964 --- /dev/null +++ b/internal/controller/trigger/subscription/offset_test.go @@ -0,0 +1,184 @@ +// Copyright 2022 Linkall Inc. +// +// 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 subscription + +import ( + "context" + "testing" + "time" + + "github.com/golang/mock/gomock" + "github.com/linkall-labs/vanus/client" + "github.com/linkall-labs/vanus/client/pkg/api" + "github.com/linkall-labs/vanus/internal/controller/trigger/metadata" + "github.com/linkall-labs/vanus/internal/controller/trigger/secret" + "github.com/linkall-labs/vanus/internal/controller/trigger/storage" + "github.com/linkall-labs/vanus/internal/controller/trigger/subscription/offset" + "github.com/linkall-labs/vanus/internal/primitive" + "github.com/linkall-labs/vanus/internal/primitive/info" + "github.com/linkall-labs/vanus/internal/primitive/vanus" + . "github.com/smartystreets/goconvey/convey" +) + +func TestSaveOffset(t *testing.T) { + Convey("test save offset", t, func() { + ctx := context.Background() + ctrl := gomock.NewController(t) + defer ctrl.Finish() + storage := storage.NewMockStorage(ctrl) + secret := secret.NewMockStorage(ctrl) + + m := NewSubscriptionManager(storage, secret, nil).(*manager) + offsetManager := offset.NewMockManager(ctrl) + m.offsetManager = offsetManager + storage.MockSubscriptionStorage.EXPECT().CreateSubscription(ctx, gomock.Any()).AnyTimes().Return(nil) + noExistID := vanus.NewTestID() + id := vanus.NewTestID() + sub := &metadata.Subscription{ + ID: id, + } + m.AddSubscription(ctx, sub) + logID := vanus.NewTestID() + offsetV := uint64(10) + listOffsetInfo := info.ListOffsetInfo{ + {EventLogID: logID, Offset: offsetV}, + } + Convey("save offset subscription no exist", func() { + err := m.SaveOffset(ctx, noExistID, listOffsetInfo, false) + So(err, ShouldBeNil) + }) + Convey("save offset valid", func() { + offsetManager.EXPECT().Offset(ctx, id, listOffsetInfo, false).Return(nil) + err := m.SaveOffset(ctx, id, listOffsetInfo, false) + So(err, ShouldBeNil) + }) + }) +} + +func TestGetOffset(t *testing.T) { + Convey("test get offset", t, func() { + ctx := context.Background() + ctrl := gomock.NewController(t) + defer ctrl.Finish() + storage := storage.NewMockStorage(ctrl) + secret := secret.NewMockStorage(ctrl) + mockClient := client.NewMockClient(ctrl) + + m := NewSubscriptionManager(storage, secret, mockClient).(*manager) + offsetManager := offset.NewMockManager(ctrl) + m.offsetManager = offsetManager + storage.MockSubscriptionStorage.EXPECT().CreateSubscription(ctx, gomock.Any()).AnyTimes().Return(nil) + storage.MockSubscriptionStorage.EXPECT().UpdateSubscription(ctx, gomock.Any()).AnyTimes().Return(nil) + noExistID := vanus.NewTestID() + id := vanus.NewTestID() + sub := &metadata.Subscription{ + ID: id, + } + m.AddSubscription(ctx, sub) + logID := vanus.NewTestID() + offsetV := uint64(10) + listOffsetInfo := info.ListOffsetInfo{ + {EventLogID: logID, Offset: offsetV}, + } + Convey("get offset subscription no exist", func() { + offsets, err := m.GetOffset(ctx, noExistID) + So(err, ShouldNotBeNil) + So(len(offsets), ShouldEqual, 0) + }) + Convey("get offset from storage offset", func() { + offsetManager.EXPECT().GetOffset(ctx, id).Return(listOffsetInfo, nil) + offsets, err := m.GetOffset(ctx, id) + So(err, ShouldBeNil) + So(len(offsets), ShouldEqual, len(listOffsetInfo)) + So(offsets[0].EventLogID, ShouldEqual, logID) + So(offsets[0].Offset, ShouldEqual, offsetV) + }) + Convey("get offset from client", func() { + offsetManager.EXPECT().GetOffset(ctx, id).AnyTimes().Return(nil, nil) + offsets, err := m.GetOffset(ctx, id) + So(err, ShouldBeNil) + So(len(offsets), ShouldEqual, 0) + offsetManager.EXPECT().Offset(gomock.Any(), gomock.Any(), gomock.Any(), true).AnyTimes().Return(nil) + mockEventbus := api.NewMockEventbus(ctrl) + mockEventLog := api.NewMockEventlog(ctrl) + mockClient.EXPECT().Eventbus(gomock.Any(), gomock.Any()).AnyTimes().Return(mockEventbus) + mockEventbus.EXPECT().ListLog(gomock.Any()).AnyTimes().Return([]api.Eventlog{mockEventLog}, nil) + mockEventLog.EXPECT().ID().AnyTimes().Return(logID.Uint64()) + mockEventLog.EXPECT().LatestOffset(gomock.Any()).AnyTimes().Return(int64(offsetV), nil) + Convey("test get offset from latest", func() { + offsets, err = m.GetOrSaveOffset(ctx, id) + So(err, ShouldBeNil) + So(len(offsets), ShouldEqual, 2*len(listOffsetInfo)) + So(offsets[0].EventLogID, ShouldEqual, logID) + So(offsets[0].Offset, ShouldEqual, offsetV) + }) + Convey("test get offset from earliest", func() { + sub.Config.OffsetType = primitive.EarliestOffset + m.UpdateSubscription(ctx, sub) + mockEventLog.EXPECT().EarliestOffset(gomock.Any()).Return(int64(offsetV), nil) + offsets, err = m.GetOrSaveOffset(ctx, id) + So(err, ShouldBeNil) + So(len(offsets), ShouldEqual, 2*len(listOffsetInfo)) + So(offsets[0].EventLogID, ShouldEqual, logID) + So(offsets[0].Offset, ShouldEqual, offsetV) + }) + Convey("test get offset from timestamp", func() { + sub.Config.OffsetType = primitive.Timestamp + time := uint64(time.Now().Unix()) + sub.Config.OffsetTimestamp = &time + m.UpdateSubscription(ctx, sub) + mockEventLog.EXPECT().QueryOffsetByTime(gomock.Any(), int64(time)).Return(int64(offsetV), nil) + offsets, err = m.GetOrSaveOffset(ctx, id) + So(err, ShouldBeNil) + So(len(offsets), ShouldEqual, 2*len(listOffsetInfo)) + So(offsets[0].EventLogID, ShouldEqual, logID) + So(offsets[0].Offset, ShouldEqual, offsetV) + }) + }) + }) +} + +func TestResetOffsetByTimestamp(t *testing.T) { + Convey("test reset offset by timestamp", t, func() { + ctx := context.Background() + ctrl := gomock.NewController(t) + defer ctrl.Finish() + storage := storage.NewMockStorage(ctrl) + secret := secret.NewMockStorage(ctrl) + mockClient := client.NewMockClient(ctrl) + + m := NewSubscriptionManager(storage, secret, mockClient).(*manager) + offsetManager := offset.NewMockManager(ctrl) + m.offsetManager = offsetManager + storage.MockSubscriptionStorage.EXPECT().CreateSubscription(ctx, gomock.Any()).AnyTimes().Return(nil) + id := vanus.NewTestID() + sub := &metadata.Subscription{ + ID: id, + } + m.AddSubscription(ctx, sub) + logID := vanus.NewTestID() + + offsetManager.EXPECT().Offset(ctx, id, gomock.Any(), true).Return(nil) + mockEventbus := api.NewMockEventbus(ctrl) + mockEventLog := api.NewMockEventlog(ctrl) + mockClient.EXPECT().Eventbus(gomock.Any(), gomock.Any()).AnyTimes().Return(mockEventbus) + mockEventbus.EXPECT().ListLog(gomock.Any()).AnyTimes().Return([]api.Eventlog{mockEventLog}, nil) + mockEventLog.EXPECT().ID().AnyTimes().Return(logID.Uint64()) + time := uint64(time.Now().Unix()) + mockEventLog.EXPECT().QueryOffsetByTime(gomock.Any(), int64(time)).Return(int64(100), nil) + _, err := m.ResetOffsetByTimestamp(ctx, id, time) + So(err, ShouldBeNil) + }) +} diff --git a/internal/controller/trigger/subscription/subscription.go b/internal/controller/trigger/subscription/subscription.go index 7cbcbb8a3..52fbe5238 100644 --- a/internal/controller/trigger/subscription/subscription.go +++ b/internal/controller/trigger/subscription/subscription.go @@ -22,19 +22,25 @@ import ( "sync" "time" + eb "github.com/linkall-labs/vanus/client" "github.com/linkall-labs/vanus/internal/controller/trigger/metadata" "github.com/linkall-labs/vanus/internal/controller/trigger/secret" "github.com/linkall-labs/vanus/internal/controller/trigger/storage" "github.com/linkall-labs/vanus/internal/controller/trigger/subscription/offset" - iInfo "github.com/linkall-labs/vanus/internal/primitive/info" + "github.com/linkall-labs/vanus/internal/primitive/info" "github.com/linkall-labs/vanus/internal/primitive/vanus" "github.com/linkall-labs/vanus/observability/log" "github.com/linkall-labs/vanus/observability/metrics" ) type Manager interface { - SaveOffset(ctx context.Context, id vanus.ID, offsets iInfo.ListOffsetInfo, commit bool) error - GetOffset(ctx context.Context, id vanus.ID) (iInfo.ListOffsetInfo, error) + SaveOffset(ctx context.Context, id vanus.ID, offsets info.ListOffsetInfo, commit bool) error + // GetOrSaveOffset get offset only from etcd, if it isn't exist will get from cli and save to etcd, + // and it contains retry eb offset + GetOrSaveOffset(ctx context.Context, id vanus.ID) (info.ListOffsetInfo, error) + // GetOffset get offset only from etcd, it doesn't contain retry eb offset + GetOffset(ctx context.Context, id vanus.ID) (info.ListOffsetInfo, error) + ResetOffsetByTimestamp(ctx context.Context, id vanus.ID, timestamp uint64) (info.ListOffsetInfo, error) ListSubscription(ctx context.Context) []*metadata.Subscription GetSubscription(ctx context.Context, id vanus.ID) *metadata.Subscription AddSubscription(ctx context.Context, subscription *metadata.Subscription) error @@ -55,6 +61,7 @@ const ( ) type manager struct { + ebCli eb.Client secretStorage secret.Storage storage storage.Storage offsetManager offset.Manager @@ -62,8 +69,9 @@ type manager struct { subscriptionMap map[vanus.ID]*metadata.Subscription } -func NewSubscriptionManager(storage storage.Storage, secretStorage secret.Storage) Manager { +func NewSubscriptionManager(storage storage.Storage, secretStorage secret.Storage, ebCli eb.Client) Manager { m := &manager{ + ebCli: ebCli, storage: storage, secretStorage: secretStorage, subscriptionMap: map[vanus.ID]*metadata.Subscription{}, @@ -72,23 +80,7 @@ func NewSubscriptionManager(storage storage.Storage, secretStorage secret.Storag return m } -func (m *manager) SaveOffset(ctx context.Context, id vanus.ID, offsets iInfo.ListOffsetInfo, commit bool) error { - subscription := m.GetSubscription(ctx, id) - if subscription == nil { - return nil - } - return m.offsetManager.Offset(ctx, id, offsets, commit) -} - -func (m *manager) GetOffset(ctx context.Context, id vanus.ID) (iInfo.ListOffsetInfo, error) { - subscription := m.GetSubscription(ctx, id) - if subscription == nil { - return iInfo.ListOffsetInfo{}, ErrSubscriptionNotExist - } - return m.offsetManager.GetOffset(ctx, id) -} - -func (m *manager) ListSubscription(ctx context.Context) []*metadata.Subscription { +func (m *manager) ListSubscription(_ context.Context) []*metadata.Subscription { m.lock.RLock() defer m.lock.RUnlock() list := make([]*metadata.Subscription, 0, len(m.subscriptionMap)) diff --git a/internal/controller/trigger/subscription/subscription_test.go b/internal/controller/trigger/subscription/subscription_test.go index 8dea9d143..2d1b5bbfc 100644 --- a/internal/controller/trigger/subscription/subscription_test.go +++ b/internal/controller/trigger/subscription/subscription_test.go @@ -25,7 +25,6 @@ import ( "github.com/linkall-labs/vanus/internal/controller/trigger/storage" "github.com/linkall-labs/vanus/internal/controller/trigger/subscription/offset" "github.com/linkall-labs/vanus/internal/primitive" - "github.com/linkall-labs/vanus/internal/primitive/info" "github.com/linkall-labs/vanus/internal/primitive/vanus" . "github.com/smartystreets/goconvey/convey" ) @@ -36,7 +35,7 @@ func TestSubscriptionInit(t *testing.T) { defer ctrl.Finish() storage := storage.NewMockStorage(ctrl) secret := secret.NewMockStorage(ctrl) - m := NewSubscriptionManager(storage, secret) + m := NewSubscriptionManager(storage, secret, nil) Convey("init ", t, func() { subID := vanus.NewTestID() @@ -63,7 +62,7 @@ func TestGetListSubscription(t *testing.T) { defer ctrl.Finish() storage := storage.NewMockStorage(ctrl) secret := secret.NewMockStorage(ctrl) - m := NewSubscriptionManager(storage, secret) + m := NewSubscriptionManager(storage, secret, nil) id := vanus.NewTestID() Convey("list subscription size 0", func() { subscriptions := m.ListSubscription(ctx) @@ -104,7 +103,7 @@ func TestSubscription(t *testing.T) { defer ctrl.Finish() storage := storage.NewMockStorage(ctrl) secret := secret.NewMockStorage(ctrl) - m := NewSubscriptionManager(storage, secret) + m := NewSubscriptionManager(storage, secret, nil) subID := vanus.NewTestID() Convey("test add subscription", func() { storage.MockSubscriptionStorage.EXPECT().CreateSubscription(ctx, gomock.Any()).Return(nil) @@ -168,45 +167,3 @@ func TestSubscription(t *testing.T) { }) }) } - -func TestOffset(t *testing.T) { - Convey("test offset", t, func() { - ctx := context.Background() - ctrl := gomock.NewController(t) - defer ctrl.Finish() - storage := storage.NewMockStorage(ctrl) - secret := secret.NewMockStorage(ctrl) - m := NewSubscriptionManager(storage, secret).(*manager) - offsetManager := offset.NewMockManager(ctrl) - m.offsetManager = offsetManager - storage.MockSubscriptionStorage.EXPECT().CreateSubscription(ctx, gomock.Any()).Return(nil) - m.AddSubscription(ctx, &metadata.Subscription{}) - subscriptions := m.ListSubscription(ctx) - id := subscriptions[0].ID - listOffsetInfo := info.ListOffsetInfo{ - {EventLogID: 1, Offset: 10}, - } - Convey("set offset subscription no exist", func() { - err := m.SaveOffset(ctx, 1, listOffsetInfo, false) - So(err, ShouldBeNil) - }) - Convey("set offset ", func() { - offsetManager.EXPECT().Offset(ctx, id, listOffsetInfo, false).Return(nil) - err := m.SaveOffset(ctx, id, listOffsetInfo, false) - So(err, ShouldBeNil) - }) - Convey("get offset subscription no exist", func() { - offsets, err := m.GetOffset(ctx, 1) - So(err, ShouldNotBeNil) - So(len(offsets), ShouldEqual, 0) - }) - Convey("get offset", func() { - offsetManager.EXPECT().GetOffset(ctx, id).Return(listOffsetInfo, nil) - offsets, err := m.GetOffset(ctx, id) - So(err, ShouldBeNil) - So(len(offsets), ShouldEqual, 1) - So(offsets[0].EventLogID, ShouldEqual, 1) - So(offsets[0].Offset, ShouldEqual, 10) - }) - }) -} diff --git a/internal/controller/trigger/worker/mock_worker.go b/internal/controller/trigger/worker/mock_worker.go index 5788c707c..c6d6247a2 100644 --- a/internal/controller/trigger/worker/mock_worker.go +++ b/internal/controller/trigger/worker/mock_worker.go @@ -213,20 +213,6 @@ func (mr *MockTriggerWorkerMockRecorder) Reset() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reset", reflect.TypeOf((*MockTriggerWorker)(nil).Reset)) } -// ResetOffsetToTimestamp mocks base method. -func (m *MockTriggerWorker) ResetOffsetToTimestamp(id vanus.ID, timestamp uint64) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ResetOffsetToTimestamp", id, timestamp) - ret0, _ := ret[0].(error) - return ret0 -} - -// ResetOffsetToTimestamp indicates an expected call of ResetOffsetToTimestamp. -func (mr *MockTriggerWorkerMockRecorder) ResetOffsetToTimestamp(id, timestamp interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetOffsetToTimestamp", reflect.TypeOf((*MockTriggerWorker)(nil).ResetOffsetToTimestamp), id, timestamp) -} - // SetPhase mocks base method. func (m *MockTriggerWorker) SetPhase(arg0 metadata.TriggerWorkerPhase) { m.ctrl.T.Helper() @@ -254,9 +240,11 @@ func (mr *MockTriggerWorkerMockRecorder) Start(ctx interface{}) *gomock.Call { } // UnAssignSubscription mocks base method. -func (m *MockTriggerWorker) UnAssignSubscription(id vanus.ID) { +func (m *MockTriggerWorker) UnAssignSubscription(id vanus.ID) error { m.ctrl.T.Helper() - m.ctrl.Call(m, "UnAssignSubscription", id) + ret := m.ctrl.Call(m, "UnAssignSubscription", id) + ret0, _ := ret[0].(error) + return ret0 } // UnAssignSubscription indicates an expected call of UnAssignSubscription. diff --git a/internal/controller/trigger/worker/scheduler.go b/internal/controller/trigger/worker/scheduler.go index bc3029890..80243b4be 100644 --- a/internal/controller/trigger/worker/scheduler.go +++ b/internal/controller/trigger/worker/scheduler.go @@ -18,7 +18,6 @@ import ( "context" "time" - "github.com/linkall-labs/vanus/internal/controller/trigger/metadata" "github.com/linkall-labs/vanus/internal/controller/trigger/subscription" "github.com/linkall-labs/vanus/internal/primitive/queue" "github.com/linkall-labs/vanus/internal/primitive/vanus" @@ -119,15 +118,13 @@ func (s *SubscriptionScheduler) handler(ctx context.Context, subscriptionID vanu return ErrTriggerWorkerNotFound } if subscription.TriggerWorker == "" { + subscription.TriggerWorker = twAddr + err := s.subscriptionManager.UpdateSubscription(ctx, subscription) + if err != nil { + return err + } metrics.CtrlTriggerGauge.WithLabelValues(twAddr).Inc() } - subscription.TriggerWorker = twAddr - subscription.Phase = metadata.SubscriptionPhaseScheduled - subscription.HeartbeatTime = time.Now() - err := s.subscriptionManager.UpdateSubscription(ctx, subscription) - if err != nil { - return err - } tWorker.AssignSubscription(subscriptionID) return nil } diff --git a/internal/controller/trigger/worker/worker.go b/internal/controller/trigger/worker/worker.go index 392a12c57..93908f7c0 100644 --- a/internal/controller/trigger/worker/worker.go +++ b/internal/controller/trigger/worker/worker.go @@ -49,9 +49,8 @@ type TriggerWorker interface { GetHeartbeatTime() time.Time Polish() AssignSubscription(id vanus.ID) - UnAssignSubscription(id vanus.ID) + UnAssignSubscription(id vanus.ID) error GetAssignedSubscriptions() []vanus.ID - ResetOffsetToTimestamp(id vanus.ID, timestamp uint64) error } // triggerWorker send subscription to trigger worker server. @@ -133,7 +132,24 @@ func (tw *triggerWorker) handler(ctx context.Context, subscriptionID vanus.ID) e if sub == nil { return nil } - offsets, err := tw.subscriptionManager.GetOffset(ctx, subscriptionID) + switch sub.Phase { + case metadata.SubscriptionPhaseStopping, metadata.SubscriptionPhaseStopped: + err := tw.removeSubscription(ctx, subscriptionID) + if err != nil { + return err + } + if sub.Phase != metadata.SubscriptionPhaseStopped { + // modify phase to stopped. + sub.Phase = metadata.SubscriptionPhaseStopped + sub.TriggerWorker = "" + err = tw.subscriptionManager.UpdateSubscription(ctx, sub) + if err != nil { + return err + } + } + return nil + } + offsets, err := tw.subscriptionManager.GetOrSaveOffset(ctx, subscriptionID) if err != nil { return err } @@ -246,7 +262,7 @@ func (tw *triggerWorker) AssignSubscription(id vanus.ID) { tw.subscriptionQueue.Add(id) } -func (tw *triggerWorker) UnAssignSubscription(id vanus.ID) { +func (tw *triggerWorker) UnAssignSubscription(id vanus.ID) error { log.Info(context.Background(), "trigger worker remove a subscription", map[string]interface{}{ log.KeyTriggerWorkerAddr: tw.info.Addr, log.KeySubscriptionID: id, @@ -260,9 +276,10 @@ func (tw *triggerWorker) UnAssignSubscription(id vanus.ID) { log.KeyTriggerWorkerAddr: tw.info.Addr, log.KeySubscriptionID: id, }) - tw.subscriptionQueue.Add(id) + return err } } + return nil } func (tw *triggerWorker) GetAssignedSubscriptions() []vanus.ID { @@ -329,15 +346,6 @@ func (tw *triggerWorker) RemoteStart(ctx context.Context) error { return nil } -func (tw *triggerWorker) ResetOffsetToTimestamp(id vanus.ID, timestamp uint64) error { - request := &trigger.ResetOffsetToTimestampRequest{SubscriptionId: id.Uint64(), Timestamp: timestamp} - _, err := tw.client.ResetOffsetToTimestamp(tw.ctx, request) - if err != nil { - return errors.ErrTriggerWorker.WithMessage("reset offset to timestamp").Wrap(err) - } - return nil -} - func (tw *triggerWorker) addSubscription(ctx context.Context, sub *primitive.Subscription) error { request := convert.ToPbAddSubscription(sub) _, err := tw.client.AddSubscription(ctx, request) diff --git a/internal/controller/trigger/worker/worker_test.go b/internal/controller/trigger/worker/worker_test.go index a430b6082..4acc4678f 100644 --- a/internal/controller/trigger/worker/worker_test.go +++ b/internal/controller/trigger/worker/worker_test.go @@ -31,23 +31,6 @@ import ( . "github.com/smartystreets/goconvey/convey" ) -func TestTriggerWorker_ResetOffsetToTimestamp(t *testing.T) { - Convey("test reset offset to timestamp", t, func() { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - subscriptionManager := subscription.NewMockManager(ctrl) - client := pbtrigger.NewMockTriggerWorkerClient(ctrl) - addr := "test" - tWorker := NewTriggerWorkerByAddr(addr, subscriptionManager).(*triggerWorker) - tWorker.client = client - id := vanus.NewTestID() - client.EXPECT().ResetOffsetToTimestamp(gomock.Any(), gomock.Any()).Return(nil, nil) - err := tWorker.ResetOffsetToTimestamp(id, uint64(time.Now().Unix())) - So(err, ShouldBeNil) - _ = tWorker.Close() - }) -} - func TestTriggerWorker_AssignSubscription(t *testing.T) { Convey("test assign subscription", t, func() { ctrl := gomock.NewController(t) @@ -153,7 +136,7 @@ func TestTriggerWorker_Handler(t *testing.T) { }, } subscriptionManager.EXPECT().GetSubscription(gomock.Any(), gomock.Any()).AnyTimes().Return(sub) - subscriptionManager.EXPECT().GetOffset(gomock.Any(), gomock.Any()).AnyTimes().Return(info.ListOffsetInfo{}, nil) + subscriptionManager.EXPECT().GetOrSaveOffset(gomock.Any(), gomock.Any()).AnyTimes().Return(info.ListOffsetInfo{}, nil) client.EXPECT().AddSubscription(gomock.Any(), gomock.Any()).Return(nil, nil) subscriptionManager.EXPECT().UpdateSubscription(gomock.Any(), gomock.Any()).AnyTimes().Return(nil) err := tWorker.handler(ctx, id) diff --git a/internal/convert/convert.go b/internal/convert/convert.go index 801cd6c4e..c0bd67c0c 100644 --- a/internal/convert/convert.go +++ b/internal/convert/convert.go @@ -39,7 +39,6 @@ func FromPbSubscriptionRequest(sub *ctrl.SubscriptionRequest) *metadata.Subscrip Transformer: fromPbTransformer(sub.Transformer), EventBus: sub.EventBus, Name: sub.Name, - Disable: sub.Disable, Description: sub.Description, } return to @@ -288,11 +287,13 @@ func ToPbSubscription(sub *metadata.Subscription, offsets info.ListOffsetInfo) * Transformer: ToPbTransformer(sub.Transformer), Offsets: ToPbOffsetInfos(offsets), Name: sub.Name, - Disable: sub.Disable, Description: sub.Description, CreatedAt: sub.CreatedAt.UnixMilli(), UpdatedAt: sub.UpdatedAt.UnixMilli(), } + if sub.Phase == metadata.SubscriptionPhaseStopped { + to.Disable = true + } return to } diff --git a/internal/gateway/proxy/direct.go b/internal/gateway/proxy/direct.go index 24b6c5a13..e638769fa 100644 --- a/internal/gateway/proxy/direct.go +++ b/internal/gateway/proxy/direct.go @@ -81,3 +81,18 @@ func (cp *ControllerProxy) ListSubscription(ctx context.Context, req *emptypb.Empty) (*ctrlpb.ListSubscriptionResponse, error) { return cp.triggerCtrl.ListSubscription(ctx, req) } + +func (cp *ControllerProxy) DisableSubscription(ctx context.Context, + req *ctrlpb.DisableSubscriptionRequest) (*emptypb.Empty, error) { + return cp.triggerCtrl.DisableSubscription(ctx, req) +} + +func (cp *ControllerProxy) ResumeSubscription(ctx context.Context, + req *ctrlpb.ResumeSubscriptionRequest) (*emptypb.Empty, error) { + return cp.triggerCtrl.ResumeSubscription(ctx, req) +} + +func (cp *ControllerProxy) ResetOffsetToTimestamp(ctx context.Context, + req *ctrlpb.ResetOffsetToTimestampRequest) (*ctrlpb.ResetOffsetToTimestampResponse, error) { + return cp.triggerCtrl.ResetOffsetToTimestamp(ctx, req) +} diff --git a/internal/trigger/mock_worker.go b/internal/trigger/mock_worker.go index 0213b3e33..94e63fb2c 100644 --- a/internal/trigger/mock_worker.go +++ b/internal/trigger/mock_worker.go @@ -106,20 +106,6 @@ func (mr *MockWorkerMockRecorder) RemoveSubscription(ctx, id interface{}) *gomoc return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveSubscription", reflect.TypeOf((*MockWorker)(nil).RemoveSubscription), ctx, id) } -// ResetOffsetToTimestamp mocks base method. -func (m *MockWorker) ResetOffsetToTimestamp(ctx context.Context, id vanus.ID, timestamp int64) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ResetOffsetToTimestamp", ctx, id, timestamp) - ret0, _ := ret[0].(error) - return ret0 -} - -// ResetOffsetToTimestamp indicates an expected call of ResetOffsetToTimestamp. -func (mr *MockWorkerMockRecorder) ResetOffsetToTimestamp(ctx, id, timestamp interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetOffsetToTimestamp", reflect.TypeOf((*MockWorker)(nil).ResetOffsetToTimestamp), ctx, id, timestamp) -} - // Start mocks base method. func (m *MockWorker) Start(ctx context.Context) error { m.ctrl.T.Helper() diff --git a/internal/trigger/reader/mock_reader.go b/internal/trigger/reader/mock_reader.go index 13a7139e1..dcc137588 100644 --- a/internal/trigger/reader/mock_reader.go +++ b/internal/trigger/reader/mock_reader.go @@ -5,11 +5,9 @@ package reader import ( - context "context" reflect "reflect" gomock "github.com/golang/mock/gomock" - info "github.com/linkall-labs/vanus/internal/primitive/info" ) // MockReader is a mock of Reader interface. @@ -47,21 +45,6 @@ func (mr *MockReaderMockRecorder) Close() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockReader)(nil).Close)) } -// GetOffsetByTimestamp mocks base method. -func (m *MockReader) GetOffsetByTimestamp(ctx context.Context, timestamp int64) (info.ListOffsetInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetOffsetByTimestamp", ctx, timestamp) - ret0, _ := ret[0].(info.ListOffsetInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetOffsetByTimestamp indicates an expected call of GetOffsetByTimestamp. -func (mr *MockReaderMockRecorder) GetOffsetByTimestamp(ctx, timestamp interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOffsetByTimestamp", reflect.TypeOf((*MockReader)(nil).GetOffsetByTimestamp), ctx, timestamp) -} - // Start mocks base method. func (m *MockReader) Start() error { m.ctrl.T.Helper() diff --git a/internal/trigger/reader/reader.go b/internal/trigger/reader/reader.go index 733f55f1d..7aa9f3623 100644 --- a/internal/trigger/reader/reader.go +++ b/internal/trigger/reader/reader.go @@ -28,7 +28,6 @@ import ( "github.com/linkall-labs/vanus/client/pkg/eventlog" "github.com/linkall-labs/vanus/client/pkg/option" "github.com/linkall-labs/vanus/client/pkg/policy" - "github.com/linkall-labs/vanus/internal/primitive" pInfo "github.com/linkall-labs/vanus/internal/primitive/info" "github.com/linkall-labs/vanus/internal/primitive/vanus" "github.com/linkall-labs/vanus/internal/trigger/info" @@ -41,7 +40,6 @@ import ( const ( checkEventLogInterval = 30 * time.Second lookupReadableLogsTimeout = 5 * time.Second - readerSeekTimeout = 5 * time.Second readEventTimeout = 5 * time.Second initErrSleepTime = 5 * time.Second readErrSleepTime = 2 * time.Second @@ -50,13 +48,10 @@ const ( type Config struct { EventBusName string - Controllers []string Client eb.Client SubscriptionID vanus.ID SubscriptionIDStr string Offset EventLogOffset - OffsetType primitive.OffsetType - OffsetTimestamp int64 CheckEventLogInterval time.Duration } @@ -64,7 +59,6 @@ type EventLogOffset map[vanus.ID]uint64 type Reader interface { Start() error - GetOffsetByTimestamp(ctx context.Context, timestamp int64) (pInfo.ListOffsetInfo, error) Close() } @@ -92,26 +86,6 @@ func NewReader(config Config, events chan<- info.EventRecord) Reader { return r } -func (r *reader) GetOffsetByTimestamp(ctx context.Context, timestamp int64) (pInfo.ListOffsetInfo, error) { - offsets := make(pInfo.ListOffsetInfo, 0, len(r.elReader)) - bus := r.config.Client.Eventbus(ctx, r.config.EventBusName) - for id := range r.elReader { - log, err := bus.GetLog(ctx, id.Uint64()) - if err != nil { - return offsets, err - } - offset, err := log.QueryOffsetByTime(ctx, timestamp) - if err != nil { - return offsets, err - } - offsets = append(offsets, pInfo.OffsetInfo{ - EventLogID: id, - Offset: uint64(offset), - }) - } - return offsets, nil -} - func (r *reader) Close() { r.stop() r.wg.Wait() @@ -165,36 +139,17 @@ func (r *reader) checkEventLogChange() { } } -func (r *reader) getOffset(ctx context.Context, eventLogID vanus.ID) (uint64, error) { - l, err := r.config.Client.Eventbus(ctx, r.config.EventBusName).GetLog(ctx, eventLogID.Uint64()) - if err != nil { - return 0, err +func (r *reader) getOffset(eventLogID vanus.ID) uint64 { + v, exist := r.config.Offset[eventLogID] + if exist { + return v } - offset, exist := r.config.Offset[eventLogID] - if !exist { - var err error - var v int64 - switch r.config.OffsetType { - case primitive.LatestOffset: - if v, err = l.LatestOffset(ctx); err != nil { - return 0, err - } - case primitive.EarliestOffset: - if v, err = l.EarliestOffset(ctx); err != nil { - return 0, err - } - case primitive.Timestamp: - if v, err = l.QueryOffsetByTime(ctx, r.config.OffsetTimestamp); err != nil { - return 0, err - } - } - // fix offset is negative which convert to uint64 is big. - if v < 0 { - v = 0 - } - offset = uint64(v) - } - return offset, nil + log.Warning(r.stctx, "offset no exist, will use 0", map[string]interface{}{ + log.KeyEventbusName: r.config.EventBusName, + log.KeySubscriptionID: r.config.SubscriptionID, + log.KeyEventlogID: eventLogID, + }) + return 0 } func (r *reader) start(els []uint64) { @@ -205,13 +160,7 @@ func (r *reader) start(els []uint64) { if _, exist := r.elReader[eventLogID]; exist { continue } - offset, err := r.getOffset(r.stctx, eventLogID) - if err != nil { - log.Error(r.stctx, "event log get offset error", map[string]interface{}{ - log.KeyError: err, - }) - continue - } + offset := r.getOffset(eventLogID) l, err := r.config.Client.Eventbus(r.stctx, r.config.EventBusName).GetLog(r.stctx, eventLogID.Uint64()) if err != nil { log.Error(r.stctx, "get eventlog error", map[string]interface{}{ diff --git a/internal/trigger/reader/reader_test.go b/internal/trigger/reader/reader_test.go index 71ac9f47a..be888b4f8 100644 --- a/internal/trigger/reader/reader_test.go +++ b/internal/trigger/reader/reader_test.go @@ -17,132 +17,20 @@ package reader import ( "context" "encoding/binary" - "math/rand" "sync" "testing" "time" + ce "github.com/cloudevents/sdk-go/v2" + . "github.com/golang/mock/gomock" "github.com/google/uuid" "github.com/linkall-labs/vanus/client" "github.com/linkall-labs/vanus/client/pkg/api" "github.com/linkall-labs/vanus/client/pkg/eventlog" - "github.com/linkall-labs/vanus/internal/primitive" - "github.com/linkall-labs/vanus/internal/primitive/vanus" "github.com/linkall-labs/vanus/internal/trigger/info" - - ce "github.com/cloudevents/sdk-go/v2" - . "github.com/golang/mock/gomock" . "github.com/smartystreets/goconvey/convey" ) -func TestGetOffsetByTimestamp(t *testing.T) { - Convey("test get offset by timestamp", t, func() { - events := make(chan info.EventRecord, 10) - r := NewReader(Config{}, events).(*reader) - eventLogID := vanus.NewTestID() - r.elReader[eventLogID] = struct{}{} - rand.Seed(time.Now().Unix()) - offset := rand.Uint64() - mockCtrl := NewController(t) - mockClient := client.NewMockClient(mockCtrl) - mockEventbus := api.NewMockEventbus(mockCtrl) - mockEventlog := api.NewMockEventlog(mockCtrl) - mockBusWriter := api.NewMockBusWriter(mockCtrl) - mockBusReader := api.NewMockBusReader(mockCtrl) - mockClient.EXPECT().Eventbus(Any(), Any()).AnyTimes().Return(mockEventbus) - mockEventbus.EXPECT().Writer().AnyTimes().Return(mockBusWriter) - mockEventbus.EXPECT().Reader().AnyTimes().Return(mockBusReader) - mockEventbus.EXPECT().GetLog(Any(), Any()).AnyTimes().Return(mockEventlog, nil) - mockEventlog.EXPECT().QueryOffsetByTime(Any(), Any()).AnyTimes().Return(int64(offset), nil) - r.config.Client = mockClient - offsets, err := r.GetOffsetByTimestamp(context.Background(), time.Now().Unix()) - So(err, ShouldBeNil) - So(len(offsets), ShouldEqual, 1) - So(offsets[0].EventLogID, ShouldEqual, eventLogID) - So(offsets[0].Offset, ShouldEqual, offset) - }) -} - -func TestGetOffset(t *testing.T) { - Convey("test get offset", t, func() { - events := make(chan info.EventRecord, 10) - r := NewReader(Config{}, events).(*reader) - eventLogID := vanus.NewTestID() - r.elReader = map[vanus.ID]struct{}{} - mockCtrl := NewController(t) - mockClient := client.NewMockClient(mockCtrl) - mockEventbus := api.NewMockEventbus(mockCtrl) - mockEventlog := api.NewMockEventlog(mockCtrl) - mockBusWriter := api.NewMockBusWriter(mockCtrl) - mockBusReader := api.NewMockBusReader(mockCtrl) - mockClient.EXPECT().Eventbus(Any(), Any()).AnyTimes().Return(mockEventbus) - mockEventbus.EXPECT().Writer().AnyTimes().Return(mockBusWriter) - mockEventbus.EXPECT().Reader().AnyTimes().Return(mockBusReader) - mockEventbus.EXPECT().GetLog(Any(), Any()).AnyTimes().Return(mockEventlog, nil) - r.config.Client = mockClient - Convey("test latest", func() { - r.config.OffsetType = primitive.LatestOffset - rand.Seed(time.Now().Unix()) - offset := rand.Uint32() - Convey("negative number", func() { - mockEventlog.EXPECT().LatestOffset(Any()).AnyTimes().Return(int64(offset)*-1, nil) - v, err := r.getOffset(context.Background(), eventLogID) - So(err, ShouldBeNil) - So(v, ShouldEqual, 0) - }) - Convey("non negative number", func() { - mockEventlog.EXPECT().LatestOffset(Any()).AnyTimes().Return(int64(offset), nil) - v, err := r.getOffset(context.Background(), eventLogID) - So(err, ShouldBeNil) - So(v, ShouldEqual, offset) - }) - }) - Convey("test earliest", func() { - r.config.OffsetType = primitive.EarliestOffset - rand.Seed(time.Now().Unix()) - offset := rand.Uint32() - Convey("negative number", func() { - mockEventlog.EXPECT().EarliestOffset(Any()).AnyTimes().Return(int64(offset)*-1, nil) - v, err := r.getOffset(context.Background(), eventLogID) - So(err, ShouldBeNil) - So(v, ShouldEqual, 0) - }) - Convey("non negative number", func() { - mockEventlog.EXPECT().EarliestOffset(Any()).AnyTimes().Return(int64(offset), nil) - v, err := r.getOffset(context.Background(), eventLogID) - So(err, ShouldBeNil) - So(v, ShouldEqual, offset) - }) - }) - Convey("test timestamp", func() { - r.config.OffsetType = primitive.Timestamp - r.config.OffsetTimestamp = time.Now().Unix() - rand.Seed(time.Now().Unix()) - offset := rand.Uint32() - Convey("negative number", func() { - mockEventlog.EXPECT().QueryOffsetByTime(Any(), Any()).AnyTimes().Return(int64(offset)*-1, nil) - v, err := r.getOffset(context.Background(), eventLogID) - So(err, ShouldBeNil) - So(v, ShouldEqual, 0) - }) - Convey("non negative number", func() { - mockEventlog.EXPECT().QueryOffsetByTime(Any(), Any()).AnyTimes().Return(int64(offset), nil) - v, err := r.getOffset(context.Background(), eventLogID) - So(err, ShouldBeNil) - So(v, ShouldEqual, offset) - }) - }) - Convey("test exist", func() { - rand.Seed(time.Now().Unix()) - offset := rand.Uint64() - r.config.Offset = map[vanus.ID]uint64{eventLogID: offset} - v, err := r.getOffset(context.Background(), eventLogID) - So(err, ShouldBeNil) - So(v, ShouldEqual, offset) - }) - }) -} - func TestReaderStart(t *testing.T) { mockCtrl := NewController(t) defer mockCtrl.Finish() diff --git a/internal/trigger/server.go b/internal/trigger/server.go index a65dc9ade..7881fd75c 100644 --- a/internal/trigger/server.go +++ b/internal/trigger/server.go @@ -25,7 +25,6 @@ import ( "github.com/linkall-labs/vanus/observability/log" "github.com/linkall-labs/vanus/pkg/errors" pbtrigger "github.com/linkall-labs/vanus/proto/pkg/trigger" - "google.golang.org/protobuf/types/known/emptypb" ) var ( @@ -140,21 +139,6 @@ func (s *server) ResumeSubscription(ctx context.Context, return &pbtrigger.ResumeSubscriptionResponse{}, nil } -func (s *server) ResetOffsetToTimestamp(ctx context.Context, - request *pbtrigger.ResetOffsetToTimestampRequest) (*emptypb.Empty, error) { - log.Info(ctx, "subscription reset offset ", map[string]interface{}{"request": request}) - id := vanus.NewIDFromUint64(request.SubscriptionId) - err := s.worker.ResetOffsetToTimestamp(ctx, id, int64(request.Timestamp)) - if err != nil { - log.Error(ctx, "reset offset error", map[string]interface{}{ - log.KeySubscriptionID: id, - log.KeyError: err, - }) - return nil, err - } - return &emptypb.Empty{}, nil -} - func (s *server) Initialize(ctx context.Context) error { err := s.worker.Init(ctx) if err != nil { diff --git a/internal/trigger/server_test.go b/internal/trigger/server_test.go index a44d5f6bc..827dfda0f 100644 --- a/internal/trigger/server_test.go +++ b/internal/trigger/server_test.go @@ -80,16 +80,6 @@ func TestServerApi(t *testing.T) { _, err := s.ResumeSubscription(ctx, &pbtrigger.ResumeSubscriptionRequest{}) So(err, ShouldNotBeNil) }) - Convey("test reset offset to timestamp", func() { - w.EXPECT().ResetOffsetToTimestamp(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil) - _, err := s.ResetOffsetToTimestamp(ctx, &pbtrigger.ResetOffsetToTimestampRequest{}) - So(err, ShouldBeNil) - }) - Convey("test reset offset to timestamp has error", func() { - w.EXPECT().ResetOffsetToTimestamp(gomock.Any(), gomock.Any(), gomock.Any()).Return(fmt.Errorf("test error")) - _, err := s.ResetOffsetToTimestamp(ctx, &pbtrigger.ResetOffsetToTimestampRequest{}) - So(err, ShouldNotBeNil) - }) }) } diff --git a/internal/trigger/trigger/mock_trigger.go b/internal/trigger/trigger/mock_trigger.go index 26f0ed06e..f06aae501 100644 --- a/internal/trigger/trigger/mock_trigger.go +++ b/internal/trigger/trigger/mock_trigger.go @@ -78,21 +78,6 @@ func (mr *MockTriggerMockRecorder) Init(ctx interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Init", reflect.TypeOf((*MockTrigger)(nil).Init), ctx) } -// ResetOffsetToTimestamp mocks base method. -func (m *MockTrigger) ResetOffsetToTimestamp(ctx context.Context, timestamp int64) (info.ListOffsetInfo, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ResetOffsetToTimestamp", ctx, timestamp) - ret0, _ := ret[0].(info.ListOffsetInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ResetOffsetToTimestamp indicates an expected call of ResetOffsetToTimestamp. -func (mr *MockTriggerMockRecorder) ResetOffsetToTimestamp(ctx, timestamp interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetOffsetToTimestamp", reflect.TypeOf((*MockTrigger)(nil).ResetOffsetToTimestamp), ctx, timestamp) -} - // Start mocks base method. func (m *MockTrigger) Start(ctx context.Context) error { m.ctrl.T.Helper() diff --git a/internal/trigger/trigger/trigger.go b/internal/trigger/trigger/trigger.go index bf1238f76..87a0f4f02 100644 --- a/internal/trigger/trigger/trigger.go +++ b/internal/trigger/trigger/trigger.go @@ -57,7 +57,6 @@ type Trigger interface { Stop(ctx context.Context) error Change(ctx context.Context, subscription *primitive.Subscription) error GetOffsets(ctx context.Context) pInfo.ListOffsetInfo - ResetOffsetToTimestamp(ctx context.Context, timestamp int64) (pInfo.ListOffsetInfo, error) } type trigger struct { @@ -416,33 +415,22 @@ func (t *trigger) writeEventToDeadLetter(ctx context.Context, e *ce.Event, reaso } func (t *trigger) getReaderConfig() reader.Config { - controllers := t.config.Controllers sub := t.subscription - var offsetTimestamp int64 - if sub.Config.OffsetTimestamp != nil { - offsetTimestamp = int64(*sub.Config.OffsetTimestamp) - } return reader.Config{ - EventBusName: sub.EventBus, - Controllers: controllers, - Client: t.client, - SubscriptionID: sub.ID, - OffsetType: sub.Config.OffsetType, - OffsetTimestamp: offsetTimestamp, - Offset: getOffset(t.offsetManager, sub), + EventBusName: sub.EventBus, + Client: t.client, + SubscriptionID: sub.ID, + Offset: getOffset(t.offsetManager, sub), } } func (t *trigger) getRetryEventReaderConfig() reader.Config { - controllers := t.config.Controllers sub := t.subscription ebName := primitive.RetryEventbusName return reader.Config{ EventBusName: ebName, - Controllers: controllers, Client: t.client, SubscriptionID: sub.ID, - OffsetType: primitive.LatestOffset, Offset: getOffset(t.offsetManager, sub), } } @@ -541,16 +529,6 @@ func (t *trigger) Change(ctx context.Context, subscription *primitive.Subscripti return nil } -func (t *trigger) ResetOffsetToTimestamp(ctx context.Context, timestamp int64) (pInfo.ListOffsetInfo, error) { - offsets, err := t.reader.GetOffsetByTimestamp(ctx, timestamp) - if err != nil { - return nil, err - } - t.subscription.Offsets = offsets - t.offsetManager.Clear() - return offsets, nil -} - // GetOffsets contains retry eventlog. func (t *trigger) GetOffsets(ctx context.Context) pInfo.ListOffsetInfo { return t.offsetManager.GetCommit() diff --git a/internal/trigger/trigger/trigger_test.go b/internal/trigger/trigger/trigger_test.go index 483af9a8b..a259dabeb 100644 --- a/internal/trigger/trigger/trigger_test.go +++ b/internal/trigger/trigger/trigger_test.go @@ -30,7 +30,6 @@ import ( eb "github.com/linkall-labs/vanus/client" "github.com/linkall-labs/vanus/client/pkg/api" "github.com/linkall-labs/vanus/internal/primitive" - pInfo "github.com/linkall-labs/vanus/internal/primitive/info" "github.com/linkall-labs/vanus/internal/primitive/vanus" "github.com/linkall-labs/vanus/internal/trigger/client" "github.com/linkall-labs/vanus/internal/trigger/info" @@ -308,22 +307,3 @@ func TestChangeSubscription(t *testing.T) { }) }) } - -func TestResetOffset(t *testing.T) { - Convey("test reset offset", t, func() { - ctrl := gomock.NewController(t) - defer ctrl.Finish() - ctx := context.Background() - id := vanus.NewTestID() - tg := NewTrigger(makeSubscription(id), WithControllers([]string{"test"})).(*trigger) - r := reader.NewMockReader(ctrl) - tg.reader = r - Convey("reset offset to timestamp", func() { - offsets := pInfo.ListOffsetInfo{{EventLogID: vanus.NewTestID(), Offset: uint64(100)}} - r.EXPECT().GetOffsetByTimestamp(gomock.Any(), gomock.Any()).Return(offsets, nil) - v, err := tg.ResetOffsetToTimestamp(ctx, time.Now().Unix()) - So(err, ShouldBeNil) - So(len(v), ShouldEqual, len(offsets)) - }) - }) -} diff --git a/internal/trigger/worker.go b/internal/trigger/worker.go index 512256add..10357e739 100644 --- a/internal/trigger/worker.go +++ b/internal/trigger/worker.go @@ -23,7 +23,6 @@ import ( "github.com/linkall-labs/vanus/internal/convert" "github.com/linkall-labs/vanus/internal/primitive" - "github.com/linkall-labs/vanus/internal/primitive/info" "github.com/linkall-labs/vanus/internal/primitive/vanus" "github.com/linkall-labs/vanus/internal/trigger/trigger" "github.com/linkall-labs/vanus/observability/log" @@ -45,7 +44,6 @@ type Worker interface { RemoveSubscription(ctx context.Context, id vanus.ID) error PauseSubscription(ctx context.Context, id vanus.ID) error StartSubscription(ctx context.Context, id vanus.ID) error - ResetOffsetToTimestamp(ctx context.Context, id vanus.ID, timestamp int64) error } const ( @@ -197,38 +195,6 @@ func (w *worker) StartSubscription(ctx context.Context, id vanus.ID) error { return w.startSubscription(ctx, id) } -func (w *worker) ResetOffsetToTimestamp(ctx context.Context, - id vanus.ID, - timestamp int64) error { - t, exist := w.getTrigger(id) - if !exist { - return errors.ErrResourceNotFound.WithMessage("subscription not exist") - } - // pause subscription - _ = w.stopSubscription(ctx, id) - // reset offset - offsets, err := t.ResetOffsetToTimestamp(ctx, timestamp) - if err != nil { - return err - } - // commit offset - log.Info(ctx, "reset offset to timestamp offsets info", map[string]interface{}{ - log.KeySubscriptionID: id, - "offsets": offsets, - }) - err = w.commitOffset(ctx, id, offsets) - if err != nil { - return err - } - // start subscription - err = w.startSubscription(ctx, id) - if err != nil { - // todo process start fail - return err - } - return nil -} - func (w *worker) startHeartbeat(ctx context.Context) error { w.wg.Add(1) defer w.wg.Done() @@ -261,17 +227,6 @@ func (w *worker) startSubscription(ctx context.Context, id vanus.ID) error { return t.Start(ctx) } -func (w *worker) commitOffset(ctx context.Context, id vanus.ID, offsets info.ListOffsetInfo) error { - _, err := w.client.CommitOffset(ctx, &ctrlpb.CommitOffsetRequest{ - ForceCommit: true, - SubscriptionInfo: []*metapb.SubscriptionInfo{convert.ToPbSubscriptionInfo(info.SubscriptionInfo{ - SubscriptionID: id, - Offsets: offsets, - })}, - }) - return err -} - func (w *worker) commitOffsets(ctx context.Context) error { _, err := w.client.CommitOffset(ctx, &ctrlpb.CommitOffsetRequest{ ForceCommit: true, diff --git a/internal/trigger/worker_test.go b/internal/trigger/worker_test.go index 0baba6325..20d2890e0 100644 --- a/internal/trigger/worker_test.go +++ b/internal/trigger/worker_test.go @@ -18,7 +18,6 @@ import ( "context" "fmt" "testing" - "time" "github.com/golang/mock/gomock" "github.com/linkall-labs/vanus/internal/primitive" @@ -159,38 +158,6 @@ func TestPauseStartSubscription(t *testing.T) { }) } -func TestResetOffsetToTimestamp(t *testing.T) { - ctx := context.Background() - Convey("test reset offset to timestamp", t, func() { - id := vanus.NewTestID() - ctrl := gomock.NewController(t) - defer ctrl.Finish() - tg := trigger.NewMockTrigger(ctrl) - m := NewWorker(Config{}).(*worker) - m.newTrigger = testNewTrigger(tg) - Convey("reset offset no exist subscription", func() { - err := m.ResetOffsetToTimestamp(ctx, id, time.Now().Unix()) - So(err, ShouldNotBeNil) - }) - Convey("reset offset exist subscription", func() { - tg.EXPECT().Init(gomock.Any()).AnyTimes().Return(nil) - tg.EXPECT().Start(gomock.Any()).AnyTimes().Return(nil) - err := m.AddSubscription(ctx, &primitive.Subscription{ - ID: id, - }) - So(err, ShouldBeNil) - tg.EXPECT().Stop(gomock.Any()).Return(nil) - offsets := info.ListOffsetInfo{{EventLogID: vanus.NewTestID(), Offset: uint64(100)}} - tg.EXPECT().ResetOffsetToTimestamp(gomock.Any(), gomock.Any()).Return(offsets, nil) - triggerClient := controller.NewMockTriggerControllerClient(ctrl) - m.client = triggerClient - triggerClient.EXPECT().CommitOffset(gomock.Any(), gomock.Any()).Return(nil, nil) - err = m.ResetOffsetToTimestamp(ctx, id, time.Now().Unix()) - So(err, ShouldBeNil) - }) - }) -} - func TestWorker_Stop(t *testing.T) { ctx := context.Background() Convey("start stop", t, func() { diff --git a/pkg/cluster/raw_client/trigger.go b/pkg/cluster/raw_client/trigger.go index e57000494..361039c15 100644 --- a/pkg/cluster/raw_client/trigger.go +++ b/pkg/cluster/raw_client/trigger.go @@ -173,8 +173,8 @@ func (tc *triggerClient) UnregisterTriggerWorker(ctx context.Context, in *ctrlpb } func (tc *triggerClient) ResetOffsetToTimestamp(ctx context.Context, in *ctrlpb.ResetOffsetToTimestampRequest, - opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) + opts ...grpc.CallOption) (*ctrlpb.ResetOffsetToTimestampResponse, error) { + out := new(ctrlpb.ResetOffsetToTimestampResponse) err := tc.cc.invoke(ctx, "/linkall.vanus.controller.TriggerController/ResetOffsetToTimestamp", in, out, opts...) if err != nil { return nil, err @@ -192,6 +192,24 @@ func (tc *triggerClient) CommitOffset(ctx context.Context, in *ctrlpb.CommitOffs return out, nil } +func (tc *triggerClient) DisableSubscription(ctx context.Context, in *ctrlpb.DisableSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := tc.cc.invoke(ctx, "/linkall.vanus.controller.TriggerController/DisableSubscription", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (tc *triggerClient) ResumeSubscription(ctx context.Context, in *ctrlpb.ResumeSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := tc.cc.invoke(ctx, "/linkall.vanus.controller.TriggerController/ResumeSubscription", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (tc *triggerClient) TriggerWorkerHeartbeat(_ context.Context, _ ...grpc.CallOption) (ctrlpb.TriggerController_TriggerWorkerHeartbeatClient, error) { panic("unsupported method, please use controller.RegisterHeartbeat") diff --git a/proto/pkg/controller/controller.pb.go b/proto/pkg/controller/controller.pb.go index 4c1789d5f..b3f3a05f7 100644 --- a/proto/pkg/controller/controller.pb.go +++ b/proto/pkg/controller/controller.pb.go @@ -15,13 +15,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.19.4 +// protoc v3.19.1 // source: controller.proto +//go:generate mockgen -source=controller.pb.go -destination=mock_controller.go -package=controller package controller import ( context "context" + reflect "reflect" + sync "sync" + meta "github.com/linkall-labs/vanus/proto/pkg/meta" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -31,8 +35,6 @@ import ( emptypb "google.golang.org/protobuf/types/known/emptypb" timestamppb "google.golang.org/protobuf/types/known/timestamppb" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" - reflect "reflect" - sync "sync" ) const ( @@ -1075,6 +1077,100 @@ func (x *DeleteSubscriptionRequest) GetId() uint64 { return 0 } +type DisableSubscriptionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DisableSubscriptionRequest) Reset() { + *x = DisableSubscriptionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisableSubscriptionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisableSubscriptionRequest) ProtoMessage() {} + +func (x *DisableSubscriptionRequest) ProtoReflect() protoreflect.Message { + mi := &file_controller_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DisableSubscriptionRequest.ProtoReflect.Descriptor instead. +func (*DisableSubscriptionRequest) Descriptor() ([]byte, []int) { + return file_controller_proto_rawDescGZIP(), []int{18} +} + +func (x *DisableSubscriptionRequest) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +type ResumeSubscriptionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *ResumeSubscriptionRequest) Reset() { + *x = ResumeSubscriptionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResumeSubscriptionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResumeSubscriptionRequest) ProtoMessage() {} + +func (x *ResumeSubscriptionRequest) ProtoReflect() protoreflect.Message { + mi := &file_controller_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResumeSubscriptionRequest.ProtoReflect.Descriptor instead. +func (*ResumeSubscriptionRequest) Descriptor() ([]byte, []int) { + return file_controller_proto_rawDescGZIP(), []int{19} +} + +func (x *ResumeSubscriptionRequest) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + type ListSubscriptionResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1086,7 +1182,7 @@ type ListSubscriptionResponse struct { func (x *ListSubscriptionResponse) Reset() { *x = ListSubscriptionResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[18] + mi := &file_controller_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1099,7 +1195,7 @@ func (x *ListSubscriptionResponse) String() string { func (*ListSubscriptionResponse) ProtoMessage() {} func (x *ListSubscriptionResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[18] + mi := &file_controller_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1112,7 +1208,7 @@ func (x *ListSubscriptionResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSubscriptionResponse.ProtoReflect.Descriptor instead. func (*ListSubscriptionResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{18} + return file_controller_proto_rawDescGZIP(), []int{20} } func (x *ListSubscriptionResponse) GetSubscription() []*meta.Subscription { @@ -1133,7 +1229,7 @@ type RegisterTriggerWorkerRequest struct { func (x *RegisterTriggerWorkerRequest) Reset() { *x = RegisterTriggerWorkerRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[19] + mi := &file_controller_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1146,7 +1242,7 @@ func (x *RegisterTriggerWorkerRequest) String() string { func (*RegisterTriggerWorkerRequest) ProtoMessage() {} func (x *RegisterTriggerWorkerRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[19] + mi := &file_controller_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1159,7 +1255,7 @@ func (x *RegisterTriggerWorkerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RegisterTriggerWorkerRequest.ProtoReflect.Descriptor instead. func (*RegisterTriggerWorkerRequest) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{19} + return file_controller_proto_rawDescGZIP(), []int{21} } func (x *RegisterTriggerWorkerRequest) GetAddress() string { @@ -1178,7 +1274,7 @@ type RegisterTriggerWorkerResponse struct { func (x *RegisterTriggerWorkerResponse) Reset() { *x = RegisterTriggerWorkerResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[20] + mi := &file_controller_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1191,7 +1287,7 @@ func (x *RegisterTriggerWorkerResponse) String() string { func (*RegisterTriggerWorkerResponse) ProtoMessage() {} func (x *RegisterTriggerWorkerResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[20] + mi := &file_controller_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1204,7 +1300,7 @@ func (x *RegisterTriggerWorkerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RegisterTriggerWorkerResponse.ProtoReflect.Descriptor instead. func (*RegisterTriggerWorkerResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{20} + return file_controller_proto_rawDescGZIP(), []int{22} } type UnregisterTriggerWorkerRequest struct { @@ -1218,7 +1314,7 @@ type UnregisterTriggerWorkerRequest struct { func (x *UnregisterTriggerWorkerRequest) Reset() { *x = UnregisterTriggerWorkerRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[21] + mi := &file_controller_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1231,7 +1327,7 @@ func (x *UnregisterTriggerWorkerRequest) String() string { func (*UnregisterTriggerWorkerRequest) ProtoMessage() {} func (x *UnregisterTriggerWorkerRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[21] + mi := &file_controller_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1244,7 +1340,7 @@ func (x *UnregisterTriggerWorkerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UnregisterTriggerWorkerRequest.ProtoReflect.Descriptor instead. func (*UnregisterTriggerWorkerRequest) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{21} + return file_controller_proto_rawDescGZIP(), []int{23} } func (x *UnregisterTriggerWorkerRequest) GetAddress() string { @@ -1263,7 +1359,7 @@ type UnregisterTriggerWorkerResponse struct { func (x *UnregisterTriggerWorkerResponse) Reset() { *x = UnregisterTriggerWorkerResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[22] + mi := &file_controller_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1276,7 +1372,7 @@ func (x *UnregisterTriggerWorkerResponse) String() string { func (*UnregisterTriggerWorkerResponse) ProtoMessage() {} func (x *UnregisterTriggerWorkerResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[22] + mi := &file_controller_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1289,7 +1385,7 @@ func (x *UnregisterTriggerWorkerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UnregisterTriggerWorkerResponse.ProtoReflect.Descriptor instead. func (*UnregisterTriggerWorkerResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{22} + return file_controller_proto_rawDescGZIP(), []int{24} } type TriggerWorkerHeartbeatRequest struct { @@ -1305,7 +1401,7 @@ type TriggerWorkerHeartbeatRequest struct { func (x *TriggerWorkerHeartbeatRequest) Reset() { *x = TriggerWorkerHeartbeatRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[23] + mi := &file_controller_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1318,7 +1414,7 @@ func (x *TriggerWorkerHeartbeatRequest) String() string { func (*TriggerWorkerHeartbeatRequest) ProtoMessage() {} func (x *TriggerWorkerHeartbeatRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[23] + mi := &file_controller_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1331,7 +1427,7 @@ func (x *TriggerWorkerHeartbeatRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TriggerWorkerHeartbeatRequest.ProtoReflect.Descriptor instead. func (*TriggerWorkerHeartbeatRequest) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{23} + return file_controller_proto_rawDescGZIP(), []int{25} } func (x *TriggerWorkerHeartbeatRequest) GetAddress() string { @@ -1364,7 +1460,7 @@ type TriggerWorkerHeartbeatResponse struct { func (x *TriggerWorkerHeartbeatResponse) Reset() { *x = TriggerWorkerHeartbeatResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[24] + mi := &file_controller_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1377,7 +1473,7 @@ func (x *TriggerWorkerHeartbeatResponse) String() string { func (*TriggerWorkerHeartbeatResponse) ProtoMessage() {} func (x *TriggerWorkerHeartbeatResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[24] + mi := &file_controller_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1390,7 +1486,7 @@ func (x *TriggerWorkerHeartbeatResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use TriggerWorkerHeartbeatResponse.ProtoReflect.Descriptor instead. func (*TriggerWorkerHeartbeatResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{24} + return file_controller_proto_rawDescGZIP(), []int{26} } type ResetOffsetToTimestampRequest struct { @@ -1406,7 +1502,7 @@ type ResetOffsetToTimestampRequest struct { func (x *ResetOffsetToTimestampRequest) Reset() { *x = ResetOffsetToTimestampRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[25] + mi := &file_controller_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1419,7 +1515,7 @@ func (x *ResetOffsetToTimestampRequest) String() string { func (*ResetOffsetToTimestampRequest) ProtoMessage() {} func (x *ResetOffsetToTimestampRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[25] + mi := &file_controller_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1432,7 +1528,7 @@ func (x *ResetOffsetToTimestampRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ResetOffsetToTimestampRequest.ProtoReflect.Descriptor instead. func (*ResetOffsetToTimestampRequest) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{25} + return file_controller_proto_rawDescGZIP(), []int{27} } func (x *ResetOffsetToTimestampRequest) GetSubscriptionId() uint64 { @@ -1449,6 +1545,53 @@ func (x *ResetOffsetToTimestampRequest) GetTimestamp() uint64 { return 0 } +type ResetOffsetToTimestampResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Offsets []*meta.OffsetInfo `protobuf:"bytes,1,rep,name=offsets,proto3" json:"offsets,omitempty"` +} + +func (x *ResetOffsetToTimestampResponse) Reset() { + *x = ResetOffsetToTimestampResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ResetOffsetToTimestampResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResetOffsetToTimestampResponse) ProtoMessage() {} + +func (x *ResetOffsetToTimestampResponse) ProtoReflect() protoreflect.Message { + mi := &file_controller_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ResetOffsetToTimestampResponse.ProtoReflect.Descriptor instead. +func (*ResetOffsetToTimestampResponse) Descriptor() ([]byte, []int) { + return file_controller_proto_rawDescGZIP(), []int{28} +} + +func (x *ResetOffsetToTimestampResponse) GetOffsets() []*meta.OffsetInfo { + if x != nil { + return x.Offsets + } + return nil +} + type CommitOffsetRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1461,7 +1604,7 @@ type CommitOffsetRequest struct { func (x *CommitOffsetRequest) Reset() { *x = CommitOffsetRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[26] + mi := &file_controller_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1474,7 +1617,7 @@ func (x *CommitOffsetRequest) String() string { func (*CommitOffsetRequest) ProtoMessage() {} func (x *CommitOffsetRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[26] + mi := &file_controller_proto_msgTypes[29] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1487,7 +1630,7 @@ func (x *CommitOffsetRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CommitOffsetRequest.ProtoReflect.Descriptor instead. func (*CommitOffsetRequest) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{26} + return file_controller_proto_rawDescGZIP(), []int{29} } func (x *CommitOffsetRequest) GetSubscriptionInfo() []*meta.SubscriptionInfo { @@ -1515,7 +1658,7 @@ type CommitOffsetResponse struct { func (x *CommitOffsetResponse) Reset() { *x = CommitOffsetResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[27] + mi := &file_controller_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1528,7 +1671,7 @@ func (x *CommitOffsetResponse) String() string { func (*CommitOffsetResponse) ProtoMessage() {} func (x *CommitOffsetResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[27] + mi := &file_controller_proto_msgTypes[30] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1541,7 +1684,7 @@ func (x *CommitOffsetResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CommitOffsetResponse.ProtoReflect.Descriptor instead. func (*CommitOffsetResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{27} + return file_controller_proto_rawDescGZIP(), []int{30} } func (x *CommitOffsetResponse) GetFailSubscriptionId() []uint64 { @@ -1571,7 +1714,7 @@ type ListSegmentRequest struct { func (x *ListSegmentRequest) Reset() { *x = ListSegmentRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[28] + mi := &file_controller_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1584,7 +1727,7 @@ func (x *ListSegmentRequest) String() string { func (*ListSegmentRequest) ProtoMessage() {} func (x *ListSegmentRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[28] + mi := &file_controller_proto_msgTypes[31] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1597,7 +1740,7 @@ func (x *ListSegmentRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSegmentRequest.ProtoReflect.Descriptor instead. func (*ListSegmentRequest) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{28} + return file_controller_proto_rawDescGZIP(), []int{31} } func (x *ListSegmentRequest) GetEventBusId() uint64 { @@ -1646,7 +1789,7 @@ type ListSegmentResponse struct { func (x *ListSegmentResponse) Reset() { *x = ListSegmentResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[29] + mi := &file_controller_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1659,7 +1802,7 @@ func (x *ListSegmentResponse) String() string { func (*ListSegmentResponse) ProtoMessage() {} func (x *ListSegmentResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[29] + mi := &file_controller_proto_msgTypes[32] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1672,7 +1815,7 @@ func (x *ListSegmentResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSegmentResponse.ProtoReflect.Descriptor instead. func (*ListSegmentResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{29} + return file_controller_proto_rawDescGZIP(), []int{32} } func (x *ListSegmentResponse) GetSegments() []*meta.Segment { @@ -1696,7 +1839,7 @@ type GetAppendableSegmentRequest struct { func (x *GetAppendableSegmentRequest) Reset() { *x = GetAppendableSegmentRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[30] + mi := &file_controller_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1709,7 +1852,7 @@ func (x *GetAppendableSegmentRequest) String() string { func (*GetAppendableSegmentRequest) ProtoMessage() {} func (x *GetAppendableSegmentRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[30] + mi := &file_controller_proto_msgTypes[33] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1722,7 +1865,7 @@ func (x *GetAppendableSegmentRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAppendableSegmentRequest.ProtoReflect.Descriptor instead. func (*GetAppendableSegmentRequest) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{30} + return file_controller_proto_rawDescGZIP(), []int{33} } func (x *GetAppendableSegmentRequest) GetEventBusId() uint64 { @@ -1757,7 +1900,7 @@ type GetAppendableSegmentResponse struct { func (x *GetAppendableSegmentResponse) Reset() { *x = GetAppendableSegmentResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[31] + mi := &file_controller_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1770,7 +1913,7 @@ func (x *GetAppendableSegmentResponse) String() string { func (*GetAppendableSegmentResponse) ProtoMessage() {} func (x *GetAppendableSegmentResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[31] + mi := &file_controller_proto_msgTypes[34] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1783,7 +1926,7 @@ func (x *GetAppendableSegmentResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAppendableSegmentResponse.ProtoReflect.Descriptor instead. func (*GetAppendableSegmentResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{31} + return file_controller_proto_rawDescGZIP(), []int{34} } func (x *GetAppendableSegmentResponse) GetSegments() []*meta.Segment { @@ -1946,285 +2089,311 @@ var file_controller_proto_rawDesc = []byte{ 0x69, 0x64, 0x22, 0x2b, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x22, - 0x60, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0c, 0x73, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x22, 0x38, 0x0a, 0x1c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, - 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x52, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, - 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x1e, - 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, - 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, - 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x21, 0x0a, 0x1f, 0x55, 0x6e, 0x72, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, - 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x1d, - 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, - 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, - 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, - 0x64, 0x12, 0x51, 0x0a, 0x11, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6c, + 0x2c, 0x0a, 0x1a, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2b, 0x0a, + 0x19, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x22, 0x60, 0x0a, 0x18, 0x4c, 0x69, + 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, - 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x10, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x20, 0x0a, 0x1e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, - 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x66, 0x0a, 0x1d, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, - 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x8b, - 0x01, 0x0a, 0x13, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x51, 0x0a, 0x11, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x24, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x10, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x6f, 0x72, - 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0b, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x22, 0x48, 0x0a, 0x14, - 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x04, 0x52, 0x12, 0x66, 0x61, 0x69, 0x6c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xb4, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x53, - 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, - 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x49, 0x64, 0x12, - 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x49, - 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x6e, 0x64, 0x5f, 0x6f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x4f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x22, 0x4e, 0x0a, - 0x13, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, - 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x65, 0x67, 0x6d, - 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x7b, 0x0a, - 0x1b, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, - 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0c, - 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x49, 0x64, 0x12, 0x20, - 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x49, 0x64, - 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x07, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x22, 0x57, 0x0a, 0x1c, 0x47, 0x65, - 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x73, 0x65, - 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, + 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, + 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x38, 0x0a, 0x1c, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, + 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x1e, 0x55, 0x6e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, + 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x22, 0x21, 0x0a, 0x1f, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x1d, 0x54, 0x72, 0x69, 0x67, 0x67, + 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, 0x51, 0x0a, 0x11, + 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x10, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x22, + 0x20, 0x0a, 0x1e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, + 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x66, 0x0a, 0x1d, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x73, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x5a, 0x0a, 0x1e, 0x52, 0x65, 0x73, + 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x6f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, - 0x61, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x32, 0x54, 0x0a, 0x0a, 0x50, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x12, 0x46, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x1a, 0x26, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x50, 0x69, 0x6e, - 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xa8, 0x04, 0x0a, 0x12, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x12, 0x5f, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, - 0x75, 0x73, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, - 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, - 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, - 0x73, 0x12, 0x65, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, - 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x2e, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x73, 0x22, 0x8b, 0x01, 0x0a, 0x13, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x51, 0x0a, + 0x11, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, + 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x10, + 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x22, 0x48, 0x0a, 0x14, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x66, + 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x12, 0x66, 0x61, 0x69, 0x6c, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xb4, 0x01, + 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x75, + 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, + 0x74, 0x42, 0x75, 0x73, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, + 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x65, + 0x6e, 0x64, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x09, 0x65, 0x6e, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x69, 0x6d, + 0x69, 0x74, 0x65, 0x64, 0x22, 0x4e, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x73, + 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, + 0x74, 0x61, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x67, 0x6d, + 0x65, 0x6e, 0x74, 0x73, 0x22, 0x7b, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, + 0x64, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x75, 0x73, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x42, 0x75, 0x73, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6c, + 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, + 0x64, 0x22, 0x57, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, + 0x6c, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x37, 0x0a, 0x08, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, + 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x52, 0x08, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x32, 0x54, 0x0a, 0x0a, 0x50, 0x69, + 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, + 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x26, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x32, 0xa8, 0x04, 0x0a, 0x12, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x5f, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x46, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, - 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x12, 0x49, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, - 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x1a, 0x1c, 0x2e, - 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, - 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x56, 0x0a, 0x0c, 0x4c, - 0x69, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x2e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, - 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, - 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x65, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, + 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, + 0x46, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, + 0x73, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x1a, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x49, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x42, 0x75, 0x73, 0x32, 0x88, 0x02, 0x0a, 0x12, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, - 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x6a, 0x0a, 0x0b, 0x4c, - 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2c, 0x2e, 0x6c, 0x69, 0x6e, + 0x74, 0x42, 0x75, 0x73, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, + 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, + 0x75, 0x73, 0x12, 0x56, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, + 0x75, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, - 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x85, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, - 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x35, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x41, - 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x62, + 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x0e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x2f, 0x2e, 0x6c, + 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, + 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, + 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x32, 0x88, 0x02, 0x0a, 0x12, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x12, 0x6a, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x2c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, + 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x85, + 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, 0x6c, 0x65, + 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x35, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, 0x6c, 0x65, - 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, - 0x83, 0x06, 0x0a, 0x11, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x88, 0x01, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, - 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x36, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, - 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, - 0x6f, 0x75, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x7b, 0x0a, 0x10, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, - 0x62, 0x65, 0x61, 0x74, 0x12, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, - 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, - 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, - 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, - 0x65, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x88, 0x01, - 0x0a, 0x15, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, - 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x36, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, - 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8e, 0x01, 0x0a, 0x17, 0x55, 0x6e, 0x72, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x12, 0x38, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, - 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, - 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, - 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, + 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, - 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x18, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, - 0x73, 0x46, 0x75, 0x6c, 0x6c, 0x12, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, + 0x65, 0x6e, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x83, 0x06, 0x0a, 0x11, 0x53, 0x65, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x88, 0x01, 0x0a, + 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x75, + 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x36, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x6f, + 0x75, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, + 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, + 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7b, 0x0a, 0x10, 0x53, 0x65, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x12, 0x31, 0x2e, 0x6c, 0x69, + 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x65, + 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, + 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x28, 0x01, 0x12, 0x88, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x36, + 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x8e, 0x01, 0x0a, 0x17, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, + 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x38, 0x2e, 0x6c, 0x69, + 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x12, 0x63, 0x0a, 0x13, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, - 0x74, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, - 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, - 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x32, 0xa7, 0x09, 0x0a, 0x11, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, - 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x6d, 0x0a, 0x12, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, - 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, 0x12, 0x6d, 0x0a, 0x12, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, - 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, 0x12, 0x63, 0x0a, 0x12, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x2e, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x65, 0x0a, 0x18, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x73, 0x46, 0x75, 0x6c, 0x6c, 0x12, 0x31, 0x2e, 0x6c, + 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, + 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x63, 0x0a, 0x13, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, + 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x67, - 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, - 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, - 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, 0x12, 0x60, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x53, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x32, 0x92, 0x0b, 0x0a, + 0x11, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x12, 0x6d, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, + 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, + 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, + 0x00, 0x12, 0x6d, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, + 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, + 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, + 0x12, 0x63, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x32, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, - 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x8d, 0x01, 0x0a, 0x16, 0x54, 0x72, - 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, 0x74, - 0x62, 0x65, 0x61, 0x74, 0x12, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, - 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, - 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, - 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, - 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, - 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x88, 0x01, 0x0a, 0x15, 0x52, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, - 0x6b, 0x65, 0x72, 0x12, 0x36, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, - 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, - 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x6c, 0x69, - 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, - 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8e, 0x01, 0x0a, 0x17, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, - 0x12, 0x38, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x6e, 0x72, 0x65, + 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x63, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x2e, 0x6c, + 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x61, 0x0a, 0x12, 0x52, 0x65, + 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x75, + 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x67, 0x0a, + 0x0f, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, + 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, 0x12, 0x60, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x1a, 0x32, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, + 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x8d, 0x01, 0x0a, 0x16, 0x54, 0x72, 0x69, + 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, + 0x65, 0x61, 0x74, 0x12, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, + 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x54, + 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, + 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x6c, + 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, + 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x88, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, + 0x65, 0x72, 0x12, 0x36, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, + 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, - 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 0x2e, 0x6c, 0x69, 0x6e, + 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, - 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x16, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, + 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x8e, 0x01, 0x0a, 0x17, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x12, + 0x38, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x6e, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, + 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, + 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8b, 0x01, 0x0a, 0x16, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x12, 0x6d, 0x0a, 0x0c, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x12, 0x2d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, - 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x2e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, - 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, - 0xee, 0x01, 0x0a, 0x13, 0x53, 0x6e, 0x6f, 0x77, 0x66, 0x6c, 0x61, 0x6b, 0x65, 0x43, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x43, 0x6c, - 0x75, 0x73, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x12, 0x44, 0x0a, 0x0c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x6f, - 0x64, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x0e, 0x55, 0x6e, 0x72, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, - 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, - 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, + 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x6d, 0x0a, 0x0c, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x12, 0x2d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, + 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x32, 0xee, 0x01, 0x0a, 0x13, 0x53, 0x6e, 0x6f, 0x77, 0x66, 0x6c, 0x61, 0x6b, 0x65, 0x43, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x13, 0x47, 0x65, 0x74, + 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, + 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x12, 0x44, 0x0a, 0x0c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, + 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x0e, 0x55, 0x6e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, + 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x76, 0x61, + 0x6e, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2239,7 +2408,7 @@ func file_controller_proto_rawDescGZIP() []byte { return file_controller_proto_rawDescData } -var file_controller_proto_msgTypes = make([]protoimpl.MessageInfo, 33) +var file_controller_proto_msgTypes = make([]protoimpl.MessageInfo, 36) var file_controller_proto_goTypes = []interface{}{ (*PingResponse)(nil), // 0: linkall.vanus.controller.PingResponse (*CreateEventBusRequest)(nil), // 1: linkall.vanus.controller.CreateEventBusRequest @@ -2259,115 +2428,124 @@ var file_controller_proto_goTypes = []interface{}{ (*UpdateSubscriptionRequest)(nil), // 15: linkall.vanus.controller.UpdateSubscriptionRequest (*GetSubscriptionRequest)(nil), // 16: linkall.vanus.controller.GetSubscriptionRequest (*DeleteSubscriptionRequest)(nil), // 17: linkall.vanus.controller.DeleteSubscriptionRequest - (*ListSubscriptionResponse)(nil), // 18: linkall.vanus.controller.ListSubscriptionResponse - (*RegisterTriggerWorkerRequest)(nil), // 19: linkall.vanus.controller.RegisterTriggerWorkerRequest - (*RegisterTriggerWorkerResponse)(nil), // 20: linkall.vanus.controller.RegisterTriggerWorkerResponse - (*UnregisterTriggerWorkerRequest)(nil), // 21: linkall.vanus.controller.UnregisterTriggerWorkerRequest - (*UnregisterTriggerWorkerResponse)(nil), // 22: linkall.vanus.controller.UnregisterTriggerWorkerResponse - (*TriggerWorkerHeartbeatRequest)(nil), // 23: linkall.vanus.controller.TriggerWorkerHeartbeatRequest - (*TriggerWorkerHeartbeatResponse)(nil), // 24: linkall.vanus.controller.TriggerWorkerHeartbeatResponse - (*ResetOffsetToTimestampRequest)(nil), // 25: linkall.vanus.controller.ResetOffsetToTimestampRequest - (*CommitOffsetRequest)(nil), // 26: linkall.vanus.controller.CommitOffsetRequest - (*CommitOffsetResponse)(nil), // 27: linkall.vanus.controller.CommitOffsetResponse - (*ListSegmentRequest)(nil), // 28: linkall.vanus.controller.ListSegmentRequest - (*ListSegmentResponse)(nil), // 29: linkall.vanus.controller.ListSegmentResponse - (*GetAppendableSegmentRequest)(nil), // 30: linkall.vanus.controller.GetAppendableSegmentRequest - (*GetAppendableSegmentResponse)(nil), // 31: linkall.vanus.controller.GetAppendableSegmentResponse - nil, // 32: linkall.vanus.controller.RegisterSegmentServerResponse.SegmentsEntry - (*meta.EventBus)(nil), // 33: linkall.vanus.meta.EventBus - (*meta.SegmentHealthInfo)(nil), // 34: linkall.vanus.meta.SegmentHealthInfo - (*meta.SubscriptionConfig)(nil), // 35: linkall.vanus.meta.SubscriptionConfig - (*meta.Filter)(nil), // 36: linkall.vanus.meta.Filter - (*meta.SinkCredential)(nil), // 37: linkall.vanus.meta.SinkCredential - (meta.Protocol)(0), // 38: linkall.vanus.meta.Protocol - (*meta.ProtocolSetting)(nil), // 39: linkall.vanus.meta.ProtocolSetting - (*meta.Transformer)(nil), // 40: linkall.vanus.meta.Transformer - (*meta.Subscription)(nil), // 41: linkall.vanus.meta.Subscription - (*meta.SubscriptionInfo)(nil), // 42: linkall.vanus.meta.SubscriptionInfo - (*meta.Segment)(nil), // 43: linkall.vanus.meta.Segment - (*emptypb.Empty)(nil), // 44: google.protobuf.Empty - (*wrapperspb.UInt32Value)(nil), // 45: google.protobuf.UInt32Value - (*timestamppb.Timestamp)(nil), // 46: google.protobuf.Timestamp + (*DisableSubscriptionRequest)(nil), // 18: linkall.vanus.controller.DisableSubscriptionRequest + (*ResumeSubscriptionRequest)(nil), // 19: linkall.vanus.controller.ResumeSubscriptionRequest + (*ListSubscriptionResponse)(nil), // 20: linkall.vanus.controller.ListSubscriptionResponse + (*RegisterTriggerWorkerRequest)(nil), // 21: linkall.vanus.controller.RegisterTriggerWorkerRequest + (*RegisterTriggerWorkerResponse)(nil), // 22: linkall.vanus.controller.RegisterTriggerWorkerResponse + (*UnregisterTriggerWorkerRequest)(nil), // 23: linkall.vanus.controller.UnregisterTriggerWorkerRequest + (*UnregisterTriggerWorkerResponse)(nil), // 24: linkall.vanus.controller.UnregisterTriggerWorkerResponse + (*TriggerWorkerHeartbeatRequest)(nil), // 25: linkall.vanus.controller.TriggerWorkerHeartbeatRequest + (*TriggerWorkerHeartbeatResponse)(nil), // 26: linkall.vanus.controller.TriggerWorkerHeartbeatResponse + (*ResetOffsetToTimestampRequest)(nil), // 27: linkall.vanus.controller.ResetOffsetToTimestampRequest + (*ResetOffsetToTimestampResponse)(nil), // 28: linkall.vanus.controller.ResetOffsetToTimestampResponse + (*CommitOffsetRequest)(nil), // 29: linkall.vanus.controller.CommitOffsetRequest + (*CommitOffsetResponse)(nil), // 30: linkall.vanus.controller.CommitOffsetResponse + (*ListSegmentRequest)(nil), // 31: linkall.vanus.controller.ListSegmentRequest + (*ListSegmentResponse)(nil), // 32: linkall.vanus.controller.ListSegmentResponse + (*GetAppendableSegmentRequest)(nil), // 33: linkall.vanus.controller.GetAppendableSegmentRequest + (*GetAppendableSegmentResponse)(nil), // 34: linkall.vanus.controller.GetAppendableSegmentResponse + nil, // 35: linkall.vanus.controller.RegisterSegmentServerResponse.SegmentsEntry + (*meta.EventBus)(nil), // 36: linkall.vanus.meta.EventBus + (*meta.SegmentHealthInfo)(nil), // 37: linkall.vanus.meta.SegmentHealthInfo + (*meta.SubscriptionConfig)(nil), // 38: linkall.vanus.meta.SubscriptionConfig + (*meta.Filter)(nil), // 39: linkall.vanus.meta.Filter + (*meta.SinkCredential)(nil), // 40: linkall.vanus.meta.SinkCredential + (meta.Protocol)(0), // 41: linkall.vanus.meta.Protocol + (*meta.ProtocolSetting)(nil), // 42: linkall.vanus.meta.ProtocolSetting + (*meta.Transformer)(nil), // 43: linkall.vanus.meta.Transformer + (*meta.Subscription)(nil), // 44: linkall.vanus.meta.Subscription + (*meta.SubscriptionInfo)(nil), // 45: linkall.vanus.meta.SubscriptionInfo + (*meta.OffsetInfo)(nil), // 46: linkall.vanus.meta.OffsetInfo + (*meta.Segment)(nil), // 47: linkall.vanus.meta.Segment + (*emptypb.Empty)(nil), // 48: google.protobuf.Empty + (*wrapperspb.UInt32Value)(nil), // 49: google.protobuf.UInt32Value + (*timestamppb.Timestamp)(nil), // 50: google.protobuf.Timestamp } var file_controller_proto_depIdxs = []int32{ - 33, // 0: linkall.vanus.controller.ListEventbusResponse.eventbus:type_name -> linkall.vanus.meta.EventBus - 34, // 1: linkall.vanus.controller.SegmentHeartbeatRequest.health_info:type_name -> linkall.vanus.meta.SegmentHealthInfo - 32, // 2: linkall.vanus.controller.RegisterSegmentServerResponse.segments:type_name -> linkall.vanus.controller.RegisterSegmentServerResponse.SegmentsEntry - 35, // 3: linkall.vanus.controller.SubscriptionRequest.config:type_name -> linkall.vanus.meta.SubscriptionConfig - 36, // 4: linkall.vanus.controller.SubscriptionRequest.filters:type_name -> linkall.vanus.meta.Filter - 37, // 5: linkall.vanus.controller.SubscriptionRequest.sink_credential:type_name -> linkall.vanus.meta.SinkCredential - 38, // 6: linkall.vanus.controller.SubscriptionRequest.protocol:type_name -> linkall.vanus.meta.Protocol - 39, // 7: linkall.vanus.controller.SubscriptionRequest.protocol_settings:type_name -> linkall.vanus.meta.ProtocolSetting - 40, // 8: linkall.vanus.controller.SubscriptionRequest.transformer:type_name -> linkall.vanus.meta.Transformer + 36, // 0: linkall.vanus.controller.ListEventbusResponse.eventbus:type_name -> linkall.vanus.meta.EventBus + 37, // 1: linkall.vanus.controller.SegmentHeartbeatRequest.health_info:type_name -> linkall.vanus.meta.SegmentHealthInfo + 35, // 2: linkall.vanus.controller.RegisterSegmentServerResponse.segments:type_name -> linkall.vanus.controller.RegisterSegmentServerResponse.SegmentsEntry + 38, // 3: linkall.vanus.controller.SubscriptionRequest.config:type_name -> linkall.vanus.meta.SubscriptionConfig + 39, // 4: linkall.vanus.controller.SubscriptionRequest.filters:type_name -> linkall.vanus.meta.Filter + 40, // 5: linkall.vanus.controller.SubscriptionRequest.sink_credential:type_name -> linkall.vanus.meta.SinkCredential + 41, // 6: linkall.vanus.controller.SubscriptionRequest.protocol:type_name -> linkall.vanus.meta.Protocol + 42, // 7: linkall.vanus.controller.SubscriptionRequest.protocol_settings:type_name -> linkall.vanus.meta.ProtocolSetting + 43, // 8: linkall.vanus.controller.SubscriptionRequest.transformer:type_name -> linkall.vanus.meta.Transformer 13, // 9: linkall.vanus.controller.CreateSubscriptionRequest.subscription:type_name -> linkall.vanus.controller.SubscriptionRequest 13, // 10: linkall.vanus.controller.UpdateSubscriptionRequest.subscription:type_name -> linkall.vanus.controller.SubscriptionRequest - 41, // 11: linkall.vanus.controller.ListSubscriptionResponse.subscription:type_name -> linkall.vanus.meta.Subscription - 42, // 12: linkall.vanus.controller.TriggerWorkerHeartbeatRequest.subscription_info:type_name -> linkall.vanus.meta.SubscriptionInfo - 42, // 13: linkall.vanus.controller.CommitOffsetRequest.subscription_info:type_name -> linkall.vanus.meta.SubscriptionInfo - 43, // 14: linkall.vanus.controller.ListSegmentResponse.segments:type_name -> linkall.vanus.meta.Segment - 43, // 15: linkall.vanus.controller.GetAppendableSegmentResponse.segments:type_name -> linkall.vanus.meta.Segment - 43, // 16: linkall.vanus.controller.RegisterSegmentServerResponse.SegmentsEntry.value:type_name -> linkall.vanus.meta.Segment - 44, // 17: linkall.vanus.controller.PingServer.Ping:input_type -> google.protobuf.Empty - 1, // 18: linkall.vanus.controller.EventBusController.CreateEventBus:input_type -> linkall.vanus.controller.CreateEventBusRequest - 1, // 19: linkall.vanus.controller.EventBusController.CreateSystemEventBus:input_type -> linkall.vanus.controller.CreateEventBusRequest - 33, // 20: linkall.vanus.controller.EventBusController.DeleteEventBus:input_type -> linkall.vanus.meta.EventBus - 33, // 21: linkall.vanus.controller.EventBusController.GetEventBus:input_type -> linkall.vanus.meta.EventBus - 44, // 22: linkall.vanus.controller.EventBusController.ListEventBus:input_type -> google.protobuf.Empty - 3, // 23: linkall.vanus.controller.EventBusController.UpdateEventBus:input_type -> linkall.vanus.controller.UpdateEventBusRequest - 28, // 24: linkall.vanus.controller.EventLogController.ListSegment:input_type -> linkall.vanus.controller.ListSegmentRequest - 30, // 25: linkall.vanus.controller.EventLogController.GetAppendableSegment:input_type -> linkall.vanus.controller.GetAppendableSegmentRequest - 4, // 26: linkall.vanus.controller.SegmentController.QuerySegmentRouteInfo:input_type -> linkall.vanus.controller.QuerySegmentRouteInfoRequest - 6, // 27: linkall.vanus.controller.SegmentController.SegmentHeartbeat:input_type -> linkall.vanus.controller.SegmentHeartbeatRequest - 8, // 28: linkall.vanus.controller.SegmentController.RegisterSegmentServer:input_type -> linkall.vanus.controller.RegisterSegmentServerRequest - 10, // 29: linkall.vanus.controller.SegmentController.UnregisterSegmentServer:input_type -> linkall.vanus.controller.UnregisterSegmentServerRequest - 6, // 30: linkall.vanus.controller.SegmentController.ReportSegmentBlockIsFull:input_type -> linkall.vanus.controller.SegmentHeartbeatRequest - 12, // 31: linkall.vanus.controller.SegmentController.ReportSegmentLeader:input_type -> linkall.vanus.controller.ReportSegmentLeaderRequest - 14, // 32: linkall.vanus.controller.TriggerController.CreateSubscription:input_type -> linkall.vanus.controller.CreateSubscriptionRequest - 15, // 33: linkall.vanus.controller.TriggerController.UpdateSubscription:input_type -> linkall.vanus.controller.UpdateSubscriptionRequest - 17, // 34: linkall.vanus.controller.TriggerController.DeleteSubscription:input_type -> linkall.vanus.controller.DeleteSubscriptionRequest - 16, // 35: linkall.vanus.controller.TriggerController.GetSubscription:input_type -> linkall.vanus.controller.GetSubscriptionRequest - 44, // 36: linkall.vanus.controller.TriggerController.ListSubscription:input_type -> google.protobuf.Empty - 23, // 37: linkall.vanus.controller.TriggerController.TriggerWorkerHeartbeat:input_type -> linkall.vanus.controller.TriggerWorkerHeartbeatRequest - 19, // 38: linkall.vanus.controller.TriggerController.RegisterTriggerWorker:input_type -> linkall.vanus.controller.RegisterTriggerWorkerRequest - 21, // 39: linkall.vanus.controller.TriggerController.UnregisterTriggerWorker:input_type -> linkall.vanus.controller.UnregisterTriggerWorkerRequest - 25, // 40: linkall.vanus.controller.TriggerController.ResetOffsetToTimestamp:input_type -> linkall.vanus.controller.ResetOffsetToTimestampRequest - 26, // 41: linkall.vanus.controller.TriggerController.CommitOffset:input_type -> linkall.vanus.controller.CommitOffsetRequest - 44, // 42: linkall.vanus.controller.SnowflakeController.GetClusterStartTime:input_type -> google.protobuf.Empty - 45, // 43: linkall.vanus.controller.SnowflakeController.RegisterNode:input_type -> google.protobuf.UInt32Value - 45, // 44: linkall.vanus.controller.SnowflakeController.UnregisterNode:input_type -> google.protobuf.UInt32Value - 0, // 45: linkall.vanus.controller.PingServer.Ping:output_type -> linkall.vanus.controller.PingResponse - 33, // 46: linkall.vanus.controller.EventBusController.CreateEventBus:output_type -> linkall.vanus.meta.EventBus - 33, // 47: linkall.vanus.controller.EventBusController.CreateSystemEventBus:output_type -> linkall.vanus.meta.EventBus - 44, // 48: linkall.vanus.controller.EventBusController.DeleteEventBus:output_type -> google.protobuf.Empty - 33, // 49: linkall.vanus.controller.EventBusController.GetEventBus:output_type -> linkall.vanus.meta.EventBus - 2, // 50: linkall.vanus.controller.EventBusController.ListEventBus:output_type -> linkall.vanus.controller.ListEventbusResponse - 33, // 51: linkall.vanus.controller.EventBusController.UpdateEventBus:output_type -> linkall.vanus.meta.EventBus - 29, // 52: linkall.vanus.controller.EventLogController.ListSegment:output_type -> linkall.vanus.controller.ListSegmentResponse - 31, // 53: linkall.vanus.controller.EventLogController.GetAppendableSegment:output_type -> linkall.vanus.controller.GetAppendableSegmentResponse - 5, // 54: linkall.vanus.controller.SegmentController.QuerySegmentRouteInfo:output_type -> linkall.vanus.controller.QuerySegmentRouteInfoResponse - 7, // 55: linkall.vanus.controller.SegmentController.SegmentHeartbeat:output_type -> linkall.vanus.controller.SegmentHeartbeatResponse - 9, // 56: linkall.vanus.controller.SegmentController.RegisterSegmentServer:output_type -> linkall.vanus.controller.RegisterSegmentServerResponse - 11, // 57: linkall.vanus.controller.SegmentController.UnregisterSegmentServer:output_type -> linkall.vanus.controller.UnregisterSegmentServerResponse - 44, // 58: linkall.vanus.controller.SegmentController.ReportSegmentBlockIsFull:output_type -> google.protobuf.Empty - 44, // 59: linkall.vanus.controller.SegmentController.ReportSegmentLeader:output_type -> google.protobuf.Empty - 41, // 60: linkall.vanus.controller.TriggerController.CreateSubscription:output_type -> linkall.vanus.meta.Subscription - 41, // 61: linkall.vanus.controller.TriggerController.UpdateSubscription:output_type -> linkall.vanus.meta.Subscription - 44, // 62: linkall.vanus.controller.TriggerController.DeleteSubscription:output_type -> google.protobuf.Empty - 41, // 63: linkall.vanus.controller.TriggerController.GetSubscription:output_type -> linkall.vanus.meta.Subscription - 18, // 64: linkall.vanus.controller.TriggerController.ListSubscription:output_type -> linkall.vanus.controller.ListSubscriptionResponse - 24, // 65: linkall.vanus.controller.TriggerController.TriggerWorkerHeartbeat:output_type -> linkall.vanus.controller.TriggerWorkerHeartbeatResponse - 20, // 66: linkall.vanus.controller.TriggerController.RegisterTriggerWorker:output_type -> linkall.vanus.controller.RegisterTriggerWorkerResponse - 22, // 67: linkall.vanus.controller.TriggerController.UnregisterTriggerWorker:output_type -> linkall.vanus.controller.UnregisterTriggerWorkerResponse - 44, // 68: linkall.vanus.controller.TriggerController.ResetOffsetToTimestamp:output_type -> google.protobuf.Empty - 27, // 69: linkall.vanus.controller.TriggerController.CommitOffset:output_type -> linkall.vanus.controller.CommitOffsetResponse - 46, // 70: linkall.vanus.controller.SnowflakeController.GetClusterStartTime:output_type -> google.protobuf.Timestamp - 44, // 71: linkall.vanus.controller.SnowflakeController.RegisterNode:output_type -> google.protobuf.Empty - 44, // 72: linkall.vanus.controller.SnowflakeController.UnregisterNode:output_type -> google.protobuf.Empty - 45, // [45:73] is the sub-list for method output_type - 17, // [17:45] is the sub-list for method input_type - 17, // [17:17] is the sub-list for extension type_name - 17, // [17:17] is the sub-list for extension extendee - 0, // [0:17] is the sub-list for field type_name + 44, // 11: linkall.vanus.controller.ListSubscriptionResponse.subscription:type_name -> linkall.vanus.meta.Subscription + 45, // 12: linkall.vanus.controller.TriggerWorkerHeartbeatRequest.subscription_info:type_name -> linkall.vanus.meta.SubscriptionInfo + 46, // 13: linkall.vanus.controller.ResetOffsetToTimestampResponse.offsets:type_name -> linkall.vanus.meta.OffsetInfo + 45, // 14: linkall.vanus.controller.CommitOffsetRequest.subscription_info:type_name -> linkall.vanus.meta.SubscriptionInfo + 47, // 15: linkall.vanus.controller.ListSegmentResponse.segments:type_name -> linkall.vanus.meta.Segment + 47, // 16: linkall.vanus.controller.GetAppendableSegmentResponse.segments:type_name -> linkall.vanus.meta.Segment + 47, // 17: linkall.vanus.controller.RegisterSegmentServerResponse.SegmentsEntry.value:type_name -> linkall.vanus.meta.Segment + 48, // 18: linkall.vanus.controller.PingServer.Ping:input_type -> google.protobuf.Empty + 1, // 19: linkall.vanus.controller.EventBusController.CreateEventBus:input_type -> linkall.vanus.controller.CreateEventBusRequest + 1, // 20: linkall.vanus.controller.EventBusController.CreateSystemEventBus:input_type -> linkall.vanus.controller.CreateEventBusRequest + 36, // 21: linkall.vanus.controller.EventBusController.DeleteEventBus:input_type -> linkall.vanus.meta.EventBus + 36, // 22: linkall.vanus.controller.EventBusController.GetEventBus:input_type -> linkall.vanus.meta.EventBus + 48, // 23: linkall.vanus.controller.EventBusController.ListEventBus:input_type -> google.protobuf.Empty + 3, // 24: linkall.vanus.controller.EventBusController.UpdateEventBus:input_type -> linkall.vanus.controller.UpdateEventBusRequest + 31, // 25: linkall.vanus.controller.EventLogController.ListSegment:input_type -> linkall.vanus.controller.ListSegmentRequest + 33, // 26: linkall.vanus.controller.EventLogController.GetAppendableSegment:input_type -> linkall.vanus.controller.GetAppendableSegmentRequest + 4, // 27: linkall.vanus.controller.SegmentController.QuerySegmentRouteInfo:input_type -> linkall.vanus.controller.QuerySegmentRouteInfoRequest + 6, // 28: linkall.vanus.controller.SegmentController.SegmentHeartbeat:input_type -> linkall.vanus.controller.SegmentHeartbeatRequest + 8, // 29: linkall.vanus.controller.SegmentController.RegisterSegmentServer:input_type -> linkall.vanus.controller.RegisterSegmentServerRequest + 10, // 30: linkall.vanus.controller.SegmentController.UnregisterSegmentServer:input_type -> linkall.vanus.controller.UnregisterSegmentServerRequest + 6, // 31: linkall.vanus.controller.SegmentController.ReportSegmentBlockIsFull:input_type -> linkall.vanus.controller.SegmentHeartbeatRequest + 12, // 32: linkall.vanus.controller.SegmentController.ReportSegmentLeader:input_type -> linkall.vanus.controller.ReportSegmentLeaderRequest + 14, // 33: linkall.vanus.controller.TriggerController.CreateSubscription:input_type -> linkall.vanus.controller.CreateSubscriptionRequest + 15, // 34: linkall.vanus.controller.TriggerController.UpdateSubscription:input_type -> linkall.vanus.controller.UpdateSubscriptionRequest + 17, // 35: linkall.vanus.controller.TriggerController.DeleteSubscription:input_type -> linkall.vanus.controller.DeleteSubscriptionRequest + 18, // 36: linkall.vanus.controller.TriggerController.DisableSubscription:input_type -> linkall.vanus.controller.DisableSubscriptionRequest + 19, // 37: linkall.vanus.controller.TriggerController.ResumeSubscription:input_type -> linkall.vanus.controller.ResumeSubscriptionRequest + 16, // 38: linkall.vanus.controller.TriggerController.GetSubscription:input_type -> linkall.vanus.controller.GetSubscriptionRequest + 48, // 39: linkall.vanus.controller.TriggerController.ListSubscription:input_type -> google.protobuf.Empty + 25, // 40: linkall.vanus.controller.TriggerController.TriggerWorkerHeartbeat:input_type -> linkall.vanus.controller.TriggerWorkerHeartbeatRequest + 21, // 41: linkall.vanus.controller.TriggerController.RegisterTriggerWorker:input_type -> linkall.vanus.controller.RegisterTriggerWorkerRequest + 23, // 42: linkall.vanus.controller.TriggerController.UnregisterTriggerWorker:input_type -> linkall.vanus.controller.UnregisterTriggerWorkerRequest + 27, // 43: linkall.vanus.controller.TriggerController.ResetOffsetToTimestamp:input_type -> linkall.vanus.controller.ResetOffsetToTimestampRequest + 29, // 44: linkall.vanus.controller.TriggerController.CommitOffset:input_type -> linkall.vanus.controller.CommitOffsetRequest + 48, // 45: linkall.vanus.controller.SnowflakeController.GetClusterStartTime:input_type -> google.protobuf.Empty + 49, // 46: linkall.vanus.controller.SnowflakeController.RegisterNode:input_type -> google.protobuf.UInt32Value + 49, // 47: linkall.vanus.controller.SnowflakeController.UnregisterNode:input_type -> google.protobuf.UInt32Value + 0, // 48: linkall.vanus.controller.PingServer.Ping:output_type -> linkall.vanus.controller.PingResponse + 36, // 49: linkall.vanus.controller.EventBusController.CreateEventBus:output_type -> linkall.vanus.meta.EventBus + 36, // 50: linkall.vanus.controller.EventBusController.CreateSystemEventBus:output_type -> linkall.vanus.meta.EventBus + 48, // 51: linkall.vanus.controller.EventBusController.DeleteEventBus:output_type -> google.protobuf.Empty + 36, // 52: linkall.vanus.controller.EventBusController.GetEventBus:output_type -> linkall.vanus.meta.EventBus + 2, // 53: linkall.vanus.controller.EventBusController.ListEventBus:output_type -> linkall.vanus.controller.ListEventbusResponse + 36, // 54: linkall.vanus.controller.EventBusController.UpdateEventBus:output_type -> linkall.vanus.meta.EventBus + 32, // 55: linkall.vanus.controller.EventLogController.ListSegment:output_type -> linkall.vanus.controller.ListSegmentResponse + 34, // 56: linkall.vanus.controller.EventLogController.GetAppendableSegment:output_type -> linkall.vanus.controller.GetAppendableSegmentResponse + 5, // 57: linkall.vanus.controller.SegmentController.QuerySegmentRouteInfo:output_type -> linkall.vanus.controller.QuerySegmentRouteInfoResponse + 7, // 58: linkall.vanus.controller.SegmentController.SegmentHeartbeat:output_type -> linkall.vanus.controller.SegmentHeartbeatResponse + 9, // 59: linkall.vanus.controller.SegmentController.RegisterSegmentServer:output_type -> linkall.vanus.controller.RegisterSegmentServerResponse + 11, // 60: linkall.vanus.controller.SegmentController.UnregisterSegmentServer:output_type -> linkall.vanus.controller.UnregisterSegmentServerResponse + 48, // 61: linkall.vanus.controller.SegmentController.ReportSegmentBlockIsFull:output_type -> google.protobuf.Empty + 48, // 62: linkall.vanus.controller.SegmentController.ReportSegmentLeader:output_type -> google.protobuf.Empty + 44, // 63: linkall.vanus.controller.TriggerController.CreateSubscription:output_type -> linkall.vanus.meta.Subscription + 44, // 64: linkall.vanus.controller.TriggerController.UpdateSubscription:output_type -> linkall.vanus.meta.Subscription + 48, // 65: linkall.vanus.controller.TriggerController.DeleteSubscription:output_type -> google.protobuf.Empty + 48, // 66: linkall.vanus.controller.TriggerController.DisableSubscription:output_type -> google.protobuf.Empty + 48, // 67: linkall.vanus.controller.TriggerController.ResumeSubscription:output_type -> google.protobuf.Empty + 44, // 68: linkall.vanus.controller.TriggerController.GetSubscription:output_type -> linkall.vanus.meta.Subscription + 20, // 69: linkall.vanus.controller.TriggerController.ListSubscription:output_type -> linkall.vanus.controller.ListSubscriptionResponse + 26, // 70: linkall.vanus.controller.TriggerController.TriggerWorkerHeartbeat:output_type -> linkall.vanus.controller.TriggerWorkerHeartbeatResponse + 22, // 71: linkall.vanus.controller.TriggerController.RegisterTriggerWorker:output_type -> linkall.vanus.controller.RegisterTriggerWorkerResponse + 24, // 72: linkall.vanus.controller.TriggerController.UnregisterTriggerWorker:output_type -> linkall.vanus.controller.UnregisterTriggerWorkerResponse + 28, // 73: linkall.vanus.controller.TriggerController.ResetOffsetToTimestamp:output_type -> linkall.vanus.controller.ResetOffsetToTimestampResponse + 30, // 74: linkall.vanus.controller.TriggerController.CommitOffset:output_type -> linkall.vanus.controller.CommitOffsetResponse + 50, // 75: linkall.vanus.controller.SnowflakeController.GetClusterStartTime:output_type -> google.protobuf.Timestamp + 48, // 76: linkall.vanus.controller.SnowflakeController.RegisterNode:output_type -> google.protobuf.Empty + 48, // 77: linkall.vanus.controller.SnowflakeController.UnregisterNode:output_type -> google.protobuf.Empty + 48, // [48:78] is the sub-list for method output_type + 18, // [18:48] is the sub-list for method input_type + 18, // [18:18] is the sub-list for extension type_name + 18, // [18:18] is the sub-list for extension extendee + 0, // [0:18] is the sub-list for field type_name } func init() { file_controller_proto_init() } @@ -2593,7 +2771,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListSubscriptionResponse); i { + switch v := v.(*DisableSubscriptionRequest); i { case 0: return &v.state case 1: @@ -2605,7 +2783,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegisterTriggerWorkerRequest); i { + switch v := v.(*ResumeSubscriptionRequest); i { case 0: return &v.state case 1: @@ -2617,7 +2795,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegisterTriggerWorkerResponse); i { + switch v := v.(*ListSubscriptionResponse); i { case 0: return &v.state case 1: @@ -2629,7 +2807,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UnregisterTriggerWorkerRequest); i { + switch v := v.(*RegisterTriggerWorkerRequest); i { case 0: return &v.state case 1: @@ -2641,7 +2819,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UnregisterTriggerWorkerResponse); i { + switch v := v.(*RegisterTriggerWorkerResponse); i { case 0: return &v.state case 1: @@ -2653,7 +2831,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TriggerWorkerHeartbeatRequest); i { + switch v := v.(*UnregisterTriggerWorkerRequest); i { case 0: return &v.state case 1: @@ -2665,7 +2843,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TriggerWorkerHeartbeatResponse); i { + switch v := v.(*UnregisterTriggerWorkerResponse); i { case 0: return &v.state case 1: @@ -2677,7 +2855,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResetOffsetToTimestampRequest); i { + switch v := v.(*TriggerWorkerHeartbeatRequest); i { case 0: return &v.state case 1: @@ -2689,7 +2867,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommitOffsetRequest); i { + switch v := v.(*TriggerWorkerHeartbeatResponse); i { case 0: return &v.state case 1: @@ -2701,7 +2879,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommitOffsetResponse); i { + switch v := v.(*ResetOffsetToTimestampRequest); i { case 0: return &v.state case 1: @@ -2713,7 +2891,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListSegmentRequest); i { + switch v := v.(*ResetOffsetToTimestampResponse); i { case 0: return &v.state case 1: @@ -2725,7 +2903,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListSegmentResponse); i { + switch v := v.(*CommitOffsetRequest); i { case 0: return &v.state case 1: @@ -2737,7 +2915,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetAppendableSegmentRequest); i { + switch v := v.(*CommitOffsetResponse); i { case 0: return &v.state case 1: @@ -2749,6 +2927,42 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSegmentRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSegmentResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAppendableSegmentRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetAppendableSegmentResponse); i { case 0: return &v.state @@ -2767,7 +2981,7 @@ func file_controller_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_controller_proto_rawDesc, NumEnums: 0, - NumMessages: 33, + NumMessages: 36, NumExtensions: 0, NumServices: 6, }, @@ -3517,12 +3731,14 @@ type TriggerControllerClient interface { CreateSubscription(ctx context.Context, in *CreateSubscriptionRequest, opts ...grpc.CallOption) (*meta.Subscription, error) UpdateSubscription(ctx context.Context, in *UpdateSubscriptionRequest, opts ...grpc.CallOption) (*meta.Subscription, error) DeleteSubscription(ctx context.Context, in *DeleteSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + DisableSubscription(ctx context.Context, in *DisableSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + ResumeSubscription(ctx context.Context, in *ResumeSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) GetSubscription(ctx context.Context, in *GetSubscriptionRequest, opts ...grpc.CallOption) (*meta.Subscription, error) ListSubscription(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListSubscriptionResponse, error) TriggerWorkerHeartbeat(ctx context.Context, opts ...grpc.CallOption) (TriggerController_TriggerWorkerHeartbeatClient, error) RegisterTriggerWorker(ctx context.Context, in *RegisterTriggerWorkerRequest, opts ...grpc.CallOption) (*RegisterTriggerWorkerResponse, error) UnregisterTriggerWorker(ctx context.Context, in *UnregisterTriggerWorkerRequest, opts ...grpc.CallOption) (*UnregisterTriggerWorkerResponse, error) - ResetOffsetToTimestamp(ctx context.Context, in *ResetOffsetToTimestampRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + ResetOffsetToTimestamp(ctx context.Context, in *ResetOffsetToTimestampRequest, opts ...grpc.CallOption) (*ResetOffsetToTimestampResponse, error) CommitOffset(ctx context.Context, in *CommitOffsetRequest, opts ...grpc.CallOption) (*CommitOffsetResponse, error) } @@ -3561,6 +3777,24 @@ func (c *triggerControllerClient) DeleteSubscription(ctx context.Context, in *De return out, nil } +func (c *triggerControllerClient) DisableSubscription(ctx context.Context, in *DisableSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/linkall.vanus.controller.TriggerController/DisableSubscription", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *triggerControllerClient) ResumeSubscription(ctx context.Context, in *ResumeSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/linkall.vanus.controller.TriggerController/ResumeSubscription", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *triggerControllerClient) GetSubscription(ctx context.Context, in *GetSubscriptionRequest, opts ...grpc.CallOption) (*meta.Subscription, error) { out := new(meta.Subscription) err := c.cc.Invoke(ctx, "/linkall.vanus.controller.TriggerController/GetSubscription", in, out, opts...) @@ -3631,8 +3865,8 @@ func (c *triggerControllerClient) UnregisterTriggerWorker(ctx context.Context, i return out, nil } -func (c *triggerControllerClient) ResetOffsetToTimestamp(ctx context.Context, in *ResetOffsetToTimestampRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) +func (c *triggerControllerClient) ResetOffsetToTimestamp(ctx context.Context, in *ResetOffsetToTimestampRequest, opts ...grpc.CallOption) (*ResetOffsetToTimestampResponse, error) { + out := new(ResetOffsetToTimestampResponse) err := c.cc.Invoke(ctx, "/linkall.vanus.controller.TriggerController/ResetOffsetToTimestamp", in, out, opts...) if err != nil { return nil, err @@ -3654,12 +3888,14 @@ type TriggerControllerServer interface { CreateSubscription(context.Context, *CreateSubscriptionRequest) (*meta.Subscription, error) UpdateSubscription(context.Context, *UpdateSubscriptionRequest) (*meta.Subscription, error) DeleteSubscription(context.Context, *DeleteSubscriptionRequest) (*emptypb.Empty, error) + DisableSubscription(context.Context, *DisableSubscriptionRequest) (*emptypb.Empty, error) + ResumeSubscription(context.Context, *ResumeSubscriptionRequest) (*emptypb.Empty, error) GetSubscription(context.Context, *GetSubscriptionRequest) (*meta.Subscription, error) ListSubscription(context.Context, *emptypb.Empty) (*ListSubscriptionResponse, error) TriggerWorkerHeartbeat(TriggerController_TriggerWorkerHeartbeatServer) error RegisterTriggerWorker(context.Context, *RegisterTriggerWorkerRequest) (*RegisterTriggerWorkerResponse, error) UnregisterTriggerWorker(context.Context, *UnregisterTriggerWorkerRequest) (*UnregisterTriggerWorkerResponse, error) - ResetOffsetToTimestamp(context.Context, *ResetOffsetToTimestampRequest) (*emptypb.Empty, error) + ResetOffsetToTimestamp(context.Context, *ResetOffsetToTimestampRequest) (*ResetOffsetToTimestampResponse, error) CommitOffset(context.Context, *CommitOffsetRequest) (*CommitOffsetResponse, error) } @@ -3676,6 +3912,12 @@ func (*UnimplementedTriggerControllerServer) UpdateSubscription(context.Context, func (*UnimplementedTriggerControllerServer) DeleteSubscription(context.Context, *DeleteSubscriptionRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method DeleteSubscription not implemented") } +func (*UnimplementedTriggerControllerServer) DisableSubscription(context.Context, *DisableSubscriptionRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DisableSubscription not implemented") +} +func (*UnimplementedTriggerControllerServer) ResumeSubscription(context.Context, *ResumeSubscriptionRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResumeSubscription not implemented") +} func (*UnimplementedTriggerControllerServer) GetSubscription(context.Context, *GetSubscriptionRequest) (*meta.Subscription, error) { return nil, status.Errorf(codes.Unimplemented, "method GetSubscription not implemented") } @@ -3691,7 +3933,7 @@ func (*UnimplementedTriggerControllerServer) RegisterTriggerWorker(context.Conte func (*UnimplementedTriggerControllerServer) UnregisterTriggerWorker(context.Context, *UnregisterTriggerWorkerRequest) (*UnregisterTriggerWorkerResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UnregisterTriggerWorker not implemented") } -func (*UnimplementedTriggerControllerServer) ResetOffsetToTimestamp(context.Context, *ResetOffsetToTimestampRequest) (*emptypb.Empty, error) { +func (*UnimplementedTriggerControllerServer) ResetOffsetToTimestamp(context.Context, *ResetOffsetToTimestampRequest) (*ResetOffsetToTimestampResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ResetOffsetToTimestamp not implemented") } func (*UnimplementedTriggerControllerServer) CommitOffset(context.Context, *CommitOffsetRequest) (*CommitOffsetResponse, error) { @@ -3756,6 +3998,42 @@ func _TriggerController_DeleteSubscription_Handler(srv interface{}, ctx context. return interceptor(ctx, in, info, handler) } +func _TriggerController_DisableSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DisableSubscriptionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TriggerControllerServer).DisableSubscription(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.controller.TriggerController/DisableSubscription", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TriggerControllerServer).DisableSubscription(ctx, req.(*DisableSubscriptionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TriggerController_ResumeSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResumeSubscriptionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TriggerControllerServer).ResumeSubscription(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.controller.TriggerController/ResumeSubscription", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TriggerControllerServer).ResumeSubscription(ctx, req.(*ResumeSubscriptionRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _TriggerController_GetSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetSubscriptionRequest) if err := dec(in); err != nil { @@ -3906,6 +4184,14 @@ var _TriggerController_serviceDesc = grpc.ServiceDesc{ MethodName: "DeleteSubscription", Handler: _TriggerController_DeleteSubscription_Handler, }, + { + MethodName: "DisableSubscription", + Handler: _TriggerController_DisableSubscription_Handler, + }, + { + MethodName: "ResumeSubscription", + Handler: _TriggerController_ResumeSubscription_Handler, + }, { MethodName: "GetSubscription", Handler: _TriggerController_GetSubscription_Handler, diff --git a/proto/pkg/controller/mock_controller.go b/proto/pkg/controller/mock_controller.go index 49838b4dc..febca4c90 100644 --- a/proto/pkg/controller/mock_controller.go +++ b/proto/pkg/controller/mock_controller.go @@ -1079,6 +1079,26 @@ func (mr *MockTriggerControllerClientMockRecorder) DeleteSubscription(ctx, in in return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSubscription", reflect.TypeOf((*MockTriggerControllerClient)(nil).DeleteSubscription), varargs...) } +// DisableSubscription mocks base method. +func (m *MockTriggerControllerClient) DisableSubscription(ctx context.Context, in *DisableSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DisableSubscription", varargs...) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DisableSubscription indicates an expected call of DisableSubscription. +func (mr *MockTriggerControllerClientMockRecorder) DisableSubscription(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DisableSubscription", reflect.TypeOf((*MockTriggerControllerClient)(nil).DisableSubscription), varargs...) +} + // GetSubscription mocks base method. func (m *MockTriggerControllerClient) GetSubscription(ctx context.Context, in *GetSubscriptionRequest, opts ...grpc.CallOption) (*meta.Subscription, error) { m.ctrl.T.Helper() @@ -1140,14 +1160,14 @@ func (mr *MockTriggerControllerClientMockRecorder) RegisterTriggerWorker(ctx, in } // ResetOffsetToTimestamp mocks base method. -func (m *MockTriggerControllerClient) ResetOffsetToTimestamp(ctx context.Context, in *ResetOffsetToTimestampRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { +func (m *MockTriggerControllerClient) ResetOffsetToTimestamp(ctx context.Context, in *ResetOffsetToTimestampRequest, opts ...grpc.CallOption) (*ResetOffsetToTimestampResponse, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, in} for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "ResetOffsetToTimestamp", varargs...) - ret0, _ := ret[0].(*emptypb.Empty) + ret0, _ := ret[0].(*ResetOffsetToTimestampResponse) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1159,6 +1179,26 @@ func (mr *MockTriggerControllerClientMockRecorder) ResetOffsetToTimestamp(ctx, i return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetOffsetToTimestamp", reflect.TypeOf((*MockTriggerControllerClient)(nil).ResetOffsetToTimestamp), varargs...) } +// ResumeSubscription mocks base method. +func (m *MockTriggerControllerClient) ResumeSubscription(ctx context.Context, in *ResumeSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ResumeSubscription", varargs...) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ResumeSubscription indicates an expected call of ResumeSubscription. +func (mr *MockTriggerControllerClientMockRecorder) ResumeSubscription(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResumeSubscription", reflect.TypeOf((*MockTriggerControllerClient)(nil).ResumeSubscription), varargs...) +} + // TriggerWorkerHeartbeat mocks base method. func (m *MockTriggerControllerClient) TriggerWorkerHeartbeat(ctx context.Context, opts ...grpc.CallOption) (TriggerController_TriggerWorkerHeartbeatClient, error) { m.ctrl.T.Helper() @@ -1424,6 +1464,21 @@ func (mr *MockTriggerControllerServerMockRecorder) DeleteSubscription(arg0, arg1 return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSubscription", reflect.TypeOf((*MockTriggerControllerServer)(nil).DeleteSubscription), arg0, arg1) } +// DisableSubscription mocks base method. +func (m *MockTriggerControllerServer) DisableSubscription(arg0 context.Context, arg1 *DisableSubscriptionRequest) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DisableSubscription", arg0, arg1) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DisableSubscription indicates an expected call of DisableSubscription. +func (mr *MockTriggerControllerServerMockRecorder) DisableSubscription(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DisableSubscription", reflect.TypeOf((*MockTriggerControllerServer)(nil).DisableSubscription), arg0, arg1) +} + // GetSubscription mocks base method. func (m *MockTriggerControllerServer) GetSubscription(arg0 context.Context, arg1 *GetSubscriptionRequest) (*meta.Subscription, error) { m.ctrl.T.Helper() @@ -1470,10 +1525,10 @@ func (mr *MockTriggerControllerServerMockRecorder) RegisterTriggerWorker(arg0, a } // ResetOffsetToTimestamp mocks base method. -func (m *MockTriggerControllerServer) ResetOffsetToTimestamp(arg0 context.Context, arg1 *ResetOffsetToTimestampRequest) (*emptypb.Empty, error) { +func (m *MockTriggerControllerServer) ResetOffsetToTimestamp(arg0 context.Context, arg1 *ResetOffsetToTimestampRequest) (*ResetOffsetToTimestampResponse, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ResetOffsetToTimestamp", arg0, arg1) - ret0, _ := ret[0].(*emptypb.Empty) + ret0, _ := ret[0].(*ResetOffsetToTimestampResponse) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1484,6 +1539,21 @@ func (mr *MockTriggerControllerServerMockRecorder) ResetOffsetToTimestamp(arg0, return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetOffsetToTimestamp", reflect.TypeOf((*MockTriggerControllerServer)(nil).ResetOffsetToTimestamp), arg0, arg1) } +// ResumeSubscription mocks base method. +func (m *MockTriggerControllerServer) ResumeSubscription(arg0 context.Context, arg1 *ResumeSubscriptionRequest) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ResumeSubscription", arg0, arg1) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ResumeSubscription indicates an expected call of ResumeSubscription. +func (mr *MockTriggerControllerServerMockRecorder) ResumeSubscription(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResumeSubscription", reflect.TypeOf((*MockTriggerControllerServer)(nil).ResumeSubscription), arg0, arg1) +} + // TriggerWorkerHeartbeat mocks base method. func (m *MockTriggerControllerServer) TriggerWorkerHeartbeat(arg0 TriggerController_TriggerWorkerHeartbeatServer) error { m.ctrl.T.Helper() diff --git a/proto/pkg/proxy/proxy.pb.go b/proto/pkg/proxy/proxy.pb.go index 051d394b4..917308164 100644 --- a/proto/pkg/proxy/proxy.pb.go +++ b/proto/pkg/proxy/proxy.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.19.4 +// protoc v3.19.1 // source: proxy.proto package proxy @@ -547,7 +547,7 @@ var file_proxy_proto_rawDesc = []byte{ 0x75, 0x6c, 0x74, 0x12, 0x2d, 0x0a, 0x12, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x32, 0xba, 0x0b, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x6c, 0x74, 0x32, 0x90, 0x0e, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x5f, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, @@ -614,35 +614,56 @@ var file_proxy_proto_rawDesc = []byte{ 0x32, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x0b, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x28, 0x2e, 0x6c, 0x69, 0x6e, + 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x2e, 0x6c, 0x69, 0x6e, + 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x61, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x75, + 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, + 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x8b, 0x01, 0x0a, 0x16, + 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x38, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, + 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x0b, 0x43, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x1a, 0x28, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x0c, 0x4c, 0x6f, + 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x28, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x12, 0x28, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, + 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, - 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, - 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x08, 0x47, 0x65, 0x74, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x24, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, - 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x47, 0x65, 0x74, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x69, + 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x57, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x24, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x7b, 0x0a, 0x14, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x2e, 0x6c, 0x69, 0x6e, - 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6c, - 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x78, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, - 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, - 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7b, 0x0a, 0x14, 0x56, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, + 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, 0x73, + 0x2f, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -659,29 +680,33 @@ func file_proxy_proto_rawDescGZIP() []byte { var file_proxy_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_proxy_proto_goTypes = []interface{}{ - (*LookupOffsetRequest)(nil), // 0: linkall.vanus.proxy.LookupOffsetRequest - (*LookupOffsetResponse)(nil), // 1: linkall.vanus.proxy.LookupOffsetResponse - (*GetEventRequest)(nil), // 2: linkall.vanus.proxy.GetEventRequest - (*GetEventResponse)(nil), // 3: linkall.vanus.proxy.GetEventResponse - (*ClusterInfoResponse)(nil), // 4: linkall.vanus.proxy.ClusterInfoResponse - (*ValidateSubscriptionRequest)(nil), // 5: linkall.vanus.proxy.ValidateSubscriptionRequest - (*ValidateSubscriptionResponse)(nil), // 6: linkall.vanus.proxy.ValidateSubscriptionResponse - nil, // 7: linkall.vanus.proxy.LookupOffsetResponse.OffsetsEntry - (*wrapperspb.BytesValue)(nil), // 8: google.protobuf.BytesValue - (*controller.SubscriptionRequest)(nil), // 9: linkall.vanus.controller.SubscriptionRequest - (*controller.CreateEventBusRequest)(nil), // 10: linkall.vanus.controller.CreateEventBusRequest - (*meta.EventBus)(nil), // 11: linkall.vanus.meta.EventBus - (*emptypb.Empty)(nil), // 12: google.protobuf.Empty - (*controller.UpdateEventBusRequest)(nil), // 13: linkall.vanus.controller.UpdateEventBusRequest - (*controller.ListSegmentRequest)(nil), // 14: linkall.vanus.controller.ListSegmentRequest - (*controller.CreateSubscriptionRequest)(nil), // 15: linkall.vanus.controller.CreateSubscriptionRequest - (*controller.UpdateSubscriptionRequest)(nil), // 16: linkall.vanus.controller.UpdateSubscriptionRequest - (*controller.DeleteSubscriptionRequest)(nil), // 17: linkall.vanus.controller.DeleteSubscriptionRequest - (*controller.GetSubscriptionRequest)(nil), // 18: linkall.vanus.controller.GetSubscriptionRequest - (*controller.ListEventbusResponse)(nil), // 19: linkall.vanus.controller.ListEventbusResponse - (*controller.ListSegmentResponse)(nil), // 20: linkall.vanus.controller.ListSegmentResponse - (*meta.Subscription)(nil), // 21: linkall.vanus.meta.Subscription - (*controller.ListSubscriptionResponse)(nil), // 22: linkall.vanus.controller.ListSubscriptionResponse + (*LookupOffsetRequest)(nil), // 0: linkall.vanus.proxy.LookupOffsetRequest + (*LookupOffsetResponse)(nil), // 1: linkall.vanus.proxy.LookupOffsetResponse + (*GetEventRequest)(nil), // 2: linkall.vanus.proxy.GetEventRequest + (*GetEventResponse)(nil), // 3: linkall.vanus.proxy.GetEventResponse + (*ClusterInfoResponse)(nil), // 4: linkall.vanus.proxy.ClusterInfoResponse + (*ValidateSubscriptionRequest)(nil), // 5: linkall.vanus.proxy.ValidateSubscriptionRequest + (*ValidateSubscriptionResponse)(nil), // 6: linkall.vanus.proxy.ValidateSubscriptionResponse + nil, // 7: linkall.vanus.proxy.LookupOffsetResponse.OffsetsEntry + (*wrapperspb.BytesValue)(nil), // 8: google.protobuf.BytesValue + (*controller.SubscriptionRequest)(nil), // 9: linkall.vanus.controller.SubscriptionRequest + (*controller.CreateEventBusRequest)(nil), // 10: linkall.vanus.controller.CreateEventBusRequest + (*meta.EventBus)(nil), // 11: linkall.vanus.meta.EventBus + (*emptypb.Empty)(nil), // 12: google.protobuf.Empty + (*controller.UpdateEventBusRequest)(nil), // 13: linkall.vanus.controller.UpdateEventBusRequest + (*controller.ListSegmentRequest)(nil), // 14: linkall.vanus.controller.ListSegmentRequest + (*controller.CreateSubscriptionRequest)(nil), // 15: linkall.vanus.controller.CreateSubscriptionRequest + (*controller.UpdateSubscriptionRequest)(nil), // 16: linkall.vanus.controller.UpdateSubscriptionRequest + (*controller.DeleteSubscriptionRequest)(nil), // 17: linkall.vanus.controller.DeleteSubscriptionRequest + (*controller.GetSubscriptionRequest)(nil), // 18: linkall.vanus.controller.GetSubscriptionRequest + (*controller.DisableSubscriptionRequest)(nil), // 19: linkall.vanus.controller.DisableSubscriptionRequest + (*controller.ResumeSubscriptionRequest)(nil), // 20: linkall.vanus.controller.ResumeSubscriptionRequest + (*controller.ResetOffsetToTimestampRequest)(nil), // 21: linkall.vanus.controller.ResetOffsetToTimestampRequest + (*controller.ListEventbusResponse)(nil), // 22: linkall.vanus.controller.ListEventbusResponse + (*controller.ListSegmentResponse)(nil), // 23: linkall.vanus.controller.ListSegmentResponse + (*meta.Subscription)(nil), // 24: linkall.vanus.meta.Subscription + (*controller.ListSubscriptionResponse)(nil), // 25: linkall.vanus.controller.ListSubscriptionResponse + (*controller.ResetOffsetToTimestampResponse)(nil), // 26: linkall.vanus.controller.ResetOffsetToTimestampResponse } var file_proxy_proto_depIdxs = []int32{ 7, // 0: linkall.vanus.proxy.LookupOffsetResponse.offsets:type_name -> linkall.vanus.proxy.LookupOffsetResponse.OffsetsEntry @@ -698,27 +723,33 @@ var file_proxy_proto_depIdxs = []int32{ 17, // 11: linkall.vanus.proxy.ControllerProxy.DeleteSubscription:input_type -> linkall.vanus.controller.DeleteSubscriptionRequest 18, // 12: linkall.vanus.proxy.ControllerProxy.GetSubscription:input_type -> linkall.vanus.controller.GetSubscriptionRequest 12, // 13: linkall.vanus.proxy.ControllerProxy.ListSubscription:input_type -> google.protobuf.Empty - 12, // 14: linkall.vanus.proxy.ControllerProxy.ClusterInfo:input_type -> google.protobuf.Empty - 0, // 15: linkall.vanus.proxy.ControllerProxy.LookupOffset:input_type -> linkall.vanus.proxy.LookupOffsetRequest - 2, // 16: linkall.vanus.proxy.ControllerProxy.GetEvent:input_type -> linkall.vanus.proxy.GetEventRequest - 5, // 17: linkall.vanus.proxy.ControllerProxy.ValidateSubscription:input_type -> linkall.vanus.proxy.ValidateSubscriptionRequest - 11, // 18: linkall.vanus.proxy.ControllerProxy.CreateEventBus:output_type -> linkall.vanus.meta.EventBus - 12, // 19: linkall.vanus.proxy.ControllerProxy.DeleteEventBus:output_type -> google.protobuf.Empty - 11, // 20: linkall.vanus.proxy.ControllerProxy.GetEventBus:output_type -> linkall.vanus.meta.EventBus - 19, // 21: linkall.vanus.proxy.ControllerProxy.ListEventBus:output_type -> linkall.vanus.controller.ListEventbusResponse - 11, // 22: linkall.vanus.proxy.ControllerProxy.UpdateEventBus:output_type -> linkall.vanus.meta.EventBus - 20, // 23: linkall.vanus.proxy.ControllerProxy.ListSegment:output_type -> linkall.vanus.controller.ListSegmentResponse - 21, // 24: linkall.vanus.proxy.ControllerProxy.CreateSubscription:output_type -> linkall.vanus.meta.Subscription - 21, // 25: linkall.vanus.proxy.ControllerProxy.UpdateSubscription:output_type -> linkall.vanus.meta.Subscription - 12, // 26: linkall.vanus.proxy.ControllerProxy.DeleteSubscription:output_type -> google.protobuf.Empty - 21, // 27: linkall.vanus.proxy.ControllerProxy.GetSubscription:output_type -> linkall.vanus.meta.Subscription - 22, // 28: linkall.vanus.proxy.ControllerProxy.ListSubscription:output_type -> linkall.vanus.controller.ListSubscriptionResponse - 4, // 29: linkall.vanus.proxy.ControllerProxy.ClusterInfo:output_type -> linkall.vanus.proxy.ClusterInfoResponse - 1, // 30: linkall.vanus.proxy.ControllerProxy.LookupOffset:output_type -> linkall.vanus.proxy.LookupOffsetResponse - 3, // 31: linkall.vanus.proxy.ControllerProxy.GetEvent:output_type -> linkall.vanus.proxy.GetEventResponse - 6, // 32: linkall.vanus.proxy.ControllerProxy.ValidateSubscription:output_type -> linkall.vanus.proxy.ValidateSubscriptionResponse - 18, // [18:33] is the sub-list for method output_type - 3, // [3:18] is the sub-list for method input_type + 19, // 14: linkall.vanus.proxy.ControllerProxy.DisableSubscription:input_type -> linkall.vanus.controller.DisableSubscriptionRequest + 20, // 15: linkall.vanus.proxy.ControllerProxy.ResumeSubscription:input_type -> linkall.vanus.controller.ResumeSubscriptionRequest + 21, // 16: linkall.vanus.proxy.ControllerProxy.ResetOffsetToTimestamp:input_type -> linkall.vanus.controller.ResetOffsetToTimestampRequest + 12, // 17: linkall.vanus.proxy.ControllerProxy.ClusterInfo:input_type -> google.protobuf.Empty + 0, // 18: linkall.vanus.proxy.ControllerProxy.LookupOffset:input_type -> linkall.vanus.proxy.LookupOffsetRequest + 2, // 19: linkall.vanus.proxy.ControllerProxy.GetEvent:input_type -> linkall.vanus.proxy.GetEventRequest + 5, // 20: linkall.vanus.proxy.ControllerProxy.ValidateSubscription:input_type -> linkall.vanus.proxy.ValidateSubscriptionRequest + 11, // 21: linkall.vanus.proxy.ControllerProxy.CreateEventBus:output_type -> linkall.vanus.meta.EventBus + 12, // 22: linkall.vanus.proxy.ControllerProxy.DeleteEventBus:output_type -> google.protobuf.Empty + 11, // 23: linkall.vanus.proxy.ControllerProxy.GetEventBus:output_type -> linkall.vanus.meta.EventBus + 22, // 24: linkall.vanus.proxy.ControllerProxy.ListEventBus:output_type -> linkall.vanus.controller.ListEventbusResponse + 11, // 25: linkall.vanus.proxy.ControllerProxy.UpdateEventBus:output_type -> linkall.vanus.meta.EventBus + 23, // 26: linkall.vanus.proxy.ControllerProxy.ListSegment:output_type -> linkall.vanus.controller.ListSegmentResponse + 24, // 27: linkall.vanus.proxy.ControllerProxy.CreateSubscription:output_type -> linkall.vanus.meta.Subscription + 24, // 28: linkall.vanus.proxy.ControllerProxy.UpdateSubscription:output_type -> linkall.vanus.meta.Subscription + 12, // 29: linkall.vanus.proxy.ControllerProxy.DeleteSubscription:output_type -> google.protobuf.Empty + 24, // 30: linkall.vanus.proxy.ControllerProxy.GetSubscription:output_type -> linkall.vanus.meta.Subscription + 25, // 31: linkall.vanus.proxy.ControllerProxy.ListSubscription:output_type -> linkall.vanus.controller.ListSubscriptionResponse + 12, // 32: linkall.vanus.proxy.ControllerProxy.DisableSubscription:output_type -> google.protobuf.Empty + 12, // 33: linkall.vanus.proxy.ControllerProxy.ResumeSubscription:output_type -> google.protobuf.Empty + 26, // 34: linkall.vanus.proxy.ControllerProxy.ResetOffsetToTimestamp:output_type -> linkall.vanus.controller.ResetOffsetToTimestampResponse + 4, // 35: linkall.vanus.proxy.ControllerProxy.ClusterInfo:output_type -> linkall.vanus.proxy.ClusterInfoResponse + 1, // 36: linkall.vanus.proxy.ControllerProxy.LookupOffset:output_type -> linkall.vanus.proxy.LookupOffsetResponse + 3, // 37: linkall.vanus.proxy.ControllerProxy.GetEvent:output_type -> linkall.vanus.proxy.GetEventResponse + 6, // 38: linkall.vanus.proxy.ControllerProxy.ValidateSubscription:output_type -> linkall.vanus.proxy.ValidateSubscriptionResponse + 21, // [21:39] is the sub-list for method output_type + 3, // [3:21] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name 3, // [3:3] is the sub-list for extension extendee 0, // [0:3] is the sub-list for field type_name @@ -847,7 +878,7 @@ const _ = grpc.SupportPackageIsVersion6 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ControllerProxyClient interface { - // EventbusService + // Eventbus CreateEventBus(ctx context.Context, in *controller.CreateEventBusRequest, opts ...grpc.CallOption) (*meta.EventBus, error) DeleteEventBus(ctx context.Context, in *meta.EventBus, opts ...grpc.CallOption) (*emptypb.Empty, error) GetEventBus(ctx context.Context, in *meta.EventBus, opts ...grpc.CallOption) (*meta.EventBus, error) @@ -860,6 +891,9 @@ type ControllerProxyClient interface { DeleteSubscription(ctx context.Context, in *controller.DeleteSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) GetSubscription(ctx context.Context, in *controller.GetSubscriptionRequest, opts ...grpc.CallOption) (*meta.Subscription, error) ListSubscription(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*controller.ListSubscriptionResponse, error) + DisableSubscription(ctx context.Context, in *controller.DisableSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + ResumeSubscription(ctx context.Context, in *controller.ResumeSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + ResetOffsetToTimestamp(ctx context.Context, in *controller.ResetOffsetToTimestampRequest, opts ...grpc.CallOption) (*controller.ResetOffsetToTimestampResponse, error) // custom ClusterInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ClusterInfoResponse, error) LookupOffset(ctx context.Context, in *LookupOffsetRequest, opts ...grpc.CallOption) (*LookupOffsetResponse, error) @@ -974,6 +1008,33 @@ func (c *controllerProxyClient) ListSubscription(ctx context.Context, in *emptyp return out, nil } +func (c *controllerProxyClient) DisableSubscription(ctx context.Context, in *controller.DisableSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/linkall.vanus.proxy.ControllerProxy/DisableSubscription", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controllerProxyClient) ResumeSubscription(ctx context.Context, in *controller.ResumeSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/linkall.vanus.proxy.ControllerProxy/ResumeSubscription", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *controllerProxyClient) ResetOffsetToTimestamp(ctx context.Context, in *controller.ResetOffsetToTimestampRequest, opts ...grpc.CallOption) (*controller.ResetOffsetToTimestampResponse, error) { + out := new(controller.ResetOffsetToTimestampResponse) + err := c.cc.Invoke(ctx, "/linkall.vanus.proxy.ControllerProxy/ResetOffsetToTimestamp", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *controllerProxyClient) ClusterInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ClusterInfoResponse, error) { out := new(ClusterInfoResponse) err := c.cc.Invoke(ctx, "/linkall.vanus.proxy.ControllerProxy/ClusterInfo", in, out, opts...) @@ -1012,7 +1073,7 @@ func (c *controllerProxyClient) ValidateSubscription(ctx context.Context, in *Va // ControllerProxyServer is the server API for ControllerProxy service. type ControllerProxyServer interface { - // EventbusService + // Eventbus CreateEventBus(context.Context, *controller.CreateEventBusRequest) (*meta.EventBus, error) DeleteEventBus(context.Context, *meta.EventBus) (*emptypb.Empty, error) GetEventBus(context.Context, *meta.EventBus) (*meta.EventBus, error) @@ -1025,6 +1086,9 @@ type ControllerProxyServer interface { DeleteSubscription(context.Context, *controller.DeleteSubscriptionRequest) (*emptypb.Empty, error) GetSubscription(context.Context, *controller.GetSubscriptionRequest) (*meta.Subscription, error) ListSubscription(context.Context, *emptypb.Empty) (*controller.ListSubscriptionResponse, error) + DisableSubscription(context.Context, *controller.DisableSubscriptionRequest) (*emptypb.Empty, error) + ResumeSubscription(context.Context, *controller.ResumeSubscriptionRequest) (*emptypb.Empty, error) + ResetOffsetToTimestamp(context.Context, *controller.ResetOffsetToTimestampRequest) (*controller.ResetOffsetToTimestampResponse, error) // custom ClusterInfo(context.Context, *emptypb.Empty) (*ClusterInfoResponse, error) LookupOffset(context.Context, *LookupOffsetRequest) (*LookupOffsetResponse, error) @@ -1069,6 +1133,15 @@ func (*UnimplementedControllerProxyServer) GetSubscription(context.Context, *con func (*UnimplementedControllerProxyServer) ListSubscription(context.Context, *emptypb.Empty) (*controller.ListSubscriptionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListSubscription not implemented") } +func (*UnimplementedControllerProxyServer) DisableSubscription(context.Context, *controller.DisableSubscriptionRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DisableSubscription not implemented") +} +func (*UnimplementedControllerProxyServer) ResumeSubscription(context.Context, *controller.ResumeSubscriptionRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResumeSubscription not implemented") +} +func (*UnimplementedControllerProxyServer) ResetOffsetToTimestamp(context.Context, *controller.ResetOffsetToTimestampRequest) (*controller.ResetOffsetToTimestampResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ResetOffsetToTimestamp not implemented") +} func (*UnimplementedControllerProxyServer) ClusterInfo(context.Context, *emptypb.Empty) (*ClusterInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ClusterInfo not implemented") } @@ -1284,6 +1357,60 @@ func _ControllerProxy_ListSubscription_Handler(srv interface{}, ctx context.Cont return interceptor(ctx, in, info, handler) } +func _ControllerProxy_DisableSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(controller.DisableSubscriptionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerProxyServer).DisableSubscription(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.proxy.ControllerProxy/DisableSubscription", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerProxyServer).DisableSubscription(ctx, req.(*controller.DisableSubscriptionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ControllerProxy_ResumeSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(controller.ResumeSubscriptionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerProxyServer).ResumeSubscription(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.proxy.ControllerProxy/ResumeSubscription", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerProxyServer).ResumeSubscription(ctx, req.(*controller.ResumeSubscriptionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ControllerProxy_ResetOffsetToTimestamp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(controller.ResetOffsetToTimestampRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControllerProxyServer).ResetOffsetToTimestamp(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.proxy.ControllerProxy/ResetOffsetToTimestamp", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControllerProxyServer).ResetOffsetToTimestamp(ctx, req.(*controller.ResetOffsetToTimestampRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _ControllerProxy_ClusterInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(emptypb.Empty) if err := dec(in); err != nil { @@ -1404,6 +1531,18 @@ var _ControllerProxy_serviceDesc = grpc.ServiceDesc{ MethodName: "ListSubscription", Handler: _ControllerProxy_ListSubscription_Handler, }, + { + MethodName: "DisableSubscription", + Handler: _ControllerProxy_DisableSubscription_Handler, + }, + { + MethodName: "ResumeSubscription", + Handler: _ControllerProxy_ResumeSubscription_Handler, + }, + { + MethodName: "ResetOffsetToTimestamp", + Handler: _ControllerProxy_ResetOffsetToTimestamp_Handler, + }, { MethodName: "ClusterInfo", Handler: _ControllerProxy_ClusterInfo_Handler, diff --git a/proto/pkg/trigger/mock_trigger.go b/proto/pkg/trigger/mock_trigger.go index f5c7543f9..fefa2c5ea 100644 --- a/proto/pkg/trigger/mock_trigger.go +++ b/proto/pkg/trigger/mock_trigger.go @@ -10,7 +10,6 @@ import ( gomock "github.com/golang/mock/gomock" grpc "google.golang.org/grpc" - emptypb "google.golang.org/protobuf/types/known/emptypb" ) // MockTriggerWorkerClient is a mock of TriggerWorkerClient interface. @@ -96,26 +95,6 @@ func (mr *MockTriggerWorkerClientMockRecorder) RemoveSubscription(ctx, in interf return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveSubscription", reflect.TypeOf((*MockTriggerWorkerClient)(nil).RemoveSubscription), varargs...) } -// ResetOffsetToTimestamp mocks base method. -func (m *MockTriggerWorkerClient) ResetOffsetToTimestamp(ctx context.Context, in *ResetOffsetToTimestampRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - m.ctrl.T.Helper() - varargs := []interface{}{ctx, in} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "ResetOffsetToTimestamp", varargs...) - ret0, _ := ret[0].(*emptypb.Empty) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ResetOffsetToTimestamp indicates an expected call of ResetOffsetToTimestamp. -func (mr *MockTriggerWorkerClientMockRecorder) ResetOffsetToTimestamp(ctx, in interface{}, opts ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, in}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetOffsetToTimestamp", reflect.TypeOf((*MockTriggerWorkerClient)(nil).ResetOffsetToTimestamp), varargs...) -} - // ResumeSubscription mocks base method. func (m *MockTriggerWorkerClient) ResumeSubscription(ctx context.Context, in *ResumeSubscriptionRequest, opts ...grpc.CallOption) (*ResumeSubscriptionResponse, error) { m.ctrl.T.Helper() @@ -244,21 +223,6 @@ func (mr *MockTriggerWorkerServerMockRecorder) RemoveSubscription(arg0, arg1 int return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveSubscription", reflect.TypeOf((*MockTriggerWorkerServer)(nil).RemoveSubscription), arg0, arg1) } -// ResetOffsetToTimestamp mocks base method. -func (m *MockTriggerWorkerServer) ResetOffsetToTimestamp(arg0 context.Context, arg1 *ResetOffsetToTimestampRequest) (*emptypb.Empty, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ResetOffsetToTimestamp", arg0, arg1) - ret0, _ := ret[0].(*emptypb.Empty) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ResetOffsetToTimestamp indicates an expected call of ResetOffsetToTimestamp. -func (mr *MockTriggerWorkerServerMockRecorder) ResetOffsetToTimestamp(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ResetOffsetToTimestamp", reflect.TypeOf((*MockTriggerWorkerServer)(nil).ResetOffsetToTimestamp), arg0, arg1) -} - // ResumeSubscription mocks base method. func (m *MockTriggerWorkerServer) ResumeSubscription(arg0 context.Context, arg1 *ResumeSubscriptionRequest) (*ResumeSubscriptionResponse, error) { m.ctrl.T.Helper() diff --git a/proto/pkg/trigger/trigger.pb.go b/proto/pkg/trigger/trigger.pb.go index 905444b5c..497f30050 100644 --- a/proto/pkg/trigger/trigger.pb.go +++ b/proto/pkg/trigger/trigger.pb.go @@ -18,10 +18,14 @@ // protoc v3.19.1 // source: trigger.proto +//go:generate mockgen -source=trigger.pb.go -destination=mock_trigger.go -package=trigger package trigger import ( context "context" + reflect "reflect" + sync "sync" + config "github.com/linkall-labs/vanus/proto/pkg/config" meta "github.com/linkall-labs/vanus/proto/pkg/meta" grpc "google.golang.org/grpc" @@ -29,9 +33,6 @@ import ( status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - emptypb "google.golang.org/protobuf/types/known/emptypb" - reflect "reflect" - sync "sync" ) const ( @@ -614,197 +615,128 @@ func (*ResumeSubscriptionResponse) Descriptor() ([]byte, []int) { return file_trigger_proto_rawDescGZIP(), []int{11} } -type ResetOffsetToTimestampRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SubscriptionId uint64 `protobuf:"varint,1,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` - Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` -} - -func (x *ResetOffsetToTimestampRequest) Reset() { - *x = ResetOffsetToTimestampRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_trigger_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ResetOffsetToTimestampRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ResetOffsetToTimestampRequest) ProtoMessage() {} - -func (x *ResetOffsetToTimestampRequest) ProtoReflect() protoreflect.Message { - mi := &file_trigger_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ResetOffsetToTimestampRequest.ProtoReflect.Descriptor instead. -func (*ResetOffsetToTimestampRequest) Descriptor() ([]byte, []int) { - return file_trigger_proto_rawDescGZIP(), []int{12} -} - -func (x *ResetOffsetToTimestampRequest) GetSubscriptionId() uint64 { - if x != nil { - return x.SubscriptionId - } - return 0 -} - -func (x *ResetOffsetToTimestampRequest) GetTimestamp() uint64 { - if x != nil { - return x.Timestamp - } - return 0 -} - var File_trigger_proto protoreflect.FileDescriptor var file_trigger_proto_rawDesc = []byte{ 0x0a, 0x0d, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, - 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, - 0x19, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, - 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x06, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6c, 0x69, 0x6e, - 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x1c, 0x0a, 0x1a, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, - 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x0a, 0x18, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x69, 0x67, - 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x22, 0x1b, 0x0a, 0x19, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, - 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa5, 0x04, - 0x0a, 0x16, 0x41, 0x64, 0x64, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3e, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, - 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x34, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, - 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x46, - 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x12, 0x12, - 0x0a, 0x04, 0x73, 0x69, 0x6e, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x69, - 0x6e, 0x6b, 0x12, 0x4b, 0x0a, 0x0f, 0x73, 0x69, 0x6e, 0x6b, 0x5f, 0x63, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6c, 0x69, + 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x1a, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x57, 0x0a, 0x19, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, + 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, + 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, + 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x1c, 0x0a, 0x1a, 0x53, 0x74, 0x61, + 0x72, 0x74, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x0a, 0x18, 0x53, 0x74, 0x6f, 0x70, 0x54, + 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0x1b, 0x0a, 0x19, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x69, 0x67, 0x67, + 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0xa5, 0x04, 0x0a, 0x16, 0x41, 0x64, 0x64, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3e, 0x0a, 0x06, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, - 0x2e, 0x53, 0x69, 0x6e, 0x6b, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x52, - 0x0e, 0x73, 0x69, 0x6e, 0x6b, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, - 0x38, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x52, - 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x50, 0x0a, 0x11, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, - 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, - 0x6f, 0x6c, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6c, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x65, - 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x65, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x41, 0x0a, 0x0b, 0x74, 0x72, 0x61, 0x6e, - 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, - 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, - 0x74, 0x61, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x52, 0x0b, - 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x12, 0x38, 0x0a, 0x07, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, + 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x34, 0x0a, 0x07, 0x66, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, - 0x61, 0x2e, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x41, 0x64, 0x64, 0x53, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x44, 0x0a, 0x19, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, - 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x43, 0x0a, 0x18, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x75, 0x62, + 0x61, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x6e, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x73, 0x69, 0x6e, 0x6b, 0x12, 0x4b, 0x0a, 0x0f, 0x73, 0x69, 0x6e, 0x6b, 0x5f, 0x63, 0x72, + 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, + 0x65, 0x74, 0x61, 0x2e, 0x53, 0x69, 0x6e, 0x6b, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x52, 0x0e, 0x73, 0x69, 0x6e, 0x6b, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x61, 0x6c, 0x12, 0x38, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, + 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x50, 0x0a, 0x11, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x1b, + 0x0a, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x41, 0x0a, 0x0b, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, + 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, + 0x72, 0x52, 0x0b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x12, 0x38, + 0x0a, 0x07, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, + 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x07, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x41, 0x64, 0x64, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x44, 0x0a, 0x19, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x1b, 0x0a, 0x19, 0x50, 0x61, 0x75, - 0x73, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x44, 0x0a, 0x19, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x52, 0x65, 0x6d, + 0x6f, 0x76, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x43, 0x0a, 0x18, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x73, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x1c, 0x0a, 0x1a, - 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x66, 0x0a, 0x1d, 0x52, 0x65, - 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x73, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x32, 0xb0, 0x06, 0x0a, 0x0d, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, - 0x72, 0x6b, 0x65, 0x72, 0x12, 0x6c, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x30, 0x2e, - 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, - 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x72, 0x69, 0x67, 0x67, - 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x72, 0x69, - 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x69, 0x0a, 0x04, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x1b, 0x0a, 0x19, + 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x44, 0x0a, 0x19, 0x52, 0x65, 0x73, + 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, + 0x1c, 0x0a, 0x1a, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc8, 0x05, + 0x0a, 0x0d, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x12, + 0x6c, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, + 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, + 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, - 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, - 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x6c, 0x69, + 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, + 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, + 0x04, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, + 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x53, 0x74, + 0x6f, 0x70, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x53, + 0x74, 0x6f, 0x70, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x70, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, - 0x67, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, - 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x70, 0x0a, - 0x0f, 0x41, 0x64, 0x64, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x2d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x53, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x2e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x79, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, - 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, + 0x67, 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6c, 0x69, 0x6e, + 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, + 0x65, 0x72, 0x2e, 0x41, 0x64, 0x64, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, - 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, - 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x11, 0x50, 0x61, - 0x75, 0x73, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x79, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, - 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, - 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6c, 0x69, 0x6e, + 0x12, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, + 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, + 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, + 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x11, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, - 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, - 0x16, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x34, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, - 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, - 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, 0x73, - 0x2f, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, - 0x2f, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x72, 0x2e, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x6c, 0x69, + 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, + 0x67, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, + 0x12, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, + 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x75, + 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, + 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x65, + 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, + 0x61, 0x62, 0x73, 0x2f, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -819,56 +751,52 @@ func file_trigger_proto_rawDescGZIP() []byte { return file_trigger_proto_rawDescData } -var file_trigger_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_trigger_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_trigger_proto_goTypes = []interface{}{ - (*StartTriggerWorkerRequest)(nil), // 0: linkall.vanus.trigger.StartTriggerWorkerRequest - (*StartTriggerWorkerResponse)(nil), // 1: linkall.vanus.trigger.StartTriggerWorkerResponse - (*StopTriggerWorkerRequest)(nil), // 2: linkall.vanus.trigger.StopTriggerWorkerRequest - (*StopTriggerWorkerResponse)(nil), // 3: linkall.vanus.trigger.StopTriggerWorkerResponse - (*AddSubscriptionRequest)(nil), // 4: linkall.vanus.trigger.AddSubscriptionRequest - (*AddSubscriptionResponse)(nil), // 5: linkall.vanus.trigger.AddSubscriptionResponse - (*RemoveSubscriptionRequest)(nil), // 6: linkall.vanus.trigger.RemoveSubscriptionRequest - (*RemoveSubscriptionResponse)(nil), // 7: linkall.vanus.trigger.RemoveSubscriptionResponse - (*PauseSubscriptionRequest)(nil), // 8: linkall.vanus.trigger.PauseSubscriptionRequest - (*PauseSubscriptionResponse)(nil), // 9: linkall.vanus.trigger.PauseSubscriptionResponse - (*ResumeSubscriptionRequest)(nil), // 10: linkall.vanus.trigger.ResumeSubscriptionRequest - (*ResumeSubscriptionResponse)(nil), // 11: linkall.vanus.trigger.ResumeSubscriptionResponse - (*ResetOffsetToTimestampRequest)(nil), // 12: linkall.vanus.trigger.ResetOffsetToTimestampRequest - (*config.ServerConfig)(nil), // 13: linkall.vanus.config.ServerConfig - (*meta.SubscriptionConfig)(nil), // 14: linkall.vanus.meta.SubscriptionConfig - (*meta.Filter)(nil), // 15: linkall.vanus.meta.Filter - (*meta.SinkCredential)(nil), // 16: linkall.vanus.meta.SinkCredential - (meta.Protocol)(0), // 17: linkall.vanus.meta.Protocol - (*meta.ProtocolSetting)(nil), // 18: linkall.vanus.meta.ProtocolSetting - (*meta.Transformer)(nil), // 19: linkall.vanus.meta.Transformer - (*meta.OffsetInfo)(nil), // 20: linkall.vanus.meta.OffsetInfo - (*emptypb.Empty)(nil), // 21: google.protobuf.Empty + (*StartTriggerWorkerRequest)(nil), // 0: linkall.vanus.trigger.StartTriggerWorkerRequest + (*StartTriggerWorkerResponse)(nil), // 1: linkall.vanus.trigger.StartTriggerWorkerResponse + (*StopTriggerWorkerRequest)(nil), // 2: linkall.vanus.trigger.StopTriggerWorkerRequest + (*StopTriggerWorkerResponse)(nil), // 3: linkall.vanus.trigger.StopTriggerWorkerResponse + (*AddSubscriptionRequest)(nil), // 4: linkall.vanus.trigger.AddSubscriptionRequest + (*AddSubscriptionResponse)(nil), // 5: linkall.vanus.trigger.AddSubscriptionResponse + (*RemoveSubscriptionRequest)(nil), // 6: linkall.vanus.trigger.RemoveSubscriptionRequest + (*RemoveSubscriptionResponse)(nil), // 7: linkall.vanus.trigger.RemoveSubscriptionResponse + (*PauseSubscriptionRequest)(nil), // 8: linkall.vanus.trigger.PauseSubscriptionRequest + (*PauseSubscriptionResponse)(nil), // 9: linkall.vanus.trigger.PauseSubscriptionResponse + (*ResumeSubscriptionRequest)(nil), // 10: linkall.vanus.trigger.ResumeSubscriptionRequest + (*ResumeSubscriptionResponse)(nil), // 11: linkall.vanus.trigger.ResumeSubscriptionResponse + (*config.ServerConfig)(nil), // 12: linkall.vanus.config.ServerConfig + (*meta.SubscriptionConfig)(nil), // 13: linkall.vanus.meta.SubscriptionConfig + (*meta.Filter)(nil), // 14: linkall.vanus.meta.Filter + (*meta.SinkCredential)(nil), // 15: linkall.vanus.meta.SinkCredential + (meta.Protocol)(0), // 16: linkall.vanus.meta.Protocol + (*meta.ProtocolSetting)(nil), // 17: linkall.vanus.meta.ProtocolSetting + (*meta.Transformer)(nil), // 18: linkall.vanus.meta.Transformer + (*meta.OffsetInfo)(nil), // 19: linkall.vanus.meta.OffsetInfo } var file_trigger_proto_depIdxs = []int32{ - 13, // 0: linkall.vanus.trigger.StartTriggerWorkerRequest.config:type_name -> linkall.vanus.config.ServerConfig - 14, // 1: linkall.vanus.trigger.AddSubscriptionRequest.config:type_name -> linkall.vanus.meta.SubscriptionConfig - 15, // 2: linkall.vanus.trigger.AddSubscriptionRequest.filters:type_name -> linkall.vanus.meta.Filter - 16, // 3: linkall.vanus.trigger.AddSubscriptionRequest.sink_credential:type_name -> linkall.vanus.meta.SinkCredential - 17, // 4: linkall.vanus.trigger.AddSubscriptionRequest.protocol:type_name -> linkall.vanus.meta.Protocol - 18, // 5: linkall.vanus.trigger.AddSubscriptionRequest.protocol_settings:type_name -> linkall.vanus.meta.ProtocolSetting - 19, // 6: linkall.vanus.trigger.AddSubscriptionRequest.transformer:type_name -> linkall.vanus.meta.Transformer - 20, // 7: linkall.vanus.trigger.AddSubscriptionRequest.offsets:type_name -> linkall.vanus.meta.OffsetInfo + 12, // 0: linkall.vanus.trigger.StartTriggerWorkerRequest.config:type_name -> linkall.vanus.config.ServerConfig + 13, // 1: linkall.vanus.trigger.AddSubscriptionRequest.config:type_name -> linkall.vanus.meta.SubscriptionConfig + 14, // 2: linkall.vanus.trigger.AddSubscriptionRequest.filters:type_name -> linkall.vanus.meta.Filter + 15, // 3: linkall.vanus.trigger.AddSubscriptionRequest.sink_credential:type_name -> linkall.vanus.meta.SinkCredential + 16, // 4: linkall.vanus.trigger.AddSubscriptionRequest.protocol:type_name -> linkall.vanus.meta.Protocol + 17, // 5: linkall.vanus.trigger.AddSubscriptionRequest.protocol_settings:type_name -> linkall.vanus.meta.ProtocolSetting + 18, // 6: linkall.vanus.trigger.AddSubscriptionRequest.transformer:type_name -> linkall.vanus.meta.Transformer + 19, // 7: linkall.vanus.trigger.AddSubscriptionRequest.offsets:type_name -> linkall.vanus.meta.OffsetInfo 0, // 8: linkall.vanus.trigger.TriggerWorker.Start:input_type -> linkall.vanus.trigger.StartTriggerWorkerRequest 2, // 9: linkall.vanus.trigger.TriggerWorker.Stop:input_type -> linkall.vanus.trigger.StopTriggerWorkerRequest 4, // 10: linkall.vanus.trigger.TriggerWorker.AddSubscription:input_type -> linkall.vanus.trigger.AddSubscriptionRequest 6, // 11: linkall.vanus.trigger.TriggerWorker.RemoveSubscription:input_type -> linkall.vanus.trigger.RemoveSubscriptionRequest 8, // 12: linkall.vanus.trigger.TriggerWorker.PauseSubscription:input_type -> linkall.vanus.trigger.PauseSubscriptionRequest 10, // 13: linkall.vanus.trigger.TriggerWorker.ResumeSubscription:input_type -> linkall.vanus.trigger.ResumeSubscriptionRequest - 12, // 14: linkall.vanus.trigger.TriggerWorker.ResetOffsetToTimestamp:input_type -> linkall.vanus.trigger.ResetOffsetToTimestampRequest - 1, // 15: linkall.vanus.trigger.TriggerWorker.Start:output_type -> linkall.vanus.trigger.StartTriggerWorkerResponse - 3, // 16: linkall.vanus.trigger.TriggerWorker.Stop:output_type -> linkall.vanus.trigger.StopTriggerWorkerResponse - 5, // 17: linkall.vanus.trigger.TriggerWorker.AddSubscription:output_type -> linkall.vanus.trigger.AddSubscriptionResponse - 7, // 18: linkall.vanus.trigger.TriggerWorker.RemoveSubscription:output_type -> linkall.vanus.trigger.RemoveSubscriptionResponse - 9, // 19: linkall.vanus.trigger.TriggerWorker.PauseSubscription:output_type -> linkall.vanus.trigger.PauseSubscriptionResponse - 11, // 20: linkall.vanus.trigger.TriggerWorker.ResumeSubscription:output_type -> linkall.vanus.trigger.ResumeSubscriptionResponse - 21, // 21: linkall.vanus.trigger.TriggerWorker.ResetOffsetToTimestamp:output_type -> google.protobuf.Empty - 15, // [15:22] is the sub-list for method output_type - 8, // [8:15] is the sub-list for method input_type + 1, // 14: linkall.vanus.trigger.TriggerWorker.Start:output_type -> linkall.vanus.trigger.StartTriggerWorkerResponse + 3, // 15: linkall.vanus.trigger.TriggerWorker.Stop:output_type -> linkall.vanus.trigger.StopTriggerWorkerResponse + 5, // 16: linkall.vanus.trigger.TriggerWorker.AddSubscription:output_type -> linkall.vanus.trigger.AddSubscriptionResponse + 7, // 17: linkall.vanus.trigger.TriggerWorker.RemoveSubscription:output_type -> linkall.vanus.trigger.RemoveSubscriptionResponse + 9, // 18: linkall.vanus.trigger.TriggerWorker.PauseSubscription:output_type -> linkall.vanus.trigger.PauseSubscriptionResponse + 11, // 19: linkall.vanus.trigger.TriggerWorker.ResumeSubscription:output_type -> linkall.vanus.trigger.ResumeSubscriptionResponse + 14, // [14:20] is the sub-list for method output_type + 8, // [8:14] is the sub-list for method input_type 8, // [8:8] is the sub-list for extension type_name 8, // [8:8] is the sub-list for extension extendee 0, // [0:8] is the sub-list for field type_name @@ -1024,18 +952,6 @@ func file_trigger_proto_init() { return nil } } - file_trigger_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResetOffsetToTimestampRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1043,7 +959,7 @@ func file_trigger_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_trigger_proto_rawDesc, NumEnums: 0, - NumMessages: 13, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, @@ -1075,7 +991,6 @@ type TriggerWorkerClient interface { RemoveSubscription(ctx context.Context, in *RemoveSubscriptionRequest, opts ...grpc.CallOption) (*RemoveSubscriptionResponse, error) PauseSubscription(ctx context.Context, in *PauseSubscriptionRequest, opts ...grpc.CallOption) (*PauseSubscriptionResponse, error) ResumeSubscription(ctx context.Context, in *ResumeSubscriptionRequest, opts ...grpc.CallOption) (*ResumeSubscriptionResponse, error) - ResetOffsetToTimestamp(ctx context.Context, in *ResetOffsetToTimestampRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) } type triggerWorkerClient struct { @@ -1140,15 +1055,6 @@ func (c *triggerWorkerClient) ResumeSubscription(ctx context.Context, in *Resume return out, nil } -func (c *triggerWorkerClient) ResetOffsetToTimestamp(ctx context.Context, in *ResetOffsetToTimestampRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/linkall.vanus.trigger.TriggerWorker/ResetOffsetToTimestamp", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // TriggerWorkerServer is the server API for TriggerWorker service. type TriggerWorkerServer interface { Start(context.Context, *StartTriggerWorkerRequest) (*StartTriggerWorkerResponse, error) @@ -1157,7 +1063,6 @@ type TriggerWorkerServer interface { RemoveSubscription(context.Context, *RemoveSubscriptionRequest) (*RemoveSubscriptionResponse, error) PauseSubscription(context.Context, *PauseSubscriptionRequest) (*PauseSubscriptionResponse, error) ResumeSubscription(context.Context, *ResumeSubscriptionRequest) (*ResumeSubscriptionResponse, error) - ResetOffsetToTimestamp(context.Context, *ResetOffsetToTimestampRequest) (*emptypb.Empty, error) } // UnimplementedTriggerWorkerServer can be embedded to have forward compatible implementations. @@ -1182,9 +1087,6 @@ func (*UnimplementedTriggerWorkerServer) PauseSubscription(context.Context, *Pau func (*UnimplementedTriggerWorkerServer) ResumeSubscription(context.Context, *ResumeSubscriptionRequest) (*ResumeSubscriptionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ResumeSubscription not implemented") } -func (*UnimplementedTriggerWorkerServer) ResetOffsetToTimestamp(context.Context, *ResetOffsetToTimestampRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method ResetOffsetToTimestamp not implemented") -} func RegisterTriggerWorkerServer(s *grpc.Server, srv TriggerWorkerServer) { s.RegisterService(&_TriggerWorker_serviceDesc, srv) @@ -1298,24 +1200,6 @@ func _TriggerWorker_ResumeSubscription_Handler(srv interface{}, ctx context.Cont return interceptor(ctx, in, info, handler) } -func _TriggerWorker_ResetOffsetToTimestamp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ResetOffsetToTimestampRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TriggerWorkerServer).ResetOffsetToTimestamp(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/linkall.vanus.trigger.TriggerWorker/ResetOffsetToTimestamp", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TriggerWorkerServer).ResetOffsetToTimestamp(ctx, req.(*ResetOffsetToTimestampRequest)) - } - return interceptor(ctx, in, info, handler) -} - var _TriggerWorker_serviceDesc = grpc.ServiceDesc{ ServiceName: "linkall.vanus.trigger.TriggerWorker", HandlerType: (*TriggerWorkerServer)(nil), @@ -1344,10 +1228,6 @@ var _TriggerWorker_serviceDesc = grpc.ServiceDesc{ MethodName: "ResumeSubscription", Handler: _TriggerWorker_ResumeSubscription_Handler, }, - { - MethodName: "ResetOffsetToTimestamp", - Handler: _TriggerWorker_ResetOffsetToTimestamp_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "trigger.proto", diff --git a/proto/proto/controller.proto b/proto/proto/controller.proto index fec9a5e80..a9f811343 100644 --- a/proto/proto/controller.proto +++ b/proto/proto/controller.proto @@ -69,6 +69,10 @@ service TriggerController { returns (linkall.vanus.meta.Subscription) {} rpc DeleteSubscription(DeleteSubscriptionRequest) returns (google.protobuf.Empty) {} + rpc DisableSubscription(DisableSubscriptionRequest) + returns (google.protobuf.Empty); + rpc ResumeSubscription(ResumeSubscriptionRequest) + returns (google.protobuf.Empty); rpc GetSubscription(GetSubscriptionRequest) returns (linkall.vanus.meta.Subscription) {} rpc ListSubscription(google.protobuf.Empty) @@ -80,7 +84,7 @@ service TriggerController { rpc UnregisterTriggerWorker(UnregisterTriggerWorkerRequest) returns (UnregisterTriggerWorkerResponse); rpc ResetOffsetToTimestamp(ResetOffsetToTimestampRequest) - returns (google.protobuf.Empty); + returns (ResetOffsetToTimestampResponse); rpc CommitOffset(CommitOffsetRequest) returns (CommitOffsetResponse); } @@ -94,7 +98,7 @@ service SnowflakeController { message PingResponse { string leader_addr = 1; string gateway_addr = 2; - bool is_eventbus_ready=3; + bool is_eventbus_ready = 3; } message CreateEventBusRequest { @@ -182,6 +186,14 @@ message DeleteSubscriptionRequest { uint64 id = 1; } +message DisableSubscriptionRequest { + uint64 id = 1; +} + +message ResumeSubscriptionRequest { + uint64 id = 1; +} + message ListSubscriptionResponse { repeated linkall.vanus.meta.Subscription subscription = 1; } @@ -212,6 +224,11 @@ message ResetOffsetToTimestampRequest { uint64 timestamp = 2; } +message ResetOffsetToTimestampResponse { + repeated meta.OffsetInfo offsets = 1; +} + + message CommitOffsetRequest { repeated meta.SubscriptionInfo subscription_info = 1; bool force_commit = 2; diff --git a/proto/proto/proxy.proto b/proto/proto/proxy.proto index 623091f2e..165514b2e 100644 --- a/proto/proto/proxy.proto +++ b/proto/proto/proxy.proto @@ -45,6 +45,12 @@ service ControllerProxy { returns (meta.Subscription); rpc ListSubscription(google.protobuf.Empty) returns (controller.ListSubscriptionResponse); + rpc DisableSubscription(controller.DisableSubscriptionRequest) + returns (google.protobuf.Empty); + rpc ResumeSubscription(controller.ResumeSubscriptionRequest) + returns (google.protobuf.Empty); + rpc ResetOffsetToTimestamp(controller.ResetOffsetToTimestampRequest) + returns (controller.ResetOffsetToTimestampResponse); // custom rpc ClusterInfo(google.protobuf.Empty) returns (ClusterInfoResponse); diff --git a/proto/proto/trigger.proto b/proto/proto/trigger.proto index 78ae061e2..76aa5167b 100644 --- a/proto/proto/trigger.proto +++ b/proto/proto/trigger.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package linkall.vanus.trigger; -import "google/protobuf/empty.proto"; import "config.proto"; import "meta.proto"; @@ -32,8 +31,6 @@ service TriggerWorker { returns (PauseSubscriptionResponse); rpc ResumeSubscription(ResumeSubscriptionRequest) returns (ResumeSubscriptionResponse); - rpc ResetOffsetToTimestamp(ResetOffsetToTimestampRequest) - returns (google.protobuf.Empty); } message StartTriggerWorkerRequest { @@ -78,8 +75,3 @@ message ResumeSubscriptionRequest { } message ResumeSubscriptionResponse {} - -message ResetOffsetToTimestampRequest { - uint64 subscription_id = 1; - uint64 timestamp = 2; -} diff --git a/test/e2e/sink/main.go b/test/e2e/sink/main.go index 3c4baa405..1459ea6da 100644 --- a/test/e2e/sink/main.go +++ b/test/e2e/sink/main.go @@ -16,14 +16,18 @@ package main import ( "context" + "fmt" + "net" + "sync/atomic" + ce "github.com/cloudevents/sdk-go/v2" "github.com/cloudevents/sdk-go/v2/client" cehttp "github.com/cloudevents/sdk-go/v2/protocol/http" "github.com/linkall-labs/vanus/observability/log" - "net" ) func main() { + var total int64 ls, err := net.Listen("tcp4", ":18080") if err != nil { panic(err) @@ -34,8 +38,7 @@ func main() { } log.Info(context.Background(), "start success", nil) c.StartReceiver(context.Background(), func(e ce.Event) { - log.Info(context.Background(), "receive event", map[string]interface{}{ - "event": e, - }) + fmt.Println(fmt.Sprintf("---total: %d", atomic.AddInt64(&total, 1))) + fmt.Println(e) }) } diff --git a/vsctl/command/flag.go b/vsctl/command/flag.go index c0acee2cd..eaef4c524 100644 --- a/vsctl/command/flag.go +++ b/vsctl/command/flag.go @@ -52,6 +52,7 @@ var ( sinkCredential string deliveryTimeout uint32 maxRetryAttempts int32 + offsetTimestamp uint64 showSegment bool showBlock bool diff --git a/vsctl/command/subscription.go b/vsctl/command/subscription.go index f964a2d97..9ec8a876b 100644 --- a/vsctl/command/subscription.go +++ b/vsctl/command/subscription.go @@ -50,8 +50,11 @@ func NewSubscriptionCommand() *cobra.Command { } cmd.AddCommand(createSubscriptionCommand()) cmd.AddCommand(deleteSubscriptionCommand()) + cmd.AddCommand(disableSubscriptionCommand()) + cmd.AddCommand(resumeSubscriptionCommand()) cmd.AddCommand(getSubscriptionCommand()) cmd.AddCommand(listSubscriptionCommand()) + cmd.AddCommand(resetOffsetCommand()) return cmd } @@ -261,6 +264,122 @@ func deleteSubscriptionCommand() *cobra.Command { return cmd } +func resumeSubscriptionCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "resume", + Short: "resume a subscription", + Run: func(cmd *cobra.Command, args []string) { + id, err := vanus.NewIDFromString(subscriptionIDStr) + if err != nil { + cmdFailedWithHelpNotice(cmd, fmt.Sprintf("invalid subscription id: %s\n", err.Error())) + } + + _, err = client.ResumeSubscription(context.Background(), &ctrlpb.ResumeSubscriptionRequest{ + Id: id.Uint64(), + }) + if err != nil { + cmdFailedf(cmd, "resume subscription failed: %s", err) + } + + if IsFormatJSON(cmd) { + data, _ := json.Marshal(map[string]interface{}{"subscription_id": subscriptionIDStr}) + color.Green(string(data)) + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"subscription_id"}) + t.AppendRow(table.Row{subscriptionIDStr}) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + }) + t.SetOutputMirror(os.Stdout) + t.Render() + } + color.Green("resume subscription: %d success\n", subscriptionIDStr) + }, + } + cmd.Flags().StringVar(&subscriptionIDStr, "id", "", "subscription id to resume") + return cmd +} + +func disableSubscriptionCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "disable", + Short: "disable a subscription", + Run: func(cmd *cobra.Command, args []string) { + id, err := vanus.NewIDFromString(subscriptionIDStr) + if err != nil { + cmdFailedWithHelpNotice(cmd, fmt.Sprintf("invalid subscription id: %s\n", err.Error())) + } + + _, err = client.DisableSubscription(context.Background(), &ctrlpb.DisableSubscriptionRequest{ + Id: id.Uint64(), + }) + if err != nil { + cmdFailedf(cmd, "disable subscription failed: %s", err) + } + + if IsFormatJSON(cmd) { + data, _ := json.Marshal(map[string]interface{}{"subscription_id": subscriptionIDStr}) + color.Green(string(data)) + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"subscription_id"}) + t.AppendRow(table.Row{subscriptionIDStr}) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + }) + t.SetOutputMirror(os.Stdout) + t.Render() + } + color.Green("disable subscription: %d success\n", subscriptionIDStr) + }, + } + cmd.Flags().StringVar(&subscriptionIDStr, "id", "", "subscription id to disable") + return cmd +} + +func resetOffsetCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "reset-offset", + Short: "reset offset a subscription", + Run: func(cmd *cobra.Command, args []string) { + id, err := vanus.NewIDFromString(subscriptionIDStr) + if err != nil { + cmdFailedWithHelpNotice(cmd, fmt.Sprintf("invalid subscription id: %s\n", err.Error())) + } + if offsetTimestamp == 0 { + cmdFailedf(cmd, "reset offset timestamp must gt 0") + } + res, err := client.ResetOffsetToTimestamp(context.Background(), &ctrlpb.ResetOffsetToTimestampRequest{ + SubscriptionId: id.Uint64(), + Timestamp: offsetTimestamp, + }) + if err != nil { + cmdFailedf(cmd, "reset offset subscription failed: %s", err) + } + data, _ := json.MarshalIndent(res.Offsets, "", " ") + if IsFormatJSON(cmd) { + color.Green(string(data)) + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"subscription_id", "filters"}) + t.AppendSeparator() + t.AppendRow(table.Row{subscriptionIDStr, string(data)}) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, VAlign: text.VAlignMiddle, AlignHeader: text.AlignCenter}, + {Number: 2, VAlign: text.VAlignMiddle, AlignHeader: text.AlignCenter}, + }) + t.SetOutputMirror(os.Stdout) + t.Render() + } + color.Green("reset offset by subscription: %s success\n", subscriptionIDStr) + }, + } + cmd.Flags().StringVar(&subscriptionIDStr, "id", "", "subscription id to disable") + cmd.Flags().Uint64Var(&offsetTimestamp, "timestamp", 0, "reset offset to UTC second") + return cmd +} + func getSubscriptionCommand() *cobra.Command { cmd := &cobra.Command{ Use: "info", From 1ca00750c8f69cce7032c0f76959f72b3de1f9b9 Mon Sep 17 00:00:00 2001 From: wenfeng Date: Thu, 5 Jan 2023 11:09:44 +0800 Subject: [PATCH 17/46] fix: roundrobin policy (#383) * fix: roundrobin policy Signed-off-by: wenfeng * fix Signed-off-by: wenfeng Signed-off-by: wenfeng --- client/pkg/policy/policy.go | 41 ++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/client/pkg/policy/policy.go b/client/pkg/policy/policy.go index 0bf763ff1..0f2b5b2db 100644 --- a/client/pkg/policy/policy.go +++ b/client/pkg/policy/policy.go @@ -16,6 +16,8 @@ package policy import ( "context" + "sort" + "sync" "sync/atomic" "github.com/linkall-labs/vanus/client/pkg/api" @@ -30,8 +32,10 @@ func NewRoundRobinWritePolicy(eb api.Eventbus) api.WritePolicy { } type roundRobinWritePolicy struct { - bus api.Eventbus - idx uint64 + bus api.Eventbus + idx uint64 + cached []api.Eventlog + mutex sync.Mutex } func (w *roundRobinWritePolicy) Type() api.PolicyType { @@ -47,6 +51,18 @@ func (w *roundRobinWritePolicy) NextLog(ctx context.Context) (api.Eventlog, erro if len(logs) == 0 { continue } + + if len(logs) == len(w.cached) { + logs = w.cached + } else { + w.mutex.Lock() + sort.Slice(logs, func(i, j int) bool { + return logs[i].ID() > logs[j].ID() + }) + w.cached = logs + w.mutex.Unlock() + } + l := len(logs) i := atomic.AddUint64(&w.idx, 1) % uint64(l) return logs[i], nil @@ -82,28 +98,43 @@ type roundRobinReadPolicy struct { bus api.Eventbus idx uint64 offset int64 + cached []api.Eventlog + mutex sync.Mutex } -func (r roundRobinReadPolicy) Type() api.PolicyType { +func (r *roundRobinReadPolicy) Type() api.PolicyType { return api.RoundRobin } -func (r roundRobinReadPolicy) NextLog(ctx context.Context) (api.Eventlog, error) { +func (r *roundRobinReadPolicy) NextLog(ctx context.Context) (api.Eventlog, error) { for { logs, err := r.bus.ListLog(ctx) if err != nil { return nil, err } + if len(logs) == 0 { continue } + + if len(logs) == len(r.cached) { + logs = r.cached + } else { + r.mutex.Lock() + sort.Slice(logs, func(i, j int) bool { + return logs[i].ID() > logs[j].ID() + }) + r.cached = logs + r.mutex.Unlock() + } + l := len(logs) i := atomic.AddUint64(&r.idx, 1) % uint64(l) return logs[i], nil } } -func (r roundRobinReadPolicy) Offset() int64 { +func (r *roundRobinReadPolicy) Offset() int64 { return atomic.LoadInt64(&r.offset) } From 6c6ddc4d3086f44e7d3c3991f4c00887aaf28f5e Mon Sep 17 00:00:00 2001 From: delu Date: Thu, 5 Jan 2023 13:50:18 +0800 Subject: [PATCH 18/46] feat: support batch when use grpc (#384) * feat: support trigger batch Signed-off-by: xdlbdy * feat: support batch Signed-off-by: xdlbdy * feat: support batch Signed-off-by: xdlbdy * feat: support batch Signed-off-by: xdlbdy * feat: support batch Signed-off-by: xdlbdy Signed-off-by: xdlbdy --- client/internal/vanus/store/block_store.go | 4 +- .../{internal/vanus => pkg}/codec/protobuf.go | 0 go.mod | 1 + go.sum | 2 + .../trigger/validation/subscripton.go | 3 + internal/convert/convert.go | 4 + internal/primitive/subscription.go | 1 + internal/trigger/client/gcloud_functions.go | 3 +- internal/trigger/client/grpc.go | 84 ++++++++ internal/trigger/client/http.go | 5 +- internal/trigger/client/interface.go | 4 +- internal/trigger/client/lambda.go | 3 +- internal/trigger/client/mock_interface.go | 26 ++- internal/trigger/trigger/config.go | 7 + internal/trigger/trigger/trigger.go | 200 ++++++++++++------ internal/trigger/trigger/trigger_test.go | 4 +- internal/trigger/trigger/util.go | 13 +- proto/pkg/meta/meta.pb.go | 16 +- proto/proto/meta.proto | 1 + vsctl/command/subscription.go | 6 +- 20 files changed, 299 insertions(+), 88 deletions(-) rename client/{internal/vanus => pkg}/codec/protobuf.go (100%) create mode 100644 internal/trigger/client/grpc.go diff --git a/client/internal/vanus/store/block_store.go b/client/internal/vanus/store/block_store.go index 62e8bc011..bb36fbeeb 100644 --- a/client/internal/vanus/store/block_store.go +++ b/client/internal/vanus/store/block_store.go @@ -19,6 +19,8 @@ import ( "context" "time" + "github.com/linkall-labs/vanus/client/pkg/codec" + "github.com/linkall-labs/vanus/observability/tracing" "go.opentelemetry.io/otel/trace" @@ -30,8 +32,6 @@ import ( cepb "github.com/linkall-labs/vanus/proto/pkg/cloudevents" segpb "github.com/linkall-labs/vanus/proto/pkg/segment" - // this project - "github.com/linkall-labs/vanus/client/internal/vanus/codec" "github.com/linkall-labs/vanus/client/internal/vanus/net/rpc" "github.com/linkall-labs/vanus/client/internal/vanus/net/rpc/bare" "github.com/linkall-labs/vanus/client/pkg/primitive" diff --git a/client/internal/vanus/codec/protobuf.go b/client/pkg/codec/protobuf.go similarity index 100% rename from client/internal/vanus/codec/protobuf.go rename to client/pkg/codec/protobuf.go diff --git a/go.mod b/go.mod index 010109cf0..dfbe6104f 100644 --- a/go.mod +++ b/go.mod @@ -30,6 +30,7 @@ require ( github.com/linkall-labs/vanus/raft v0.5.1 github.com/ncw/directio v1.0.5 github.com/ohler55/ojg v1.14.5 + github.com/panjf2000/ants/v2 v2.7.1 github.com/pkg/errors v0.9.1 github.com/prashantv/gostub v1.1.0 github.com/prometheus/client_golang v1.14.0 diff --git a/go.sum b/go.sum index 4810c5efe..e4be51190 100644 --- a/go.sum +++ b/go.sum @@ -322,6 +322,8 @@ github.com/ohler55/ojg v1.14.5/go.mod h1:7Ghirupn8NC8hSSDpI0gcjorPxj+vSVIONDWfli github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/panjf2000/ants/v2 v2.7.1 h1:qBy5lfSdbxvrR0yUnZfaEDjf0FlCw4ufsbcsxmE7r+M= +github.com/panjf2000/ants/v2 v2.7.1/go.mod h1:KIBmYG9QQX5U2qzFP/yQJaq/nSb6rahS9iEHkrCMgM8= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= diff --git a/internal/controller/trigger/validation/subscripton.go b/internal/controller/trigger/validation/subscripton.go index 574bac348..7755bf709 100644 --- a/internal/controller/trigger/validation/subscripton.go +++ b/internal/controller/trigger/validation/subscripton.go @@ -63,6 +63,8 @@ func validateProtocol(ctx context.Context, protocol metapb.Protocol) error { case metapb.Protocol_HTTP: case metapb.Protocol_AWS_LAMBDA: case metapb.Protocol_GCLOUD_FUNCTIONS: + case metapb.Protocol_GRPC: + default: return errors.ErrInvalidRequest.WithMessage("protocol is invalid") } @@ -96,6 +98,7 @@ func ValidateSinkAndProtocol(ctx context.Context, return errors.ErrInvalidRequest. WithMessage("protocol is http, sink is url,url parse error").Wrap(err) } + case metapb.Protocol_GRPC: } return nil } diff --git a/internal/convert/convert.go b/internal/convert/convert.go index c0bd67c0c..7ff66da16 100644 --- a/internal/convert/convert.go +++ b/internal/convert/convert.go @@ -53,6 +53,8 @@ func fromPbProtocol(from pb.Protocol) primitive.Protocol { to = primitive.AwsLambdaProtocol case pb.Protocol_GCLOUD_FUNCTIONS: to = primitive.GCloudFunctions + case pb.Protocol_GRPC: + to = primitive.GRPC } return to } @@ -66,6 +68,8 @@ func toPbProtocol(from primitive.Protocol) pb.Protocol { to = pb.Protocol_AWS_LAMBDA case primitive.GCloudFunctions: to = pb.Protocol_GCLOUD_FUNCTIONS + case primitive.GRPC: + to = pb.Protocol_GRPC } return to } diff --git a/internal/primitive/subscription.go b/internal/primitive/subscription.go index 1e0b644b9..1e239a8ab 100644 --- a/internal/primitive/subscription.go +++ b/internal/primitive/subscription.go @@ -49,6 +49,7 @@ const ( HTTPProtocol Protocol = "http" AwsLambdaProtocol Protocol = "aws-lambda" GCloudFunctions Protocol = "gcloud-functions" + GRPC Protocol = "grpc" ) type ProtocolSetting struct { diff --git a/internal/trigger/client/gcloud_functions.go b/internal/trigger/client/gcloud_functions.go index d873d10a5..797d20760 100644 --- a/internal/trigger/client/gcloud_functions.go +++ b/internal/trigger/client/gcloud_functions.go @@ -54,7 +54,8 @@ func (c *gcloudFunctions) init(ctx context.Context) error { return nil } -func (c *gcloudFunctions) Send(ctx context.Context, event ce.Event) Result { +func (c *gcloudFunctions) Send(ctx context.Context, events ...*ce.Event) Result { + event := events[0] if c.client == nil { err := c.init(ctx) if err != nil { diff --git a/internal/trigger/client/grpc.go b/internal/trigger/client/grpc.go new file mode 100644 index 000000000..a6027f96e --- /dev/null +++ b/internal/trigger/client/grpc.go @@ -0,0 +1,84 @@ +// Copyright 2022 Linkall Inc. +// +// 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 ( + "context" + "sync" + "time" + + ce "github.com/cloudevents/sdk-go/v2" + "github.com/linkall-labs/vanus/client/pkg/codec" + "github.com/linkall-labs/vanus/proto/pkg/cloudevents" + "github.com/pkg/errors" + stdGrpc "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +type grpc struct { + client cloudevents.CloudEventsClient + url string + lock sync.Mutex +} + +func NewGRPCClient(url string) EventClient { + return &grpc{ + url: url, + } +} + +func (c *grpc) init() error { + c.lock.Lock() + defer c.lock.Unlock() + if c.client != nil { + return nil + } + opts := []stdGrpc.DialOption{ + stdGrpc.WithBlock(), + stdGrpc.WithTransportCredentials(insecure.NewCredentials()), + } + //nolint:gomnd //wrong check + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + conn, err := stdGrpc.DialContext(ctx, c.url, opts...) + if err != nil { + return err + } + c.client = cloudevents.NewCloudEventsClient(conn) + return nil +} + +func (c *grpc) Send(ctx context.Context, events ...*ce.Event) Result { + if c.client == nil { + err := c.init() + if err != nil { + return newUndefinedErr(err) + } + } + es := make([]*cloudevents.CloudEvent, len(events)) + for idx := range events { + es[idx], _ = codec.ToProto(events[idx]) + } + _, err := c.client.Send(ctx, &cloudevents.BatchEvent{ + Events: &cloudevents.CloudEventBatch{Events: es}, + }) + if err != nil { + if errors.Is(err, context.DeadlineExceeded) { + return DeliveryTimeout + } + return newUndefinedErr(err) + } + return Success +} diff --git a/internal/trigger/client/http.go b/internal/trigger/client/http.go index 5b0f782f1..22230a947 100644 --- a/internal/trigger/client/http.go +++ b/internal/trigger/client/http.go @@ -33,8 +33,9 @@ func NewHTTPClient(url string) EventClient { } } -func (c *http) Send(ctx context.Context, event ce.Event) Result { - res := c.client.Send(ctx, event) +func (c *http) Send(ctx context.Context, events ...*ce.Event) Result { + event := events[0] + res := c.client.Send(ctx, *event) if ce.IsACK(res) { return Success } diff --git a/internal/trigger/client/interface.go b/internal/trigger/client/interface.go index c733340fb..476ea04cc 100644 --- a/internal/trigger/client/interface.go +++ b/internal/trigger/client/interface.go @@ -25,7 +25,7 @@ import ( ) type Sender interface { - Send(ctx context.Context, event ce.Event) Result + Send(ctx context.Context, events ...*ce.Event) Result } type EventClient interface { @@ -83,5 +83,5 @@ const ( errStatusCode = nethttp.StatusBadRequest ErrDeliveryTimeout = 601 - ErrUndefined = 700 + ErrUndefined = 602 ) diff --git a/internal/trigger/client/lambda.go b/internal/trigger/client/lambda.go index d47569869..520733a97 100644 --- a/internal/trigger/client/lambda.go +++ b/internal/trigger/client/lambda.go @@ -43,7 +43,8 @@ func NewAwsLambdaClient(accessKeyID, secretKeyID, arnStr string) EventClient { } } -func (l *awsLambda) Send(ctx context.Context, event ce.Event) Result { +func (l *awsLambda) Send(ctx context.Context, events ...*ce.Event) Result { + event := events[0] payload, err := event.MarshalJSON() if err != nil { return newInternalErr(err) diff --git a/internal/trigger/client/mock_interface.go b/internal/trigger/client/mock_interface.go index 8530b87d8..a70bb1c47 100644 --- a/internal/trigger/client/mock_interface.go +++ b/internal/trigger/client/mock_interface.go @@ -36,17 +36,22 @@ func (m *MockSender) EXPECT() *MockSenderMockRecorder { } // Send mocks base method. -func (m *MockSender) Send(ctx context.Context, event v2.Event) Result { +func (m *MockSender) Send(ctx context.Context, events ...*v2.Event) Result { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Send", ctx, event) + varargs := []interface{}{ctx} + for _, a := range events { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "Send", varargs...) ret0, _ := ret[0].(Result) return ret0 } // Send indicates an expected call of Send. -func (mr *MockSenderMockRecorder) Send(ctx, event interface{}) *gomock.Call { +func (mr *MockSenderMockRecorder) Send(ctx interface{}, events ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockSender)(nil).Send), ctx, event) + varargs := append([]interface{}{ctx}, events...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockSender)(nil).Send), varargs...) } // MockEventClient is a mock of EventClient interface. @@ -73,15 +78,20 @@ func (m *MockEventClient) EXPECT() *MockEventClientMockRecorder { } // Send mocks base method. -func (m *MockEventClient) Send(ctx context.Context, event v2.Event) Result { +func (m *MockEventClient) Send(ctx context.Context, events ...*v2.Event) Result { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Send", ctx, event) + varargs := []interface{}{ctx} + for _, a := range events { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "Send", varargs...) ret0, _ := ret[0].(Result) return ret0 } // Send indicates an expected call of Send. -func (mr *MockEventClientMockRecorder) Send(ctx, event interface{}) *gomock.Call { +func (mr *MockEventClientMockRecorder) Send(ctx interface{}, events ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockEventClient)(nil).Send), ctx, event) + varargs := append([]interface{}{ctx}, events...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockEventClient)(nil).Send), varargs...) } diff --git a/internal/trigger/trigger/config.go b/internal/trigger/trigger/config.go index 6e6470688..0d1377263 100644 --- a/internal/trigger/trigger/config.go +++ b/internal/trigger/trigger/config.go @@ -27,6 +27,8 @@ const ( defaultFilterProcessSize = 2 defaultDeliveryTimeout = 5 * time.Second defaultMaxWriteAttempt = 3 + defaultGoroutineSize = 10000 + defaultBatchSize = 32 ) type Config struct { @@ -39,6 +41,9 @@ type Config struct { DeadLetterEventbus string MaxWriteAttempt int Ordered bool + + GoroutineSize int + BatchSize int } func defaultConfig() Config { @@ -49,6 +54,8 @@ func defaultConfig() Config { DeliveryTimeout: defaultDeliveryTimeout, DeadLetterEventbus: primitive.DeadLetterEventbusName, MaxWriteAttempt: defaultMaxWriteAttempt, + GoroutineSize: defaultGoroutineSize, + BatchSize: defaultBatchSize, } return c } diff --git a/internal/trigger/trigger/trigger.go b/internal/trigger/trigger/trigger.go index 87a0f4f02..12b71e10e 100644 --- a/internal/trigger/trigger/trigger.go +++ b/internal/trigger/trigger/trigger.go @@ -36,6 +36,7 @@ import ( "github.com/linkall-labs/vanus/observability/log" "github.com/linkall-labs/vanus/observability/metrics" "github.com/linkall-labs/vanus/pkg/util" + "github.com/panjf2000/ants/v2" "go.uber.org/ratelimit" ) @@ -66,13 +67,15 @@ type trigger struct { offsetManager *offset.SubscriptionOffset reader reader.Reader eventCh chan info.EventRecord - sendCh chan info.EventRecord + sendCh chan *toSendEvent + batchSendCh chan []*toSendEvent eventCli client.EventClient client eb.Client filter filter.Filter transformer *transform.Transformer rateLimiter ratelimit.Limiter config Config + batch bool retryEventCh chan info.EventRecord retryEventReader reader.Reader @@ -83,6 +86,13 @@ type trigger struct { stop context.CancelFunc lock sync.RWMutex wg util.Group + + pool *ants.Pool +} + +type toSendEvent struct { + record info.EventRecord + transform *ce.Event } func NewTrigger(subscription *primitive.Subscription, opts ...Option) Trigger { @@ -96,10 +106,14 @@ func NewTrigger(subscription *primitive.Subscription, opts ...Option) Trigger { subscriptionIDStr: subscription.ID.String(), transformer: transform.NewTransformer(subscription.Transformer), } + if subscription.Protocol == primitive.GRPC { + t.batch = true + } t.applyOptions(opts...) if t.rateLimiter == nil { t.rateLimiter = ratelimit.NewUnlimited() } + t.pool, _ = ants.NewPool(t.config.GoroutineSize) return t } @@ -187,83 +201,138 @@ func (t *trigger) eventArrived(ctx context.Context, event info.EventRecord) erro } } -func (t *trigger) sendEvent(ctx context.Context, e *ce.Event) (int, error) { - var err error +func (t *trigger) transformEvent(record info.EventRecord) (*toSendEvent, error) { transformer := t.getTransformer() - sendEvent := *e + event := record.Event if transformer != nil { // transform will chang event which lost origin event - sendEvent = e.Clone() + clone := record.Event.Clone() + event = &clone startTime := time.Now() - err = transformer.Execute(&sendEvent) + err := transformer.Execute(event) metrics.TriggerTransformCostSecond.WithLabelValues(t.subscriptionIDStr).Observe(time.Since(startTime).Seconds()) if err != nil { - return -1, err + return nil, err } } + return &toSendEvent{record: record, transform: event}, nil +} + +func (t *trigger) sendEvent(ctx context.Context, events ...*ce.Event) (int, error) { timeoutCtx, cancel := context.WithTimeout(ctx, t.getConfig().DeliveryTimeout) defer cancel() t.rateLimiter.Take() startTime := time.Now() - r := t.getClient().Send(timeoutCtx, sendEvent) + r := t.getClient().Send(timeoutCtx, events...) if r == client.Success { metrics.TriggerPushEventTime.WithLabelValues(t.subscriptionIDStr).Observe(time.Since(startTime).Seconds()) } return r.StatusCode, r.Err } -func (t *trigger) runRetryEventFilter(ctx context.Context) { +func (t *trigger) runRetryEventFilterTransform(ctx context.Context) { for { select { case <-ctx.Done(): return - case event, ok := <-t.retryEventCh: + case record, ok := <-t.retryEventCh: if !ok { return } - t.offsetManager.EventReceive(event.OffsetInfo) - ec, _ := event.Event.Context.(*ce.EventContextV1) - if len(ec.Extensions) == 0 { - t.offsetManager.EventCommit(event.OffsetInfo) - continue - } - v, exist := ec.Extensions[primitive.XVanusSubscriptionID] - if !exist || t.subscriptionIDStr != v.(string) { - t.offsetManager.EventCommit(event.OffsetInfo) - continue - } - startTime := time.Now() - res := filter.Run(t.getFilter(), *event.Event) - metrics.TriggerFilterCostSecond.WithLabelValues(t.subscriptionIDStr).Observe(time.Since(startTime).Seconds()) - if res == filter.FailFilter { - t.offsetManager.EventCommit(event.OffsetInfo) - continue + _ = t.pool.Submit(func() { + t.offsetManager.EventReceive(record.OffsetInfo) + ec, _ := record.Event.Context.(*ce.EventContextV1) + if len(ec.Extensions) == 0 { + t.offsetManager.EventCommit(record.OffsetInfo) + return + } + v, exist := ec.Extensions[primitive.XVanusSubscriptionID] + if !exist || t.subscriptionIDStr != v.(string) { + t.offsetManager.EventCommit(record.OffsetInfo) + return + } + startTime := time.Now() + res := filter.Run(t.getFilter(), *record.Event) + metrics.TriggerFilterCostSecond.WithLabelValues(t.subscriptionIDStr).Observe(time.Since(startTime).Seconds()) + if res == filter.FailFilter { + t.offsetManager.EventCommit(record.OffsetInfo) + return + } + metrics.TriggerFilterMatchRetryEventCounter.WithLabelValues(t.subscriptionIDStr).Inc() + event, err := t.transformEvent(record) + if err != nil { + t.writeFailEvent(ctx, record.Event, ErrTransformCode, err) + t.offsetManager.EventCommit(record.OffsetInfo) + return + } + t.sendCh <- event + }) + } + } +} + +func (t *trigger) runEventFilterTransform(ctx context.Context) { + for { + select { + case <-ctx.Done(): + return + case record, ok := <-t.eventCh: + if !ok { + return } - t.sendCh <- event - metrics.TriggerFilterMatchRetryEventCounter.WithLabelValues(t.subscriptionIDStr).Inc() + _ = t.pool.Submit(func() { + t.offsetManager.EventReceive(record.OffsetInfo) + startTime := time.Now() + res := filter.Run(t.getFilter(), *record.Event) + metrics.TriggerFilterCostSecond.WithLabelValues(t.subscriptionIDStr).Observe(time.Since(startTime).Seconds()) + if res == filter.FailFilter { + t.offsetManager.EventCommit(record.OffsetInfo) + return + } + metrics.TriggerFilterMatchEventCounter.WithLabelValues(t.subscriptionIDStr).Inc() + event, err := t.transformEvent(record) + if err != nil { + t.writeFailEvent(ctx, record.Event, ErrTransformCode, err) + t.offsetManager.EventCommit(record.OffsetInfo) + return + } + t.sendCh <- event + }) } } } -func (t *trigger) runEventFilter(ctx context.Context) { +func (t *trigger) runEventToBatch(ctx context.Context) { + var events []*toSendEvent + ticker := time.NewTicker(500 * time.Millisecond) ////nolint:gomnd + defer ticker.Stop() + var lock sync.Mutex for { select { case <-ctx.Done(): return - case event, ok := <-t.eventCh: + case <-ticker.C: + lock.Lock() + if len(events) != 0 { + e := make([]*toSendEvent, len(events)) + copy(e, events) + t.batchSendCh <- e + events = nil + } + lock.Unlock() + case event, ok := <-t.sendCh: if !ok { return } - t.offsetManager.EventReceive(event.OffsetInfo) - startTime := time.Now() - res := filter.Run(t.getFilter(), *event.Event) - metrics.TriggerFilterCostSecond.WithLabelValues(t.subscriptionIDStr).Observe(time.Since(startTime).Seconds()) - if res == filter.FailFilter { - t.offsetManager.EventCommit(event.OffsetInfo) - continue + lock.Lock() + events = append(events, event) + if !t.batch || len(events) >= t.config.BatchSize { + e := make([]*toSendEvent, len(events)) + copy(e, events) + t.batchSendCh <- e + events = nil } - t.sendCh <- event - metrics.TriggerFilterMatchEventCounter.WithLabelValues(t.subscriptionIDStr).Inc() + lock.Unlock() } } } @@ -273,43 +342,52 @@ func (t *trigger) runEventSend(ctx context.Context) { select { case <-ctx.Done(): return - case event, ok := <-t.sendCh: + case events, ok := <-t.batchSendCh: if !ok { return } if t.config.Ordered { - t.processEvent(ctx, event) + t.processEvent(ctx, events...) } else { - go func(event info.EventRecord) { - t.processEvent(ctx, event) - }(event) + _ = t.pool.Submit(func() { + t.processEvent(ctx, events...) + }) } } } } -func (t *trigger) processEvent(ctx context.Context, event info.EventRecord) { - code, err := t.sendEvent(ctx, event.Event) +func (t *trigger) processEvent(ctx context.Context, events ...*toSendEvent) { + es := make([]*ce.Event, len(events)) + for i := range events { + es[i] = events[i].transform + } + code, err := t.sendEvent(ctx, es...) if err != nil { metrics.TriggerPushEventCounter.WithLabelValues(t.subscriptionIDStr, metrics.LabelValuePushEventFail).Inc() log.Info(ctx, "send event fail", map[string]interface{}{ log.KeyError: err, - "event": event.Event, + "count": len(es), }) if t.config.Ordered { // ordered event no need retry direct into dead letter - code = NoNeedRetryCode + code = OrderEventCode + } + for _, event := range events { + t.writeFailEvent(ctx, event.record.Event, code, err) } - t.writeFailEvent(ctx, event.Event, code, err) } else { metrics.TriggerPushEventCounter.WithLabelValues(t.subscriptionIDStr, metrics.LabelValuePushEventSuccess).Inc() log.Debug(ctx, "send event success", map[string]interface{}{ - "event": event.Event, + "count": len(es), }) } - t.offsetManager.EventCommit(event.OffsetInfo) + for _, event := range events { + t.offsetManager.EventCommit(event.record.OffsetInfo) + } } -func (t *trigger) writeFailEvent(ctx context.Context, e *ce.Event, code int, sendErr error) { + +func (t *trigger) writeFailEvent(ctx context.Context, e *ce.Event, code int, err error) { needRetry, reason := isShouldRetry(code) ec, _ := e.Context.(*ce.EventContextV1) if ec.Extensions == nil { @@ -334,7 +412,7 @@ func (t *trigger) writeFailEvent(ctx context.Context, e *ce.Event, code int, sen } if !needRetry { // dead letter - t.writeEventToDeadLetter(ctx, e, reason, sendErr.Error()) + t.writeEventToDeadLetter(ctx, e, reason, err.Error()) metrics.TriggerDeadLetterEventCounter.WithLabelValues(t.subscriptionIDStr).Inc() return } @@ -457,7 +535,8 @@ func (t *trigger) Init(ctx context.Context) error { t.timerEventWriter = t.client.Eventbus(ctx, primitive.TimerEventbusName).Writer() t.dlEventWriter = t.client.Eventbus(ctx, t.config.DeadLetterEventbus).Writer() t.eventCh = make(chan info.EventRecord, t.config.BufferSize) - t.sendCh = make(chan info.EventRecord, t.config.BufferSize) + t.sendCh = make(chan *toSendEvent, t.config.BufferSize) + t.batchSendCh = make(chan []*toSendEvent, t.config.BufferSize) t.reader = reader.NewReader(t.getReaderConfig(), t.eventCh) t.retryEventCh = make(chan info.EventRecord, t.config.BufferSize) t.retryEventReader = reader.NewReader(t.getRetryEventReaderConfig(), t.retryEventCh) @@ -473,13 +552,12 @@ func (t *trigger) Start(ctx context.Context) error { t.stop = cancel // eb event _ = t.reader.Start() - for i := 0; i < t.config.FilterProcessSize; i++ { - t.wg.StartWithContext(ctx, t.runEventFilter) - } + t.wg.StartWithContext(ctx, t.runEventFilterTransform) + t.wg.StartWithContext(ctx, t.runEventToBatch) t.wg.StartWithContext(ctx, t.runEventSend) // retry event _ = t.retryEventReader.Start() - t.wg.StartWithContext(ctx, t.runRetryEventFilter) + t.wg.StartWithContext(ctx, t.runRetryEventFilterTransform) t.state = TriggerRunning log.Info(ctx, "trigger started", map[string]interface{}{ log.KeySubscriptionID: t.subscription.ID, @@ -499,8 +577,10 @@ func (t *trigger) Stop(ctx context.Context) error { t.retryEventReader.Close() t.wg.Wait() close(t.eventCh) - close(t.sendCh) close(t.retryEventCh) + close(t.sendCh) + close(t.batchSendCh) + t.pool.Release() t.state = TriggerStopped log.Info(ctx, "trigger stopped", map[string]interface{}{ log.KeySubscriptionID: t.subscription.ID, diff --git a/internal/trigger/trigger/trigger_test.go b/internal/trigger/trigger/trigger_test.go index a259dabeb..6178f25f3 100644 --- a/internal/trigger/trigger/trigger_test.go +++ b/internal/trigger/trigger/trigger_test.go @@ -190,7 +190,7 @@ func TestTriggerRunEventSend(t *testing.T) { wg.Add(1) go func() { defer wg.Done() - tg.runEventFilter(ctx) + tg.runEventFilterTransform(ctx) }() time.Sleep(100 * time.Millisecond) So(len(tg.sendCh), ShouldEqual, size) @@ -202,7 +202,7 @@ func TestTriggerRunEventSend(t *testing.T) { wg.Add(1) go func() { defer wg.Done() - tg.runEventSend(ctx) + tg.runEventToBatch(ctx) }() time.Sleep(100 * time.Millisecond) close(tg.sendCh) diff --git a/internal/trigger/trigger/util.go b/internal/trigger/trigger/util.go index c6151f72d..6b8afe9bd 100644 --- a/internal/trigger/trigger/util.go +++ b/internal/trigger/trigger/util.go @@ -34,17 +34,24 @@ func newEventClient(sink primitive.URI, case primitive.GCloudFunctions: _credential, _ := credential.(*primitive.GCloudSinkCredential) return client.NewGCloudFunctionClient(string(sink), _credential.CredentialJSON) + case primitive.GRPC: + return client.NewGRPCClient(string(sink)) default: return client.NewHTTPClient(string(sink)) } } -const NoNeedRetryCode = -1 +const ( + OrderEventCode = -1 + ErrTransformCode = 1 +) func isShouldRetry(statusCode int) (bool, string) { switch statusCode { - case NoNeedRetryCode: - return false, "NoNeedRetry" + case ErrTransformCode: + return false, "TransformError" + case OrderEventCode: + return false, "OrderEvent" case 400: return false, "BadRequest" case 403: diff --git a/proto/pkg/meta/meta.pb.go b/proto/pkg/meta/meta.pb.go index ba358e273..9bbd9b308 100644 --- a/proto/pkg/meta/meta.pb.go +++ b/proto/pkg/meta/meta.pb.go @@ -139,6 +139,7 @@ const ( Protocol_HTTP Protocol = 0 Protocol_AWS_LAMBDA Protocol = 1 Protocol_GCLOUD_FUNCTIONS Protocol = 2 + Protocol_GRPC Protocol = 3 ) // Enum value maps for Protocol. @@ -147,11 +148,13 @@ var ( 0: "HTTP", 1: "AWS_LAMBDA", 2: "GCLOUD_FUNCTIONS", + 3: "GRPC", } Protocol_value = map[string]int32{ "HTTP": 0, "AWS_LAMBDA": 1, "GCLOUD_FUNCTIONS": 2, + "GRPC": 3, } ) @@ -2050,14 +2053,15 @@ var file_meta_proto_rawDesc = []byte{ 0x44, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x53, 0x33, 0x10, 0x03, 0x2a, 0x26, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4c, 0x5a, - 0x34, 0x10, 0x01, 0x2a, 0x3a, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, + 0x34, 0x10, 0x01, 0x2a, 0x44, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x54, 0x54, 0x50, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x57, 0x53, 0x5f, 0x4c, 0x41, 0x4d, 0x42, 0x44, 0x41, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x47, 0x43, 0x4c, - 0x4f, 0x55, 0x44, 0x5f, 0x46, 0x55, 0x4e, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x10, 0x02, 0x42, - 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, - 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4f, 0x55, 0x44, 0x5f, 0x46, 0x55, 0x4e, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x10, 0x02, 0x12, + 0x08, 0x0a, 0x04, 0x47, 0x52, 0x50, 0x43, 0x10, 0x03, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, + 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/proto/proto/meta.proto b/proto/proto/meta.proto index 588395d27..da725e2c4 100644 --- a/proto/proto/meta.proto +++ b/proto/proto/meta.proto @@ -118,6 +118,7 @@ enum Protocol{ HTTP = 0; AWS_LAMBDA = 1; GCLOUD_FUNCTIONS = 2; + GRPC = 3; } message SinkCredential { diff --git a/vsctl/command/subscription.go b/vsctl/command/subscription.go index 9ec8a876b..d4442f029 100644 --- a/vsctl/command/subscription.go +++ b/vsctl/command/subscription.go @@ -87,6 +87,8 @@ func createSubscriptionCommand() *cobra.Command { if sinkCredentialType != GCloudCredentialType { cmdFailedf(cmd, "protocol is aws-lambda, credential-type must be %s\n", GCloudCredentialType) } + case "grpc": + p = meta.Protocol_GRPC default: cmdFailedf(cmd, "protocol is invalid\n") } @@ -213,7 +215,7 @@ func createSubscriptionCommand() *cobra.Command { cmd.Flags().StringVar(&transformer, "transformer", "", "transformer, JSON format required") cmd.Flags().Uint32Var(&rateLimit, "rate-limit", 0, "max event number pushing to sink per second, default is 0, means unlimited") cmd.Flags().StringVar(&from, "from", "", "consume events from, latest,earliest or RFC3339 format time") - cmd.Flags().StringVar(&subProtocol, "protocol", "http", "protocol,http or aws-lambda or gcloud-functions") + cmd.Flags().StringVar(&subProtocol, "protocol", "http", "protocol,http or aws-lambda or gcloud-functions or grpc") cmd.Flags().StringVar(&sinkCredentialType, "credential-type", "", "sink credential type: aws or gcloud") cmd.Flags().StringVar(&sinkCredential, "credential", "", "sink credential info, JSON format or @file") cmd.Flags().Uint32Var(&deliveryTimeout, "delivery-timeout", 0, "event delivery to sink timeout by millisecond, default is 0, means using server-side default value: 5s") @@ -486,6 +488,8 @@ func getSubscriptionRow(sub *meta.Subscription) []interface{} { protocol = "aws-lambda" case meta.Protocol_GCLOUD_FUNCTIONS: protocol = "gcloud-functions" + case meta.Protocol_GRPC: + protocol = "grpc" } result = append(result, protocol) From b7c5d8775e89baea3caa208d97ae0c22d8acd56b Mon Sep 17 00:00:00 2001 From: wenfeng Date: Thu, 5 Jan 2023 16:09:14 +0800 Subject: [PATCH 19/46] feat: enrich vanus test infrastructure (#382) * feat: vanus-bench support batch sending Signed-off-by: wenfeng * update infra Signed-off-by: wenfeng * update Signed-off-by: wenfeng * update Signed-off-by: wenfeng Signed-off-by: wenfeng --- .github/workflows/codecov.yml | 3 +- build/images/controller/Dockerfile | 2 +- build/images/gateway/Dockerfile | 2 +- build/images/store/Dockerfile | 2 +- build/images/timer/Dockerfile | 2 +- build/images/trigger/Dockerfile | 2 +- client/go.mod | 6 +- client/pkg/eventbus/eventbus.go | 4 +- go.mod | 10 +- internal/gateway/proxy/proxy.go | 13 +- internal/raft/transport/host.go | 5 + internal/raft/transport/peer.go | 14 +- internal/store/block/raft/appender.go | 5 +- internal/store/block/raft/transport.go | 27 +- internal/store/io/stream/stream.go | 9 +- internal/store/vsb/block_append.go | 12 + internal/store/vsb/block_read.go | 15 +- internal/store/vsb/block_snapshot.go | 13 +- internal/store/wal/record/record.go | 8 +- pkg/go.mod | 4 +- proto/go.mod | 2 +- raft/go.mod | 2 +- test/benchmark/command/common.go | 4 - test/benchmark/command/component.go | 53 +++- test/benchmark/command/performance.go | 369 +++++++++++++++++-------- test/benchmark/main.go | 4 - test/infra/Dockerfile | 9 +- test/infra/benchmark.yml | 6 +- test/infra/case1/job-a.yml | 6 +- test/infra/case1/job-b.yml | 6 +- test/infra/case1/job-c.yml | 9 +- test/infra/case2/play.sh | 4 +- test/infra/consumer/consumer.yml | 51 ++++ test/infra/consumer/play.sh | 7 + test/infra/producer/play.sh | 14 + test/infra/producer/producer.yml | 47 ++++ test/infra/run.sh | 4 - test/infra/sc.yml | 259 +++++++++++++++++ test/infra/secret.yml.example | 2 +- test/infra/vanus.yml | 83 ++++-- 40 files changed, 874 insertions(+), 225 deletions(-) create mode 100644 test/infra/consumer/consumer.yml create mode 100644 test/infra/consumer/play.sh create mode 100644 test/infra/producer/play.sh create mode 100644 test/infra/producer/producer.yml delete mode 100644 test/infra/run.sh create mode 100644 test/infra/sc.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 16b5db9f5..8c9e77971 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -21,7 +21,8 @@ jobs: startsWith(github.event.pull_request.title, 'fix') || startsWith(github.event.pull_request.title, 'feat') || startsWith(github.event.pull_request.title, 'refactor') || - startsWith(github.event.pull_request.title, 'perf') + startsWith(github.event.pull_request.title, 'perf') || + startsWith(github.event.pull_request.title, 'test') runs-on: ${{ matrix.os }} env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/build/images/controller/Dockerfile b/build/images/controller/Dockerfile index 56fb86ee1..c6be0225c 100644 --- a/build/images/controller/Dockerfile +++ b/build/images/controller/Dockerfile @@ -8,7 +8,7 @@ ARG TARGETOS ARG TARGETARCH RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make build-controller -FROM alpine:3.15.4 +FROM ubuntu:22.10 WORKDIR /vanus COPY --from=builder /workspace/bin/controller bin/controller ENTRYPOINT ["bin/controller"] diff --git a/build/images/gateway/Dockerfile b/build/images/gateway/Dockerfile index 396dc45a9..c335f7831 100644 --- a/build/images/gateway/Dockerfile +++ b/build/images/gateway/Dockerfile @@ -8,7 +8,7 @@ ARG TARGETOS ARG TARGETARCH RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make build-gateway -FROM alpine:3.15.4 +FROM ubuntu:22.10 WORKDIR /vanus COPY --from=builder /workspace/bin/gateway bin/gateway ENTRYPOINT ["bin/gateway"] diff --git a/build/images/store/Dockerfile b/build/images/store/Dockerfile index ebb6d1952..cc33f6d13 100644 --- a/build/images/store/Dockerfile +++ b/build/images/store/Dockerfile @@ -8,7 +8,7 @@ ARG TARGETOS ARG TARGETARCH RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make build-store -FROM alpine:3.15.4 +FROM ubuntu:22.10 WORKDIR /vanus COPY --from=builder /workspace/bin/store bin/store ENTRYPOINT ["bin/store"] diff --git a/build/images/timer/Dockerfile b/build/images/timer/Dockerfile index edaa3a5ec..e67ede69f 100644 --- a/build/images/timer/Dockerfile +++ b/build/images/timer/Dockerfile @@ -8,7 +8,7 @@ ARG TARGETOS ARG TARGETARCH RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make build-timer -FROM alpine:3.15.4 +FROM ubuntu:22.10 WORKDIR /vanus COPY --from=builder /workspace/bin/timer bin/timer ENTRYPOINT ["bin/timer"] diff --git a/build/images/trigger/Dockerfile b/build/images/trigger/Dockerfile index 630f878e1..9b45b92cc 100644 --- a/build/images/trigger/Dockerfile +++ b/build/images/trigger/Dockerfile @@ -8,7 +8,7 @@ ARG TARGETOS ARG TARGETARCH RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make build-trigger -FROM alpine:3.15.4 +FROM ubuntu:22.10 WORKDIR /vanus COPY --from=builder /workspace/bin/trigger bin/trigger ENTRYPOINT ["bin/trigger"] diff --git a/client/go.mod b/client/go.mod index 1aa246039..a7e037dd2 100644 --- a/client/go.mod +++ b/client/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/cloudevents/sdk-go/v2 v2.12.0 github.com/golang/mock v1.6.0 - github.com/linkall-labs/vanus/observability v0.5.1 - github.com/linkall-labs/vanus/pkg v0.5.1 - github.com/linkall-labs/vanus/proto v0.5.1 + github.com/linkall-labs/vanus/observability v0.5.6 + github.com/linkall-labs/vanus/pkg v0.5.6 + github.com/linkall-labs/vanus/proto v0.5.6 github.com/scylladb/go-set v1.0.2 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4 go.opentelemetry.io/otel/trace v1.11.2 diff --git a/client/pkg/eventbus/eventbus.go b/client/pkg/eventbus/eventbus.go index 813a8a806..b42d28745 100644 --- a/client/pkg/eventbus/eventbus.go +++ b/client/pkg/eventbus/eventbus.go @@ -450,7 +450,7 @@ func (w *busWriter) AppendBatch(ctx context.Context, events *cloudevents.CloudEv _ctx, span := w.tracer.Start(ctx, "CloudEventBatch") defer span.End() - var writeOpts *api.WriteOptions = w.opts + var writeOpts = w.opts if len(opts) > 0 { writeOpts = w.opts.Copy() for _, opt := range opts { @@ -475,7 +475,7 @@ func (w *busWriter) AppendOne(ctx context.Context, event *ce.Event, opts ...api. _ctx, span := w.tracer.Start(ctx, "AppendOne") defer span.End() - var writeOpts *api.WriteOptions = w.opts + var writeOpts = w.opts if len(opts) > 0 { writeOpts = w.opts.Copy() for _, opt := range opts { diff --git a/go.mod b/go.mod index dfbe6104f..cf8c85a46 100644 --- a/go.mod +++ b/go.mod @@ -23,11 +23,11 @@ require ( github.com/jedib0t/go-pretty/v6 v6.3.1 github.com/json-iterator/go v1.1.12 github.com/linkall-labs/embed-etcd v0.1.2 - github.com/linkall-labs/vanus/client v0.5.1 - github.com/linkall-labs/vanus/observability v0.5.1 - github.com/linkall-labs/vanus/pkg v0.5.1 - github.com/linkall-labs/vanus/proto v0.5.1 - github.com/linkall-labs/vanus/raft v0.5.1 + github.com/linkall-labs/vanus/client v0.5.6 + github.com/linkall-labs/vanus/observability v0.5.6 + github.com/linkall-labs/vanus/pkg v0.5.6 + github.com/linkall-labs/vanus/proto v0.5.6 + github.com/linkall-labs/vanus/raft v0.5.6 github.com/ncw/directio v1.0.5 github.com/ohler55/ojg v1.14.5 github.com/panjf2000/ants/v2 v2.7.1 diff --git a/internal/gateway/proxy/proxy.go b/internal/gateway/proxy/proxy.go index 7d2b7728c..9f1dffe00 100644 --- a/internal/gateway/proxy/proxy.go +++ b/internal/gateway/proxy/proxy.go @@ -86,6 +86,7 @@ type ControllerProxy struct { triggerCtrl ctrlpb.TriggerControllerClient grpcSrv *grpc.Server ctrl cluster.Cluster + writerMap sync.Map } func (cp *ControllerProxy) Send(ctx context.Context, batch *cloudevents.BatchEvent) (*emptypb.Empty, error) { @@ -102,6 +103,9 @@ func (cp *ControllerProxy) Send(ctx context.Context, batch *cloudevents.BatchEve if err != nil { return nil, v2.NewHTTPResult(http.StatusBadRequest, err.Error()) } + if e.Attributes == nil { + e.Attributes = make(map[string]*cloudevents.CloudEvent_CloudEventAttributeValue, 0) + } e.Attributes[primitive.XVanusEventbus] = &cloudevents.CloudEvent_CloudEventAttributeValue{ Attr: &cloudevents.CloudEvent_CloudEventAttributeValue_CeString{CeString: batch.EventbusName}, } @@ -119,7 +123,14 @@ func (cp *ControllerProxy) Send(ctx context.Context, batch *cloudevents.BatchEve } } - err := cp.client.Eventbus(ctx, batch.GetEventbusName()).Writer().AppendBatch(_ctx, batch.GetEvents()) + val, exist := cp.writerMap.Load(batch.GetEventbusName()) + if !exist { + val, _ = cp.writerMap.LoadOrStore(batch.GetEventbusName(), + cp.client.Eventbus(ctx, batch.GetEventbusName()).Writer()) + } + + w, _ := val.(api.BusWriter) + err := w.AppendBatch(_ctx, batch.GetEvents()) if err != nil { log.Warning(_ctx, "append to failed", map[string]interface{}{ log.KeyError: err, diff --git a/internal/raft/transport/host.go b/internal/raft/transport/host.go index 85135d78d..ec2451632 100644 --- a/internal/raft/transport/host.go +++ b/internal/raft/transport/host.go @@ -17,6 +17,7 @@ package transport import ( // standard libraries. "context" + "github.com/linkall-labs/vanus/observability/log" "sync" // third-party libraries. @@ -80,6 +81,10 @@ func (h *host) Send(ctx context.Context, msg *raftpb.Message, to uint64, endpoin mux := h.resolveMultiplexer(ctx, to, endpoint) if mux == nil { + log.Info(ctx, "found not mux", map[string]interface{}{ + "to": to, + "endpoint": endpoint, + }) cb(ErrNotReachable) return } diff --git a/internal/raft/transport/peer.go b/internal/raft/transport/peer.go index 36d722b12..4e89fd369 100644 --- a/internal/raft/transport/peer.go +++ b/internal/raft/transport/peer.go @@ -31,8 +31,9 @@ import ( ) const ( + minConnectTimeout = 100 * time.Millisecond defaultConnectTimeout = 300 * time.Millisecond - defaultMessageChainSize = 32 + defaultMessageChainSize = 2048 ) type task struct { @@ -148,8 +149,15 @@ func (p *peer) Send(ctx context.Context, msg *raftpb.Message, cb SendCallback) { } func (p *peer) connect(ctx context.Context, opts ...grpc.DialOption) (vsraftpb.RaftServer_SendMessageClient, error) { - ctx, cancel := context.WithTimeout(ctx, defaultConnectTimeout) - defer cancel() + if dl, ok := ctx.Deadline(); !ok { + cancelCtx, cancel := context.WithTimeout(ctx, defaultConnectTimeout) + defer cancel() + ctx = cancelCtx + } else if dl.Sub(time.Now()) < minConnectTimeout { + cancelCtx, cancel := context.WithTimeout(context.Background(), minConnectTimeout) + defer cancel() + ctx = cancelCtx + } conn, err := grpc.DialContext(ctx, p.addr, opts...) if err != nil { diff --git a/internal/store/block/raft/appender.go b/internal/store/block/raft/appender.go index 7d4bcba93..2f84a226e 100644 --- a/internal/store/block/raft/appender.go +++ b/internal/store/block/raft/appender.go @@ -46,6 +46,7 @@ const ( defaultHeartbeatTick = 3 defaultMaxSizePerMsg = 4096 defaultMaxInflightMsgs = 256 + defaultSendTimeout = 80 * time.Millisecond ) type Peer struct { @@ -215,7 +216,9 @@ func (a *appender) run(ctx context.Context) { } // NOTE: Messages to be sent AFTER HardState and Entries are committed to stable storage. - a.send(rCtx, rd.Messages) + sCtx, cancel := context.WithTimeout(rCtx, defaultSendTimeout) + a.send(sCtx, rd.Messages) + cancel() // TODO(james.yin): snapshot if !raft.IsEmptySnap(rd.Snapshot) { diff --git a/internal/store/block/raft/transport.go b/internal/store/block/raft/transport.go index 2adca62f5..d24be2d1e 100644 --- a/internal/store/block/raft/transport.go +++ b/internal/store/block/raft/transport.go @@ -18,11 +18,14 @@ import ( // standard libraries. "context" - // first-party libraries. - "github.com/linkall-labs/vanus/raft/raftpb" + // third-party libraries. "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" + // first-party libraries. + "github.com/linkall-labs/vanus/observability/log" + "github.com/linkall-labs/vanus/raft/raftpb" + // this project. "github.com/linkall-labs/vanus/internal/raft/transport" ) @@ -41,9 +44,15 @@ func (a *appender) send(ctx context.Context, msgs []raftpb.Message) { if len(msgs) == 1 { msg := &msgs[0] - endpoint := a.peerHint(ctx, msg.To) - a.host.Send(ctx, msg, msg.To, endpoint, func(err error) { + to := msg.To + endpoint := a.peerHint(ctx, to) + a.host.Send(ctx, msg, to, endpoint, func(err error) { if err != nil { + log.Warning(ctx, "send message failed", map[string]interface{}{ + log.KeyError: err, + "to": to, + "endpoint": endpoint, + }) a.node.ReportUnreachable(msg.To) } }) @@ -64,6 +73,11 @@ func (a *appender) send(ctx context.Context, msgs []raftpb.Message) { for i := 0; i < len(msgs); i++ { a.host.Send(ctx, &msgs[i], to, endpoint, func(err error) { if err != nil { + log.Warning(ctx, "send message failed", map[string]interface{}{ + log.KeyError: err, + "to": to, + "endpoint": endpoint, + }) a.node.ReportUnreachable(to) } }) @@ -81,6 +95,11 @@ func (a *appender) send(ctx context.Context, msgs []raftpb.Message) { for _, m := range msgs { a.host.Send(ctx, m, to, endpoint, func(err error) { if err != nil { + log.Warning(ctx, "send message failed", map[string]interface{}{ + log.KeyError: err, + "to": to, + "endpoint": endpoint, + }) a.node.ReportUnreachable(to) } }) diff --git a/internal/store/io/stream/stream.go b/internal/store/io/stream/stream.go index e3a59df75..ab73842f5 100644 --- a/internal/store/io/stream/stream.go +++ b/internal/store/io/stream/stream.go @@ -118,6 +118,10 @@ func (s *stream) Append(r stdio.Reader, cb io.WriteCallback) { if empty { s.waiting = append(s.waiting, cb) + if last == nil && !s.dirty { + s.dirty = true + s.startFlushTimer() + } } if last != nil { @@ -241,7 +245,10 @@ func (s *stream) onFlushed(base int64, off int, cbs []io.WriteCallback) { return } - v, _ = s.pending.LoadAndDelete(base) + v, loaded = s.pending.LoadAndDelete(base) + if !loaded { + continue + } ft, _ := v.(*flushTask) // FIXME(james.yin): pass n diff --git a/internal/store/vsb/block_append.go b/internal/store/vsb/block_append.go index 1a04d3136..9534889dd 100644 --- a/internal/store/vsb/block_append.go +++ b/internal/store/vsb/block_append.go @@ -169,8 +169,14 @@ func (b *vsBlock) CommitAppend(ctx context.Context, frag block.Fragment, cb bloc if !archived { b.s.Append(bytes.NewReader(frag.Payload()), func(n int, err error) { + log.Info(context.Background(), "acquiring index write lock", map[string]interface{}{ + "block_id": b.id, + }) b.mu.Lock() b.indexes = append(b.indexes, indexes...) + log.Info(context.Background(), "release index write lock", map[string]interface{}{ + "block_id": b.id, + }) b.mu.Unlock() cb() @@ -183,8 +189,14 @@ func (b *vsBlock) CommitAppend(ctx context.Context, frag block.Fragment, cb bloc b.wg.Add(1) b.s.Append(bytes.NewReader(frag.Payload()), func(n int, err error) { if len(indexes) != 0 { + log.Info(context.Background(), "acquiring index write lock", map[string]interface{}{ + "block_id": b.id, + }) b.mu.Lock() b.indexes = append(b.indexes, indexes...) + log.Info(context.Background(), "release index write lock", map[string]interface{}{ + "block_id": b.id, + }) b.mu.Unlock() } diff --git a/internal/store/vsb/block_read.go b/internal/store/vsb/block_read.go index 4fad2401b..115ea0b44 100644 --- a/internal/store/vsb/block_read.go +++ b/internal/store/vsb/block_read.go @@ -21,6 +21,9 @@ import ( // third-party libraries. "go.opentelemetry.io/otel/trace" + // first-party libraries. + "github.com/linkall-labs/vanus/observability/log" + // this project. "github.com/linkall-labs/vanus/internal/store/block" ) @@ -57,8 +60,18 @@ func (b *vsBlock) Read(ctx context.Context, seq int64, num int) ([]block.Entry, func (b *vsBlock) entryRange(start, num int) (int64, int64, int, error) { // TODO(james.yin): optimize lock. + log.Info(context.Background(), "acquiring index read lock", map[string]interface{}{ + "block_id": b.id, + "start": start, + "num": num, + }) b.mu.RLock() - defer b.mu.RUnlock() + defer func() { + log.Info(context.Background(), "release index read lock", map[string]interface{}{ + "block_id": b.id, + }) + b.mu.RUnlock() + }() sz := len(b.indexes) diff --git a/internal/store/vsb/block_snapshot.go b/internal/store/vsb/block_snapshot.go index 674ddeff7..d25a17132 100644 --- a/internal/store/vsb/block_snapshot.go +++ b/internal/store/vsb/block_snapshot.go @@ -20,6 +20,9 @@ import ( "encoding/binary" "sync/atomic" + // first-party libraries. + "github.com/linkall-labs/vanus/observability/log" + // this project. "github.com/linkall-labs/vanus/internal/store/block" ceschema "github.com/linkall-labs/vanus/internal/store/schema/ce" @@ -30,8 +33,16 @@ import ( var _ block.Snapshoter = (*vsBlock)(nil) func (b *vsBlock) makeSnapshot() (meta, []index.Index) { + log.Info(context.Background(), "acquiring index read lock", map[string]interface{}{ + "block_id": b.id, + }) b.mu.RLock() - defer b.mu.RUnlock() + defer func() { + log.Info(context.Background(), "release index read lock", map[string]interface{}{ + "block_id": b.id, + }) + b.mu.RUnlock() + }() return makeSnapshot(b.actx, b.indexes) } diff --git a/internal/store/wal/record/record.go b/internal/store/wal/record/record.go index 22653228f..6c675f10f 100644 --- a/internal/store/wal/record/record.go +++ b/internal/store/wal/record/record.go @@ -23,12 +23,12 @@ import ( const ( crcFieldSO = 0 - crcFieldEO = crcFieldSO + 4 + crcFieldEO = crcFieldSO + 4 // [0,4) lengthFieldSO = crcFieldEO - lengthFieldEO = lengthFieldSO + 2 + lengthFieldEO = lengthFieldSO + 2 // [4,6) typeFieldSO = lengthFieldEO - typeFieldEO = typeFieldSO + 1 - dataFieldSO = typeFieldEO + typeFieldEO = typeFieldSO + 1 // [6,7) + dataFieldSO = typeFieldEO // [7,n) ) const HeaderSize = dataFieldSO diff --git a/pkg/go.mod b/pkg/go.mod index b9a10d0c6..82e3f8cc5 100644 --- a/pkg/go.mod +++ b/pkg/go.mod @@ -4,8 +4,8 @@ go 1.18 require ( github.com/golang/mock v1.6.0 - github.com/linkall-labs/vanus/observability v0.5.1 - github.com/linkall-labs/vanus/proto v0.5.1 + github.com/linkall-labs/vanus/observability v0.5.6 + github.com/linkall-labs/vanus/proto v0.5.6 github.com/pkg/errors v0.9.1 github.com/smartystreets/goconvey v1.7.2 google.golang.org/grpc v1.51.0 diff --git a/proto/go.mod b/proto/go.mod index 392e168a0..a5ee0c9da 100644 --- a/proto/go.mod +++ b/proto/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/golang/mock v1.6.0 - github.com/linkall-labs/vanus/raft v0.5.1 + github.com/linkall-labs/vanus/raft v0.5.6 google.golang.org/grpc v1.51.0 google.golang.org/protobuf v1.28.1 ) diff --git a/raft/go.mod b/raft/go.mod index 86ec49132..7a439ad2f 100644 --- a/raft/go.mod +++ b/raft/go.mod @@ -6,7 +6,7 @@ require ( github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5 github.com/gogo/protobuf v1.3.2 github.com/golang/protobuf v1.5.2 - github.com/linkall-labs/vanus/observability v0.5.1 + github.com/linkall-labs/vanus/observability v0.5.6 go.etcd.io/etcd/client/pkg/v3 v3.6.0-alpha.0 go.opentelemetry.io/otel/trace v1.11.2 ) diff --git a/test/benchmark/command/common.go b/test/benchmark/command/common.go index 94f232bce..c5fc1d426 100644 --- a/test/benchmark/command/common.go +++ b/test/benchmark/command/common.go @@ -33,10 +33,6 @@ type BlockRecord struct { Replicas map[uint64]string } -func SetCaseName(_name string) { - name = _name -} - type ResultType string const ( diff --git a/test/benchmark/command/component.go b/test/benchmark/command/component.go index 0717d3131..f0f1da42c 100644 --- a/test/benchmark/command/component.go +++ b/test/benchmark/command/component.go @@ -18,6 +18,9 @@ import ( "context" "encoding/json" "fmt" + "github.com/google/uuid" + "github.com/linkall-labs/vanus/internal/primitive/vanus" + "google.golang.org/protobuf/types/known/timestamppb" "math/rand" "net" "net/http" @@ -37,7 +40,7 @@ import ( v1 "github.com/linkall-labs/vanus/proto/pkg/cloudevents" segpb "github.com/linkall-labs/vanus/proto/pkg/segment" - "github.com/linkall-labs/vanus/internal/primitive/vanus" + //"github.com/linkall-labs/vanus/internal/primitive/vanus" "github.com/linkall-labs/vanus/internal/store" "github.com/linkall-labs/vanus/internal/store/config" "github.com/linkall-labs/vanus/internal/store/segment" @@ -55,6 +58,7 @@ var ( noCleanCache bool replicaNum int blockSize int64 + batchSize int ) func ComponentCommand() *cobra.Command { @@ -266,9 +270,10 @@ func sendCommand() *cobra.Command { for idx := 0; idx < parallelism; idx++ { go func(br BlockRecord, c segpb.SegmentServerClient) { for atomic.LoadInt64(&count)+atomic.LoadInt64(&failed) < totalSent { + events := generateEvents() _, err := c.AppendToBlock(context.Background(), &segpb.AppendToBlockRequest{ BlockId: br.LeaderID, - Events: &v1.CloudEventBatch{Events: generateEvents()}, + Events: &v1.CloudEventBatch{Events: events}, }) if err != nil { atomic.AddInt64(&failed, 1) @@ -276,7 +281,7 @@ func sendCommand() *cobra.Command { fmt.Printf("failed to append events to %s, block [%s], error: [%s]\n", br.LeaderAddr, vanus.ID(br.LeaderID).String(), err.Error()) } else { - atomic.AddInt64(&count, 1) + atomic.AddInt64(&count, int64(len(events))) } } }(abr, cli) @@ -298,6 +303,7 @@ func sendCommand() *cobra.Command { cmd.Flags().Int64Var(&totalSent, "total-number", 100000, "") cmd.Flags().IntVar(¶llelism, "parallelism", 4, "") cmd.Flags().IntVar(&payloadSize, "payload-size", 1024, "") + cmd.Flags().IntVar(&batchSize, "batch-size", 1, "") return cmd } @@ -337,21 +343,40 @@ func runStore(cfg store.Config) { } var ( - gOnce sync.Once - rd = rand.New(rand.NewSource(time.Now().UnixNano())) - e []*v1.CloudEvent + rd = rand.New(rand.NewSource(time.Now().UnixNano())) + payload string + mutex sync.RWMutex ) func generateEvents() []*v1.CloudEvent { - gOnce.Do(func() { - e = []*v1.CloudEvent{{ - Id: "example-event", - Source: "example/uri", + mutex.RLock() + defer mutex.RUnlock() + if payload == "" { + mutex.RUnlock() + mutex.Lock() + if payload == "" { + payload = genStr(rd, payloadSize) + } + mutex.Unlock() + mutex.RLock() + } + var e []*v1.CloudEvent + for idx := 0; idx < batchSize; idx++ { + e = append(e, &v1.CloudEvent{ + Id: uuid.NewString(), + Source: "performance.benchmark.vanus", SpecVersion: "1.0", - Type: "example.type", - Data: &v1.CloudEvent_TextData{TextData: genStr(rd, payloadSize)}, - }} - }) + Type: "performance.benchmark.vanus", + Data: &v1.CloudEvent_TextData{TextData: payload}, + Attributes: map[string]*v1.CloudEvent_CloudEventAttributeValue{ + "time": { + Attr: &v1.CloudEvent_CloudEventAttributeValue_CeTimestamp{ + CeTimestamp: timestamppb.New(time.Now()), + }, + }, + }, + }) + } return e } diff --git a/test/benchmark/command/performance.go b/test/benchmark/command/performance.go index 23e899d42..02c93b632 100644 --- a/test/benchmark/command/performance.go +++ b/test/benchmark/command/performance.go @@ -19,6 +19,10 @@ import ( "encoding/json" "errors" "fmt" + "github.com/linkall-labs/vanus/proto/pkg/cloudevents" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/protobuf/types/known/emptypb" "math/rand" "net" "net/http" @@ -31,8 +35,6 @@ import ( "github.com/HdrHistogram/hdrhistogram-go" ce "github.com/cloudevents/sdk-go/v2" - "github.com/cloudevents/sdk-go/v2/client" - "github.com/cloudevents/sdk-go/v2/protocol" cehttp "github.com/cloudevents/sdk-go/v2/protocol/http" "github.com/fatih/color" "github.com/go-redis/redis/v8" @@ -52,18 +54,16 @@ const ( ) var ( - name string eventbusList []string number int64 parallelism int payloadSize int - port int - benchType string + port int + benchType string + clientProtocol string ) -var ebCh = make(chan string, 1024) - func E2ECommand() *cobra.Command { cmd := &cobra.Command{ Use: "e2e SUB-COMMAND", @@ -80,8 +80,6 @@ func runCommand() *cobra.Command { Use: "run SUB-COMMAND", Short: "vanus performance benchmark program", Run: func(cmd *cobra.Command, args []string) { - endpoint := mustGetGatewayEndpoint(cmd) - if len(eventbusList) == 0 { panic("eventbus list is empty") } @@ -90,105 +88,212 @@ func runCommand() *cobra.Command { "id": getBenchmarkID(), }) - // start - start := time.Now() - cnt := int64(0) + if clientProtocol == "grpc" { + sendWithGRPC(cmd) + } else { + sendWithHTTP(cmd) + } + }, + } + cmd.Flags().StringArrayVar(&eventbusList, "eventbus", []string{}, "the eventbus name used to") + cmd.Flags().Int64Var(&number, "number", 100000, "the event number") + cmd.Flags().IntVar(¶llelism, "parallelism", 1, "") + cmd.Flags().IntVar(&payloadSize, "payload-size", 64, "byte") + cmd.Flags().StringVar(&clientProtocol, "protocol", "grpc", "") + cmd.Flags().IntVar(&batchSize, "batch-size", 1, "") + return cmd +} + +func sendWithGRPC(cmd *cobra.Command) { + endpoint := mustGetGatewayEndpoint(cmd) + + // start + start := time.Now() + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + defer cancel() + + opts := []grpc.DialOption{ + grpc.WithBlock(), + grpc.WithTransportCredentials(insecure.NewCredentials()), + } + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + cmdFailedf(cmd, "failed to connect to gateway") + } + + batchClient := cloudevents.NewCloudEventsClient(conn) + + var success int64 + wg := sync.WaitGroup{} + latency := hdrhistogram.New(1, 1000000, 10000) + for _, eb := range eventbusList { + for idx := 0; idx < parallelism; idx++ { + wg.Add(1) go func() { - for atomic.LoadInt64(&cnt) < number { - for idx := 0; idx < len(eventbusList); idx++ { - ebCh <- eventbusList[idx] - atomic.AddInt64(&cnt, 1) + for atomic.LoadInt64(&success) < number { + s := time.Now() + events := generateEvents() + _, err := batchClient.Send(context.Background(), &cloudevents.BatchEvent{ + EventbusName: eb, + Events: &cloudevents.CloudEventBatch{Events: events}, + }) + if err != nil { + log.Warning(context.Background(), "failed to send events", map[string]interface{}{ + log.KeyError: err, + }) + } else { + atomic.AddInt64(&success, int64(len(events))) + if err := latency.RecordValue(time.Now().Sub(s).Microseconds()); err != nil { + panic(err) + } } } - close(ebCh) - log.Info(context.Background(), "all events were made", map[string]interface{}{ - "num": number, - }) + wg.Done() }() + } + } - p, err := ce.NewHTTP() - if err != nil { - cmdFailedf(cmd, "init ce protocol error: %s\n", err) - } - c, err := ce.NewClient(p, ce.WithTimeNow(), ce.WithUUIDs()) - if err != nil { - cmdFailedf(cmd, "create ce client error: %s\n", err) + ctx, can := context.WithCancel(context.Background()) + m := make(map[int]int, 0) + wg2 := sync.WaitGroup{} + wg2.Add(1) + go func() { + var prev int64 + tick := time.NewTicker(time.Second) + c := 1 + defer func() { + tick.Stop() + tps := success - prev + log.Info(nil, fmt.Sprintf("Sent: %d, TPS: %d\n", success, tps), nil) + m[c] = int(tps) + wg2.Done() + }() + for prev < number { + select { + case <-tick.C: + cur := atomic.LoadInt64(&success) + tps := cur - prev + m[c] = int(tps) + log.Info(nil, fmt.Sprintf("Sent: %d, TPS: %d\n", cur, tps), nil) + prev = cur + c++ + case <-ctx.Done(): + return } + } + }() + wg.Wait() + can() + wg2.Wait() + saveTPS(m, "produce") + res := latency.CumulativeDistribution() + unit := "us" + result := map[string]map[string]interface{}{} + for _, v := range res { + if v.Count == 0 { + continue + } - var success int64 - wg := sync.WaitGroup{} - for idx := 0; idx < parallelism; idx++ { - wg.Add(1) - go func() { - for { - eb, ok := <-ebCh - if !ok && eb == "" { - break - } - var target string - if strings.HasPrefix(endpoint, httpPrefix) { - target = fmt.Sprintf("%s/gateway/%s", endpoint, eb) - } else { - target = fmt.Sprintf("%s%s/gateway/%s", httpPrefix, endpoint, eb) - } - r, e := send(c, target) - if e != nil { - panic(e) - } - if r { - atomic.AddInt64(&success, 1) - } - } - wg.Done() - }() - } + result[fmt.Sprintf("%.2f", v.Quantile)] = map[string]interface{}{ + "value": v.ValueAt, + "unit": unit, + "count": v.Count, + } + fmt.Printf("%.2f pct - %d %s, count: %d\n", v.Quantile, v.ValueAt, unit, v.Count) + } + + fmt.Printf("Total: %d\n", latency.TotalCount()) + fmt.Printf("Latency Mean: %.2f %s\n", latency.Mean(), unit) + fmt.Printf("Latency StdDev: %.2f\n", latency.StdDev()) + fmt.Printf("Latency Max: %d %s, Latency Min: %d %s\n", latency.Max(), unit, latency.Min(), "ms") + fmt.Println() + log.Info(nil, "all message were sent", map[string]interface{}{ + "success": success, + "failed": number - success, + "used": time.Now().Sub(start), + }) + _ = rdb.Close() +} - ctx, can := context.WithCancel(context.Background()) - m := make(map[int]int, 0) - wg2 := sync.WaitGroup{} - wg2.Add(1) +func sendWithHTTP(cmd *cobra.Command) { + endpoint := mustGetGatewayEndpoint(cmd) + + // start + start := time.Now() + p, err := ce.NewHTTP() + if err != nil { + cmdFailedf(cmd, "init ce protocol error: %s\n", err) + } + c, err := ce.NewClient(p, ce.WithTimeNow(), ce.WithUUIDs()) + if err != nil { + cmdFailedf(cmd, "create ce client error: %s\n", err) + } + + var success int64 + wg := sync.WaitGroup{} + for _, eb := range eventbusList { + for idx := 0; idx < parallelism; idx++ { + wg.Add(1) go func() { - var prev int64 - tick := time.NewTicker(time.Second) - c := 1 - defer func() { - tick.Stop() - tps := success - prev - log.Info(nil, fmt.Sprintf("Sent: %d, TPS: %d\n", success, tps), nil) - m[c] = int(tps) - wg2.Done() - }() - for prev < number { - select { - case <-tick.C: - cur := atomic.LoadInt64(&success) - tps := cur - prev - m[c] = int(tps) - log.Info(nil, fmt.Sprintf("Sent: %d, TPS: %d\n", cur, tps), nil) - prev = cur - c++ - case <-ctx.Done(): - return + for atomic.LoadInt64(&success) < number { + var target string + if strings.HasPrefix(endpoint, httpPrefix) { + target = fmt.Sprintf("%s/gateway/%s", endpoint, eb) + } else { + target = fmt.Sprintf("%s%s/gateway/%s", httpPrefix, endpoint, eb) + } + r, e := send(c, target) + if e != nil { + panic(e) + } + if r { + atomic.AddInt64(&success, 1) } } + wg.Done() }() - wg.Wait() - can() - wg2.Wait() - saveTPS(m, "produce") - log.Info(nil, "all message were sent", map[string]interface{}{ - "success": success, - "failed": number - success, - "used": time.Now().Sub(start), - }) - _ = rdb.Close() - }, + } } - cmd.Flags().StringArrayVar(&eventbusList, "eventbus", []string{}, "the eventbus name used to") - cmd.Flags().Int64Var(&number, "number", 100000, "the event number") - cmd.Flags().IntVar(¶llelism, "parallelism", 1, "") - cmd.Flags().IntVar(&payloadSize, "payload-size", 64, "byte") - return cmd + + ctx, can := context.WithCancel(context.Background()) + m := make(map[int]int, 0) + wg2 := sync.WaitGroup{} + wg2.Add(1) + go func() { + var prev int64 + tick := time.NewTicker(time.Second) + c := 1 + defer func() { + tick.Stop() + tps := success - prev + log.Info(nil, fmt.Sprintf("Sent: %d, TPS: %d\n", success, tps), nil) + m[c] = int(tps) + wg2.Done() + }() + for prev < number { + select { + case <-tick.C: + cur := atomic.LoadInt64(&success) + tps := cur - prev + m[c] = int(tps) + log.Info(nil, fmt.Sprintf("Sent: %d, TPS: %d\n", cur, tps), nil) + prev = cur + c++ + case <-ctx.Done(): + return + } + } + }() + wg.Wait() + can() + wg2.Wait() + saveTPS(m, "produce") + log.Info(nil, "all message were sent", map[string]interface{}{ + "success": success, + "failed": number - success, + "used": time.Now().Sub(start), + }) + _ = rdb.Close() } func saveTPS(m map[int]int, t string) { @@ -243,15 +348,18 @@ func receiveCommand() *cobra.Command { cmdFailedf(cmd, "init network error: %s", err) } - c, err := client.NewHTTP(cehttp.WithListener(ls), cehttp.WithRequestDataAtContextMiddleware()) - if err != nil { - cmdFailedf(cmd, "init ce http error: %s", err) - } + grpcServer := grpc.NewServer() + + cloudevents.RegisterCloudEventsServer(grpcServer, &testReceiver{}) + log.Info(context.TODO(), fmt.Sprintf("the receiver ready to work at %d", port), map[string]interface{}{ "benchmark_id": getBenchmarkID(), }) - if err := c.StartReceiver(context.Background(), receive); err != nil { - cmdFailedf(cmd, "start cloudevents receiver error: %s", err) + err = grpcServer.Serve(ls) + if err != nil { + log.Error(nil, "grpc server occurred an error", map[string]interface{}{ + log.KeyError: err, + }) } }, } @@ -259,6 +367,20 @@ func receiveCommand() *cobra.Command { return cmd } +type testReceiver struct{} + +func (t testReceiver) Send(ctx context.Context, event *cloudevents.BatchEvent) (*emptypb.Empty, error) { + for idx := range event.Events.GetEvents() { + e := event.Events.GetEvents()[idx] + attr := e.GetAttributes()["time"] + + if err := receive(ctx, e.Id, attr.GetCeTimestamp().AsTime()); err != nil { + return nil, err + } + } + return &emptypb.Empty{}, nil +} + func analyseCommand() *cobra.Command { cmd := &cobra.Command{ Use: "analyse", @@ -295,7 +417,6 @@ func analyseCommand() *cobra.Command { r := &BenchmarkResult{ ID: primitive.NewObjectID(), TaskID: taskID, - CaseName: name, RType: ResultLatency, Values: result, Mean: his.Mean(), @@ -339,7 +460,6 @@ func analyseCommand() *cobra.Command { r = &BenchmarkResult{ ID: primitive.NewObjectID(), TaskID: taskID, - CaseName: name, RType: ResultThroughput, Values: result, Mean: tps.Mean(), @@ -399,10 +519,13 @@ func analyseCommand() *cobra.Command { return cmd } -var receiveOnce = sync.Once{} -var consumingCnt = int64(0) +var ( + receiveOnce = sync.Once{} + consumingCnt = int64(0) + totalTime = int64(0) +) -func receive(_ context.Context, event ce.Event) protocol.Result { +func receive(_ context.Context, id string, t time.Time) error { receiveOnce.Do(func() { prev := int64(0) go func() { @@ -410,20 +533,21 @@ func receive(_ context.Context, event ce.Event) protocol.Result { cur := atomic.LoadInt64(&consumingCnt) tps := cur - prev prev = cur - log.Info(nil, fmt.Sprintf("Received: %d, TPS: %d\n", cur, tps), nil) + log.Info(nil, fmt.Sprintf("Received: %d, TPS: %d, Average Latency: %d us\n", cur, tps, + atomic.LoadInt64(&totalTime)/atomic.LoadInt64(&consumingCnt)), nil) time.Sleep(time.Second) } }() }) - event.SetExtension(eventReceivedAt, time.Now()) + atomic.AddInt64(&totalTime, time.Now().Sub(t).Microseconds()) r := &Record{ - ID: event.ID(), - BornAt: event.Time(), + ID: id, + BornAt: t, ReceivedAt: time.Now(), } cache(r, "receive") atomic.AddInt64(&consumingCnt, 1) - return ce.ResultACK + return nil } func isOutputFormatJSON(cmd *cobra.Command) bool { @@ -435,14 +559,14 @@ func isOutputFormatJSON(cmd *cobra.Command) bool { } func cache(r *Record, key string) { - key = path.Join(redisKey, key, getBenchmarkID()) - data, _ := json.Marshal(r) - cmd := rdb.LPush(context.Background(), key, data) - if cmd.Err() != nil { - log.Warning(context.Background(), "set event to redis failed", map[string]interface{}{ - log.KeyError: cmd.Err(), - }) - } + //key = path.Join(redisKey, key, getBenchmarkID()) + //data, _ := json.Marshal(r) + //cmd := rdb.LPush(context.Background(), key, data) + //if cmd.Err() != nil { + // log.Warning(context.Background(), "set event to redis failed", map[string]interface{}{ + // log.KeyError: cmd.Err(), + // }) + //} } func analyseProduction(ch <-chan *Record, f func(his *hdrhistogram.Histogram, unit string)) { @@ -533,6 +657,13 @@ func cmdFailedf(cmd *cobra.Command, format string, a ...interface{}) { os.Exit(-1) } +var ( + tmpID = uuid.NewString() +) + func getBenchmarkID() string { + if taskID.IsZero() { + return tmpID + } return taskID.Hex() } diff --git a/test/benchmark/main.go b/test/benchmark/main.go index 52a50b297..e629cac79 100644 --- a/test/benchmark/main.go +++ b/test/benchmark/main.go @@ -53,10 +53,6 @@ func main() { rootCmd.AddCommand(command.E2ECommand()) rootCmd.AddCommand(command.ComponentCommand()) rootCmd.PersistentPreRun = func(_ *cobra.Command, _ []string) { - if !caseNames[name] { - panic("invalid case name: " + name) - } - command.SetCaseName(name) command.InitDatabase(redisAddr, fmt.Sprintf(defaultMongoDBURI, mongodbPass), begin, withMongoDB) } rootCmd.PersistentPostRun = func(_ *cobra.Command, _ []string) { diff --git a/test/infra/Dockerfile b/test/infra/Dockerfile index 6f9cdba49..99e2d3656 100644 --- a/test/infra/Dockerfile +++ b/test/infra/Dockerfile @@ -2,7 +2,7 @@ FROM golang:1.18 as builder WORKDIR /workspace COPY . . -RUN go mod download +RUN go mod tidy RUN GOOS=linux GOARCH=amd64 go build -o bin/vanus-bench ./test/benchmark @@ -14,10 +14,7 @@ COPY --from=builder /workspace/bin/vanus-bench /usr/bin/vanus-bench WORKDIR /vanus-bench RUN apt-get update && apt-get install -y curl -RUN curl -O https://download.linkall.com/vsctl/v0.5.1/linux-amd64/vsctl && \ +RUN curl -O https://download.linkall.com/vsctl/v0.5.4/linux-amd64/vsctl && \ mv vsctl /usr/bin/vsctl RUN chmod a+x /usr/bin/vsctl -RUN chmod a+x /usr/bin/vanus-bench -RUN chmod a+x /vanus-bench/run.sh - -ENTRYPOINT ["/vanus-bench/run.sh"] \ No newline at end of file +RUN chmod a+x /usr/bin/vanus-bench \ No newline at end of file diff --git a/test/infra/benchmark.yml b/test/infra/benchmark.yml index 31b5ca8a0..ad25058ad 100644 --- a/test/infra/benchmark.yml +++ b/test/infra/benchmark.yml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Namespace metadata: - name: vanus-bench + name: vanus --- apiVersion: apps/v1 kind: Deployment @@ -9,7 +9,7 @@ metadata: labels: app: redis name: redis - namespace: vanus-bench + namespace: vanus spec: replicas: 1 selector: @@ -31,7 +31,7 @@ metadata: labels: app: redis name: redis - namespace: vanus-bench + namespace: vanus spec: ports: - port: 6379 diff --git a/test/infra/case1/job-a.yml b/test/infra/case1/job-a.yml index d5d7b7300..480aacdc2 100644 --- a/test/infra/case1/job-a.yml +++ b/test/infra/case1/job-a.yml @@ -4,7 +4,7 @@ metadata: labels: app: vanus-bench-case1-a name: vanus-bench-case1-a - namespace: vanus-bench + namespace: vanus spec: parallelism: 1 completions: 1 @@ -17,7 +17,7 @@ spec: spec: restartPolicy: Never containers: - - image: linkall.tencentcloudcr.com/vanus/test-infra:dev + - image: public.ecr.aws/vanus/test-infra:dev imagePullPolicy: Always name: vanus-bench-case1-a env: @@ -30,7 +30,7 @@ spec: - name: VANUS_GATEWAY value: "vanus-gateway.vanus:8080" - name: REDIS_ADDR - value: "redis.vanus-bench:6379" + value: "redis.vanus:6379" - name: MONGODB_PASSWORD valueFrom: secretKeyRef: diff --git a/test/infra/case1/job-b.yml b/test/infra/case1/job-b.yml index a67307088..e7e995dc0 100644 --- a/test/infra/case1/job-b.yml +++ b/test/infra/case1/job-b.yml @@ -4,7 +4,7 @@ metadata: labels: app: vanus-bench-case1-b name: vanus-bench-case1-b - namespace: vanus-bench + namespace: vanus spec: parallelism: 1 completions: 1 @@ -17,7 +17,7 @@ spec: spec: restartPolicy: Never containers: - - image: linkall.tencentcloudcr.com/vanus/test-infra:dev + - image: public.ecr.aws/vanus/test-infra:dev imagePullPolicy: Always name: vanus-bench-case1-b env: @@ -30,7 +30,7 @@ spec: - name: VANUS_GATEWAY value: "vanus-gateway.vanus:8080" - name: REDIS_ADDR - value: "redis.vanus-bench:6379" + value: "redis.vanus:6379" - name: MONGODB_PASSWORD valueFrom: secretKeyRef: diff --git a/test/infra/case1/job-c.yml b/test/infra/case1/job-c.yml index 1cfd20e18..fcefc0d6f 100644 --- a/test/infra/case1/job-c.yml +++ b/test/infra/case1/job-c.yml @@ -4,12 +4,12 @@ metadata: labels: app: vanus-bench-case1-c name: vanus-bench-case1-c - namespace: vanus-bench + namespace: vanus spec: parallelism: 1 completions: 1 backoffLimit: 3 - activeDeadlineSeconds: 3600 + activeDeadlineSeconds: 10000 template: metadata: labels: @@ -17,9 +17,10 @@ spec: spec: restartPolicy: Never containers: - - image: linkall.tencentcloudcr.com/vanus/test-infra:dev + - image: public.ecr.aws/vanus/test-infra:dev imagePullPolicy: Always name: vanus-bench-case1-c + command: ["bash", "-c", "sleep 10000"] env: - name: CASE_NAME value: "case1" @@ -30,7 +31,7 @@ spec: - name: VANUS_GATEWAY value: "vanus-gateway.vanus:8080" - name: REDIS_ADDR - value: "redis.vanus-bench:6379" + value: "redis.vanus:6379" - name: MONGODB_PASSWORD valueFrom: secretKeyRef: diff --git a/test/infra/case2/play.sh b/test/infra/case2/play.sh index 5f5a4c21a..d5ec116ee 100644 --- a/test/infra/case2/play.sh +++ b/test/infra/case2/play.sh @@ -10,10 +10,10 @@ nohup vanus-bench component store run --volume-id 3 --name e2e-component-store-3 # The maximum TPS between 12K to 14K with high shake, and TPS isn't sensitive with payload-size [10B, 1024B] # BUG: it need to wait a seconds to make sure write successfully after a Segment is activated -# vanus-bench component store create-block --name e2e-component-store-1replicas --without-mongodb --replicas 1 --block-size 512 --store-address 127.0.0.1:2149 --number 24 +# vanus-bench component store create-block --name e2e-component-store-1replicas --without-mongodb --replicas 1 --block-size 512 --store-address 127.0.0.1:2149 --number 16 # vanus-bench component store send --name e2e-component-store-1replicas --without-mongodb --no-clean-cache --total-number 1000000 --parallelism 1 --payload-size 1024 # vanus-bench component store create-block --name e2e-component-store-3replicas --without-mongodb --replicas 3 --block-size 512 --number 16 -# vanus-bench component store send --total-number 100000 --parallelism 16 --no-clean-cache --payload-size 10240 --name e2e-component-store-3replicas --without-mongodb +# vanus-bench component store send --total-number 1000000 --parallelism 16 --no-clean-cache --payload-size 1024 --name e2e-component-store-3replicas --without-mongodb --batch-size 32 # ps -ef | grep bench | grep -v "auto" | awk '{print $2}' | xargs kill && rm -rf /Users/wenfeng/tmp/data/test/vanus && rm *.log # redis-cli LTRIM /vanus/test/store/block_records 1 0 \ No newline at end of file diff --git a/test/infra/consumer/consumer.yml b/test/infra/consumer/consumer.yml new file mode 100644 index 000000000..d9c66a444 --- /dev/null +++ b/test/infra/consumer/consumer.yml @@ -0,0 +1,51 @@ +apiVersion: v1 +kind: Service +metadata: + name: vanus-benchmark-consumer + namespace: vanus +spec: + ports: + - name: receiver + port: 8080 + targetPort: 8080 + selector: + app: vanus-benchmark-consumer + type: ClusterIP +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: vanus-benchmark-consumer + name: vanus-benchmark-consumer + namespace: vanus +spec: + replicas: 1 + selector: + matchLabels: + app: vanus-benchmark-consumer + template: + metadata: + annotations: + vanus.dev/metrics.port: "2112" + labels: + app: vanus-benchmark-consumer + spec: + containers: + - image: public.ecr.aws/vanus/test-infra:dev + imagePullPolicy: Always + name: benchmark-consumer +# command: ["sh", "/vanus-bench/consumer/play.sh"] + command: ["bash", "-c", "sleep 1000000"] + env: + - name: JOB_NAME + value: "e2e-benchmark-consumer" + - name: VANUS_GATEWAY + value: "vanus-gateway.vanus:8080" + - name: REDIS_ADDR + value: "redis.vanus:6379" + - name: MONGODB_PASSWORD + valueFrom: + secretKeyRef: + name: benchmark-credentials + key: mongodb_password \ No newline at end of file diff --git a/test/infra/consumer/play.sh b/test/infra/consumer/play.sh new file mode 100644 index 000000000..145edd0c9 --- /dev/null +++ b/test/infra/consumer/play.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -ex + +vanus-bench e2e receive \ + --name "${JOB_NAME}" \ + --redis-addr "${REDIS_ADDR}" \ + --mongodb-password "${MONGODB_PASSWORD}" \ No newline at end of file diff --git a/test/infra/producer/play.sh b/test/infra/producer/play.sh new file mode 100644 index 000000000..05cec917b --- /dev/null +++ b/test/infra/producer/play.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -ex + +vanus-bench e2e run \ + --name "${JOB_NAME}" \ + --eventbus "${JOB_NAME}" \ + --number "${TOTAL_NUMBER}" \ + --parallelism "${PARALLELISM}" \ + --endpoint "${VANUS_GATEWAY}" \ + --payload-size "${PAYLOAD_SIZE}" \ + --redis-addr "${REDIS_ADDR}" \ + --mongodb-password "${MONGODB_PASSWORD}" \ + --batch-size "${BATCH_SIZE}" \ + --begin diff --git a/test/infra/producer/producer.yml b/test/infra/producer/producer.yml new file mode 100644 index 000000000..ed2624f6d --- /dev/null +++ b/test/infra/producer/producer.yml @@ -0,0 +1,47 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: vanus-benchmark-producer + name: vanus-benchmark-producer + namespace: vanus +spec: + replicas: 1 + selector: + matchLabels: + app: vanus-benchmark-producer + template: + metadata: + annotations: + vanus.dev/metrics.port: "2112" + labels: + app: vanus-benchmark-producer + spec: + containers: + - image: public.ecr.aws/vanus/test-infra:dev + imagePullPolicy: Always + name: benchmark-producer +# command: ["sh", "/vanus-bench/producer/play.sh"] + command: ["bash", "-c", "sleep 1000000"] + env: + - name: JOB_NAME + value: "e2e-benchmark-producer" + - name: PAYLOAD_SIZE + value: "1024" + - name: VANUS_GATEWAY + value: "vanus-gateway.vanus:8080" + - name: REDIS_ADDR + value: "redis.vanus:6379" + - name: MONGODB_PASSWORD + valueFrom: + secretKeyRef: + name: benchmark-credentials + key: mongodb_password + - name: EVENTLOG_NUMBER + value: "16" + - name: PARALLELISM + value: "16" + - name: BATCH_SIZE + value: "16" + - name: TOTAL_NUMBER + value: "1000000" \ No newline at end of file diff --git a/test/infra/run.sh b/test/infra/run.sh deleted file mode 100644 index 91d948ede..000000000 --- a/test/infra/run.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -ex - -sh /vanus-bench/"${CASE_NAME}"/play.sh \ No newline at end of file diff --git a/test/infra/sc.yml b/test/infra/sc.yml new file mode 100644 index 000000000..8b110c245 --- /dev/null +++ b/test/infra/sc.yml @@ -0,0 +1,259 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: local-storage + namespace: vanus +provisioner: kubernetes.io/no-provisioner +volumeBindingMode: WaitForFirstConsumer +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: controller-pv1 + namespace: vanus +spec: + capacity: + storage: 20Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: local-storage + local: + path: /var/lib/docker/data/volumes/controller-pv1 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - 10.0.32.6 +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: controller-pv2 + namespace: vanus +spec: + capacity: + storage: 20Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: local-storage + local: + path: /var/lib/docker/data/volumes/controller-pv2 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - 10.0.32.6 +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: controller-pv3 + namespace: vanus +spec: + capacity: + storage: 20Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: local-storage + local: + path: /var/lib/docker/data/volumes/controller-pv3 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - 10.0.32.6 +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: data-vanus-controller-0 + namespace: vanus +spec: + accessModes: + - ReadWriteOnce + storageClassName: local-storage + resources: + requests: + storage: 20Gi +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: data-vanus-controller-1 + namespace: vanus +spec: + accessModes: + - ReadWriteOnce + storageClassName: local-storage + resources: + requests: + storage: 20Gi +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: data-vanus-controller-2 + namespace: vanus +spec: + accessModes: + - ReadWriteOnce + storageClassName: local-storage + resources: + requests: + storage: 20Gi +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: store-pv1 + namespace: vanus +spec: + capacity: + storage: 200Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: local-storage + local: + path: /var/lib/docker/data/volumes/store-pv1 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - 10.0.32.6 +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: store-pv2 + namespace: vanus +spec: + capacity: + storage: 200Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: local-storage + local: + path: /var/lib/docker/data/volumes/store-pv2 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - 10.0.32.6 +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: store-pv3 + namespace: vanus +spec: + capacity: + storage: 200Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: local-storage + local: + path: /var/lib/docker/data/volumes/store-pv3 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - 10.0.32.6 +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: store-pv4 + namespace: vanus +spec: + capacity: + storage: 200Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: local-storage + local: + path: /var/lib/docker/data/volumes/store-pv4 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - 10.0.32.6 +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: data-vanus-store-0 + namespace: vanus +spec: + accessModes: + - ReadWriteOnce + storageClassName: local-storage + resources: + requests: + storage: 200Gi +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: data-vanus-store-1 + namespace: vanus +spec: + accessModes: + - ReadWriteOnce + storageClassName: local-storage + resources: + requests: + storage: 200Gi +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: data-vanus-store-2 + namespace: vanus +spec: + accessModes: + - ReadWriteOnce + storageClassName: local-storage + resources: + requests: + storage: 200Gi +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: data-vanus-store-3 + namespace: vanus +spec: + accessModes: + - ReadWriteOnce + storageClassName: local-storage + resources: + requests: + storage: 200Gi diff --git a/test/infra/secret.yml.example b/test/infra/secret.yml.example index 5440afa23..d4ea9051b 100644 --- a/test/infra/secret.yml.example +++ b/test/infra/secret.yml.example @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: name: benchmark-credentials - namespace: vanus-bench + namespace: vanus type: Opaque data: # echo "your_mongodb_password" | base64 diff --git a/test/infra/vanus.yml b/test/infra/vanus.yml index 6b80d0bc7..98801b6a5 100644 --- a/test/infra/vanus.yml +++ b/test/infra/vanus.yml @@ -1,9 +1,4 @@ apiVersion: v1 -kind: Namespace -metadata: - name: vanus ---- -apiVersion: v1 data: controller.yaml: |- node_id: ${NODE_ID} @@ -15,6 +10,7 @@ data: - vanus-controller-1.vanus-controller:2379 - vanus-controller-2.vanus-controller:2379 data_dir: /data + segment_capacity: 268435456 replicas: 3 metadata: key_prefix: /vanus @@ -74,8 +70,16 @@ data: engine: psync raft: wal: + block_size: 16384 io: engine: psync + parallel: 16 + vsb: + flush_batch_size: 16384 + io: + engine: psync + parallel: 16 + kind: ConfigMap metadata: name: config-store @@ -165,7 +169,7 @@ metadata: name: vanus-gateway namespace: vanus spec: - replicas: 1 + replicas: 3 selector: matchLabels: app: vanus-gateway @@ -177,16 +181,21 @@ spec: app: vanus-gateway spec: containers: - - image: linkall.tencentcloudcr.com/vanus/gateway:dev + - image: public.ecr.aws/vanus/gateway:2621ed7 imagePullPolicy: IfNotPresent name: gateway + resources: + limits: + cpu: 2000m + memory: 8000Mi + requests: + cpu: 2000m + memory: 8000Mi ports: - containerPort: 8080 - name: httpput + name: proxy - containerPort: 8081 - name: httpget - - containerPort: 8082 - name: ctrl-proxy + name: cloudevents volumeMounts: - mountPath: /vanus/config name: config-gateway @@ -203,7 +212,7 @@ metadata: name: vanus-timer namespace: vanus spec: - replicas: 2 + replicas: 1 selector: matchLabels: app: vanus-timer @@ -222,7 +231,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: linkall.tencentcloudcr.com/vanus/timer:dev + image: public.ecr.aws/vanus/timer:2621ed7 imagePullPolicy: IfNotPresent name: timer volumeMounts: @@ -252,17 +261,31 @@ spec: labels: app: vanus-trigger spec: + initContainers: + - name: set-system-parameters + image: busybox + securityContext: + capabilities: { } + privileged: true + command: ["/bin/sh", "-c", "sysctl -w net.ipv4.tcp_tw_reuse=1 && sysctl -w net.ipv4.tcp_fin_timeout=10 && sysctl -w net.ipv4.ip_local_port_range='4096 65000' && sysctl -p"] containers: - env: - name: VANUS_LOG_LEVEL - value: DEBUG + value: INFO - name: POD_IP valueFrom: fieldRef: fieldPath: status.podIP - image: linkall.tencentcloudcr.com/vanus/trigger:dev + image: public.ecr.aws/vanus/trigger:2621ed7 imagePullPolicy: IfNotPresent name: trigger + resources: + limits: + cpu: 8000m + memory: 8000Mi + requests: + cpu: 8000m + memory: 8000Mi ports: - containerPort: 2148 name: grpc @@ -310,9 +333,16 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: linkall.tencentcloudcr.com/vanus/controller:dev + image: public.ecr.aws/vanus/controller:2621ed7 imagePullPolicy: IfNotPresent name: controller + resources: + limits: + cpu: 1000m + memory: 4000Mi + requests: + cpu: 1000m + memory: 4000Mi ports: - containerPort: 2048 name: grpc @@ -339,7 +369,8 @@ spec: spec: accessModes: - ReadWriteOnce - storageClassName: ssd +# storageClassName: ssd + storageClassName: local-storage resources: requests: storage: 20Gi @@ -352,7 +383,7 @@ metadata: name: vanus-store namespace: vanus spec: - replicas: 3 + replicas: 4 selector: matchLabels: app: vanus-store @@ -371,14 +402,21 @@ spec: - VOLUME_ID=${HOSTNAME##*-} /vanus/bin/store env: - name: VANUS_LOG_LEVEL - value: DEBUG + value: INFO - name: POD_IP valueFrom: fieldRef: fieldPath: status.podIP - image: linkall.tencentcloudcr.com/vanus/store:dev + image: public.ecr.aws/vanus/store:2621ed7 imagePullPolicy: IfNotPresent name: store + resources: + limits: + cpu: 4000m + memory: 8000Mi + requests: + cpu: 4000m + memory: 8000Mi ports: - containerPort: 11811 name: grpc @@ -399,7 +437,8 @@ spec: spec: accessModes: - ReadWriteOnce - storageClassName: ssd +# storageClassName: ssd + storageClassName: local-storage resources: requests: - storage: 20Gi + storage: 200Gi From 1ea3797a1c30c632ca985132962a693c8b6d1fe2 Mon Sep 17 00:00:00 2001 From: James Yin Date: Thu, 5 Jan 2023 16:58:00 +0800 Subject: [PATCH 20/46] fix(store): recursive calls cause io worker exhaustion (#385) Signed-off-by: James Yin Signed-off-by: James Yin --- internal/store/vsb/block_append.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/store/vsb/block_append.go b/internal/store/vsb/block_append.go index 9534889dd..91d7b9880 100644 --- a/internal/store/vsb/block_append.go +++ b/internal/store/vsb/block_append.go @@ -204,7 +204,7 @@ func (b *vsBlock) CommitAppend(ctx context.Context, frag block.Fragment, cb bloc m, i := makeSnapshot(b.actx, b.indexes) - b.appendIndexEntry(ctx, i, func(n int, err error) { + go b.appendIndexEntry(ctx, i, func(n int, err error) { defer b.wg.Done() b.indexOffset = m.writeOffset b.indexLength = n From e84055c3b7c296efb6c37062ebd4e14bb0d920fe Mon Sep 17 00:00:00 2001 From: James Yin Date: Thu, 5 Jan 2023 19:08:11 +0800 Subject: [PATCH 21/46] fix(store): broken wal format (#386) Signed-off-by: James Yin Signed-off-by: James Yin --- internal/store/wal/record/packing.go | 4 ++-- internal/store/wal/record/packing_test.go | 2 +- internal/store/wal/record/record.go | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/store/wal/record/packing.go b/internal/store/wal/record/packing.go index 04b4d5487..b8530fe9c 100644 --- a/internal/store/wal/record/packing.go +++ b/internal/store/wal/record/packing.go @@ -19,7 +19,7 @@ func Pack(entry []byte, firstSize, otherSize int) ([]Record, int) { if num == 1 { packet := makePacket(Full, entry) padding := firstSize - packet.Size() - if padding > HeaderSize { + if padding >= HeaderSize { padding = 0 } return []Record{packet}, padding @@ -43,7 +43,7 @@ func Pack(entry []byte, firstSize, otherSize int) ([]Record, int) { packets = append(packets, last) padding := otherSize - last.Size() - if padding > HeaderSize { + if padding >= HeaderSize { padding = 0 } diff --git a/internal/store/wal/record/packing_test.go b/internal/store/wal/record/packing_test.go index 0a5e1a3c2..1223beb69 100644 --- a/internal/store/wal/record/packing_test.go +++ b/internal/store/wal/record/packing_test.go @@ -41,7 +41,7 @@ func TestPack(t *testing.T) { Convey("pack with just enough space in first block", t, func() { records, padding := Pack(rawData, HeaderSize*2+len(rawData), blockSize) So(records, ShouldHaveLength, 1) - So(padding, ShouldEqual, HeaderSize) + So(padding, ShouldEqual, 0) r0 := &records[0] So(r0.Type, ShouldEqual, Full) So(r0.Length, ShouldEqual, len(rawData)) diff --git a/internal/store/wal/record/record.go b/internal/store/wal/record/record.go index 6c675f10f..08c35d4fe 100644 --- a/internal/store/wal/record/record.go +++ b/internal/store/wal/record/record.go @@ -23,15 +23,15 @@ import ( const ( crcFieldSO = 0 - crcFieldEO = crcFieldSO + 4 // [0,4) - lengthFieldSO = crcFieldEO + crcFieldEO = crcFieldSO + 4 // [0,4) + lengthFieldSO = crcFieldEO // 4 lengthFieldEO = lengthFieldSO + 2 // [4,6) - typeFieldSO = lengthFieldEO - typeFieldEO = typeFieldSO + 1 // [6,7) - dataFieldSO = typeFieldEO // [7,n) + typeFieldSO = lengthFieldEO // 6 + typeFieldEO = typeFieldSO + 1 // [6,7) + dataFieldSO = typeFieldEO // [7,n) ) -const HeaderSize = dataFieldSO +const HeaderSize = dataFieldSO // 7 var crc32q = crc32.MakeTable(crc32.Castagnoli) From 394c0e9e83eacae3a9866d12afdb78a5f6d9eeb1 Mon Sep 17 00:00:00 2001 From: James Yin Date: Thu, 5 Jan 2023 20:07:04 +0800 Subject: [PATCH 22/46] fix(store): missing data in async store (#387) Signed-off-by: James Yin Signed-off-by: James Yin --- internal/store/meta/async.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/internal/store/meta/async.go b/internal/store/meta/async.go index 41642c296..1d70b1d6b 100644 --- a/internal/store/meta/async.go +++ b/internal/store/meta/async.go @@ -178,28 +178,34 @@ func (s *AsyncStore) commit() { span.End() }() + s.mu.Lock() + if s.pending.Len() == 0 { + s.mu.Unlock() return } - // Write WAL. - s.mu.RLock() + // Marshal changed data. data, err := s.marshaler.Marshal(SkiplistRange(s.pending)) - s.mu.RUnlock() if err != nil { panic(err) } + + // Update state. + merge(s.committed, s.pending) + s.pending.Init() + + s.mu.Unlock() + + // Write WAL. r, err := s.wal.AppendOne(ctx, data, walog.WithoutBatching()).Wait() if err != nil { panic(err) } - // Update state. s.mu.Lock() defer s.mu.Unlock() - merge(s.committed, s.pending) s.version = r.EO - s.pending.Init() } func merge(dst, src *skiplist.SkipList) { From 303e88adbf4687285b5c08424fcff75d40c24ec3 Mon Sep 17 00:00:00 2001 From: James Yin Date: Thu, 5 Jan 2023 20:07:41 +0800 Subject: [PATCH 23/46] fix(store): break wal format after recover (#389) Signed-off-by: James Yin Signed-off-by: James Yin --- internal/store/block/raft/appender.go | 3 +-- internal/store/io/stream/scheduler.go | 1 - internal/store/io/stream/stream.go | 3 ++- internal/store/wal/wal.go | 6 ++++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/internal/store/block/raft/appender.go b/internal/store/block/raft/appender.go index 2f84a226e..96c9e1a2a 100644 --- a/internal/store/block/raft/appender.go +++ b/internal/store/block/raft/appender.go @@ -277,7 +277,6 @@ func (a *appender) applyEntries(ctx context.Context, committedEntries []raftpb.E span.AddEvent("store.block.raft.appender.applyEntries() Start") defer span.AddEvent("store.block.raft.appender.applyEntries() End") - var cs *raftpb.ConfState for i := 0; i < len(committedEntries); i++ { pbEntry := &committedEntries[i] index := pbEntry.Index @@ -299,7 +298,7 @@ func (a *appender) applyEntries(ctx context.Context, committedEntries []raftpb.E } // Change membership. - cs = a.applyConfChange(ctx, pbEntry) + cs := a.applyConfChange(ctx, pbEntry) ch := make(chan struct{}) go func() { if err := a.log.SetConfState(ctx, *cs); err != nil { diff --git a/internal/store/io/stream/scheduler.go b/internal/store/io/stream/scheduler.go index e5060428c..19ef1428e 100644 --- a/internal/store/io/stream/scheduler.go +++ b/internal/store/io/stream/scheduler.go @@ -72,7 +72,6 @@ func (s *scheduler) Register(z zone.Interface, wo int64) Stream { if err := buf.RecoverFromFile(f, off, int(so)); err != nil { panic(err) } - // FIXME(james.yin): switch buf if it is full. } ss := &stream{ diff --git a/internal/store/io/stream/stream.go b/internal/store/io/stream/stream.go index ab73842f5..c5c30f994 100644 --- a/internal/store/io/stream/stream.go +++ b/internal/store/io/stream/stream.go @@ -118,9 +118,10 @@ func (s *stream) Append(r stdio.Reader, cb io.WriteCallback) { if empty { s.waiting = append(s.waiting, cb) - if last == nil && !s.dirty { + if last == nil { s.dirty = true s.startFlushTimer() + return } } diff --git a/internal/store/wal/wal.go b/internal/store/wal/wal.go index e187b4615..ef361789c 100644 --- a/internal/store/wal/wal.go +++ b/internal/store/wal/wal.go @@ -31,6 +31,7 @@ import ( "github.com/linkall-labs/vanus/internal/store/io/engine" "github.com/linkall-labs/vanus/internal/store/io/stream" "github.com/linkall-labs/vanus/internal/store/io/zone/segmentedfile" + "github.com/linkall-labs/vanus/internal/store/wal/record" ) const ( @@ -132,6 +133,11 @@ func open(ctx context.Context, dir string, cfg config) (*WAL, error) { return nil, err } + // Skip padding. + if padding := int64(cfg.blockSize) - off%int64(cfg.blockSize); padding < record.HeaderSize { + off += padding + } + scheduler := stream.NewScheduler(cfg.engine, cfg.blockSize, cfg.flushTimeout) s := scheduler.Register(sf, off) From 1395ee8899259fa1f780d8f1297d7abfee31a1b1 Mon Sep 17 00:00:00 2001 From: delu Date: Thu, 5 Jan 2023 20:10:06 +0800 Subject: [PATCH 24/46] feat: add trigger config (#388) * feat: add trigger config Signed-off-by: xdlbdy * feat: add trigger config Signed-off-by: xdlbdy * feat: add trigger config Signed-off-by: xdlbdy * feat: add trigger config Signed-off-by: xdlbdy Signed-off-by: xdlbdy --- internal/trigger/config.go | 10 +++- internal/trigger/offset/offset.go | 76 +++++++++++++++--------- internal/trigger/offset/offset_test.go | 9 +-- internal/trigger/reader/reader.go | 13 ++-- internal/trigger/reader/reader_test.go | 6 +- internal/trigger/trigger/config.go | 68 ++++++++++++++------- internal/trigger/trigger/trigger.go | 50 ++++++++-------- internal/trigger/trigger/trigger_test.go | 4 -- internal/trigger/worker.go | 6 +- 9 files changed, 151 insertions(+), 91 deletions(-) diff --git a/internal/trigger/config.go b/internal/trigger/config.go index ae930dbee..e58ed6228 100644 --- a/internal/trigger/config.go +++ b/internal/trigger/config.go @@ -30,7 +30,15 @@ type Config struct { ControllerAddr []string `yaml:"controllers"` Observability observability.Config `yaml:"observability"` - HeartbeatInterval time.Duration + HeartbeatInterval time.Duration `yaml:"heartbeat_interval"` + // send event goroutine size + SendEventGoroutineSize int `yaml:"send_event_goroutine_size"` + // push event batch size when use grpc + SendEventBatchSize int `yaml:"send_event_batch_size"` + // var client read event from segment batch size. + PullEventBatchSize int `yaml:"pull_event_batch_size"` + // max uack event number + MaxUACKEventNumber int `yaml:"max_uack_event_number"` } func InitConfig(filename string) (*Config, error) { diff --git a/internal/trigger/offset/offset.go b/internal/trigger/offset/offset.go index 7b36d0ed5..8b17c42d8 100644 --- a/internal/trigger/offset/offset.go +++ b/internal/trigger/offset/offset.go @@ -15,7 +15,6 @@ package offset import ( - "math" "sync" "github.com/huandu/skiplist" @@ -23,55 +22,82 @@ import ( "github.com/linkall-labs/vanus/internal/primitive/vanus" ) -func NewSubscriptionOffset(id vanus.ID) *SubscriptionOffset { - return &SubscriptionOffset{ +func NewSubscriptionOffset(id vanus.ID, maxUACKNumber int, initOffsets info.ListOffsetInfo) *SubscriptionOffset { + sub := &SubscriptionOffset{ subscriptionID: id, + cond: sync.NewCond(&sync.Mutex{}), + maxUACKNumber: maxUACKNumber, + elOffsets: make(map[vanus.ID]*offsetTracker, len(initOffsets)), } + for _, offset := range initOffsets { + sub.elOffsets[offset.EventLogID] = initOffset(offset.Offset) + } + return sub } type SubscriptionOffset struct { subscriptionID vanus.ID - elOffset sync.Map + cond *sync.Cond + maxUACKNumber int + uACKNumber int + elOffsets map[vanus.ID]*offsetTracker + closed bool } -func (offset *SubscriptionOffset) Clear() { - offset.elOffset.Range(func(key, value interface{}) bool { - offset.elOffset.Delete(key) - return true - }) +func (offset *SubscriptionOffset) Close() { + offset.cond.L.Lock() + defer offset.cond.L.Unlock() + offset.closed = true + offset.cond.Broadcast() } func (offset *SubscriptionOffset) EventReceive(info info.OffsetInfo) { - o, exist := offset.elOffset.Load(info.EventLogID) + offset.cond.L.Lock() + defer offset.cond.L.Unlock() + for offset.uACKNumber >= offset.maxUACKNumber && !offset.closed { + offset.cond.Wait() + } + if offset.closed { + return + } + offset.uACKNumber++ + tracker, exist := offset.elOffsets[info.EventLogID] if !exist { - o, _ = offset.elOffset.LoadOrStore(info.EventLogID, initOffset(info.Offset)) + tracker = initOffset(info.Offset) + offset.elOffsets[info.EventLogID] = tracker } - o.(*offsetTracker).putOffset(info.Offset) + tracker.putOffset(info.Offset) } func (offset *SubscriptionOffset) EventCommit(info info.OffsetInfo) { - o, exist := offset.elOffset.Load(info.EventLogID) + offset.cond.L.Lock() + defer offset.cond.L.Unlock() + if offset.closed { + return + } + tracker, exist := offset.elOffsets[info.EventLogID] if !exist { return } - o.(*offsetTracker).commitOffset(info.Offset) + offset.uACKNumber-- + offset.cond.Signal() + tracker.commitOffset(info.Offset) } func (offset *SubscriptionOffset) GetCommit() info.ListOffsetInfo { + offset.cond.L.Lock() + defer offset.cond.L.Unlock() var commit info.ListOffsetInfo - offset.elOffset.Range(func(key, value interface{}) bool { - tracker, _ := value.(*offsetTracker) + for id, tracker := range offset.elOffsets { commit = append(commit, info.OffsetInfo{ - EventLogID: key.(vanus.ID), + EventLogID: id, Offset: tracker.offsetToCommit(), }) - return true - }) + } return commit } type offsetTracker struct { - mutex sync.Mutex maxOffset uint64 initOffset uint64 list *skiplist.SkipList @@ -80,7 +106,7 @@ type offsetTracker struct { func initOffset(initOffset uint64) *offsetTracker { return &offsetTracker{ initOffset: initOffset, - maxOffset: math.MaxUint64, + maxOffset: initOffset, list: skiplist.New(skiplist.GreaterThanFunc(func(lhs, rhs interface{}) int { v1, _ := lhs.(uint64) v2, _ := rhs.(uint64) @@ -95,23 +121,17 @@ func initOffset(initOffset uint64) *offsetTracker { } func (o *offsetTracker) putOffset(offset uint64) { - o.mutex.Lock() - defer o.mutex.Unlock() o.list.Set(offset, offset) o.maxOffset, _ = o.list.Back().Key().(uint64) } func (o *offsetTracker) commitOffset(offset uint64) { - o.mutex.Lock() - defer o.mutex.Unlock() o.list.Remove(offset) } func (o *offsetTracker) offsetToCommit() uint64 { - o.mutex.Lock() - defer o.mutex.Unlock() if o.list.Len() == 0 { - if o.maxOffset == math.MaxUint64 { + if o.maxOffset == o.initOffset { return o.initOffset } return o.maxOffset + 1 diff --git a/internal/trigger/offset/offset_test.go b/internal/trigger/offset/offset_test.go index bc7e2fd8e..b76e167ed 100644 --- a/internal/trigger/offset/offset_test.go +++ b/internal/trigger/offset/offset_test.go @@ -26,8 +26,8 @@ import ( func TestSubscriptionOffset(t *testing.T) { Convey("subscription offset", t, func() { eventLogID := vanus.NewTestID() - subOffset := NewSubscriptionOffset(vanus.NewTestID()) - Convey("commit with no receive", func() { + Convey("commit with no exist eventlog", func() { + subOffset := NewSubscriptionOffset(vanus.NewTestID(), 100, info.ListOffsetInfo{}) offsetBegin := uint64(1) commitEnd := offsetBegin + 10 for offset := offsetBegin; offset < commitEnd; offset++ { @@ -40,6 +40,7 @@ func TestSubscriptionOffset(t *testing.T) { So(0, ShouldEqual, len(commits)) }) Convey("commit with receive", func() { + subOffset := NewSubscriptionOffset(vanus.NewTestID(), 100, info.ListOffsetInfo{}) offsetBegin := uint64(1) offsetEnd := uint64(100) var wg sync.WaitGroup @@ -88,9 +89,9 @@ func TestSubscriptionOffset(t *testing.T) { commits = subOffset.GetCommit() So(1, ShouldEqual, len(commits)) So(offsetEnd, ShouldEqual, commits[0].Offset) - subOffset.Clear() + subOffset.Close() commits = subOffset.GetCommit() - So(0, ShouldEqual, len(commits)) + So(1, ShouldEqual, len(commits)) }) }) } diff --git a/internal/trigger/reader/reader.go b/internal/trigger/reader/reader.go index 7aa9f3623..4bdb2f26c 100644 --- a/internal/trigger/reader/reader.go +++ b/internal/trigger/reader/reader.go @@ -52,6 +52,7 @@ type Config struct { SubscriptionID vanus.ID SubscriptionIDStr string Offset EventLogOffset + BatchSize int CheckEventLogInterval time.Duration } @@ -255,7 +256,7 @@ func (elReader *eventLogReader) run(ctx context.Context) { } func (elReader *eventLogReader) readEvent(ctx context.Context, lr api.BusReader) error { - events, err := readEvents(ctx, lr, elReader.policy) + events, err := readEvents(ctx, lr) if err != nil { return err } @@ -272,13 +273,14 @@ func (elReader *eventLogReader) readEvent(ctx context.Context, lr api.BusReader) return err } elReader.offset = offset - elReader.policy.Forward(1) } + elReader.policy.Forward(len(events)) metrics.TriggerPullEventCounter.WithLabelValues( elReader.config.SubscriptionIDStr, elReader.config.EventBusName, elReader.eventLogIDStr). Add(float64(len(events))) return nil } + func (elReader *eventLogReader) putEvent(ctx context.Context, event info.EventRecord) error { select { case elReader.events <- event: @@ -288,14 +290,15 @@ func (elReader *eventLogReader) putEvent(ctx context.Context, event info.EventRe } } -func readEvents(ctx context.Context, lr api.BusReader, p api.ReadPolicy) ([]*ce.Event, error) { +func readEvents(ctx context.Context, lr api.BusReader) ([]*ce.Event, error) { timeout, cancel := context.WithTimeout(ctx, readEventTimeout) defer cancel() - events, _, _, err := lr.Read(timeout, option.WithReadPolicy(p), option.WithBatchSize(int(readSize))) + events, _, _, err := lr.Read(timeout) return events, err } func (elReader *eventLogReader) init(ctx context.Context) (api.BusReader, error) { - lr := elReader.config.Client.Eventbus(ctx, elReader.config.EventBusName).Reader() + lr := elReader.config.Client.Eventbus(ctx, elReader.config.EventBusName).Reader( + option.WithReadPolicy(elReader.policy), option.WithBatchSize(elReader.config.BatchSize)) return lr, nil } diff --git a/internal/trigger/reader/reader_test.go b/internal/trigger/reader/reader_test.go index be888b4f8..54476d8dd 100644 --- a/internal/trigger/reader/reader_test.go +++ b/internal/trigger/reader/reader_test.go @@ -41,7 +41,7 @@ func TestReaderStart(t *testing.T) { mockBusReader := api.NewMockBusReader(mockCtrl) mockClient.EXPECT().Eventbus(Any(), Any()).AnyTimes().Return(mockEventbus) mockEventbus.EXPECT().Writer().AnyTimes().Return(mockBusWriter) - mockEventbus.EXPECT().Reader(Any()).AnyTimes().Return(mockBusReader) + mockEventbus.EXPECT().Reader(Any(), Any()).AnyTimes().Return(mockBusReader) mockEventbus.EXPECT().GetLog(Any(), Any()).AnyTimes().Return(mockEventlog, nil) mockEventbus.EXPECT().ListLog(Any()).AnyTimes().Return([]api.Eventlog{mockEventlog}, nil) mockEventlog.EXPECT().ID().AnyTimes().Return(uint64(0)) @@ -51,7 +51,7 @@ func TestReaderStart(t *testing.T) { index := uint64(offset) mockEventlog.EXPECT().LatestOffset(Any()).AnyTimes().Return(offset, nil) mockEventlog.EXPECT().EarliestOffset(Any()).AnyTimes().Return(offset, nil) - mockBusReader.EXPECT().Read(Any(), Any(), Any()).AnyTimes().DoAndReturn( + mockBusReader.EXPECT().Read(Any()).AnyTimes().DoAndReturn( func(ctx context.Context, opts ...api.ReadOption) ([]*ce.Event, int64, uint64, error) { time.Sleep(time.Millisecond) e := ce.NewEvent() @@ -63,7 +63,7 @@ func TestReaderStart(t *testing.T) { return []*ce.Event{&e}, int64(0), uint64(0), nil }) eventCh := make(chan info.EventRecord, 100) - r := NewReader(Config{EventBusName: "test"}, eventCh).(*reader) + r := NewReader(Config{EventBusName: "test", BatchSize: 1}, eventCh).(*reader) r.config.Client = mockClient r.Start() var wg sync.WaitGroup diff --git a/internal/trigger/trigger/config.go b/internal/trigger/trigger/config.go index 0d1377263..2a9f5a77a 100644 --- a/internal/trigger/trigger/config.go +++ b/internal/trigger/trigger/config.go @@ -23,16 +23,15 @@ import ( ) const ( - defaultBufferSize = 1 << 10 - defaultFilterProcessSize = 2 - defaultDeliveryTimeout = 5 * time.Second - defaultMaxWriteAttempt = 3 - defaultGoroutineSize = 10000 - defaultBatchSize = 32 + defaultBufferSize = 1 << 10 + defaultDeliveryTimeout = 5 * time.Second + defaultMaxWriteAttempt = 3 + defaultGoroutineSize = 10000 + defaultMaxUACKNumber = 10000 + defaultBatchSize = 32 ) type Config struct { - FilterProcessSize int BufferSize int MaxRetryAttempts int32 DeliveryTimeout time.Duration @@ -43,34 +42,28 @@ type Config struct { Ordered bool GoroutineSize int - BatchSize int + SendBatchSize int + PullBatchSize int + MaxUACKNumber int } func defaultConfig() Config { c := Config{ - FilterProcessSize: defaultFilterProcessSize, BufferSize: defaultBufferSize, MaxRetryAttempts: primitive.MaxRetryAttempts, DeliveryTimeout: defaultDeliveryTimeout, DeadLetterEventbus: primitive.DeadLetterEventbusName, MaxWriteAttempt: defaultMaxWriteAttempt, GoroutineSize: defaultGoroutineSize, - BatchSize: defaultBatchSize, + SendBatchSize: defaultBatchSize, + MaxUACKNumber: defaultMaxUACKNumber, + PullBatchSize: defaultBatchSize, } return c } type Option func(t *trigger) -func WithFilterProcessSize(size int) Option { - return func(t *trigger) { - if size <= 0 { - return - } - t.config.FilterProcessSize = size - } -} - func WithBufferSize(size int) Option { return func(t *trigger) { if size <= 0 { @@ -102,7 +95,6 @@ func WithDeliveryTimeout(timeout uint32) Option { func WithOrdered(ordered bool) Option { return func(t *trigger) { t.config.Ordered = ordered - t.config.FilterProcessSize = 1 } } @@ -131,3 +123,39 @@ func WithDeadLetterEventbus(eventbus string) Option { t.config.DeadLetterEventbus = eventbus } } + +func WithGoroutineSize(size int) Option { + return func(t *trigger) { + if size <= 0 { + return + } + t.config.GoroutineSize = size + } +} + +func WithSendBatchSize(batchSize int) Option { + return func(t *trigger) { + if batchSize <= 0 { + return + } + t.config.SendBatchSize = batchSize + } +} + +func WithPullBatchSize(batchSize int) Option { + return func(t *trigger) { + if batchSize <= 0 { + return + } + t.config.PullBatchSize = batchSize + } +} + +func WithMaxUACKNumber(maxUACKNumber int) Option { + return func(t *trigger) { + if maxUACKNumber <= 0 { + return + } + t.config.MaxUACKNumber = maxUACKNumber + } +} diff --git a/internal/trigger/trigger/trigger.go b/internal/trigger/trigger/trigger.go index 12b71e10e..56d71cc1b 100644 --- a/internal/trigger/trigger/trigger.go +++ b/internal/trigger/trigger/trigger.go @@ -101,7 +101,6 @@ func NewTrigger(subscription *primitive.Subscription, opts ...Option) Trigger { config: defaultConfig(), state: TriggerCreated, filter: filter.GetFilter(subscription.Filters), - offsetManager: offset.NewSubscriptionOffset(subscription.ID), subscription: subscription, subscriptionIDStr: subscription.ID.String(), transformer: transform.NewTransformer(subscription.Transformer), @@ -113,6 +112,7 @@ func NewTrigger(subscription *primitive.Subscription, opts ...Option) Trigger { if t.rateLimiter == nil { t.rateLimiter = ratelimit.NewUnlimited() } + t.offsetManager = offset.NewSubscriptionOffset(subscription.ID, t.config.MaxUACKNumber, subscription.Offsets) t.pool, _ = ants.NewPool(t.config.GoroutineSize) return t } @@ -239,8 +239,8 @@ func (t *trigger) runRetryEventFilterTransform(ctx context.Context) { if !ok { return } + t.offsetManager.EventReceive(record.OffsetInfo) _ = t.pool.Submit(func() { - t.offsetManager.EventReceive(record.OffsetInfo) ec, _ := record.Event.Context.(*ce.EventContextV1) if len(ec.Extensions) == 0 { t.offsetManager.EventCommit(record.OffsetInfo) @@ -280,8 +280,8 @@ func (t *trigger) runEventFilterTransform(ctx context.Context) { if !ok { return } + t.offsetManager.EventReceive(record.OffsetInfo) _ = t.pool.Submit(func() { - t.offsetManager.EventReceive(record.OffsetInfo) startTime := time.Now() res := filter.Run(t.getFilter(), *record.Event) metrics.TriggerFilterCostSecond.WithLabelValues(t.subscriptionIDStr).Observe(time.Since(startTime).Seconds()) @@ -326,7 +326,7 @@ func (t *trigger) runEventToBatch(ctx context.Context) { } lock.Lock() events = append(events, event) - if !t.batch || len(events) >= t.config.BatchSize { + if !t.batch || len(events) >= t.config.SendBatchSize { e := make([]*toSendEvent, len(events)) copy(e, events) t.batchSendCh <- e @@ -358,13 +358,20 @@ func (t *trigger) runEventSend(ctx context.Context) { } func (t *trigger) processEvent(ctx context.Context, events ...*toSendEvent) { + defer func() { + // commit offset + for _, event := range events { + t.offsetManager.EventCommit(event.record.OffsetInfo) + } + }() es := make([]*ce.Event, len(events)) for i := range events { es[i] = events[i].transform } code, err := t.sendEvent(ctx, es...) if err != nil { - metrics.TriggerPushEventCounter.WithLabelValues(t.subscriptionIDStr, metrics.LabelValuePushEventFail).Inc() + metrics.TriggerPushEventCounter.WithLabelValues(t.subscriptionIDStr, metrics.LabelValuePushEventFail). + Add(float64(len(es))) log.Info(ctx, "send event fail", map[string]interface{}{ log.KeyError: err, "count": len(es), @@ -377,14 +384,12 @@ func (t *trigger) processEvent(ctx context.Context, events ...*toSendEvent) { t.writeFailEvent(ctx, event.record.Event, code, err) } } else { - metrics.TriggerPushEventCounter.WithLabelValues(t.subscriptionIDStr, metrics.LabelValuePushEventSuccess).Inc() + metrics.TriggerPushEventCounter.WithLabelValues(t.subscriptionIDStr, metrics.LabelValuePushEventSuccess). + Add(float64(len(es))) log.Debug(ctx, "send event success", map[string]interface{}{ "count": len(es), }) } - for _, event := range events { - t.offsetManager.EventCommit(event.record.OffsetInfo) - } } func (t *trigger) writeFailEvent(ctx context.Context, e *ce.Event, code int, err error) { @@ -493,38 +498,33 @@ func (t *trigger) writeEventToDeadLetter(ctx context.Context, e *ce.Event, reaso } func (t *trigger) getReaderConfig() reader.Config { - sub := t.subscription return reader.Config{ - EventBusName: sub.EventBus, + EventBusName: t.subscription.EventBus, Client: t.client, - SubscriptionID: sub.ID, - Offset: getOffset(t.offsetManager, sub), + SubscriptionID: t.subscription.ID, + BatchSize: t.config.PullBatchSize, + Offset: getOffset(t.subscription), } } func (t *trigger) getRetryEventReaderConfig() reader.Config { - sub := t.subscription ebName := primitive.RetryEventbusName return reader.Config{ EventBusName: ebName, Client: t.client, - SubscriptionID: sub.ID, - Offset: getOffset(t.offsetManager, sub), + SubscriptionID: t.subscription.ID, + BatchSize: t.config.PullBatchSize, + Offset: getOffset(t.subscription), } } -// getOffset from subscription,if subscriptionOffset exist,use subscriptionOffset. -func getOffset(subscriptionOffset *offset.SubscriptionOffset, sub *primitive.Subscription) map[vanus.ID]uint64 { +// getOffset from subscription. +func getOffset(sub *primitive.Subscription) map[vanus.ID]uint64 { // get offset from subscription offsetMap := make(map[vanus.ID]uint64) for _, o := range sub.Offsets { offsetMap[o.EventLogID] = o.Offset } - // get offset from offset manager - offsets := subscriptionOffset.GetCommit() - for _, offset := range offsets { - offsetMap[offset.EventLogID] = offset.Offset - } return offsetMap } @@ -540,7 +540,6 @@ func (t *trigger) Init(ctx context.Context) error { t.reader = reader.NewReader(t.getReaderConfig(), t.eventCh) t.retryEventCh = make(chan info.EventRecord, t.config.BufferSize) t.retryEventReader = reader.NewReader(t.getRetryEventReaderConfig(), t.retryEventCh) - t.offsetManager.Clear() return nil } @@ -575,12 +574,13 @@ func (t *trigger) Stop(ctx context.Context) error { t.stop() t.reader.Close() t.retryEventReader.Close() - t.wg.Wait() close(t.eventCh) close(t.retryEventCh) close(t.sendCh) close(t.batchSendCh) + t.wg.Wait() t.pool.Release() + t.offsetManager.Close() t.state = TriggerStopped log.Info(ctx, "trigger stopped", map[string]interface{}{ log.KeySubscriptionID: t.subscription.ID, diff --git a/internal/trigger/trigger/trigger_test.go b/internal/trigger/trigger/trigger_test.go index 6178f25f3..ab131f578 100644 --- a/internal/trigger/trigger/trigger_test.go +++ b/internal/trigger/trigger/trigger_test.go @@ -40,11 +40,7 @@ import ( func TestTrigger_Options(t *testing.T) { Convey("test trigger option", t, func() { tg := &trigger{} - WithFilterProcessSize(0)(tg) - So(tg.config.FilterProcessSize, ShouldEqual, 0) size := rand.Intn(1000) + 1 - WithFilterProcessSize(size)(tg) - So(tg.config.FilterProcessSize, ShouldEqual, size) WithDeliveryTimeout(0)(tg) So(tg.config.DeliveryTimeout, ShouldEqual, defaultDeliveryTimeout) size = rand.Intn(1000) + size diff --git a/internal/trigger/worker.go b/internal/trigger/worker.go index 10357e739..ea7c46732 100644 --- a/internal/trigger/worker.go +++ b/internal/trigger/worker.go @@ -255,6 +255,10 @@ func (w *worker) getTriggerOptions(subscription *primitive.Subscription) []trigg trigger.WithDeliveryTimeout(config.DeliveryTimeout), trigger.WithMaxRetryAttempts(config.GetMaxRetryAttempts()), trigger.WithDeadLetterEventbus(config.DeadLetterEventbus), - trigger.WithOrdered(config.OrderedEvent)) + trigger.WithOrdered(config.OrderedEvent), + trigger.WithGoroutineSize(w.config.SendEventGoroutineSize), + trigger.WithSendBatchSize(w.config.SendEventBatchSize), + trigger.WithPullBatchSize(w.config.PullEventBatchSize), + trigger.WithMaxUACKNumber(w.config.MaxUACKEventNumber)) return opts } From 060b7af8e87e0e29a9e99d6f8d4e99400229ffeb Mon Sep 17 00:00:00 2001 From: n-kurasawa Date: Fri, 6 Jan 2023 12:38:01 +0900 Subject: [PATCH 25/46] feat: add transformer function duplicate (#392) * feat: add transformer function duplicate Signed-off-by: n-kurasawa * Update internal/primitive/transform/action/structs/duplicate.go fix the second arg type Co-authored-by: delu Signed-off-by: n-kurasawa Co-authored-by: delu --- .../transform/action/structs/duplicate.go | 57 ++++++++++++++++++ .../action/structs/duplicate_test.go | 60 +++++++++++++++++++ internal/primitive/transform/runtime/init.go | 1 + 3 files changed, 118 insertions(+) create mode 100644 internal/primitive/transform/action/structs/duplicate.go create mode 100644 internal/primitive/transform/action/structs/duplicate_test.go diff --git a/internal/primitive/transform/action/structs/duplicate.go b/internal/primitive/transform/action/structs/duplicate.go new file mode 100644 index 000000000..123d1d53b --- /dev/null +++ b/internal/primitive/transform/action/structs/duplicate.go @@ -0,0 +1,57 @@ +// Copyright 2022 Linkall Inc. +// +// 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 structs + +import ( + "fmt" + + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/common" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" +) + +type duplicateAction struct { + action.CommonAction +} + +// NewDuplicateAction ["duplicate", "sourcePath", "targetPath"]. +func NewDuplicateAction() action.Action { + return &duplicateAction{ + action.CommonAction{ + ActionName: "DUPLICATE", + FixedArgs: []arg.TypeList{arg.EventList, arg.EventList}, + }, + } +} + +func (a *duplicateAction) Init(args []arg.Arg) error { + a.TargetArg = args[1] + a.Args = args[:1] + a.ArgTypes = []common.Type{common.Any} + return nil +} + +func (a *duplicateAction) Execute(ceCtx *context.EventContext) error { + v, _ := a.TargetArg.Evaluate(ceCtx) + if v != nil { + return fmt.Errorf("key %s exist", a.TargetArg.Original()) + } + args, err := a.RunArgs(ceCtx) + if err != nil { + return err + } + return a.TargetArg.SetValue(ceCtx, args[0]) +} diff --git a/internal/primitive/transform/action/structs/duplicate_test.go b/internal/primitive/transform/action/structs/duplicate_test.go new file mode 100644 index 000000000..1034757f8 --- /dev/null +++ b/internal/primitive/transform/action/structs/duplicate_test.go @@ -0,0 +1,60 @@ +// Copyright 2022 Linkall Inc. +// +// 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 structs_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/structs" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestDuplicateAction(t *testing.T) { + funcName := structs.NewDuplicateAction().Name() + Convey("test duplicate", t, func() { + Convey("duplicate target key exist", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "$.data.abc.test"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "abc") + err = a.Execute(&context.EventContext{ + Event: &e, + Data: map[string]interface{}{ + "abc": map[string]interface{}{ + "test": "value", + }, + }, + }) + So(err, ShouldNotBeNil) + }) + Convey("duplicate", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "$.data.abc.test"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "abc") + ceCtx := &context.EventContext{ + Event: &e, + Data: map[string]interface{}{}, + } + err = a.Execute(ceCtx) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, "abc") + So(ceCtx.Data.(map[string]interface{})["abc"].(map[string]interface{})["test"], ShouldEqual, "abc") + }) + }) +} diff --git a/internal/primitive/transform/runtime/init.go b/internal/primitive/transform/runtime/init.go index 70c7d62fe..ce4ceba29 100644 --- a/internal/primitive/transform/runtime/init.go +++ b/internal/primitive/transform/runtime/init.go @@ -33,6 +33,7 @@ func init() { structs.NewReplaceAction, structs.NewMoveAction, structs.NewRenameAction, + structs.NewDuplicateAction, // math math.NewMathAddAction, math.NewMathSubAction, From 5a2e6f22c635c4903a2f79d1aa0c400f28487490 Mon Sep 17 00:00:00 2001 From: wenfeng Date: Fri, 6 Jan 2023 14:01:57 +0800 Subject: [PATCH 26/46] feat: new raft leader balancing algorithm (#390) * feat: new raft leader balancing algorithm Signed-off-by: wenfeng * update vanus.yml Signed-off-by: wenfeng * fix lint & ut Signed-off-by: wenfeng Signed-off-by: wenfeng --- internal/controller/eventbus/block/block.go | 27 ++++- .../controller/eventbus/block/mock_block.go | 16 +++ .../controller/eventbus/block/selector.go | 6 + .../controller/eventbus/eventlog/eventlog.go | 110 ++++++++++++++---- .../eventbus/eventlog/eventlog_test.go | 63 +++++++++- .../controller/eventbus/eventlog/segment.go | 6 +- internal/raft/transport/host.go | 2 +- internal/raft/transport/peer.go | 2 +- internal/store/vsb/block_append.go | 4 +- internal/store/vsb/block_read.go | 4 +- internal/store/vsb/block_snapshot.go | 4 +- test/benchmark/command/performance.go | 17 ++- test/infra/sc.yml | 72 ++++++++++++ test/infra/vanus.yml | 56 +++++---- 14 files changed, 312 insertions(+), 77 deletions(-) diff --git a/internal/controller/eventbus/block/block.go b/internal/controller/eventbus/block/block.go index ff6a70bf3..6bdc42911 100644 --- a/internal/controller/eventbus/block/block.go +++ b/internal/controller/eventbus/block/block.go @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:generate mockgen -source=block.go -destination=mock_block.go -package=block package block import ( @@ -23,6 +24,7 @@ import ( "github.com/huandu/skiplist" "github.com/linkall-labs/vanus/internal/controller/eventbus/metadata" + "github.com/linkall-labs/vanus/internal/controller/eventbus/server" "github.com/linkall-labs/vanus/internal/kv" "github.com/linkall-labs/vanus/internal/primitive/vanus" "github.com/linkall-labs/vanus/observability/log" @@ -38,6 +40,7 @@ const ( type Allocator interface { Run(ctx context.Context, kvCli kv.Client, dynamicAllocate bool) error Pick(ctx context.Context, num int) ([]*metadata.Block, error) + PickByVolumes(ctx context.Context, volumes []vanus.ID) ([]*metadata.Block, error) Stop() } @@ -66,6 +69,18 @@ type allocator struct { blockCapacity int64 } +func (al *allocator) PickByVolumes(ctx context.Context, volumes []vanus.ID) ([]*metadata.Block, error) { + instances := make([]server.Instance, len(volumes)) + for idx := range volumes { + i := al.selector.SelectByID(volumes[idx]) + if i == nil { + return nil, errors.ErrVolumeInstanceNoServer + } + instances[idx] = i + } + return al.pick(ctx, instances) +} + func (al *allocator) Run(ctx context.Context, kvCli kv.Client, startDynamicAllocate bool) error { al.kvClient = kvCli pairs, err := al.kvClient.List(ctx, metadata.BlockKeyPrefixInKVStore) @@ -99,15 +114,19 @@ func (al *allocator) Run(ctx context.Context, kvCli kv.Client, startDynamicAlloc func (al *allocator) Pick(ctx context.Context, num int) ([]*metadata.Block, error) { al.mutex.Lock() defer al.mutex.Unlock() - blockArr := make([]*metadata.Block, num) - instances := al.selector.Select(num, al.blockCapacity) if len(instances) == 0 { return nil, errors.ErrVolumeInstanceNotFound } - for idx := 0; idx < num; idx++ { - ins := instances[idx] + + return al.pick(ctx, instances) +} + +func (al *allocator) pick(ctx context.Context, volumes []server.Instance) ([]*metadata.Block, error) { + blockArr := make([]*metadata.Block, len(volumes)) + for idx := range volumes { var skipList *skiplist.SkipList + ins := volumes[idx] v, exist := al.volumeBlockBuffer.Load(ins.GetMeta().ID.Key()) var err error var block *metadata.Block diff --git a/internal/controller/eventbus/block/mock_block.go b/internal/controller/eventbus/block/mock_block.go index c78f7a227..769fedfa4 100644 --- a/internal/controller/eventbus/block/mock_block.go +++ b/internal/controller/eventbus/block/mock_block.go @@ -11,6 +11,7 @@ import ( gomock "github.com/golang/mock/gomock" metadata "github.com/linkall-labs/vanus/internal/controller/eventbus/metadata" kv "github.com/linkall-labs/vanus/internal/kv" + vanus "github.com/linkall-labs/vanus/internal/primitive/vanus" ) // MockAllocator is a mock of Allocator interface. @@ -51,6 +52,21 @@ func (mr *MockAllocatorMockRecorder) Pick(ctx, num interface{}) *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Pick", reflect.TypeOf((*MockAllocator)(nil).Pick), ctx, num) } +// PickByVolumes mocks base method. +func (m *MockAllocator) PickByVolumes(ctx context.Context, volumes []vanus.ID) ([]*metadata.Block, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PickByVolumes", ctx, volumes) + ret0, _ := ret[0].([]*metadata.Block) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PickByVolumes indicates an expected call of PickByVolumes. +func (mr *MockAllocatorMockRecorder) PickByVolumes(ctx, volumes interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PickByVolumes", reflect.TypeOf((*MockAllocator)(nil).PickByVolumes), ctx, volumes) +} + // Run mocks base method. func (m *MockAllocator) Run(ctx context.Context, kvCli kv.Client, dynamicAllocate bool) error { m.ctrl.T.Helper() diff --git a/internal/controller/eventbus/block/selector.go b/internal/controller/eventbus/block/selector.go index e1439cc1e..d2f24eac4 100644 --- a/internal/controller/eventbus/block/selector.go +++ b/internal/controller/eventbus/block/selector.go @@ -15,11 +15,14 @@ package block import ( + "context" + "fmt" "sort" "sync" "github.com/linkall-labs/vanus/internal/controller/eventbus/server" "github.com/linkall-labs/vanus/internal/primitive/vanus" + "github.com/linkall-labs/vanus/observability/log" ) // VolumeSelector selector for Block creating. The implementation based on different algorithm, typical @@ -83,6 +86,9 @@ func (s *volumeRoundRobinSelector) Select(num int, size int64) []server.Instance for idx := 0; idx < num; idx++ { instances = append(instances, m[keys[(s.count+int64(idx))%int64(len(keys))]]) } + log.Info(context.TODO(), "picked instances", map[string]interface{}{ + "instances": fmt.Sprintf("%v", instances), + }) s.count++ return instances } diff --git a/internal/controller/eventbus/eventlog/eventlog.go b/internal/controller/eventbus/eventlog/eventlog.go index 26cb942ae..dd546e328 100644 --- a/internal/controller/eventbus/eventlog/eventlog.go +++ b/internal/controller/eventbus/eventlog/eventlog.go @@ -18,7 +18,9 @@ package eventlog import ( "context" "encoding/json" + "fmt" "path/filepath" + "sort" "sync" "time" @@ -92,6 +94,7 @@ type eventlogManager struct { cleanInterval time.Duration checkSegmentExpiredInterval time.Duration segmentExpiredTime time.Duration + createSegmentMutex sync.Mutex } func NewManager(volMgr volume.Manager, replicaNum uint, defaultBlockSize int64) Manager { @@ -496,12 +499,6 @@ func (mgr *eventlogManager) dynamicScaleUpEventLog(ctx context.Context) { }) count++ } - /* log too many - log.Debug(ctx, "scale task completed", map[string]interface{}{ - "segment_created": count, - "eventlog_id": el.md.ID.String(), - }) - */ return true }) } @@ -648,7 +645,10 @@ func (mgr *eventlogManager) checkSegmentExpired(ctx context.Context) { } func (mgr *eventlogManager) createSegment(ctx context.Context, el *eventlog) (*Segment, error) { - seg, err := mgr.generateSegment(ctx) + mgr.createSegmentMutex.Lock() + defer mgr.createSegmentMutex.Unlock() + + seg, err := mgr.generateSegment(ctx, el) defer func() { // preparing to cleaning if err != nil { @@ -665,26 +665,49 @@ func (mgr *eventlogManager) createSegment(ctx context.Context, el *eventlog) (*S } seg.EventLogID = el.md.ID - for i := range seg.Replicas.Peers { - seg.Replicas.Leader = i - ins := mgr.volMgr.GetVolumeInstanceByID(seg.GetLeaderBlock().VolumeID) - srv := ins.GetServer() - if srv == nil { - return nil, errors.ErrVolumeInstanceNoServer + cur := el.currentAppendableSegment() + if cur == nil { + blk, err := mgr.whichIsLeader(seg.Replicas.Peers) + if err != nil { + return nil, err } - _, err = srv.GetClient().ActivateSegment(ctx, &segment.ActivateSegmentRequest{ - EventLogId: seg.EventLogID.Uint64(), - ReplicaGroupId: seg.Replicas.ID.Uint64(), - Replicas: mgr.getSegmentTopology(ctx, seg), - }) - if err == nil { - break + seg.Replicas.Leader = blk.ID.Uint64() + } else { + set := false + for _, blk := range seg.Replicas.Peers { + if blk.VolumeID.Equals(cur.GetLeaderBlock().VolumeID) { + seg.Replicas.Leader = blk.ID.Uint64() + set = true + break + } + } + if !set { + log.Error(ctx, "failed to set leader block", map[string]interface{}{ + "eventlog": el.md.ID.Key(), + "eventbus": el.md.EventbusName, + "previous_segment_volume_id": cur.GetLeaderBlock().VolumeID, + "replicas": fmt.Sprintf("%v", seg.Replicas), + "segment": seg.ID.Key(), + }) + return nil, errors.ErrInvalidSegment } + } + + ins := mgr.volMgr.GetVolumeInstanceByID(seg.GetLeaderBlock().VolumeID) + srv := ins.GetServer() + if srv == nil { + return nil, errors.ErrVolumeInstanceNoServer + } + _, err = srv.GetClient().ActivateSegment(ctx, &segment.ActivateSegmentRequest{ + EventLogId: seg.EventLogID.Uint64(), + ReplicaGroupId: seg.Replicas.ID.Uint64(), + Replicas: mgr.getSegmentTopology(ctx, seg), + }) + + if err != nil { log.Warning(context.TODO(), "activate segment failed", map[string]interface{}{ log.KeyError: err, }) - } - if err != nil { return nil, err } @@ -720,9 +743,22 @@ func (mgr *eventlogManager) createSegment(ctx context.Context, el *eventlog) (*S return seg, nil } -func (mgr *eventlogManager) generateSegment(ctx context.Context) (*Segment, error) { +func (mgr *eventlogManager) generateSegment(ctx context.Context, el *eventlog) (*Segment, error) { var seg *Segment - blocks, err := mgr.allocator.Pick(ctx, int(mgr.segmentReplicaNum)) + cur := el.currentAppendableSegment() + var blocks []*metadata.Block + var err error + if cur == nil { + blocks, err = mgr.allocator.Pick(ctx, int(mgr.segmentReplicaNum)) + } else { + // make sure segments of one eventlog located in one SegmentServer + volumes := make([]vanus.ID, 0) + for _, peer := range cur.Replicas.Peers { + volumes = append(volumes, peer.VolumeID) + } + blocks, err = mgr.allocator.PickByVolumes(ctx, volumes) + } + if err != nil { return nil, err } @@ -775,6 +811,32 @@ func (mgr *eventlogManager) generateSegment(ctx context.Context) (*Segment, erro return seg, nil } +func (mgr *eventlogManager) whichIsLeader(raftGroup map[uint64]*metadata.Block) (*metadata.Block, error) { + countMap := map[uint64]int{} + mgr.globalSegmentMap.Range(func(key, value any) bool { + seg, _ := value.(*Segment) + if seg.State == StateWorking { + vID := seg.GetLeaderBlock().VolumeID.Uint64() + count := countMap[vID] + countMap[vID] = count + 1 + } + return true + }) + + volumeMap := make(map[uint64]*metadata.Block, len(raftGroup)) + orderArr := make([]uint64, 0) + for _, node := range raftGroup { + volumeMap[node.VolumeID.Uint64()] = node + orderArr = append(orderArr, node.VolumeID.Uint64()) + } + sort.Slice(orderArr, func(i, j int) bool { + return countMap[orderArr[i]] < countMap[orderArr[j]] || + orderArr[i] < orderArr[j] + }) + + return volumeMap[orderArr[0]], nil +} + type eventlog struct { // uint64, *Segment segmentList *skiplist.SkipList diff --git a/internal/controller/eventbus/eventlog/eventlog_test.go b/internal/controller/eventbus/eventlog/eventlog_test.go index 436c9ac2a..4c19a67a4 100644 --- a/internal/controller/eventbus/eventlog/eventlog_test.go +++ b/internal/controller/eventbus/eventlog/eventlog_test.go @@ -186,6 +186,7 @@ func TestEventlogManager_ScaleSegmentTask(t *testing.T) { ID: vanus.NewTestID(), Capacity: 64 * 1024 * 1024 * 1024, } + vanus.InitFakeSnowflake() alloc.EXPECT().Run(gomock.Any(), gomock.Any(), gomock.Any()).Times(1).Return(nil) alloc.EXPECT().Pick(gomock.Any(), 3).AnyTimes().DoAndReturn(func(ctx stdCtx.Context, num int) ([]*metadata.Block, error) { return []*metadata.Block{ @@ -207,6 +208,26 @@ func TestEventlogManager_ScaleSegmentTask(t *testing.T) { }, nil }) + alloc.EXPECT().PickByVolumes(gomock.Any(), gomock.Any()).AnyTimes().DoAndReturn(func(ctx stdCtx.Context, volumes []vanus.ID) ([]*metadata.Block, error) { + return []*metadata.Block{ + { + ID: vanus.NewTestID(), + Capacity: 64 * 1024 * 1024, + VolumeID: vol1.ID, + }, + { + ID: vanus.NewTestID(), + Capacity: 64 * 1024 * 1024, + VolumeID: vol1.ID, + }, + { + ID: vanus.NewTestID(), + Capacity: 64 * 1024 * 1024, + VolumeID: vol1.ID, + }, + }, nil + }) + volIns := server.NewMockInstance(ctrl) volMgr.EXPECT().GetVolumeInstanceByID(vol1.ID).AnyTimes().Return(volIns) srv := server.NewMockServer(ctrl) @@ -285,6 +306,7 @@ func TestEventlogManager_CleanSegmentTask(t *testing.T) { utMgr.volMgr = volMgr kvCli := kv.NewMockClient(ctrl) utMgr.kvClient = kvCli + vanus.InitFakeSnowflake() ctx := stdCtx.Background() kvCli.EXPECT().Set(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(nil) @@ -314,6 +336,25 @@ func TestEventlogManager_CleanSegmentTask(t *testing.T) { }, }, nil }) + alloc.EXPECT().PickByVolumes(gomock.Any(), gomock.Any()).AnyTimes().DoAndReturn(func(ctx stdCtx.Context, volumes []vanus.ID) ([]*metadata.Block, error) { + return []*metadata.Block{ + { + ID: vanus.NewTestID(), + Capacity: 64 * 1024 * 1024, + VolumeID: vol1.ID, + }, + { + ID: vanus.NewTestID(), + Capacity: 64 * 1024 * 1024, + VolumeID: vol1.ID, + }, + { + ID: vanus.NewTestID(), + Capacity: 64 * 1024 * 1024, + VolumeID: vol1.ID, + }, + }, nil + }) volIns := server.NewMockInstance(ctrl) volMgr.EXPECT().GetVolumeInstanceByID(vol1.ID).AnyTimes().Return(volIns) @@ -380,6 +421,7 @@ func TestEventlogManager_CreateAndGetEventlog(t *testing.T) { kvCli := kv.NewMockClient(ctrl) utMgr.kvClient = kvCli + vanus.InitFakeSnowflake() ctx := stdCtx.Background() kvCli.EXPECT().Set(gomock.Any(), gomock.Any(), gomock.Any()).Times(14).Return(nil) alloc := block.NewMockAllocator(ctrl) @@ -388,7 +430,26 @@ func TestEventlogManager_CreateAndGetEventlog(t *testing.T) { ID: vanus.NewTestID(), Capacity: 64 * 1024 * 1024 * 1024, } - alloc.EXPECT().Pick(ctx, 3).Times(2).DoAndReturn(func(ctx stdCtx.Context, num int) ([]*metadata.Block, error) { + alloc.EXPECT().Pick(ctx, 3).Times(1).DoAndReturn(func(ctx stdCtx.Context, num int) ([]*metadata.Block, error) { + return []*metadata.Block{ + { + ID: vanus.NewTestID(), + Capacity: 64 * 1024 * 1024, + VolumeID: vol1.ID, + }, + { + ID: vanus.NewTestID(), + Capacity: 64 * 1024 * 1024, + VolumeID: vol1.ID, + }, + { + ID: vanus.NewTestID(), + Capacity: 64 * 1024 * 1024, + VolumeID: vol1.ID, + }, + }, nil + }) + alloc.EXPECT().PickByVolumes(gomock.Any(), gomock.Any()).Times(1).DoAndReturn(func(ctx stdCtx.Context, volumes []vanus.ID) ([]*metadata.Block, error) { return []*metadata.Block{ { ID: vanus.NewTestID(), diff --git a/internal/controller/eventbus/eventlog/segment.go b/internal/controller/eventbus/eventlog/segment.go index a726fb88b..c9f6eb921 100644 --- a/internal/controller/eventbus/eventlog/segment.go +++ b/internal/controller/eventbus/eventlog/segment.go @@ -125,8 +125,10 @@ func (seg *Segment) Copy() Segment { } type ReplicaGroup struct { - ID vanus.ID `json:"id"` - Leader uint64 `json:"leader"` + ID vanus.ID `json:"id"` + // the id of LeaderBlock + Leader uint64 `json:"leader"` + // blockID *metadata.Block Peers map[uint64]*metadata.Block `json:"blocks"` Term uint64 `json:"term"` CreateAt time.Time `json:"create_at"` diff --git a/internal/raft/transport/host.go b/internal/raft/transport/host.go index ec2451632..be49e9dc2 100644 --- a/internal/raft/transport/host.go +++ b/internal/raft/transport/host.go @@ -17,7 +17,6 @@ package transport import ( // standard libraries. "context" - "github.com/linkall-labs/vanus/observability/log" "sync" // third-party libraries. @@ -25,6 +24,7 @@ import ( "go.opentelemetry.io/otel/trace" // first-party libraries. + "github.com/linkall-labs/vanus/observability/log" "github.com/linkall-labs/vanus/observability/tracing" "github.com/linkall-labs/vanus/raft/raftpb" ) diff --git a/internal/raft/transport/peer.go b/internal/raft/transport/peer.go index 4e89fd369..9ce483376 100644 --- a/internal/raft/transport/peer.go +++ b/internal/raft/transport/peer.go @@ -153,7 +153,7 @@ func (p *peer) connect(ctx context.Context, opts ...grpc.DialOption) (vsraftpb.R cancelCtx, cancel := context.WithTimeout(ctx, defaultConnectTimeout) defer cancel() ctx = cancelCtx - } else if dl.Sub(time.Now()) < minConnectTimeout { + } else if time.Until(dl) < minConnectTimeout { cancelCtx, cancel := context.WithTimeout(context.Background(), minConnectTimeout) defer cancel() ctx = cancelCtx diff --git a/internal/store/vsb/block_append.go b/internal/store/vsb/block_append.go index 91d7b9880..a642b6f63 100644 --- a/internal/store/vsb/block_append.go +++ b/internal/store/vsb/block_append.go @@ -169,7 +169,7 @@ func (b *vsBlock) CommitAppend(ctx context.Context, frag block.Fragment, cb bloc if !archived { b.s.Append(bytes.NewReader(frag.Payload()), func(n int, err error) { - log.Info(context.Background(), "acquiring index write lock", map[string]interface{}{ + log.Debug(context.Background(), "acquiring index write lock", map[string]interface{}{ "block_id": b.id, }) b.mu.Lock() @@ -189,7 +189,7 @@ func (b *vsBlock) CommitAppend(ctx context.Context, frag block.Fragment, cb bloc b.wg.Add(1) b.s.Append(bytes.NewReader(frag.Payload()), func(n int, err error) { if len(indexes) != 0 { - log.Info(context.Background(), "acquiring index write lock", map[string]interface{}{ + log.Debug(context.Background(), "acquiring index write lock", map[string]interface{}{ "block_id": b.id, }) b.mu.Lock() diff --git a/internal/store/vsb/block_read.go b/internal/store/vsb/block_read.go index 115ea0b44..470c29ef3 100644 --- a/internal/store/vsb/block_read.go +++ b/internal/store/vsb/block_read.go @@ -60,14 +60,14 @@ func (b *vsBlock) Read(ctx context.Context, seq int64, num int) ([]block.Entry, func (b *vsBlock) entryRange(start, num int) (int64, int64, int, error) { // TODO(james.yin): optimize lock. - log.Info(context.Background(), "acquiring index read lock", map[string]interface{}{ + log.Debug(context.Background(), "acquiring index read lock", map[string]interface{}{ "block_id": b.id, "start": start, "num": num, }) b.mu.RLock() defer func() { - log.Info(context.Background(), "release index read lock", map[string]interface{}{ + log.Debug(context.Background(), "release index read lock", map[string]interface{}{ "block_id": b.id, }) b.mu.RUnlock() diff --git a/internal/store/vsb/block_snapshot.go b/internal/store/vsb/block_snapshot.go index d25a17132..b67aad287 100644 --- a/internal/store/vsb/block_snapshot.go +++ b/internal/store/vsb/block_snapshot.go @@ -33,12 +33,12 @@ import ( var _ block.Snapshoter = (*vsBlock)(nil) func (b *vsBlock) makeSnapshot() (meta, []index.Index) { - log.Info(context.Background(), "acquiring index read lock", map[string]interface{}{ + log.Debug(context.Background(), "acquiring index read lock", map[string]interface{}{ "block_id": b.id, }) b.mu.RLock() defer func() { - log.Info(context.Background(), "release index read lock", map[string]interface{}{ + log.Debug(context.Background(), "release index read lock", map[string]interface{}{ "block_id": b.id, }) b.mu.RUnlock() diff --git a/test/benchmark/command/performance.go b/test/benchmark/command/performance.go index 02c93b632..1a2551f18 100644 --- a/test/benchmark/command/performance.go +++ b/test/benchmark/command/performance.go @@ -116,12 +116,6 @@ func sendWithGRPC(cmd *cobra.Command) { grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()), } - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - cmdFailedf(cmd, "failed to connect to gateway") - } - - batchClient := cloudevents.NewCloudEventsClient(conn) var success int64 wg := sync.WaitGroup{} @@ -130,6 +124,11 @@ func sendWithGRPC(cmd *cobra.Command) { for idx := 0; idx < parallelism; idx++ { wg.Add(1) go func() { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + cmdFailedf(cmd, "failed to connect to gateway") + } + batchClient := cloudevents.NewCloudEventsClient(conn) for atomic.LoadInt64(&success) < number { s := time.Now() events := generateEvents() @@ -199,7 +198,7 @@ func sendWithGRPC(cmd *cobra.Command) { "unit": unit, "count": v.Count, } - fmt.Printf("%.2f pct - %d %s, count: %d\n", v.Quantile, v.ValueAt, unit, v.Count) + fmt.Printf("%.2f pct - %d %s\n", v.Quantile, v.ValueAt, unit) } fmt.Printf("Total: %d\n", latency.TotalCount()) @@ -405,7 +404,7 @@ func analyseCommand() *cobra.Command { "unit": unit, "count": v.Count, } - fmt.Printf("%.2f pct - %d %s, count: %d\n", v.Quantile, v.ValueAt, unit, v.Count) + fmt.Printf("%.2f pct - %d %s\n", v.Quantile, v.ValueAt, unit) } fmt.Printf("Total: %d\n", his.TotalCount()) @@ -450,7 +449,7 @@ func analyseCommand() *cobra.Command { continue } - fmt.Printf("%3.2f pct - %d, count: %d\n", v.Quantile, v.ValueAt, v.Count) + fmt.Printf("%3.2f pct - %d\n", v.Quantile, v.ValueAt) } fmt.Printf("Used: %d s\n", tps.TotalCount()) fmt.Printf("TPS Mean: %.2f/s\n", tps.Mean()) diff --git a/test/infra/sc.yml b/test/infra/sc.yml index 8b110c245..45845c74e 100644 --- a/test/infra/sc.yml +++ b/test/infra/sc.yml @@ -206,6 +206,52 @@ spec: values: - 10.0.32.6 --- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: store-pv5 + namespace: vanus +spec: + capacity: + storage: 200Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: local-storage + local: + path: /var/lib/docker/data/volumes/store-pv5 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - 10.0.32.6 +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: store-pv6 + namespace: vanus +spec: + capacity: + storage: 200Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: local-storage + local: + path: /var/lib/docker/data/volumes/store-pv6 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - 10.0.32.6 +--- kind: PersistentVolumeClaim apiVersion: v1 metadata: @@ -257,3 +303,29 @@ spec: resources: requests: storage: 200Gi +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: data-vanus-store-4 + namespace: vanus +spec: + accessModes: + - ReadWriteOnce + storageClassName: local-storage + resources: + requests: + storage: 200Gi +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: data-vanus-store-5 + namespace: vanus +spec: + accessModes: + - ReadWriteOnce + storageClassName: local-storage + resources: + requests: + storage: 200Gi \ No newline at end of file diff --git a/test/infra/vanus.yml b/test/infra/vanus.yml index 98801b6a5..e43778f58 100644 --- a/test/infra/vanus.yml +++ b/test/infra/vanus.yml @@ -116,6 +116,10 @@ data: trigger.yaml: |- port: 2148 ip : ${POD_IP} + send_event_goroutine_size: 1000 + send_event_batch_size: 32 + pull_event_batch_size: 32 + max_uack_event_number: 10000 controllers: - vanus-controller-0.vanus-controller.vanus.svc:2048 - vanus-controller-1.vanus-controller.vanus.svc:2048 @@ -145,18 +149,12 @@ metadata: namespace: vanus spec: ports: - - name: put - nodePort: 30001 - port: 8080 + - name: proxy targetPort: 8080 - - name: get - nodePort: 30002 - port: 8081 + port: 8080 + - name: cloudevents targetPort: 8081 - - name: ctrl-proxy - nodePort: 30003 - port: 8082 - targetPort: 8082 + port: 8081 selector: app: vanus-gateway type: NodePort @@ -169,7 +167,7 @@ metadata: name: vanus-gateway namespace: vanus spec: - replicas: 3 + replicas: 2 selector: matchLabels: app: vanus-gateway @@ -181,16 +179,16 @@ spec: app: vanus-gateway spec: containers: - - image: public.ecr.aws/vanus/gateway:2621ed7 + - image: public.ecr.aws/vanus/gateway:7b1a23d imagePullPolicy: IfNotPresent name: gateway resources: limits: - cpu: 2000m - memory: 8000Mi + cpu: 4000m + memory: 4000Mi requests: - cpu: 2000m - memory: 8000Mi + cpu: 4000m + memory: 4000Mi ports: - containerPort: 8080 name: proxy @@ -231,7 +229,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/timer:2621ed7 + image: public.ecr.aws/vanus/timer:7b1a23d imagePullPolicy: IfNotPresent name: timer volumeMounts: @@ -276,16 +274,16 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/trigger:2621ed7 + image: public.ecr.aws/vanus/trigger:7b1a23d imagePullPolicy: IfNotPresent name: trigger resources: limits: - cpu: 8000m - memory: 8000Mi + cpu: 12000m + memory: 12000Mi requests: - cpu: 8000m - memory: 8000Mi + cpu: 12000m + memory: 12000Mi ports: - containerPort: 2148 name: grpc @@ -333,7 +331,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/controller:2621ed7 + image: public.ecr.aws/vanus/controller:7b1a23d imagePullPolicy: IfNotPresent name: controller resources: @@ -383,7 +381,7 @@ metadata: name: vanus-store namespace: vanus spec: - replicas: 4 + replicas: 6 selector: matchLabels: app: vanus-store @@ -407,16 +405,16 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/store:2621ed7 + image: public.ecr.aws/vanus/store:7b1a23d imagePullPolicy: IfNotPresent name: store resources: limits: - cpu: 4000m - memory: 8000Mi + cpu: 2000m + memory: 4000Mi requests: - cpu: 4000m - memory: 8000Mi + cpu: 2000m + memory: 4000Mi ports: - containerPort: 11811 name: grpc From 6b23e5a207e7621c450e11dbfb9b4b0875c183e6 Mon Sep 17 00:00:00 2001 From: jyjiangkai Date: Fri, 6 Jan 2023 14:33:08 +0800 Subject: [PATCH 27/46] feat: add Publish&Subscribe api (#393) * feat: add Publish&Subscribe api Signed-off-by: jyjiangkai * fix golint Signed-off-by: jyjiangkai * fix review comments Signed-off-by: jyjiangkai Signed-off-by: jyjiangkai --- deploy/all-in-one.yaml | 7 + deploy/yaml/gateway.yaml | 7 + go.mod | 12 +- go.sum | 32 ++- internal/gateway/config.go | 2 + internal/gateway/proxy/proxy.go | 378 +++++++++++++++++++++++++++++++- 6 files changed, 421 insertions(+), 17 deletions(-) diff --git a/deploy/all-in-one.yaml b/deploy/all-in-one.yaml index af36cdc1b..fa173fb84 100644 --- a/deploy/all-in-one.yaml +++ b/deploy/all-in-one.yaml @@ -42,6 +42,7 @@ apiVersion: v1 data: gateway.yaml: |- port: 8080 + sink_port: 8082 controllers: - vanus-controller-0.vanus-controller:2048 - vanus-controller-1.vanus-controller:2048 @@ -176,6 +177,10 @@ spec: - env: - name: VANUS_LOG_LEVEL value: INFO + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP image: public.ecr.aws/vanus/gateway:v0.5.1 imagePullPolicy: IfNotPresent name: gateway @@ -184,6 +189,8 @@ spec: name: proxy - containerPort: 8081 name: cloudevents + - containerPort: 8082 + name: sinkproxy volumeMounts: - mountPath: /vanus/config name: config-gateway diff --git a/deploy/yaml/gateway.yaml b/deploy/yaml/gateway.yaml index 60c1a99c2..abdd76bd8 100644 --- a/deploy/yaml/gateway.yaml +++ b/deploy/yaml/gateway.yaml @@ -25,6 +25,7 @@ metadata: data: gateway.yaml: |- port: 8080 + sink_port: 8082 controllers: - vanus-controller-0.vanus-controller:2048 - vanus-controller-1.vanus-controller:2048 @@ -58,9 +59,15 @@ spec: containerPort: 8080 - name: cloudevents containerPort: 8081 + - name: sinkproxy + containerPort: 8082 env: - name: VANUS_LOG_LEVEL value: INFO + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP volumeMounts: - name: config-gateway mountPath: /vanus/config diff --git a/go.mod b/go.mod index cf8c85a46..4cc889100 100644 --- a/go.mod +++ b/go.mod @@ -91,8 +91,10 @@ require ( github.com/jonboulle/clockwork v0.2.2 // indirect github.com/jtolds/gls v4.20.0+incompatible // indirect github.com/klauspost/compress v1.13.6 // indirect + github.com/kr/pretty v0.3.0 // indirect + github.com/linkall-labs/sdk/proto v0.0.0-20230106022440-7302e243c0b6 // indirect github.com/mattn/go-colorable v0.1.11 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mattn/go-isatty v0.0.16 // indirect github.com/mattn/go-runewidth v0.0.13 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -103,6 +105,7 @@ require ( github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect github.com/rivo/uniseg v0.2.0 // indirect + github.com/rogpeppe/go-internal v1.8.0 // indirect github.com/scylladb/go-set v1.0.2 // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/smartystreets/assertions v1.2.0 // indirect @@ -134,12 +137,13 @@ require ( go.uber.org/multierr v1.7.0 // indirect go.uber.org/zap v1.17.0 // indirect golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect - golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect + golang.org/x/net v0.4.0 // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.4.0 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect google.golang.org/appengine v1.6.7 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect diff --git a/go.sum b/go.sum index e4be51190..e8029878c 100644 --- a/go.sum +++ b/go.sum @@ -284,19 +284,26 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/linkall-labs/embed-etcd v0.1.2 h1:1mTdXLwVvn9gi3XWh/PGhaEAfG8Zmxvjqwnfontb+fA= github.com/linkall-labs/embed-etcd v0.1.2/go.mod h1:QnecHaKt3WQBO9YGBckCDUTBd44VBR2VO8220BtWZ5U= +github.com/linkall-labs/sdk v0.0.0-20230104145200-8f0caa58bf30 h1:Ok2X5KwupdYiWStN3s/fMWm8FefVicPEq48zGNAdNG8= +github.com/linkall-labs/sdk v0.0.0-20230104145200-8f0caa58bf30/go.mod h1:rQKEHYp/hWhdB20Ql2unwbwXYXdwnX77xnczKiWCPBk= +github.com/linkall-labs/sdk/proto v0.0.0-20230106022440-7302e243c0b6 h1:aJkIEUfZvoLzoqU/Ea1m+zMozqLh8fw1FneMmac1G54= +github.com/linkall-labs/sdk/proto v0.0.0-20230106022440-7302e243c0b6/go.mod h1:NeFfkM8UVIDLDCiJo5+uO+ZuoEi07ffWUgObCBJAslQ= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.11 h1:nQ+aFkoE2TMGc0b68U2OKSexC+eq46+XwZzWXHRmPYs= github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= @@ -314,7 +321,6 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/ncw/directio v1.0.5 h1:JSUBhdjEvVaJvOoyPAbcW0fnd0tvRXD76wEfZ1KcQz4= github.com/ncw/directio v1.0.5/go.mod h1:rX/pKEYkOXBGOggmcyJeJGloCkleSvphPx2eV3t6ROk= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/ohler55/ojg v1.14.5 h1:xCX2oyh/ZaoesbLH6fwVHStSJpk4o4eJs8ttXutzdg0= @@ -322,6 +328,7 @@ github.com/ohler55/ojg v1.14.5/go.mod h1:7Ghirupn8NC8hSSDpI0gcjorPxj+vSVIONDWfli github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/panjf2000/ants/v2 v2.7.1 h1:qBy5lfSdbxvrR0yUnZfaEDjf0FlCw4ufsbcsxmE7r+M= github.com/panjf2000/ants/v2 v2.7.1/go.mod h1:KIBmYG9QQX5U2qzFP/yQJaq/nSb6rahS9iEHkrCMgM8= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -363,6 +370,9 @@ github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/scylladb/go-set v1.0.2 h1:SkvlMCKhP0wyyct6j+0IHJkBkSZL+TDzZ4E7f7BCcRE= github.com/scylladb/go-set v1.0.2/go.mod h1:DkpGd78rljTxKAnTDPFqXSGxvETQnJyuSOQwsHycqfs= @@ -563,8 +573,8 @@ golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20221014081412-f15817d10f9b h1:tvrvnPFcdzp294diPnrdZZZ8XUt2Tyj7svb7X52iDuU= -golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -635,8 +645,9 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -647,8 +658,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -807,8 +818,9 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= diff --git a/internal/gateway/config.go b/internal/gateway/config.go index d7726bb33..14a72f3bd 100644 --- a/internal/gateway/config.go +++ b/internal/gateway/config.go @@ -23,6 +23,7 @@ import ( type Config struct { Port int `yaml:"port"` + SinkPort int `yaml:"sink_port"` Observability observability.Config `yaml:"observability"` ControllerAddr []string `yaml:"controllers"` GRPCReflectionEnable bool `yaml:"grpc_reflection_enable"` @@ -31,6 +32,7 @@ type Config struct { func (c Config) GetProxyConfig() proxy.Config { return proxy.Config{ Endpoints: c.ControllerAddr, + SinkPort: c.SinkPort, ProxyPort: c.Port, CloudEventReceiverPort: c.GetCloudEventReceiverPort(), GRPCReflectionEnable: c.GRPCReflectionEnable, diff --git a/internal/gateway/proxy/proxy.go b/internal/gateway/proxy/proxy.go index 9f1dffe00..91906a186 100644 --- a/internal/gateway/proxy/proxy.go +++ b/internal/gateway/proxy/proxy.go @@ -21,13 +21,20 @@ import ( "fmt" "net" "net/http" + "os" "runtime/debug" "strings" "sync" + "sync/atomic" + stdtime "time" v2 "github.com/cloudevents/sdk-go/v2" + "github.com/cloudevents/sdk-go/v2/client" + "github.com/cloudevents/sdk-go/v2/protocol" + cehttp "github.com/cloudevents/sdk-go/v2/protocol/http" "github.com/cloudevents/sdk-go/v2/types" recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery" + vanuspb "github.com/linkall-labs/sdk/proto/pkg/vanus" eb "github.com/linkall-labs/vanus/client" "github.com/linkall-labs/vanus/client/pkg/api" "github.com/linkall-labs/vanus/client/pkg/option" @@ -53,20 +60,32 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/reflection" "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/known/emptypb" + "google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/wrapperspb" ) const ( maximumNumberPerGetRequest = 64 + eventChanCache = 10 + ContentTypeProtobuf = "application/protobuf" + httpRequestPrefix = "/gatewaysink" + datacontenttype = "datacontenttype" + dataschema = "dataschema" + subject = "subject" + time = "time" ) var ( - errInvalidEventbus = errors.New("the eventbus name can't be empty") + errInvalidEventbus = errors.New("the eventbus name can't be empty") + requestDataFromContext = cehttp.RequestDataFromContext + zeroTime = stdtime.Time{} ) type Config struct { Endpoints []string + SinkPort int ProxyPort int CloudEventReceiverPort int Credentials credentials.TransportCredentials @@ -77,6 +96,39 @@ var ( _ cloudevents.CloudEventsServer = &ControllerProxy{} ) +type ackCallback func(bool) + +type message struct { + sequenceID uint64 + event *v2.Event +} + +type subscribeCache struct { + sequenceID uint64 + subscriptionID string + subscribeStream vanuspb.Client_SubscribeServer + acks sync.Map + eventc chan message +} + +func newSubscribeCache(subscriptionID string, stream vanuspb.Client_SubscribeServer) *subscribeCache { + return &subscribeCache{ + sequenceID: 0, + subscriptionID: subscriptionID, + subscribeStream: stream, + acks: sync.Map{}, + eventc: make(chan message, eventChanCache), + } +} + +func (s *subscribeCache) ch() chan message { + return s.eventc +} + +func (s *subscribeCache) stream() vanuspb.Client_SubscribeServer { + return s.subscribeStream +} + type ControllerProxy struct { cfg Config tracer *tracing.Tracer @@ -87,6 +139,260 @@ type ControllerProxy struct { grpcSrv *grpc.Server ctrl cluster.Cluster writerMap sync.Map + cache sync.Map +} + +func (cp *ControllerProxy) Publish(ctx context.Context, req *vanuspb.PublishRequest) (*emptypb.Empty, error) { + _ctx, span := cp.tracer.Start(ctx, "Publish") + defer span.End() + if req.EventbusName == "" { + return nil, v2.NewHTTPResult(http.StatusBadRequest, "invalid eventbus name") + } + + for idx := range req.Events.Events { + e := req.Events.Events[idx] + err := checkExtension(e.Attributes) + if err != nil { + return nil, v2.NewHTTPResult(http.StatusBadRequest, err.Error()) + } + e.Attributes[primitive.XVanusEventbus] = &cloudevents.CloudEvent_CloudEventAttributeValue{ + Attr: &cloudevents.CloudEvent_CloudEventAttributeValue_CeString{CeString: req.EventbusName}, + } + if eventTime, ok := e.Attributes[primitive.XVanusDeliveryTime]; ok { + // validate event time + if _, err := types.ParseTime(eventTime.String()); err != nil { + log.Error(_ctx, "invalid format of event time", map[string]interface{}{ + log.KeyError: err, + "eventTime": eventTime.String(), + }) + return nil, v2.NewHTTPResult(http.StatusBadRequest, "invalid delivery time") + } + // TODO process delay message + // ebName = primitive.TimerEventbusName + } + } + + err := cp.client.Eventbus(ctx, req.GetEventbusName()).Writer().AppendBatch(_ctx, req.GetEvents()) + if err != nil { + log.Warning(_ctx, "append to failed", map[string]interface{}{ + log.KeyError: err, + "eventbus": req.EventbusName, + }) + return nil, v2.NewHTTPResult(http.StatusInternalServerError, err.Error()) + } + return &emptypb.Empty{}, nil +} + +func (cp *ControllerProxy) Subscribe(req *vanuspb.SubscribeRequest, stream vanuspb.Client_SubscribeServer) error { + _ctx, span := cp.tracer.Start(context.Background(), "Subscribe") + defer span.End() + + // 1. modify subscription sink + subscriptionID, err := vanus.NewIDFromString(req.SubscriptionId) + if err != nil { + log.Error(_ctx, "parse subscription id failed", map[string]interface{}{ + log.KeyError: err, + "id": req.SubscriptionId, + }) + return err + } + + getSubscriptionReq := &ctrlpb.GetSubscriptionRequest{ + Id: subscriptionID.Uint64(), + } + meta, err := cp.triggerCtrl.GetSubscription(context.Background(), getSubscriptionReq) + if err != nil { + log.Error(_ctx, "get subscription failed", map[string]interface{}{ + log.KeyError: err, + "id": req.SubscriptionId, + }) + return err + } + + newSink := fmt.Sprintf("http://%s:%d%s/%s", + os.Getenv("POD_IP"), cp.cfg.SinkPort, httpRequestPrefix, req.SubscriptionId) + if meta.Sink != newSink { + updateSubscriptionReq := &ctrlpb.UpdateSubscriptionRequest{ + Id: subscriptionID.Uint64(), + Subscription: &ctrlpb.SubscriptionRequest{ + Source: meta.Source, + Types: meta.Types, + Config: meta.Config, + Filters: meta.Filters, + Sink: newSink, + Protocol: meta.Protocol, + EventBus: meta.EventBus, + Transformer: meta.Transformer, + Name: meta.Name, + Description: meta.Description, + Disable: meta.Disable, + }, + } + _, err = cp.triggerCtrl.UpdateSubscription(_ctx, updateSubscriptionReq) + if err != nil { + log.Error(_ctx, "update subscription sink failed", map[string]interface{}{ + log.KeyError: err, + "id": req.SubscriptionId, + }) + return err + } + } + + // 2. cache subscribe info + subscribe := newSubscribeCache(req.SubscriptionId, stream) + cp.cache.Store(req.SubscriptionId, subscribe) + + // 3. receive and forward events + for { + select { + case <-_ctx.Done(): + return errors.ErrInternal.WithMessage("subscribe stream context done") + case msg := <-subscribe.ch(): + eventpb, err := ToProto(msg.event) + if err != nil { + // TODO(jiangkai): err check + log.Error(_ctx, "to eventpb failed", map[string]interface{}{ + log.KeyError: err, + "event": msg.event, + }) + break + } + log.Debug(_ctx, "subscribe stream send event", map[string]interface{}{ + log.KeyError: err, + "eventpb": eventpb.String(), + }) + err = subscribe.stream().Send(&vanuspb.SubscribeResponse{ + SequenceId: msg.sequenceID, + Events: &cloudevents.CloudEventBatch{ + Events: []*cloudevents.CloudEvent{eventpb}, + }, + }) + if err != nil { + cache, _ := cp.cache.LoadAndDelete(subscribe.subscriptionID) + if cache != nil { + cache.(*subscribeCache).acks.Range(func(key, value interface{}) bool { + value.(ackCallback)(false) + return true + }) + } + return err + } + } + } +} + +func (cp *ControllerProxy) Ack(stream vanuspb.Client_AckServer) error { + _ctx, span := cp.tracer.Start(context.Background(), "Ack") + defer span.End() + for { + rsp, err := stream.Recv() + if err != nil { + log.Error(_ctx, "ack stream recv failed", map[string]interface{}{ + log.KeyError: err, + }) + return err + } + log.Debug(_ctx, "ack stream recv a response", map[string]interface{}{ + log.KeyError: err, + "rsp": rsp, + }) + cache, ok := cp.cache.Load(rsp.SubscriptionId) + if !ok { + // TODO(jiangkai): err check + log.Error(_ctx, "subscription not found", map[string]interface{}{ + log.KeyError: err, + "subscription-id": rsp.SubscriptionId, + }) + continue + } + cb, _ := cache.(*subscribeCache).acks.LoadAndDelete(rsp.SequenceId) + if cb != nil { + cb.(ackCallback)(rsp.Success) + } + } +} + +func ToProto(e *v2.Event) (*cloudevents.CloudEvent, error) { + container := &cloudevents.CloudEvent{ + Id: e.ID(), + Source: e.Source(), + SpecVersion: e.SpecVersion(), + Type: e.Type(), + Attributes: make(map[string]*cloudevents.CloudEvent_CloudEventAttributeValue), + } + if e.DataContentType() != "" { + container.Attributes[datacontenttype], _ = attributeFor(e.DataContentType()) + } + if e.DataSchema() != "" { + container.Attributes[dataschema], _ = attributeFor(e.DataSchema()) + } + if e.Subject() != "" { + container.Attributes[subject], _ = attributeFor(e.Subject()) + } + if e.Time() != zeroTime { + container.Attributes[time], _ = attributeFor(e.Time()) + } + for name, value := range e.Extensions() { + attr, err := attributeFor(value) + if err != nil { + return nil, fmt.Errorf("failed to encode attribute %s: %w", name, err) + } + container.Attributes[name] = attr + } + container.Data = &cloudevents.CloudEvent_BinaryData{ + BinaryData: e.Data(), + } + if e.DataContentType() == ContentTypeProtobuf { + anymsg := &anypb.Any{ + TypeUrl: e.DataSchema(), + Value: e.Data(), + } + container.Data = &cloudevents.CloudEvent_ProtoData{ + ProtoData: anymsg, + } + } + return container, nil +} + +func attributeFor(v interface{}) (*cloudevents.CloudEvent_CloudEventAttributeValue, error) { + vv, err := types.Validate(v) + if err != nil { + return nil, err + } + attr := &cloudevents.CloudEvent_CloudEventAttributeValue{} + switch vt := vv.(type) { + case bool: + attr.Attr = &cloudevents.CloudEvent_CloudEventAttributeValue_CeBoolean{ + CeBoolean: vt, + } + case int32: + attr.Attr = &cloudevents.CloudEvent_CloudEventAttributeValue_CeInteger{ + CeInteger: vt, + } + case string: + attr.Attr = &cloudevents.CloudEvent_CloudEventAttributeValue_CeString{ + CeString: vt, + } + case []byte: + attr.Attr = &cloudevents.CloudEvent_CloudEventAttributeValue_CeBytes{ + CeBytes: vt, + } + case types.URI: + attr.Attr = &cloudevents.CloudEvent_CloudEventAttributeValue_CeUri{ + CeUri: vt.String(), + } + case types.URIRef: + attr.Attr = &cloudevents.CloudEvent_CloudEventAttributeValue_CeUriRef{ + CeUriRef: vt.String(), + } + case types.Timestamp: + attr.Attr = &cloudevents.CloudEvent_CloudEventAttributeValue_CeTimestamp{ + CeTimestamp: timestamppb.New(vt.Time), + } + default: + return nil, fmt.Errorf("unsupported attribute type: %T", v) + } + return attr, nil } func (cp *ControllerProxy) Send(ctx context.Context, batch *cloudevents.BatchEvent) (*emptypb.Empty, error) { @@ -202,8 +508,9 @@ func (cp *ControllerProxy) Start() error { proxypb.RegisterControllerProxyServer(cp.grpcSrv, cp) cloudevents.RegisterCloudEventsServer(cp.grpcSrv, cp) + vanuspb.RegisterClientServer(cp.grpcSrv, cp) - listen, err := net.Listen("tcp", fmt.Sprintf(":%d", cp.cfg.ProxyPort)) + proxyListen, err := net.Listen("tcp", fmt.Sprintf(":%d", cp.cfg.ProxyPort)) if err != nil { return err } @@ -211,16 +518,81 @@ func (cp *ControllerProxy) Start() error { wg := sync.WaitGroup{} wg.Add(1) go func() { - err = cp.grpcSrv.Serve(listen) + err = cp.grpcSrv.Serve(proxyListen) if err != nil { panic(fmt.Sprintf("start grpc proxy failed: %s", err.Error())) } wg.Done() }() log.Info(context.Background(), "the grpc proxy ready to work", nil) + + sinkListen, err := net.Listen("tcp", fmt.Sprintf(":%d", cp.cfg.SinkPort)) + if err != nil { + return err + } + + c, err := client.NewHTTP(cehttp.WithListener(sinkListen), cehttp.WithRequestDataAtContextMiddleware()) + if err != nil { + return err + } + + wg.Add(1) + go func() { + if err := c.StartReceiver(context.Background(), cp.receive); err != nil { + panic(fmt.Sprintf("start CloudEvents receiver failed: %s", err.Error())) + } + wg.Done() + }() + log.Info(context.Background(), "the sink proxy ready to work", nil) return nil } +func (cp *ControllerProxy) receive(ctx context.Context, event v2.Event) (*v2.Event, protocol.Result) { + _ctx, span := cp.tracer.Start(ctx, "receive") + defer span.End() + subscriptionID := getSubscriptionIDFromPath(requestDataFromContext(_ctx)) + if subscriptionID == "" { + return nil, v2.NewHTTPResult(http.StatusBadRequest, "invalid subscription id") + } + cache, ok := cp.cache.Load(subscriptionID) + if !ok { + // retry + return nil, v2.NewHTTPResult(http.StatusInternalServerError, "subscription not exist") + } + log.Debug(_ctx, "sink proxy received a event", map[string]interface{}{ + "event": event.String(), + }) + sequenceID := atomic.AddUint64(&cache.(*subscribeCache).sequenceID, 1) + var success bool + donec := make(chan struct{}) + cache.(*subscribeCache).acks.Store(sequenceID, ackCallback(func(result bool) { + log.Info(_ctx, "ack callback", map[string]interface{}{ + "result": result, + }) + success = result + close(donec) + })) + cache.(*subscribeCache).eventc <- message{ + sequenceID: sequenceID, + event: &event, + } + <-donec + + if !success { + return nil, v2.NewHTTPResult(http.StatusInternalServerError, "event processing failed") + } + return nil, v2.ResultACK +} + +func getSubscriptionIDFromPath(reqData *cehttp.RequestData) string { + // TODO validate + reqPathStr := reqData.URL.String() + if !strings.HasPrefix(reqPathStr, httpRequestPrefix) { + return "" + } + return strings.TrimLeft(reqPathStr[len(httpRequestPrefix):], "/") +} + func (cp *ControllerProxy) Stop() { if cp.grpcSrv != nil { cp.grpcSrv.GracefulStop() From c4aef33ec39041a1e25e6b329d76784a1e39498e Mon Sep 17 00:00:00 2001 From: wenfeng Date: Fri, 6 Jan 2023 18:07:02 +0800 Subject: [PATCH 28/46] build: bump to v0.5.7 (#396) --- Makefile | 36 ----- client/go.mod | 6 +- deploy/all-in-one.cn.yaml | 281 ++++++++++++++++++------------------ deploy/all-in-one.yaml | 10 +- deploy/yaml/controller.yaml | 2 +- deploy/yaml/gateway.yaml | 2 +- deploy/yaml/store.yaml | 2 +- deploy/yaml/timer.yaml | 2 +- deploy/yaml/trigger.yaml | 2 +- go.mod | 12 +- go.sum | 4 +- pkg/go.mod | 4 +- proto/go.mod | 2 +- raft/go.mod | 2 +- release-version.sh | 26 ++++ test/infra/vanus.yml | 20 +-- 16 files changed, 204 insertions(+), 209 deletions(-) create mode 100644 release-version.sh diff --git a/Makefile b/Makefile index f11608bb0..7e8698f0d 100644 --- a/Makefile +++ b/Makefile @@ -74,39 +74,3 @@ docker-build-timer: docker build -t ${DOCKER_REPO}/timer:${IMAGE_TAG} $(DOCKER_BUILD_ARG) -f build/images/timer/Dockerfile . build-timer: $(GO_BUILD) -o bin/timer cmd/timer/main.go - -controller-start: - go run ${VANUS_ROOT}/cmd/controller/main.go - -build-ctrl-bin: - $(GO_BUILD) -o bin/ctrl cmd/controller/main.go - -build-gw-util: - go build -o bin/gw-util test/gateway/main.go - -build-e2e: - go build -o bin/e2e test/e2e/quick-start/main.go - -build-destruct: - go build -o bin/destruct test/e2e/destruct/main.go - -controller-start: - go run ${VANUS_ROOT}/cmd/controller/${module}/main.go - -controller-api-test: - grpcui --import-path=${VSPROTO_ROOT}/include \ - --import-path=${VSPROTO_ROOT}/proto \ - --plaintext \ - --proto=controller.proto 127.0.0.1:2048 - -store-start: - go run ${VANUS_ROOT}/cmd/store/main.go - -store-api-test: - grpcui --import-path=${VSPROTO_ROOT}/include \ - --import-path=${VSPROTO_ROOT}/proto \ - --plaintext \ - --proto=segment.proto 127.0.0.1:11831 - -trigger-start: - go run ${VANUS_ROOT}/cmd/trigger/main.go diff --git a/client/go.mod b/client/go.mod index a7e037dd2..705991591 100644 --- a/client/go.mod +++ b/client/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/cloudevents/sdk-go/v2 v2.12.0 github.com/golang/mock v1.6.0 - github.com/linkall-labs/vanus/observability v0.5.6 - github.com/linkall-labs/vanus/pkg v0.5.6 - github.com/linkall-labs/vanus/proto v0.5.6 + github.com/linkall-labs/vanus/observability v0.5.7 + github.com/linkall-labs/vanus/pkg v0.5.7 + github.com/linkall-labs/vanus/proto v0.5.7 github.com/scylladb/go-set v1.0.2 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4 go.opentelemetry.io/otel/trace v1.11.2 diff --git a/deploy/all-in-one.cn.yaml b/deploy/all-in-one.cn.yaml index 96b222ffc..27557f8b6 100644 --- a/deploy/all-in-one.cn.yaml +++ b/deploy/all-in-one.cn.yaml @@ -42,6 +42,7 @@ apiVersion: v1 data: gateway.yaml: |- port: 8080 + sink_port: 8082 controllers: - vanus-controller-0.vanus-controller:2048 - vanus-controller-1.vanus-controller:2048 @@ -129,8 +130,8 @@ metadata: spec: clusterIP: None ports: - - name: vanus-controller - port: 2048 + - name: vanus-controller + port: 2048 selector: app: vanus-controller --- @@ -141,14 +142,14 @@ metadata: namespace: vanus spec: ports: - - name: proxy - nodePort: 30001 - port: 8080 - targetPort: 8080 - - name: cloudevents - nodePort: 30002 - port: 8081 - targetPort: 8081 + - name: proxy + nodePort: 30001 + port: 8080 + targetPort: 8080 + - name: cloudevents + nodePort: 30002 + port: 8081 + targetPort: 8081 selector: app: vanus-gateway type: NodePort @@ -173,24 +174,30 @@ spec: app: vanus-gateway spec: containers: - - env: - - name: VANUS_LOG_LEVEL - value: INFO - image: linkall.tencentcloudcr.com/vanus/gateway:v0.5.1 - imagePullPolicy: IfNotPresent - name: gateway - ports: - - containerPort: 8080 - name: proxy - - containerPort: 8081 - name: cloudevents - volumeMounts: - - mountPath: /vanus/config - name: config-gateway + - env: + - name: VANUS_LOG_LEVEL + value: INFO + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: linkall.tencentcloudcr.com/vanus/gateway:v0.5.7 + imagePullPolicy: IfNotPresent + name: gateway + ports: + - containerPort: 8080 + name: proxy + - containerPort: 8081 + name: cloudevents + - containerPort: 8082 + name: sinkproxy + volumeMounts: + - mountPath: /vanus/config + name: config-gateway volumes: - - configMap: + - configMap: + name: config-gateway name: config-gateway - name: config-gateway --- apiVersion: apps/v1 kind: Deployment @@ -212,23 +219,23 @@ spec: app: vanus-timer spec: containers: - - env: - - name: VANUS_LOG_LEVEL - value: INFO - - name: POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - image: linkall.tencentcloudcr.com/vanus/timer:v0.5.1 - imagePullPolicy: IfNotPresent - name: timer - volumeMounts: - - mountPath: /vanus/config - name: config-timer + - env: + - name: VANUS_LOG_LEVEL + value: INFO + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: linkall.tencentcloudcr.com/vanus/timer:v0.5.7 + imagePullPolicy: IfNotPresent + name: timer + volumeMounts: + - mountPath: /vanus/config + name: config-timer volumes: - - configMap: + - configMap: + name: config-timer name: config-timer - name: config-timer --- apiVersion: apps/v1 kind: Deployment @@ -250,26 +257,26 @@ spec: app: vanus-trigger spec: containers: - - env: - - name: VANUS_LOG_LEVEL - value: INFO - - name: POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - image: linkall.tencentcloudcr.com/vanus/trigger:v0.5.1 - imagePullPolicy: IfNotPresent - name: trigger - ports: - - containerPort: 2148 - name: grpc - volumeMounts: - - mountPath: /vanus/config - name: config-trigger + - env: + - name: VANUS_LOG_LEVEL + value: INFO + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: linkall.tencentcloudcr.com/vanus/trigger:v0.5.7 + imagePullPolicy: IfNotPresent + name: trigger + ports: + - containerPort: 2148 + name: grpc + volumeMounts: + - mountPath: /vanus/config + name: config-trigger volumes: - - configMap: + - configMap: + name: config-trigger name: config-trigger - name: config-trigger --- apiVersion: apps/v1 kind: StatefulSet @@ -292,53 +299,53 @@ spec: app: vanus-controller spec: containers: - - command: - - /bin/sh - - -c - - NODE_ID=${HOSTNAME##*-} /vanus/bin/controller - env: - - name: VANUS_LOG_LEVEL - value: INFO - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - image: linkall.tencentcloudcr.com/vanus/controller:v0.5.1 - imagePullPolicy: IfNotPresent - name: controller - ports: - - containerPort: 2048 - name: grpc - - containerPort: 2379 - name: etcd-client - - containerPort: 2380 - name: etcd-peer - - containerPort: 2112 - name: metrics - volumeMounts: - - mountPath: /vanus/config - name: config-controller - - mountPath: /data - name: data + - command: + - /bin/sh + - -c + - NODE_ID=${HOSTNAME##*-} /vanus/bin/controller + env: + - name: VANUS_LOG_LEVEL + value: INFO + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: linkall.tencentcloudcr.com/vanus/controller:v0.5.7 + imagePullPolicy: IfNotPresent + name: controller + ports: + - containerPort: 2048 + name: grpc + - containerPort: 2379 + name: etcd-client + - containerPort: 2380 + name: etcd-peer + - containerPort: 2112 + name: metrics + volumeMounts: + - mountPath: /vanus/config + name: config-controller + - mountPath: /data + name: data volumes: - - configMap: + - configMap: + name: config-controller name: config-controller - name: config-controller volumeClaimTemplates: - - metadata: - labels: - app: vanus-controller - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi + - metadata: + labels: + app: vanus-controller + name: data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi --- apiVersion: apps/v1 kind: StatefulSet @@ -361,40 +368,40 @@ spec: app: vanus-store spec: containers: - - command: - - /bin/sh - - -c - - VOLUME_ID=${HOSTNAME##*-} /vanus/bin/store - env: - - name: VANUS_LOG_LEVEL - value: INFO - - name: POD_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - image: linkall.tencentcloudcr.com/vanus/store:v0.5.1 - imagePullPolicy: IfNotPresent - name: store - ports: - - containerPort: 11811 - name: grpc - volumeMounts: - - mountPath: /vanus/config - name: config-store - - mountPath: /data - name: data + - command: + - /bin/sh + - -c + - VOLUME_ID=${HOSTNAME##*-} /vanus/bin/store + env: + - name: VANUS_LOG_LEVEL + value: INFO + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: linkall.tencentcloudcr.com/vanus/store:v0.5.7 + imagePullPolicy: IfNotPresent + name: store + ports: + - containerPort: 11811 + name: grpc + volumeMounts: + - mountPath: /vanus/config + name: config-store + - mountPath: /data + name: data volumes: - - configMap: + - configMap: + name: config-store name: config-store - name: config-store volumeClaimTemplates: - - metadata: - labels: - app: vanus-controller - name: data - spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 1Gi + - metadata: + labels: + app: vanus-controller + name: data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi diff --git a/deploy/all-in-one.yaml b/deploy/all-in-one.yaml index fa173fb84..c62d7498f 100644 --- a/deploy/all-in-one.yaml +++ b/deploy/all-in-one.yaml @@ -181,7 +181,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/gateway:v0.5.1 + image: public.ecr.aws/vanus/gateway:v0.5.7 imagePullPolicy: IfNotPresent name: gateway ports: @@ -226,7 +226,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/timer:v0.5.1 + image: public.ecr.aws/vanus/timer:v0.5.7 imagePullPolicy: IfNotPresent name: timer volumeMounts: @@ -264,7 +264,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/trigger:v0.5.1 + image: public.ecr.aws/vanus/trigger:v0.5.7 imagePullPolicy: IfNotPresent name: trigger ports: @@ -314,7 +314,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/controller:v0.5.1 + image: public.ecr.aws/vanus/controller:v0.5.7 imagePullPolicy: IfNotPresent name: controller ports: @@ -379,7 +379,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/store:v0.5.1 + image: public.ecr.aws/vanus/store:v0.5.7 imagePullPolicy: IfNotPresent name: store ports: diff --git a/deploy/yaml/controller.yaml b/deploy/yaml/controller.yaml index 046495bd1..03ecc108e 100644 --- a/deploy/yaml/controller.yaml +++ b/deploy/yaml/controller.yaml @@ -79,7 +79,7 @@ spec: spec: containers: - name: controller - image: public.ecr.aws/vanus/controller:v0.5.1 + image: public.ecr.aws/vanus/controller:v0.5.7 imagePullPolicy: IfNotPresent command: [ "/bin/sh", "-c", "NODE_ID=${HOSTNAME##*-} /vanus/bin/controller" ] diff --git a/deploy/yaml/gateway.yaml b/deploy/yaml/gateway.yaml index abdd76bd8..aac7779c5 100644 --- a/deploy/yaml/gateway.yaml +++ b/deploy/yaml/gateway.yaml @@ -52,7 +52,7 @@ spec: spec: containers: - name: gateway - image: public.ecr.aws/vanus/gateway:v0.5.1 + image: public.ecr.aws/vanus/gateway:v0.5.7 imagePullPolicy: IfNotPresent ports: - name: proxy diff --git a/deploy/yaml/store.yaml b/deploy/yaml/store.yaml index 48f06a30d..739f55a68 100644 --- a/deploy/yaml/store.yaml +++ b/deploy/yaml/store.yaml @@ -61,7 +61,7 @@ spec: spec: containers: - name: store - image: public.ecr.aws/vanus/store:v0.5.1 + image: public.ecr.aws/vanus/store:v0.5.7 imagePullPolicy: IfNotPresent command: ["/bin/sh", "-c", "VOLUME_ID=${HOSTNAME##*-} /vanus/bin/store"] diff --git a/deploy/yaml/timer.yaml b/deploy/yaml/timer.yaml index f105dfb97..409bba877 100644 --- a/deploy/yaml/timer.yaml +++ b/deploy/yaml/timer.yaml @@ -45,7 +45,7 @@ spec: spec: containers: - name: timer - image: public.ecr.aws/vanus/timer:v0.5.1 + image: public.ecr.aws/vanus/timer:v0.5.7 imagePullPolicy: IfNotPresent env: - name: VANUS_LOG_LEVEL diff --git a/deploy/yaml/trigger.yaml b/deploy/yaml/trigger.yaml index 4706b72b9..dec470dd7 100644 --- a/deploy/yaml/trigger.yaml +++ b/deploy/yaml/trigger.yaml @@ -33,7 +33,7 @@ spec: spec: containers: - name: trigger - image: public.ecr.aws/vanus/trigger:v0.5.1 + image: public.ecr.aws/vanus/trigger:v0.5.7 imagePullPolicy: IfNotPresent ports: - name: grpc diff --git a/go.mod b/go.mod index 4cc889100..b576b5b96 100644 --- a/go.mod +++ b/go.mod @@ -23,11 +23,12 @@ require ( github.com/jedib0t/go-pretty/v6 v6.3.1 github.com/json-iterator/go v1.1.12 github.com/linkall-labs/embed-etcd v0.1.2 - github.com/linkall-labs/vanus/client v0.5.6 - github.com/linkall-labs/vanus/observability v0.5.6 - github.com/linkall-labs/vanus/pkg v0.5.6 - github.com/linkall-labs/vanus/proto v0.5.6 - github.com/linkall-labs/vanus/raft v0.5.6 + github.com/linkall-labs/sdk/proto v0.0.0-20230106022440-7302e243c0b6 + github.com/linkall-labs/vanus/client v0.5.7 + github.com/linkall-labs/vanus/observability v0.5.7 + github.com/linkall-labs/vanus/pkg v0.5.7 + github.com/linkall-labs/vanus/proto v0.5.7 + github.com/linkall-labs/vanus/raft v0.5.7 github.com/ncw/directio v1.0.5 github.com/ohler55/ojg v1.14.5 github.com/panjf2000/ants/v2 v2.7.1 @@ -92,7 +93,6 @@ require ( github.com/jtolds/gls v4.20.0+incompatible // indirect github.com/klauspost/compress v1.13.6 // indirect github.com/kr/pretty v0.3.0 // indirect - github.com/linkall-labs/sdk/proto v0.0.0-20230106022440-7302e243c0b6 // indirect github.com/mattn/go-colorable v0.1.11 // indirect github.com/mattn/go-isatty v0.0.16 // indirect github.com/mattn/go-runewidth v0.0.13 // indirect diff --git a/go.sum b/go.sum index e8029878c..69842a208 100644 --- a/go.sum +++ b/go.sum @@ -293,8 +293,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/linkall-labs/embed-etcd v0.1.2 h1:1mTdXLwVvn9gi3XWh/PGhaEAfG8Zmxvjqwnfontb+fA= github.com/linkall-labs/embed-etcd v0.1.2/go.mod h1:QnecHaKt3WQBO9YGBckCDUTBd44VBR2VO8220BtWZ5U= -github.com/linkall-labs/sdk v0.0.0-20230104145200-8f0caa58bf30 h1:Ok2X5KwupdYiWStN3s/fMWm8FefVicPEq48zGNAdNG8= -github.com/linkall-labs/sdk v0.0.0-20230104145200-8f0caa58bf30/go.mod h1:rQKEHYp/hWhdB20Ql2unwbwXYXdwnX77xnczKiWCPBk= github.com/linkall-labs/sdk/proto v0.0.0-20230106022440-7302e243c0b6 h1:aJkIEUfZvoLzoqU/Ea1m+zMozqLh8fw1FneMmac1G54= github.com/linkall-labs/sdk/proto v0.0.0-20230106022440-7302e243c0b6/go.mod h1:NeFfkM8UVIDLDCiJo5+uO+ZuoEi07ffWUgObCBJAslQ= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -328,9 +326,9 @@ github.com/ohler55/ojg v1.14.5/go.mod h1:7Ghirupn8NC8hSSDpI0gcjorPxj+vSVIONDWfli github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/panjf2000/ants/v2 v2.7.1 h1:qBy5lfSdbxvrR0yUnZfaEDjf0FlCw4ufsbcsxmE7r+M= github.com/panjf2000/ants/v2 v2.7.1/go.mod h1:KIBmYG9QQX5U2qzFP/yQJaq/nSb6rahS9iEHkrCMgM8= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= diff --git a/pkg/go.mod b/pkg/go.mod index 82e3f8cc5..ee883efd7 100644 --- a/pkg/go.mod +++ b/pkg/go.mod @@ -4,8 +4,8 @@ go 1.18 require ( github.com/golang/mock v1.6.0 - github.com/linkall-labs/vanus/observability v0.5.6 - github.com/linkall-labs/vanus/proto v0.5.6 + github.com/linkall-labs/vanus/observability v0.5.7 + github.com/linkall-labs/vanus/proto v0.5.7 github.com/pkg/errors v0.9.1 github.com/smartystreets/goconvey v1.7.2 google.golang.org/grpc v1.51.0 diff --git a/proto/go.mod b/proto/go.mod index a5ee0c9da..0803eb97d 100644 --- a/proto/go.mod +++ b/proto/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/golang/mock v1.6.0 - github.com/linkall-labs/vanus/raft v0.5.6 + github.com/linkall-labs/vanus/raft v0.5.7 google.golang.org/grpc v1.51.0 google.golang.org/protobuf v1.28.1 ) diff --git a/raft/go.mod b/raft/go.mod index 7a439ad2f..a5ca3595c 100644 --- a/raft/go.mod +++ b/raft/go.mod @@ -6,7 +6,7 @@ require ( github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5 github.com/gogo/protobuf v1.3.2 github.com/golang/protobuf v1.5.2 - github.com/linkall-labs/vanus/observability v0.5.6 + github.com/linkall-labs/vanus/observability v0.5.7 go.etcd.io/etcd/client/pkg/v3 v3.6.0-alpha.0 go.opentelemetry.io/otel/trace v1.11.2 ) diff --git a/release-version.sh b/release-version.sh new file mode 100644 index 000000000..c4117b4ee --- /dev/null +++ b/release-version.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env sh +set -ex + +VERSION=$1 + +ROOT_PATH=/var/vanus-k8s + +make docker-push IMAGE_TAG="${VERSION}" +make docker-push IMAGE_TAG="${VERSION}" DOCKER_REGISTRY=linkall.tencentcloudcr.com + +sudo mkdir -p "${ROOT_PATH}"/vsctl/"${VERSION}"/linux-amd64 +make build-cmd GOOS=linux GOARCH=amd64 VERSION="$VERSION" +sudo mv bin/vsctl "${ROOT_PATH}"/vsctl/"${VERSION}"/linux-amd64 + +sudo mkdir -p "${ROOT_PATH}"/vsctl/"${VERSION}"/macos-amd64 +make build-cmd GOOS=darwin GOARCH=amd64 VERSION="$VERSION" +sudo mv bin/vsctl "${ROOT_PATH}"/vsctl/"${VERSION}"/macos-amd64 + +sudo mkdir -p "${ROOT_PATH}"/vsctl/"${VERSION}"/macos-arm64 +make build-cmd GOOS=darwin GOARCH=arm64 VERSION="$VERSION" +sudo mv bin/vsctl "${ROOT_PATH}"/vsctl/"${VERSION}"/macos-arm64 + +sudo cp "${ROOT_PATH}"/all-in-one/template.yml "${ROOT_PATH}"/all-in-one/"$VERSION".yml +sudo sed -i "s/:/:${VERSION}/g" "${ROOT_PATH}"/all-in-one/"$VERSION".yml +sudo cp "${ROOT_PATH}"/all-in-one/template.cn.yml "${ROOT_PATH}"/all-in-one/"$VERSION".cn.yml +sudo sed -i "s/:/:${VERSION}/g" "${ROOT_PATH}"/all-in-one/"$VERSION".cn.yml diff --git a/test/infra/vanus.yml b/test/infra/vanus.yml index e43778f58..de9bf34e5 100644 --- a/test/infra/vanus.yml +++ b/test/infra/vanus.yml @@ -179,7 +179,7 @@ spec: app: vanus-gateway spec: containers: - - image: public.ecr.aws/vanus/gateway:7b1a23d + - image: public.ecr.aws/vanus/gateway:6b23e5a imagePullPolicy: IfNotPresent name: gateway resources: @@ -229,7 +229,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/timer:7b1a23d + image: public.ecr.aws/vanus/timer:6b23e5a imagePullPolicy: IfNotPresent name: timer volumeMounts: @@ -274,7 +274,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/trigger:7b1a23d + image: public.ecr.aws/vanus/trigger:6b23e5a imagePullPolicy: IfNotPresent name: trigger resources: @@ -331,7 +331,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/controller:7b1a23d + image: public.ecr.aws/vanus/controller:6b23e5a imagePullPolicy: IfNotPresent name: controller resources: @@ -381,7 +381,7 @@ metadata: name: vanus-store namespace: vanus spec: - replicas: 6 + replicas: 4 selector: matchLabels: app: vanus-store @@ -405,16 +405,16 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/store:7b1a23d + image: public.ecr.aws/vanus/store:6b23e5a imagePullPolicy: IfNotPresent name: store resources: limits: - cpu: 2000m - memory: 4000Mi + cpu: 4000m + memory: 8000Mi requests: - cpu: 2000m - memory: 4000Mi + cpu: 4000m + memory: 8000Mi ports: - containerPort: 11811 name: grpc From 65b710182613b765a5aaf11c49567f9f1e8c51e5 Mon Sep 17 00:00:00 2001 From: James Yin Date: Fri, 6 Jan 2023 18:14:54 +0800 Subject: [PATCH 29/46] fix: send unexpected MsgAppResp to leader (#395) Signed-off-by: James Yin Signed-off-by: James Yin --- raft/raft.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/raft/raft.go b/raft/raft.go index 063a74551..b56a723cf 100644 --- a/raft/raft.go +++ b/raft/raft.go @@ -250,6 +250,8 @@ type raft struct { Term uint64 Vote uint64 + receiving bool + readStates []ReadState // the log @@ -613,6 +615,7 @@ func (r *raft) reset(term uint64) { r.Vote = None } r.lead = None + r.receiving = false r.electionElapsed = 0 r.heartbeatElapsed = 0 @@ -1554,7 +1557,9 @@ func stepFollower(r *raft, m pb.Message) error { case pb.MsgLogResp: if r.raftLog.stableTo(m.Index, m.LogTerm) { r.raftLog.localCommitTo(r.raftLog.committed) - r.send(pb.Message{To: r.lead, Type: pb.MsgAppResp, Index: m.Index}) + if r.receiving { + r.send(pb.Message{To: r.lead, Type: pb.MsgAppResp, Index: m.Index, LogTerm: m.LogTerm}) + } } case pb.MsgApplyResp: // TODO(james.yin): @@ -1630,6 +1635,8 @@ func (r *raft) handleAppendEntries(m pb.Message) { RejectHint: hintIndex, LogTerm: hintTerm, }) + } else if !r.receiving { + r.receiving = true } } From 58921e54561813b58ea01db2ef78c4dae63d268c Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Fri, 6 Jan 2023 19:23:31 +0800 Subject: [PATCH 30/46] test: use `T.TempDir` to create temporary test directory (#381) This commit replaces `os.MkdirTemp` with `t.TempDir` in tests. The directory created by `t.TempDir` is automatically removed when the test and all its subtests complete. Prior to this commit, temporary directory created using `os.MkdirTemp` needs to be removed manually by calling `os.RemoveAll`, which is omitted in some tests. The error handling boilerplate e.g. defer func() { if err := os.RemoveAll(dir); err != nil { t.Fatal(err) } } is also tedious, but `t.TempDir` handles this for us nicely. Reference: https://pkg.go.dev/testing#T.TempDir Signed-off-by: Eng Zer Jun --- internal/raft/log/compaction_test.go | 21 ++----------- internal/raft/log/log_test.go | 21 ++----------- internal/raft/log/snapshot_storage_test.go | 21 ++----------- .../zone/segmentedfile/segmented_file_test.go | 7 +---- internal/store/meta/async_test.go | 9 +----- internal/store/meta/sync_test.go | 9 +----- internal/store/segment/recovery_test.go | 9 ++---- internal/store/wal/recovery_test.go | 9 +----- internal/store/wal/wal_bench_test.go | 19 ++---------- internal/store/wal/wal_test.go | 30 ++++--------------- 10 files changed, 23 insertions(+), 132 deletions(-) diff --git a/internal/raft/log/compaction_test.go b/internal/raft/log/compaction_test.go index aac802468..6f53419c5 100644 --- a/internal/raft/log/compaction_test.go +++ b/internal/raft/log/compaction_test.go @@ -19,7 +19,6 @@ import ( // standard libraries. "encoding/binary" "fmt" - "os" "testing" // third-party libraries. @@ -37,23 +36,9 @@ func TestLog_Compact(t *testing.T) { data := make([]byte, blockSize) copy(data, []byte("hello world!")) - metaDir, err := os.MkdirTemp("", "meta-*") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(metaDir) - - offsetDir, err := os.MkdirTemp("", "offset-*") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(offsetDir) - - walDir, err := os.MkdirTemp("", "wal-*") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(walDir) + metaDir := t.TempDir() + offsetDir := t.TempDir() + walDir := t.TempDir() Convey("raft log compaction", t, func() { metaStore, err := meta.RecoverSyncStore(stdCtx.Background(), metaCfg, metaDir) diff --git a/internal/raft/log/log_test.go b/internal/raft/log/log_test.go index f2971af2e..df64e3c03 100644 --- a/internal/raft/log/log_test.go +++ b/internal/raft/log/log_test.go @@ -18,7 +18,6 @@ import ( // standard libraries. "context" "math" - "os" "testing" // third-party libraries. @@ -61,23 +60,9 @@ var ( func TestLog(t *testing.T) { ctx := context.Background() - metaDir, err := os.MkdirTemp("", "meta-*") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(metaDir) - - offsetDir, err := os.MkdirTemp("", "offset-*") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(offsetDir) - - walDir, err := os.MkdirTemp("", "wal-*") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(walDir) + metaDir := t.TempDir() + offsetDir := t.TempDir() + walDir := t.TempDir() cc1 := raftpb.ConfChange{ Type: raftpb.ConfChangeAddNode, NodeID: nodeID1.Uint64(), diff --git a/internal/raft/log/snapshot_storage_test.go b/internal/raft/log/snapshot_storage_test.go index 4f93b7203..68739aaf5 100644 --- a/internal/raft/log/snapshot_storage_test.go +++ b/internal/raft/log/snapshot_storage_test.go @@ -17,7 +17,6 @@ package log import ( // standard libraries. "context" - "os" "testing" // third-party libraries. @@ -35,23 +34,9 @@ import ( func TestLog_SnapshotStorage(t *testing.T) { ctx := context.Background() - metaDir, err := os.MkdirTemp("", "meta-*") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(metaDir) - - offsetDir, err := os.MkdirTemp("", "offset-*") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(offsetDir) - - walDir, err := os.MkdirTemp("", "wal-*") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(walDir) + metaDir := t.TempDir() + offsetDir := t.TempDir() + walDir := t.TempDir() cc1 := raftpb.ConfChange{ Type: raftpb.ConfChangeAddNode, NodeID: nodeID1.Uint64(), diff --git a/internal/store/io/zone/segmentedfile/segmented_file_test.go b/internal/store/io/zone/segmentedfile/segmented_file_test.go index 6f7470bfa..e2f656aed 100644 --- a/internal/store/io/zone/segmentedfile/segmented_file_test.go +++ b/internal/store/io/zone/segmentedfile/segmented_file_test.go @@ -16,7 +16,6 @@ package segmentedfile import ( // standard libraries. - "os" "testing" // third-party libraries. @@ -27,8 +26,7 @@ const fileSize = 32 * 1024 func TestSegmentedFile_SelectSegment(t *testing.T) { Convey("segmented file", t, func() { - dir, err := os.MkdirTemp("", "sf-*") - So(err, ShouldBeNil) + dir := t.TempDir() sf, err := Open(dir, WithSegmentSize(fileSize)) So(err, ShouldBeNil) @@ -79,9 +77,6 @@ func TestSegmentedFile_SelectSegment(t *testing.T) { Reset(func() { sf.Close() - - err = os.RemoveAll(dir) - So(err, ShouldBeNil) }) }) } diff --git a/internal/store/meta/async_test.go b/internal/store/meta/async_test.go index 686db7c14..38b5745d1 100644 --- a/internal/store/meta/async_test.go +++ b/internal/store/meta/async_test.go @@ -17,7 +17,6 @@ package meta import ( // standard libraries. "context" - "os" "testing" // third-party libraries. @@ -31,8 +30,7 @@ func TestAsyncStore(t *testing.T) { ctx := context.Background() Convey("AsyncStore", t, func() { - walDir, err := os.MkdirTemp("", "async-*") - So(err, ShouldBeNil) + walDir := t.TempDir() Convey("new empty AsyncStore by recovery", func() { ss, err := RecoverAsyncStore(ctx, config.AsyncStore{}, walDir) @@ -97,10 +95,5 @@ func TestAsyncStore(t *testing.T) { }) }) }) - - Reset(func() { - err := os.RemoveAll(walDir) - So(err, ShouldBeNil) - }) }) } diff --git a/internal/store/meta/sync_test.go b/internal/store/meta/sync_test.go index 13155f768..3cc3bca88 100644 --- a/internal/store/meta/sync_test.go +++ b/internal/store/meta/sync_test.go @@ -17,7 +17,6 @@ package meta import ( // standard libraries. "context" - "os" "testing" // third-party libraries. @@ -35,8 +34,7 @@ var ( func TestSyncStore(t *testing.T) { Convey("SyncStore", t, func() { - walDir, err := os.MkdirTemp("", "sync-*") - So(err, ShouldBeNil) + walDir := t.TempDir() Convey("new empty SyncStore by recovery", func() { ss, err := RecoverSyncStore(context.Background(), config.SyncStore{}, walDir) @@ -101,10 +99,5 @@ func TestSyncStore(t *testing.T) { }) }) }) - - Reset(func() { - err := os.RemoveAll(walDir) - So(err, ShouldBeNil) - }) }) } diff --git a/internal/store/segment/recovery_test.go b/internal/store/segment/recovery_test.go index 74bdfc2f4..17a086f0d 100644 --- a/internal/store/segment/recovery_test.go +++ b/internal/store/segment/recovery_test.go @@ -17,7 +17,6 @@ package segment import ( // standard libraries. "context" - "os" "testing" // third-party libraries. @@ -33,11 +32,7 @@ func TestServer_recover(t *testing.T) { defer ctrl.Finish() Convey("recover", t, func() { - dir, err := os.MkdirTemp("", "volume-*") - So(err, ShouldBeNil) - defer func() { - So(os.RemoveAll(dir), ShouldBeNil) - }() + dir := t.TempDir() srv := &server{ cfg: store.Config{ @@ -46,7 +41,7 @@ func TestServer_recover(t *testing.T) { }, }, } - err = srv.loadVSBEngine(context.Background(), srv.cfg.VSB) + err := srv.loadVSBEngine(context.Background(), srv.cfg.VSB) So(err, ShouldBeNil) err = srv.recover(context.Background()) diff --git a/internal/store/wal/recovery_test.go b/internal/store/wal/recovery_test.go index 0ba59825a..f707ef27f 100644 --- a/internal/store/wal/recovery_test.go +++ b/internal/store/wal/recovery_test.go @@ -17,7 +17,6 @@ package wal import ( // standard libraries. "context" - "os" "testing" // third-party libraries. @@ -28,8 +27,7 @@ func TestOpen(t *testing.T) { ctx := context.Background() Convey("open wal in recover mode", t, func() { - walDir, err := os.MkdirTemp("", "wal-*") - So(err, ShouldBeNil) + walDir := t.TempDir() Convey("create empty wal", func() { var entryNum int @@ -107,10 +105,5 @@ func TestOpen(t *testing.T) { wal.Close() wal.Wait() }) - - Reset(func() { - err := os.RemoveAll(walDir) - So(err, ShouldBeNil) - }) }) } diff --git a/internal/store/wal/wal_bench_test.go b/internal/store/wal/wal_bench_test.go index 133136911..850b49b85 100644 --- a/internal/store/wal/wal_bench_test.go +++ b/internal/store/wal/wal_bench_test.go @@ -19,7 +19,6 @@ import ( "context" "fmt" "log" - "os" "sync" "testing" @@ -30,11 +29,7 @@ import ( const walTempDir = "" func BenchmarkWAL_AppendOneWithBatching(b *testing.B) { - walDir, err := os.MkdirTemp(walTempDir, "wal-*") - if err != nil { - b.Fatal(err) - } - defer os.RemoveAll(walDir) + walDir := b.TempDir() wal, err := Open(context.Background(), walDir) if err != nil { @@ -63,11 +58,7 @@ func BenchmarkWAL_AppendOneWithBatching(b *testing.B) { } func BenchmarkWAL_AppendOneWithoutBatching(b *testing.B) { - walDir, err := os.MkdirTemp(walTempDir, "wal-*") - if err != nil { - b.Fatal(err) - } - defer os.RemoveAll(walDir) + walDir := b.TempDir() wal, err := Open(context.Background(), walDir) if err != nil { @@ -97,11 +88,7 @@ func BenchmarkWAL_AppendOneWithoutBatching(b *testing.B) { func BenchmarkWAL_AppendOneWithCallback(b *testing.B) { // walDir := filepath.Join(walTempDir, "wal-test") - walDir, err := os.MkdirTemp(walTempDir, "wal-*") - if err != nil { - b.Fatal(err) - } - defer os.RemoveAll(walDir) + walDir := b.TempDir() wal, err := Open(context.Background(), walDir) if err != nil { diff --git a/internal/store/wal/wal_test.go b/internal/store/wal/wal_test.go index 2c7666429..313990553 100644 --- a/internal/store/wal/wal_test.go +++ b/internal/store/wal/wal_test.go @@ -41,8 +41,7 @@ func TestWAL_AppendOne(t *testing.T) { ctx := context.Background() Convey("wal append one", t, func() { - walDir, err := os.MkdirTemp("", "wal-*") - So(err, ShouldBeNil) + walDir := t.TempDir() wal, err := Open(ctx, walDir, WithFileSize(fileSize)) So(err, ShouldBeNil) @@ -86,15 +85,11 @@ func TestWAL_AppendOne(t *testing.T) { Reset(func() { wal.Close() wal.Wait() - - err := os.RemoveAll(walDir) - So(err, ShouldBeNil) }) }) Convey("flush wal when timeout", t, func() { - walDir, err := os.MkdirTemp("", "wal-*") - So(err, ShouldBeNil) + walDir := t.TempDir() flushTimeout := time.Second wal, err := Open(ctx, walDir, WithFileSize(fileSize), WithFlushTimeout(flushTimeout)) @@ -120,14 +115,10 @@ func TestWAL_AppendOne(t *testing.T) { wal.Close() wal.Wait() - - err = os.RemoveAll(walDir) - So(err, ShouldBeNil) }) Convey("wal append one after close", t, func() { - walDir, err := os.MkdirTemp("", "wal-*") - So(err, ShouldBeNil) + walDir := t.TempDir() flushTimeout := 100 * time.Millisecond wal, err := Open(ctx, walDir, WithFileSize(fileSize), WithFlushTimeout(flushTimeout)) @@ -153,9 +144,6 @@ func TestWAL_AppendOne(t *testing.T) { // NOTE: There is no guarantee that data0 will be successfully written. // So(wal.wb.Size(), ShouldEqual, 10) // So(wal.wb.Committed(), ShouldEqual, 10) - - err = os.RemoveAll(walDir) - So(err, ShouldBeNil) }) } @@ -163,8 +151,7 @@ func TestWAL_Append(t *testing.T) { ctx := context.Background() Convey("wal append", t, func() { - walDir, err := os.MkdirTemp("", "wal-*") - So(err, ShouldBeNil) + walDir := t.TempDir() wal, err := Open(ctx, walDir, WithFileSize(fileSize)) So(err, ShouldBeNil) @@ -194,9 +181,6 @@ func TestWAL_Append(t *testing.T) { Reset(func() { wal.Close() wal.Wait() - - err := os.RemoveAll(walDir) - So(err, ShouldBeNil) }) }) } @@ -207,8 +191,7 @@ func TestWAL_Compact(t *testing.T) { copy(data, []byte("hello world!")) Convey("wal compaction", t, func() { - walDir, err := os.MkdirTemp("", "wal-*") - So(err, ShouldBeNil) + walDir := t.TempDir() wal, err := Open(ctx, walDir, WithFileSize(fileSize)) So(err, ShouldBeNil) @@ -244,8 +227,5 @@ func TestWAL_Compact(t *testing.T) { wal.Close() wal.Wait() - - err = os.RemoveAll(walDir) - So(err, ShouldBeNil) }) } From 0d5daded2455297c9569b3e80ee9509147e5a413 Mon Sep 17 00:00:00 2001 From: wenfeng Date: Fri, 6 Jan 2023 19:48:10 +0800 Subject: [PATCH 31/46] build: update release script --- release-version.sh | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/release-version.sh b/release-version.sh index c4117b4ee..1c6917de8 100644 --- a/release-version.sh +++ b/release-version.sh @@ -1,26 +1,59 @@ #!/usr/bin/env sh -set -ex +set -e VERSION=$1 +if [ "$VERSION" = "" ] +then + echo "please specify version" + exit 1 +else + echo "Version=$VERSION" +fi + ROOT_PATH=/var/vanus-k8s +# build images make docker-push IMAGE_TAG="${VERSION}" make docker-push IMAGE_TAG="${VERSION}" DOCKER_REGISTRY=linkall.tencentcloudcr.com +# build vsctl +echo "Building vsctl for linux/amd64..." +sudo rm -r "${ROOT_PATH}"/vsctl/"${VERSION}" sudo mkdir -p "${ROOT_PATH}"/vsctl/"${VERSION}"/linux-amd64 make build-cmd GOOS=linux GOARCH=amd64 VERSION="$VERSION" sudo mv bin/vsctl "${ROOT_PATH}"/vsctl/"${VERSION}"/linux-amd64 +echo "Building vsctl for darwin/amd64..." sudo mkdir -p "${ROOT_PATH}"/vsctl/"${VERSION}"/macos-amd64 make build-cmd GOOS=darwin GOARCH=amd64 VERSION="$VERSION" sudo mv bin/vsctl "${ROOT_PATH}"/vsctl/"${VERSION}"/macos-amd64 +echo "Building vsctl for darwin/arm64..." sudo mkdir -p "${ROOT_PATH}"/vsctl/"${VERSION}"/macos-arm64 make build-cmd GOOS=darwin GOARCH=arm64 VERSION="$VERSION" sudo mv bin/vsctl "${ROOT_PATH}"/vsctl/"${VERSION}"/macos-arm64 +# update latest +echo "Updating latest vsctl" +sudo rm -r "${ROOT_PATH}"/vsctl/latest +sudo cp -r "${ROOT_PATH}"/vsctl/"${VERSION}" "${ROOT_PATH}"/vsctl/latest + +echo "Building vsctl is done" + +# build k8s yaml file +echo "Generating Kubernetes YAML files" sudo cp "${ROOT_PATH}"/all-in-one/template.yml "${ROOT_PATH}"/all-in-one/"$VERSION".yml sudo sed -i "s/:/:${VERSION}/g" "${ROOT_PATH}"/all-in-one/"$VERSION".yml sudo cp "${ROOT_PATH}"/all-in-one/template.cn.yml "${ROOT_PATH}"/all-in-one/"$VERSION".cn.yml sudo sed -i "s/:/:${VERSION}/g" "${ROOT_PATH}"/all-in-one/"$VERSION".cn.yml + +# update latest +echo "Updating Kubernetes YAML files" +sudo rm "${ROOT_PATH}"/all-in-one/latest.yml +sudo cp "${ROOT_PATH}"/all-in-one/"$VERSION".yml "${ROOT_PATH}"/all-in-one/latest.yml +sudo rm "${ROOT_PATH}"/all-in-one/latest.cn.yml +sudo cp "${ROOT_PATH}"/all-in-one/"$VERSION".cn.yml "${ROOT_PATH}"/all-in-one/latest.cn.yml +echo "Generating is done" + +echo "Release Vanus $VERSION is completed." \ No newline at end of file From 6a23a87e01da74c314179daa6164a0408a8c91f8 Mon Sep 17 00:00:00 2001 From: wenfeng Date: Sat, 7 Jan 2023 13:12:13 +0800 Subject: [PATCH 32/46] build: add all-in-one container (#397) Signed-off-by: wenfeng Signed-off-by: wenfeng --- Makefile | 3 +++ build/all-in-one/Dockerfile | 33 ++++++++++++++++++++++++ build/all-in-one/config/controller.yaml | 34 +++++++++++++++++++++++++ build/all-in-one/config/gateway.yaml | 12 +++++++++ build/all-in-one/config/store.yaml | 30 ++++++++++++++++++++++ build/all-in-one/config/timer.yaml | 24 +++++++++++++++++ build/all-in-one/config/trigger.yaml | 14 ++++++++++ build/all-in-one/run.sh | 10 ++++++++ 8 files changed, 160 insertions(+) create mode 100644 build/all-in-one/Dockerfile create mode 100644 build/all-in-one/config/controller.yaml create mode 100644 build/all-in-one/config/gateway.yaml create mode 100644 build/all-in-one/config/store.yaml create mode 100644 build/all-in-one/config/timer.yaml create mode 100644 build/all-in-one/config/trigger.yaml create mode 100644 build/all-in-one/run.sh diff --git a/Makefile b/Makefile index 7e8698f0d..4730fb637 100644 --- a/Makefile +++ b/Makefile @@ -74,3 +74,6 @@ docker-build-timer: docker build -t ${DOCKER_REPO}/timer:${IMAGE_TAG} $(DOCKER_BUILD_ARG) -f build/images/timer/Dockerfile . build-timer: $(GO_BUILD) -o bin/timer cmd/timer/main.go + +docker-push-aio: + docker buildx build --platform ${DOCKER_PLATFORM} -t ${DOCKER_REPO}/all-in-one:${IMAGE_TAG} -f build/all-in-one/Dockerfile . --push \ No newline at end of file diff --git a/build/all-in-one/Dockerfile b/build/all-in-one/Dockerfile new file mode 100644 index 000000000..0df398864 --- /dev/null +++ b/build/all-in-one/Dockerfile @@ -0,0 +1,33 @@ +FROM --platform=$BUILDPLATFORM golang:1.18 as builder +WORKDIR /workspace + +COPY . . +RUN go mod download + +ARG TARGETOS +ARG TARGETARCH +RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make build-controller +RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make build-store +RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make build-trigger +RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make build-timer +RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make build-gateway + +FROM centos:latest +WORKDIR /vanus + +ARG VERSION +COPY --from=builder /workspace/bin/controller bin/controller +COPY --from=builder /workspace/bin/store bin/store +COPY --from=builder /workspace/bin/trigger bin/trigger +COPY --from=builder /workspace/bin/timer bin/timer +COPY --from=builder /workspace/bin/gateway bin/gateway +COPY --from=builder /workspace/build/all-in-one/config config +COPY --from=builder /workspace/build/all-in-one/run.sh run.sh + +RUN chmod a+x /vanus/run.sh +RUN mkdir /vanus/logs + +ENV VERSION=$VERSION + +ENTRYPOINT ["/vanus/run.sh"] + diff --git a/build/all-in-one/config/controller.yaml b/build/all-in-one/config/controller.yaml new file mode 100644 index 000000000..95fccca23 --- /dev/null +++ b/build/all-in-one/config/controller.yaml @@ -0,0 +1,34 @@ +name: "standalone" +ip: "127.0.0.1" +port: 2048 +etcd: + - "127.0.0.1:2379" +data_dir: "/vanus/data/controller" +gateway_endpoint: "127.0.0.1:18080" +segment_capacity: 8388604 # 8MB +topology: + standalone: 127.0.0.1:2048 +replicas: 1 +metadata: + key_prefix: "/standalone" +embed_etcd: + # relative path to ${data_dir} above + data_dir: "etcd" + listen_client_addr: 127.0.0.1:2379 + listen_peer_addr: 127.0.0.1:2380 + advertise_client_addr: 127.0.0.1:2379 + advertise_peer_addr: 127.0.0.1:2380 + heartbeat-interval: 600000 + election-timeout: 600000 + clusters: + - standalone=http://127.0.0.1:2380 +secret_encryption_salt: "encryption_salt" +observability: + metrics: + enable: false + # metrics for prometheus scratch data + port: 2112 + tracing: + enable: false + # OpenTelemetry Collector endpoint, https://opentelemetry.io/docs/collector/getting-started/ + otel_collector: http://127.0.0.1:4318 \ No newline at end of file diff --git a/build/all-in-one/config/gateway.yaml b/build/all-in-one/config/gateway.yaml new file mode 100644 index 000000000..4c4b0c487 --- /dev/null +++ b/build/all-in-one/config/gateway.yaml @@ -0,0 +1,12 @@ +port: 8080 +controllers: + - "127.0.0.1:2048" +observability: + metrics: + enable: false + # metrics for prometheus scratch data + port: 2113 + tracing: + enable: false + # OpenTelemetry Collector endpoint, https://opentelemetry.io/docs/collector/getting-started/ + otel_collector: http://127.0.0.1:4318 \ No newline at end of file diff --git a/build/all-in-one/config/store.yaml b/build/all-in-one/config/store.yaml new file mode 100644 index 000000000..c8c1baacb --- /dev/null +++ b/build/all-in-one/config/store.yaml @@ -0,0 +1,30 @@ +port: 11811 +ip : 127.0.0.1 +controllers: + - 127.0.0.1:2048 +volume: + id: 1 + dir: /vanus/data/store + capacity: 1073741824 # 1GB +meta_store: + wal: + io: + engine: psync +offset_store: + wal: + io: + engine: psync +raft: + wal: + block_size: 32768 + io: + engine: psync +observability: + metrics: + enable: false + # metrics for prometheus scratch data + port: 2114 + tracing: + enable: false + # OpenTelemetry Collector endpoint, https://opentelemetry.io/docs/collector/getting-started/ + otel_collector: http://127.0.0.1:4318 \ No newline at end of file diff --git a/build/all-in-one/config/timer.yaml b/build/all-in-one/config/timer.yaml new file mode 100644 index 000000000..622b7d0c6 --- /dev/null +++ b/build/all-in-one/config/timer.yaml @@ -0,0 +1,24 @@ +name: "timer" +ip: "127.0.0.1" +etcd: + - "127.0.0.1:2379" +replicas: 1 +metadata: + key_prefix: "/standalone" +leaderelection: + lease_duration: 15 +timingwheel: + tick: 1 + wheel_size: 32 + layers: 4 +controllers: + - 127.0.0.1:2048 +observability: + metrics: + enable: false + # metrics for prometheus scratch data + port: 2115 + tracing: + enable: false + # OpenTelemetry Collector endpoint, https://opentelemetry.io/docs/collector/getting-started/ + otel_collector: http://127.0.0.1:4318 \ No newline at end of file diff --git a/build/all-in-one/config/trigger.yaml b/build/all-in-one/config/trigger.yaml new file mode 100644 index 000000000..2b1a6e074 --- /dev/null +++ b/build/all-in-one/config/trigger.yaml @@ -0,0 +1,14 @@ +port: 2148 +ip: "127.0.0.1" +controllers: + - 127.0.0.1:2048 +rateLimit: 0 +observability: + metrics: + enable: false + # metrics for prometheus scratch data + port: 2116 + tracing: + enable: false + # OpenTelemetry Collector endpoint, https://opentelemetry.io/docs/collector/getting-started/ + otel_collector: http://127.0.0.1:4318 \ No newline at end of file diff --git a/build/all-in-one/run.sh b/build/all-in-one/run.sh new file mode 100644 index 000000000..e25cee067 --- /dev/null +++ b/build/all-in-one/run.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +nohup /vanus/bin/controller --config /vanus/config/controller.yaml > /vanus/logs/controller.log & +nohup /vanus/bin/store --config /vanus/config/store.yaml > /vanus/logs/store.log & +nohup /vanus/bin/trigger --config /vanus/config/trigger.yaml > /vanus/logs/trigger.log & +nohup /vanus/bin/timer --config /vanus/config/timer.yaml > /vanus/logs/timer.log & +nohup /vanus/bin/gateway --config /vanus/config/gateway.yaml > /vanus/logs/gateway.log & + +sleep 3600 + +pkill -f vanus From 327de28438fb32ae64c3de6a027aa5e813cc462f Mon Sep 17 00:00:00 2001 From: delu Date: Sat, 7 Jan 2023 13:13:54 +0800 Subject: [PATCH 33/46] fix: fix remove subscription reader block (#394) * fix: fix remove subscription reader block Signed-off-by: xdlbdy * fix: fix remove subscription reader block Signed-off-by: xdlbdy * fix: fix remove subscription reader block Signed-off-by: xdlbdy * fix: fix golangci Signed-off-by: xdlbdy Signed-off-by: xdlbdy --- internal/store/wal/wal_bench_test.go | 2 - internal/trigger/reader/reader.go | 194 +++++++++------------------ internal/trigger/trigger/trigger.go | 15 ++- 3 files changed, 72 insertions(+), 139 deletions(-) diff --git a/internal/store/wal/wal_bench_test.go b/internal/store/wal/wal_bench_test.go index 850b49b85..ab51f29e7 100644 --- a/internal/store/wal/wal_bench_test.go +++ b/internal/store/wal/wal_bench_test.go @@ -26,8 +26,6 @@ import ( "github.com/linkall-labs/vanus/internal/store/wal/record" ) -const walTempDir = "" - func BenchmarkWAL_AppendOneWithBatching(b *testing.B) { walDir := b.TempDir() diff --git a/internal/trigger/reader/reader.go b/internal/trigger/reader/reader.go index 4bdb2f26c..7cc01e0cf 100644 --- a/internal/trigger/reader/reader.go +++ b/internal/trigger/reader/reader.go @@ -35,15 +35,14 @@ import ( "github.com/linkall-labs/vanus/observability/metrics" "github.com/linkall-labs/vanus/pkg/errors" "github.com/linkall-labs/vanus/pkg/util" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) const ( - checkEventLogInterval = 30 * time.Second lookupReadableLogsTimeout = 5 * time.Second readEventTimeout = 5 * time.Second - initErrSleepTime = 5 * time.Second readErrSleepTime = 2 * time.Second - readSize = 5 ) type Config struct { @@ -53,8 +52,6 @@ type Config struct { SubscriptionIDStr string Offset EventLogOffset BatchSize int - - CheckEventLogInterval time.Duration } type EventLogOffset map[vanus.ID]uint64 @@ -68,107 +65,45 @@ type reader struct { elReader map[vanus.ID]struct{} events chan<- info.EventRecord stop context.CancelFunc - stctx context.Context wg sync.WaitGroup - lock sync.Mutex } func NewReader(config Config, events chan<- info.EventRecord) Reader { - if config.CheckEventLogInterval <= 0 { - config.CheckEventLogInterval = checkEventLogInterval - } config.SubscriptionIDStr = config.SubscriptionID.String() r := &reader{ config: config, events: events, elReader: make(map[vanus.ID]struct{}), } - r.stctx, r.stop = context.WithCancel(context.Background()) return r } func (r *reader) Close() { - r.stop() + if r.stop != nil { + r.stop() + } r.wg.Wait() - log.Info(r.stctx, "reader closed", map[string]interface{}{ + log.Info(context.TODO(), "reader closed", map[string]interface{}{ log.KeyEventbusName: r.config.EventBusName, }) } func (r *reader) Start() error { - go r.watchEventLogChange() - return nil -} - -func (r *reader) watchEventLogChange() { - r.checkEventLogChange() - tk := time.NewTicker(r.config.CheckEventLogInterval) - defer tk.Stop() - for { - select { - case <-r.stctx.Done(): - return - case <-tk.C: - r.checkEventLogChange() - } - } -} - -func (r *reader) checkEventLogChange() { - ctx, cancel := context.WithTimeout(r.stctx, lookupReadableLogsTimeout) + ctx, cancel := context.WithCancel(context.Background()) + r.stop = cancel + timeoutCtx, cancel := context.WithTimeout(ctx, lookupReadableLogsTimeout) defer cancel() - ls, err := r.config.Client.Eventbus(ctx, r.config.EventBusName).ListLog(ctx) + logs, err := r.config.Client.Eventbus(timeoutCtx, r.config.EventBusName).ListLog(timeoutCtx) if err != nil { log.Warning(ctx, "eventbus lookup Readable eventlog error", map[string]interface{}{ log.KeyEventbusName: r.config.EventBusName, log.KeyError: err, }) - return - } - els := make([]uint64, len(ls)) - for idx, l := range ls { - els[idx] = l.ID() - } - if len(els) != len(r.elReader) { - log.Info(ctx, "event eventlog change,will restart event eventlog reader", map[string]interface{}{ - log.KeyEventbusName: r.config.EventBusName, - }) - r.start(els) - log.Info(ctx, "event eventlog change,restart event eventlog reader success", map[string]interface{}{ - log.KeyEventbusName: r.config.EventBusName, - }) - } -} - -func (r *reader) getOffset(eventLogID vanus.ID) uint64 { - v, exist := r.config.Offset[eventLogID] - if exist { - return v + return err } - log.Warning(r.stctx, "offset no exist, will use 0", map[string]interface{}{ - log.KeyEventbusName: r.config.EventBusName, - log.KeySubscriptionID: r.config.SubscriptionID, - log.KeyEventlogID: eventLogID, - }) - return 0 -} - -func (r *reader) start(els []uint64) { - r.lock.Lock() - defer r.lock.Unlock() - for _, el := range els { - eventLogID := vanus.ID(el) - if _, exist := r.elReader[eventLogID]; exist { - continue - } + for _, l := range logs { + eventLogID := vanus.NewIDFromUint64(l.ID()) offset := r.getOffset(eventLogID) - l, err := r.config.Client.Eventbus(r.stctx, r.config.EventBusName).GetLog(r.stctx, eventLogID.Uint64()) - if err != nil { - log.Error(r.stctx, "get eventlog error", map[string]interface{}{ - log.KeyError: err, - }) - continue - } elc := &eventLogReader{ config: r.config, eventLogID: eventLogID, @@ -177,22 +112,36 @@ func (r *reader) start(els []uint64) { events: r.events, offset: offset, } - r.elReader[elc.eventLogID] = struct{}{} r.wg.Add(1) go func() { - defer func() { - r.wg.Done() - log.Info(r.stctx, "event eventlog reader stop", map[string]interface{}{ - log.KeyEventlogID: elc.eventLogID, - "offset": elc.offset, - }) - }() - log.Info(r.stctx, "event eventlog reader start", map[string]interface{}{ - log.KeyEventlogID: elc.eventLogID, + defer r.wg.Done() + log.Info(ctx, "event eventlog reader start", map[string]interface{}{ + log.KeyEventbusName: elc.config.EventBusName, + log.KeyEventlogID: elc.eventLogID, + "offset": elc.offset, + }) + elc.run(ctx) + log.Info(ctx, "event eventlog reader stop", map[string]interface{}{ + log.KeyEventbusName: elc.config.EventBusName, + log.KeyEventlogID: elc.eventLogID, + "offset": elc.offset, }) - elc.run(r.stctx) }() } + return nil +} + +func (r *reader) getOffset(eventLogID vanus.ID) uint64 { + v, exist := r.config.Offset[eventLogID] + if exist { + return v + } + log.Warning(context.TODO(), "offset no exist, will use 0", map[string]interface{}{ + log.KeyEventbusName: r.config.EventBusName, + log.KeySubscriptionID: r.config.SubscriptionID, + log.KeyEventlogID: eventLogID, + }) + return 0 } type eventLogReader struct { @@ -205,57 +154,42 @@ type eventLogReader struct { } func (elReader *eventLogReader) run(ctx context.Context) { - for attempt := 0; ; attempt++ { - lr, err := elReader.init(ctx) - switch err { - case nil: - case context.Canceled: + r := elReader.config.Client.Eventbus(ctx, elReader.config.EventBusName).Reader( + option.WithReadPolicy(elReader.policy), option.WithBatchSize(elReader.config.BatchSize)) + log.Info(ctx, "eventlog reader init success", map[string]interface{}{ + log.KeyEventbusName: elReader.config.EventBusName, + log.KeyEventlogID: elReader.eventLogID, + "offset": elReader.offset, + }) + for { + select { + case <-ctx.Done(): return - case context.DeadlineExceeded: - log.Warning(ctx, "eventlog reader init timeout", map[string]interface{}{ - log.KeyEventbusName: elReader.config.EventBusName, - log.KeyEventlogID: elReader.eventLogID, - }) + default: + } + err := elReader.loop(ctx, r) + switch { + case err == nil, errors.Is(err, errors.ErrOffsetOnEnd), errors.Is(err, errors.ErrTryAgain): continue + case stderr.Is(err, context.Canceled), status.Convert(err).Code() == codes.Canceled: + return + case errors.Is(err, errors.ErrOffsetUnderflow): + // todo reset offset timestamp default: - log.Warning(ctx, "eventlog reader init error,will retry", map[string]interface{}{ + log.Warning(ctx, "read event error", map[string]interface{}{ log.KeyEventbusName: elReader.config.EventBusName, log.KeyEventlogID: elReader.eventLogID, + "offset": elReader.offset, log.KeyError: err, }) - if !util.SleepWithContext(ctx, initErrSleepTime) { + if !util.SleepWithContext(ctx, readErrSleepTime) { return } - continue - } - log.Info(ctx, "eventlog reader init success", map[string]interface{}{ - log.KeyEventbusName: elReader.config.EventBusName, - log.KeyEventlogID: elReader.eventLogID, - "offset": elReader.offset, - }) - for { - err = elReader.readEvent(ctx, lr) - switch { - case err == nil, errors.Is(err, errors.ErrOffsetOnEnd), errors.Is(err, errors.ErrTryAgain): - case stderr.Is(err, context.Canceled): - return - case errors.Is(err, errors.ErrOffsetUnderflow): - // todo reset offset timestamp - default: - log.Warning(ctx, "read event error", map[string]interface{}{ - log.KeyEventlogID: elReader.eventLogID, - "offset": elReader.offset, - log.KeyError: err, - }) - if !util.SleepWithContext(ctx, readErrSleepTime) { - return - } - } } } } -func (elReader *eventLogReader) readEvent(ctx context.Context, lr api.BusReader) error { +func (elReader *eventLogReader) loop(ctx context.Context, lr api.BusReader) error { events, err := readEvents(ctx, lr) if err != nil { return err @@ -296,9 +230,3 @@ func readEvents(ctx context.Context, lr api.BusReader) ([]*ce.Event, error) { events, _, _, err := lr.Read(timeout) return events, err } - -func (elReader *eventLogReader) init(ctx context.Context) (api.BusReader, error) { - lr := elReader.config.Client.Eventbus(ctx, elReader.config.EventBusName).Reader( - option.WithReadPolicy(elReader.policy), option.WithBatchSize(elReader.config.BatchSize)) - return lr, nil -} diff --git a/internal/trigger/trigger/trigger.go b/internal/trigger/trigger/trigger.go index 56d71cc1b..e21f6484b 100644 --- a/internal/trigger/trigger/trigger.go +++ b/internal/trigger/trigger/trigger.go @@ -550,12 +550,19 @@ func (t *trigger) Start(ctx context.Context) error { ctx, cancel := context.WithCancel(context.Background()) t.stop = cancel // eb event - _ = t.reader.Start() + err := t.reader.Start() + if err != nil { + return err + } + // retry event + err = t.retryEventReader.Start() + if err != nil { + t.reader.Close() + return err + } t.wg.StartWithContext(ctx, t.runEventFilterTransform) t.wg.StartWithContext(ctx, t.runEventToBatch) t.wg.StartWithContext(ctx, t.runEventSend) - // retry event - _ = t.retryEventReader.Start() t.wg.StartWithContext(ctx, t.runRetryEventFilterTransform) t.state = TriggerRunning log.Info(ctx, "trigger started", map[string]interface{}{ @@ -571,9 +578,9 @@ func (t *trigger) Stop(ctx context.Context) error { if t.state == TriggerStopped { return nil } - t.stop() t.reader.Close() t.retryEventReader.Close() + t.stop() close(t.eventCh) close(t.retryEventCh) close(t.sendCh) From 27891204864cf3d194ecb893b45fdae021f1c4a7 Mon Sep 17 00:00:00 2001 From: delu Date: Sat, 7 Jan 2023 13:14:31 +0800 Subject: [PATCH 34/46] feat: filter exact, prefix and suffix support event data (#379) * feat: exact, perfix and suffix support data Signed-off-by: delu * feat: exact, perfix and suffix support data Signed-off-by: xdlbdy Signed-off-by: delu Signed-off-by: xdlbdy --- internal/trigger/filter/common.go | 84 ++++++++++++++++++++ internal/trigger/filter/exact_filter.go | 42 +++------- internal/trigger/filter/exact_filter_test.go | 49 +++++++++--- internal/trigger/filter/prefix_filter.go | 38 +++------ internal/trigger/filter/suffix_filter.go | 38 +++------ 5 files changed, 150 insertions(+), 101 deletions(-) create mode 100644 internal/trigger/filter/common.go diff --git a/internal/trigger/filter/common.go b/internal/trigger/filter/common.go new file mode 100644 index 000000000..409c18a1a --- /dev/null +++ b/internal/trigger/filter/common.go @@ -0,0 +1,84 @@ +// Copyright 2023 Linkall Inc. +// +// 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 filter + +import ( + "context" + + ce "github.com/cloudevents/sdk-go/v2" + "github.com/linkall-labs/vanus/internal/trigger/util" + "github.com/linkall-labs/vanus/observability/log" + "github.com/tidwall/gjson" +) + +type commonFilter struct { + attribute map[string]string + data map[string]string + meetCondition meetCondition +} + +type meetCondition func(exist bool, value interface{}, compareValue string) bool + +func newCommonFilter(value map[string]string, meetCondition meetCondition) *commonFilter { + attribute := map[string]string{} + data := map[string]string{} + for attr, v := range value { + if attr == "" || v == "" { + log.Info(context.Background(), "new filter but has empty ", map[string]interface{}{ + "attr": attr, + "value": v, + }) + return nil + } + switch { + case attr == "data": + data[""] = v + case len(attr) > 4 && attr[:5] == "data.": + attr = attr[5:] + data[attr] = v + default: + // event attribute. + attribute[attr] = v + } + } + return &commonFilter{ + attribute: attribute, + data: data, + meetCondition: meetCondition, + } +} + +func (filter *commonFilter) Filter(event ce.Event) Result { + for attr, v := range filter.attribute { + value, ok := util.LookupAttribute(event, attr) + if !filter.meetCondition(ok, value, v) { + return FailFilter + } + } + for attr, v := range filter.data { + if attr == "" { + // event data + if !filter.meetCondition(true, string(event.Data()), v) { + return FailFilter + } + continue + } + result := gjson.GetBytes(event.Data(), attr) + if !filter.meetCondition(result.Exists(), result.Value(), v) { + return FailFilter + } + } + return PassFilter +} diff --git a/internal/trigger/filter/exact_filter.go b/internal/trigger/filter/exact_filter.go index 29aed3fe7..211c2bd95 100644 --- a/internal/trigger/filter/exact_filter.go +++ b/internal/trigger/filter/exact_filter.go @@ -14,45 +14,21 @@ package filter -import ( - "context" - "fmt" - - "github.com/linkall-labs/vanus/internal/trigger/util" - "github.com/linkall-labs/vanus/observability/log" - - ce "github.com/cloudevents/sdk-go/v2" -) - type exactFilter struct { - exact map[string]string + commonFilter } func NewExactFilter(exact map[string]string) Filter { - for attr, v := range exact { - if attr == "" || v == "" { - log.Info(context.Background(), "new exact filter but has empty ", map[string]interface{}{ - "attr": attr, - "value": v, - }) - return nil + f := newCommonFilter(exact, func(exist bool, value interface{}, compareValue string) bool { + if !exist { + return false } + return value == compareValue + }) + if f == nil { + return nil } - return &exactFilter{exact: exact} -} - -func (filter *exactFilter) Filter(event ce.Event) Result { - for attr, v := range filter.exact { - value, ok := util.LookupAttribute(event, attr) - if !ok || value != v { - return FailFilter - } - } - return PassFilter -} - -func (filter *exactFilter) String() string { - return fmt.Sprintf("exact:%v", filter.exact) + return &exactFilter{commonFilter: *f} } var _ Filter = (*exactFilter)(nil) diff --git a/internal/trigger/filter/exact_filter_test.go b/internal/trigger/filter/exact_filter_test.go index bf91a5e5b..49fa917f5 100644 --- a/internal/trigger/filter/exact_filter_test.go +++ b/internal/trigger/filter/exact_filter_test.go @@ -28,6 +28,10 @@ func TestExactFilter(t *testing.T) { event.SetID("testID") event.SetSource("testSource") event.SetExtension("key", "value") + event.SetData(ce.ApplicationJSON, map[string]interface{}{ + "str": "strValue", + "number": 123, + }) Convey("exact filter nil", t, func() { f := filter.NewExactFilter(map[string]string{ "": "testID", @@ -38,18 +42,43 @@ func TestExactFilter(t *testing.T) { }) So(f, ShouldBeNil) }) - Convey("exact filter pass", t, func() { - f := filter.NewExactFilter(map[string]string{ - "key": "value", + Convey("exact filter attribute", t, func() { + Convey("exact filter pass", func() { + f := filter.NewExactFilter(map[string]string{ + "key": "value", + }) + result := f.Filter(event) + So(result, ShouldEqual, filter.PassFilter) + }) + Convey("exact filter fail", func() { + f := filter.NewExactFilter(map[string]string{ + "key": "unknown", + }) + result := f.Filter(event) + So(result, ShouldEqual, filter.FailFilter) }) - result := f.Filter(event) - So(result, ShouldEqual, filter.PassFilter) }) - Convey("exact filter fail", t, func() { - f := filter.NewExactFilter(map[string]string{ - "key": "unknown", + Convey("exact data", t, func() { + Convey("exact filter pass", func() { + f := filter.NewExactFilter(map[string]string{ + "data.str": "strValue", + }) + result := f.Filter(event) + So(result, ShouldEqual, filter.PassFilter) + }) + Convey("exact filter fail", func() { + f := filter.NewExactFilter(map[string]string{ + "data.str": "unknown", + }) + result := f.Filter(event) + So(result, ShouldEqual, filter.FailFilter) + }) + Convey("exact filter data", func() { + f := filter.NewExactFilter(map[string]string{ + "data": "unknown", + }) + result := f.Filter(event) + So(result, ShouldEqual, filter.FailFilter) }) - result := f.Filter(event) - So(result, ShouldEqual, filter.FailFilter) }) } diff --git a/internal/trigger/filter/prefix_filter.go b/internal/trigger/filter/prefix_filter.go index 5fd664c1d..2e8f5ba5f 100644 --- a/internal/trigger/filter/prefix_filter.go +++ b/internal/trigger/filter/prefix_filter.go @@ -15,46 +15,26 @@ package filter import ( - "context" - "fmt" "strings" - "github.com/linkall-labs/vanus/internal/trigger/util" - "github.com/linkall-labs/vanus/observability/log" pkgUtil "github.com/linkall-labs/vanus/pkg/util" - - ce "github.com/cloudevents/sdk-go/v2" ) type prefixFilter struct { - prefix map[string]string + commonFilter } func NewPrefixFilter(prefix map[string]string) Filter { - for attr, v := range prefix { - if attr == "" || v == "" { - log.Info(context.Background(), "new prefix filter but has empty ", map[string]interface{}{ - "attr": attr, - "value": v, - }) - return nil + f := newCommonFilter(prefix, func(exist bool, value interface{}, compareValue string) bool { + if !exist { + return false } + return strings.HasPrefix(pkgUtil.StringValue(value), compareValue) + }) + if f == nil { + return nil } - return &prefixFilter{prefix: prefix} -} - -func (filter *prefixFilter) Filter(event ce.Event) Result { - for attr, prefix := range filter.prefix { - value, ok := util.LookupAttribute(event, attr) - if !ok || !strings.HasPrefix(pkgUtil.StringValue(value), prefix) { - return FailFilter - } - } - return PassFilter -} - -func (filter *prefixFilter) String() string { - return fmt.Sprintf("prefix:%v", filter.prefix) + return &prefixFilter{commonFilter: *f} } var _ Filter = (*prefixFilter)(nil) diff --git a/internal/trigger/filter/suffix_filter.go b/internal/trigger/filter/suffix_filter.go index a771ef2f0..83edfa251 100644 --- a/internal/trigger/filter/suffix_filter.go +++ b/internal/trigger/filter/suffix_filter.go @@ -15,46 +15,26 @@ package filter import ( - "context" - "fmt" "strings" - "github.com/linkall-labs/vanus/internal/trigger/util" - "github.com/linkall-labs/vanus/observability/log" pkgUtil "github.com/linkall-labs/vanus/pkg/util" - - ce "github.com/cloudevents/sdk-go/v2" ) type suffixFilter struct { - suffix map[string]string + commonFilter } func NewSuffixFilter(suffix map[string]string) Filter { - for attr, v := range suffix { - if attr == "" || v == "" { - log.Info(context.TODO(), "new suffix filter but has empty ", map[string]interface{}{ - "attr": attr, - "value": v, - }) - return nil + f := newCommonFilter(suffix, func(exist bool, value interface{}, compareValue string) bool { + if !exist { + return false } + return strings.HasSuffix(pkgUtil.StringValue(value), compareValue) + }) + if f == nil { + return nil } - return &suffixFilter{suffix: suffix} -} - -func (filter *suffixFilter) Filter(event ce.Event) Result { - for attr, suffix := range filter.suffix { - value, ok := util.LookupAttribute(event, attr) - if !ok || !strings.HasSuffix(pkgUtil.StringValue(value), suffix) { - return FailFilter - } - } - return PassFilter -} - -func (filter *suffixFilter) String() string { - return fmt.Sprintf("suffix:%v", filter.suffix) + return &suffixFilter{commonFilter: *f} } var _ Filter = (*suffixFilter)(nil) From 89f80c3d3624d599251a083f8e38643410163e5e Mon Sep 17 00:00:00 2001 From: jyjiangkai Date: Sat, 7 Jan 2023 19:55:35 +0800 Subject: [PATCH 35/46] feat: merge the publish and send interfaces (#398) Signed-off-by: jyjiangkai Signed-off-by: jyjiangkai --- internal/gateway/proxy/proxy.go | 70 +++++++-------------------------- 1 file changed, 14 insertions(+), 56 deletions(-) diff --git a/internal/gateway/proxy/proxy.go b/internal/gateway/proxy/proxy.go index 91906a186..0b8b095a6 100644 --- a/internal/gateway/proxy/proxy.go +++ b/internal/gateway/proxy/proxy.go @@ -93,7 +93,7 @@ type Config struct { } var ( - _ cloudevents.CloudEventsServer = &ControllerProxy{} + _ vanuspb.ClientServer = &ControllerProxy{} ) type ackCallback func(bool) @@ -145,6 +145,7 @@ type ControllerProxy struct { func (cp *ControllerProxy) Publish(ctx context.Context, req *vanuspb.PublishRequest) (*emptypb.Empty, error) { _ctx, span := cp.tracer.Start(ctx, "Publish") defer span.End() + if req.EventbusName == "" { return nil, v2.NewHTTPResult(http.StatusBadRequest, "invalid eventbus name") } @@ -155,6 +156,9 @@ func (cp *ControllerProxy) Publish(ctx context.Context, req *vanuspb.PublishRequ if err != nil { return nil, v2.NewHTTPResult(http.StatusBadRequest, err.Error()) } + if e.Attributes == nil { + e.Attributes = make(map[string]*cloudevents.CloudEvent_CloudEventAttributeValue, 0) + } e.Attributes[primitive.XVanusEventbus] = &cloudevents.CloudEvent_CloudEventAttributeValue{ Attr: &cloudevents.CloudEvent_CloudEventAttributeValue_CeString{CeString: req.EventbusName}, } @@ -172,7 +176,15 @@ func (cp *ControllerProxy) Publish(ctx context.Context, req *vanuspb.PublishRequ } } - err := cp.client.Eventbus(ctx, req.GetEventbusName()).Writer().AppendBatch(_ctx, req.GetEvents()) + val, exist := cp.writerMap.Load(req.GetEventbusName()) + if !exist { + val, _ = cp.writerMap.LoadOrStore(req.GetEventbusName(), + cp.client.Eventbus(ctx, req.GetEventbusName()).Writer()) + } + + w, _ := val.(api.BusWriter) + + err := w.AppendBatch(_ctx, req.GetEvents()) if err != nil { log.Warning(_ctx, "append to failed", map[string]interface{}{ log.KeyError: err, @@ -395,59 +407,6 @@ func attributeFor(v interface{}) (*cloudevents.CloudEvent_CloudEventAttributeVal return attr, nil } -func (cp *ControllerProxy) Send(ctx context.Context, batch *cloudevents.BatchEvent) (*emptypb.Empty, error) { - _ctx, span := cp.tracer.Start(ctx, "Send") - defer span.End() - - if batch.EventbusName == "" { - return nil, v2.NewHTTPResult(http.StatusBadRequest, "invalid eventbus name") - } - - for idx := range batch.Events.Events { - e := batch.Events.Events[idx] - err := checkExtension(e.Attributes) - if err != nil { - return nil, v2.NewHTTPResult(http.StatusBadRequest, err.Error()) - } - if e.Attributes == nil { - e.Attributes = make(map[string]*cloudevents.CloudEvent_CloudEventAttributeValue, 0) - } - e.Attributes[primitive.XVanusEventbus] = &cloudevents.CloudEvent_CloudEventAttributeValue{ - Attr: &cloudevents.CloudEvent_CloudEventAttributeValue_CeString{CeString: batch.EventbusName}, - } - if eventTime, ok := e.Attributes[primitive.XVanusDeliveryTime]; ok { - // validate event time - if _, err := types.ParseTime(eventTime.String()); err != nil { - log.Error(_ctx, "invalid format of event time", map[string]interface{}{ - log.KeyError: err, - "eventTime": eventTime.String(), - }) - return nil, v2.NewHTTPResult(http.StatusBadRequest, "invalid delivery time") - } - // TODO process delay message - // ebName = primitive.TimerEventbusName - } - } - - val, exist := cp.writerMap.Load(batch.GetEventbusName()) - if !exist { - val, _ = cp.writerMap.LoadOrStore(batch.GetEventbusName(), - cp.client.Eventbus(ctx, batch.GetEventbusName()).Writer()) - } - - w, _ := val.(api.BusWriter) - err := w.AppendBatch(_ctx, batch.GetEvents()) - if err != nil { - log.Warning(_ctx, "append to failed", map[string]interface{}{ - log.KeyError: err, - "eventbus": batch.EventbusName, - }) - return nil, v2.NewHTTPResult(http.StatusInternalServerError, err.Error()) - } - - return &emptypb.Empty{}, nil -} - func checkExtension(extensions map[string]*cloudevents.CloudEvent_CloudEventAttributeValue) error { if len(extensions) == 0 { return nil @@ -507,7 +466,6 @@ func (cp *ControllerProxy) Start() error { } proxypb.RegisterControllerProxyServer(cp.grpcSrv, cp) - cloudevents.RegisterCloudEventsServer(cp.grpcSrv, cp) vanuspb.RegisterClientServer(cp.grpcSrv, cp) proxyListen, err := net.Listen("tcp", fmt.Sprintf(":%d", cp.cfg.ProxyPort)) From ba42f8f1771d0f48c6fd383e0585ce4c0092b032 Mon Sep 17 00:00:00 2001 From: wenfeng Date: Sun, 8 Jan 2023 20:01:03 +0800 Subject: [PATCH 36/46] test: add aws test cluster yaml (#399) --- test/infra/Dockerfile | 2 +- test/infra/aws-eks/controller.yml | 127 +++++++++++++++++++++++ test/infra/aws-eks/deploy.sh | 6 ++ test/infra/aws-eks/gateway.yml | 74 +++++++++++++ test/infra/aws-eks/ns.yml | 4 + test/infra/aws-eks/sc.yml | 13 +++ test/infra/aws-eks/store.yml | 105 +++++++++++++++++++ test/infra/aws-eks/timer.yml | 72 +++++++++++++ test/infra/aws-eks/trigger.yml | 74 +++++++++++++ test/infra/{ => benchmark}/benchmark.yml | 0 test/infra/{ => benchmark}/sc.yml | 0 test/infra/{ => benchmark}/vanus.yml | 5 + test/infra/secret.yml.example | 9 -- test/yaml/display.yml | 33 ------ test/yaml/etcd-srv.yml | 13 --- 15 files changed, 481 insertions(+), 56 deletions(-) create mode 100644 test/infra/aws-eks/controller.yml create mode 100644 test/infra/aws-eks/deploy.sh create mode 100644 test/infra/aws-eks/gateway.yml create mode 100644 test/infra/aws-eks/ns.yml create mode 100644 test/infra/aws-eks/sc.yml create mode 100644 test/infra/aws-eks/store.yml create mode 100644 test/infra/aws-eks/timer.yml create mode 100644 test/infra/aws-eks/trigger.yml rename test/infra/{ => benchmark}/benchmark.yml (100%) rename test/infra/{ => benchmark}/sc.yml (100%) rename test/infra/{ => benchmark}/vanus.yml (99%) delete mode 100644 test/infra/secret.yml.example delete mode 100644 test/yaml/display.yml delete mode 100644 test/yaml/etcd-srv.yml diff --git a/test/infra/Dockerfile b/test/infra/Dockerfile index 99e2d3656..813769d77 100644 --- a/test/infra/Dockerfile +++ b/test/infra/Dockerfile @@ -14,7 +14,7 @@ COPY --from=builder /workspace/bin/vanus-bench /usr/bin/vanus-bench WORKDIR /vanus-bench RUN apt-get update && apt-get install -y curl -RUN curl -O https://download.linkall.com/vsctl/v0.5.4/linux-amd64/vsctl && \ +RUN curl -O https://download.linkall.com/vsctl/latest/linux-amd64/vsctl && \ mv vsctl /usr/bin/vsctl RUN chmod a+x /usr/bin/vsctl RUN chmod a+x /usr/bin/vanus-bench \ No newline at end of file diff --git a/test/infra/aws-eks/controller.yml b/test/infra/aws-eks/controller.yml new file mode 100644 index 000000000..72c3872ed --- /dev/null +++ b/test/infra/aws-eks/controller.yml @@ -0,0 +1,127 @@ +kind: ConfigMap +metadata: + name: config-controller + namespace: vanus +apiVersion: v1 +data: + controller.yaml: |- + node_id: ${NODE_ID} + name: ${POD_NAME} + ip: ${POD_IP} + port: 2048 + etcd: + - vanus-controller-0.vanus-controller:2379 + - vanus-controller-1.vanus-controller:2379 + - vanus-controller-2.vanus-controller:2379 + data_dir: /data + segment_capacity: 268435456 + replicas: 3 + metadata: + key_prefix: /vanus + topology: + vanus-controller-0: vanus-controller-0.vanus-controller.vanus.svc:2048 + vanus-controller-1: vanus-controller-1.vanus-controller.vanus.svc:2048 + vanus-controller-2: vanus-controller-2.vanus-controller.vanus.svc:2048 + embed_etcd: + # relative path to ${data_dir} above + data_dir: etcd/data + listen_client_addr: 0.0.0.0:2379 + listen_peer_addr: 0.0.0.0:2380 + advertise_client_addr: ${POD_NAME}.vanus-controller:2379 + advertise_peer_addr: ${POD_NAME}.vanus-controller:2380 + clusters: + - vanus-controller-0=http://vanus-controller-0.vanus-controller:2380 + - vanus-controller-1=http://vanus-controller-1.vanus-controller:2380 + - vanus-controller-2=http://vanus-controller-2.vanus-controller:2380 +--- +apiVersion: v1 +kind: Service +metadata: + name: vanus-controller + namespace: vanus +spec: + clusterIP: None + ports: + - name: vanus-controller + port: 2048 + selector: + app: vanus-controller +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app: vanus-controller + name: vanus-controller + namespace: vanus +spec: + replicas: 3 + selector: + matchLabels: + app: vanus-controller + serviceName: vanus-controller + template: + metadata: + annotations: + vanus.dev/metrics.port: "2112" + labels: + app: vanus-controller + spec: + nodeSelector: + type: storage + containers: + - command: + - /bin/sh + - -c + - NODE_ID=${HOSTNAME##*-} /vanus/bin/controller + env: + - name: VANUS_LOG_LEVEL + value: DEBUG + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/controller:6b23e5a + imagePullPolicy: IfNotPresent + name: controller + resources: + limits: + cpu: 1000m + memory: 4000Mi + requests: + cpu: 1000m + memory: 4000Mi + ports: + - containerPort: 2048 + name: grpc + - containerPort: 2379 + name: etcd-client + - containerPort: 2380 + name: etcd-peer + - containerPort: 2112 + name: metrics + volumeMounts: + - mountPath: /vanus/config + name: config-controller + - mountPath: /data + name: data + volumes: + - configMap: + name: config-controller + name: config-controller + volumeClaimTemplates: + - metadata: + labels: + app: vanus-controller + name: data + spec: + accessModes: + - ReadWriteOnce + storageClassName: gp3 + resources: + requests: + storage: 20Gi \ No newline at end of file diff --git a/test/infra/aws-eks/deploy.sh b/test/infra/aws-eks/deploy.sh new file mode 100644 index 000000000..860432664 --- /dev/null +++ b/test/infra/aws-eks/deploy.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +kubectl apply -f sc.yml +kubectl apply -f controller.yml +kubectl apply -f store.yml +kubectl apply -f trigger.yml +kubectl apply -f timer.yml diff --git a/test/infra/aws-eks/gateway.yml b/test/infra/aws-eks/gateway.yml new file mode 100644 index 000000000..554db1b6c --- /dev/null +++ b/test/infra/aws-eks/gateway.yml @@ -0,0 +1,74 @@ +kind: ConfigMap +metadata: + name: config-gateway + namespace: vanus +apiVersion: v1 +data: + gateway.yaml: |- + port: 8080 + controllers: + - vanus-controller-0.vanus-controller:2048 + - vanus-controller-1.vanus-controller:2048 + - vanus-controller-2.vanus-controller:2048 +--- +apiVersion: v1 +kind: Service +metadata: + name: vanus-gateway + namespace: vanus +spec: + ports: + - name: proxy + targetPort: 8080 + port: 8080 + - name: cloudevents + targetPort: 8081 + port: 8081 + selector: + app: vanus-gateway + type: NodePort +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: vanus-gateway + name: vanus-gateway + namespace: vanus +spec: + replicas: 1 + selector: + matchLabels: + app: vanus-gateway + template: + metadata: + annotations: + vanus.dev/metrics.port: "2112" + labels: + app: vanus-gateway + spec: + nodeSelector: + type: calculation + containers: + - image: public.ecr.aws/vanus/gateway:6b23e5a + imagePullPolicy: IfNotPresent + name: gateway + resources: + limits: + cpu: 2000m + memory: 2000Mi + requests: + cpu: 2000m + memory: 2000Mi + ports: + - containerPort: 8080 + name: proxy + - containerPort: 8081 + name: cloudevents + volumeMounts: + - mountPath: /vanus/config + name: config-gateway + volumes: + - configMap: + name: config-gateway + name: config-gateway \ No newline at end of file diff --git a/test/infra/aws-eks/ns.yml b/test/infra/aws-eks/ns.yml new file mode 100644 index 000000000..b4fe73b27 --- /dev/null +++ b/test/infra/aws-eks/ns.yml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: vanus \ No newline at end of file diff --git a/test/infra/aws-eks/sc.yml b/test/infra/aws-eks/sc.yml new file mode 100644 index 000000000..7d776637d --- /dev/null +++ b/test/infra/aws-eks/sc.yml @@ -0,0 +1,13 @@ +# https://github.com/kubernetes-sigs/aws-ebs-csi-driver/tree/master/examples/kubernetes/dynamic-provisioning/manifests +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: gp3 + annotations: + storageclass.kubernetes.io/is-default-class: "false" +provisioner: ebs.csi.aws.com +volumeBindingMode: WaitForFirstConsumer +reclaimPolicy: Delete +parameters: + type: gp3 + fsType: xfs \ No newline at end of file diff --git a/test/infra/aws-eks/store.yml b/test/infra/aws-eks/store.yml new file mode 100644 index 000000000..6b6e30474 --- /dev/null +++ b/test/infra/aws-eks/store.yml @@ -0,0 +1,105 @@ +kind: ConfigMap +metadata: + name: config-store + namespace: vanus +apiVersion: v1 +data: + store.yaml: |- + port: 11811 + ip: ${POD_IP} + controllers: + - vanus-controller-0.vanus-controller:2048 + - vanus-controller-1.vanus-controller:2048 + - vanus-controller-2.vanus-controller:2048 + volume: + id: ${VOLUME_ID} + dir: /data + capacity: 1073741824 + meta_store: + wal: + io: + engine: psync + offset_store: + wal: + io: + engine: psync + raft: + wal: + block_size: 16384 + io: + engine: psync + parallel: 16 + vsb: + flush_batch_size: 16384 + io: + engine: psync + parallel: 16 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app: vanus-store + name: vanus-store + namespace: vanus +spec: + replicas: 3 + selector: + matchLabels: + app: vanus-store + serviceName: vanus-store + template: + metadata: + annotations: + vanus.dev/metrics.port: "2112" + labels: + app: vanus-store + spec: + nodeSelector: + type: storage + containers: + - command: + - /bin/sh + - -c + - VOLUME_ID=${HOSTNAME##*-} /vanus/bin/store + env: + - name: VANUS_LOG_LEVEL + value: INFO + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/store:6b23e5a + imagePullPolicy: IfNotPresent + name: store + resources: + limits: + cpu: 2000m + memory: 8000Mi + requests: + cpu: 2000m + memory: 8000Mi + ports: + - containerPort: 11811 + name: grpc + volumeMounts: + - mountPath: /vanus/config + name: config-store + - mountPath: /data + name: data + volumes: + - configMap: + name: config-store + name: config-store + volumeClaimTemplates: + - metadata: + labels: + app: vanus-store + name: data + spec: + accessModes: + - ReadWriteOnce + storageClassName: gp3 + resources: + requests: + storage: 200Gi \ No newline at end of file diff --git a/test/infra/aws-eks/timer.yml b/test/infra/aws-eks/timer.yml new file mode 100644 index 000000000..15c411770 --- /dev/null +++ b/test/infra/aws-eks/timer.yml @@ -0,0 +1,72 @@ +apiVersion: v1 +data: + timer.yaml: |- + name: "timer" + ip: ${POD_IP} + etcd: + - vanus-controller-0.vanus-controller:2379 + - vanus-controller-1.vanus-controller:2379 + - vanus-controller-2.vanus-controller:2379 + metadata: + key_prefix: "/vanus" + leaderelection: + lease_duration: 15 + timingwheel: + tick: 1 + wheel_size: 32 + layers: 4 + controllers: + - vanus-controller-0.vanus-controller.vanus.svc:2048 + - vanus-controller-1.vanus-controller.vanus.svc:2048 + - vanus-controller-2.vanus-controller.vanus.svc:2048 +kind: ConfigMap +metadata: + name: config-timer + namespace: vanus +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: vanus-timer + name: vanus-timer + namespace: vanus +spec: + replicas: 1 + selector: + matchLabels: + app: vanus-timer + template: + metadata: + annotations: + vanus.dev/metrics.port: "2112" + labels: + app: vanus-timer + spec: + nodeSelector: + type: calculation + containers: + - env: + - name: VANUS_LOG_LEVEL + value: DEBUG + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/timer:6b23e5a + imagePullPolicy: IfNotPresent + name: timer + volumeMounts: + - mountPath: /vanus/config + name: config-timer + resources: + limits: + cpu: 2000m + memory: 4000Mi + requests: + cpu: 2000m + memory: 4000Mi + volumes: + - configMap: + name: config-timer + name: config-timer \ No newline at end of file diff --git a/test/infra/aws-eks/trigger.yml b/test/infra/aws-eks/trigger.yml new file mode 100644 index 000000000..93d42db34 --- /dev/null +++ b/test/infra/aws-eks/trigger.yml @@ -0,0 +1,74 @@ +apiVersion: v1 +data: + trigger.yaml: |- + port: 2148 + ip : ${POD_IP} + send_event_goroutine_size: 1000 + send_event_batch_size: 32 + pull_event_batch_size: 32 + max_uack_event_number: 10000 + controllers: + - vanus-controller-0.vanus-controller.vanus.svc:2048 + - vanus-controller-1.vanus-controller.vanus.svc:2048 + - vanus-controller-2.vanus-controller.vanus.svc:2048 +kind: ConfigMap +metadata: + name: config-trigger + namespace: vanus +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: vanus-trigger + name: vanus-trigger + namespace: vanus +spec: + replicas: 1 + selector: + matchLabels: + app: vanus-trigger + template: + metadata: + annotations: + vanus.dev/metrics.port: "2112" + labels: + app: vanus-trigger + spec: + initContainers: + - name: set-system-parameters + image: busybox + securityContext: + capabilities: { } + privileged: true + command: ["/bin/sh", "-c", "sysctl -w net.ipv4.tcp_tw_reuse=1 && sysctl -w net.ipv4.tcp_fin_timeout=10 && sysctl -w net.ipv4.ip_local_port_range='4096 65000' && sysctl -p"] + nodeSelector: + type: storage + containers: + - env: + - name: VANUS_LOG_LEVEL + value: INFO + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/trigger:6b23e5a + imagePullPolicy: IfNotPresent + name: trigger + resources: + limits: + cpu: 2000m + memory: 2000Mi + requests: + cpu: 2000m + memory: 2000Mi + ports: + - containerPort: 2148 + name: grpc + volumeMounts: + - mountPath: /vanus/config + name: config-trigger + volumes: + - configMap: + name: config-trigger + name: config-trigger \ No newline at end of file diff --git a/test/infra/benchmark.yml b/test/infra/benchmark/benchmark.yml similarity index 100% rename from test/infra/benchmark.yml rename to test/infra/benchmark/benchmark.yml diff --git a/test/infra/sc.yml b/test/infra/benchmark/sc.yml similarity index 100% rename from test/infra/sc.yml rename to test/infra/benchmark/sc.yml diff --git a/test/infra/vanus.yml b/test/infra/benchmark/vanus.yml similarity index 99% rename from test/infra/vanus.yml rename to test/infra/benchmark/vanus.yml index de9bf34e5..b9699535c 100644 --- a/test/infra/vanus.yml +++ b/test/infra/benchmark/vanus.yml @@ -1,4 +1,9 @@ apiVersion: v1 +kind: Namespace +metadata: + name: vanus +--- +apiVersion: v1 data: controller.yaml: |- node_id: ${NODE_ID} diff --git a/test/infra/secret.yml.example b/test/infra/secret.yml.example deleted file mode 100644 index d4ea9051b..000000000 --- a/test/infra/secret.yml.example +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: benchmark-credentials - namespace: vanus -type: Opaque -data: - # echo "your_mongodb_password" | base64 - mongodb_password: xxxxxxxxxxxx= \ No newline at end of file diff --git a/test/yaml/display.yml b/test/yaml/display.yml deleted file mode 100644 index 9c02a0f2f..000000000 --- a/test/yaml/display.yml +++ /dev/null @@ -1,33 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: quick-display - namespace: vanus - labels: - app: quick-display -spec: - selector: - matchLabels: - app: quick-display - template: - metadata: - labels: - app: quick-display - spec: - containers: - - name: quick-display - image: vancehub/sink-display:latest - imagePullPolicy: IfNotPresent ---- -apiVersion: v1 -kind: Service -metadata: - namespace: vanus - name: quick-display -spec: - ports: - - port: 80 - targetPort: 8081 - selector: - app: quick-display - type: ClusterIP diff --git a/test/yaml/etcd-srv.yml b/test/yaml/etcd-srv.yml deleted file mode 100644 index 02b286cce..000000000 --- a/test/yaml/etcd-srv.yml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: my-service - namespace: vanus -spec: - type: NodePort - selector: - app: vanus-controller - ports: - - port: 2379 - targetPort: 2379 - nodePort: 30007 From 0e4588d4a129c8afef62f6b829c5f9c7de34d9bc Mon Sep 17 00:00:00 2001 From: delu Date: Mon, 9 Jan 2023 11:03:37 +0800 Subject: [PATCH 37/46] feat: subscription list with condition (#401) Signed-off-by: xdlbdy Signed-off-by: xdlbdy --- internal/controller/trigger/controller.go | 23 +- .../controller/trigger/controller_test.go | 10 +- .../trigger/subscription/mock_subscription.go | 14 + .../trigger/subscription/subscription.go | 15 + .../trigger/validation/subscripton.go | 5 +- internal/gateway/proxy/direct.go | 2 +- internal/gateway/proxy/direct_test.go | 2 +- pkg/cluster/raw_client/trigger.go | 2 +- proto/pkg/controller/controller.pb.go | 951 ++++++++++-------- proto/pkg/controller/mock_controller.go | 4 +- proto/pkg/proxy/proxy.pb.go | 161 +-- proto/proto/controller.proto | 7 +- proto/proto/proxy.proto | 2 +- vsctl/command/subscription.go | 8 +- 14 files changed, 677 insertions(+), 529 deletions(-) diff --git a/internal/controller/trigger/controller.go b/internal/controller/trigger/controller.go index 863907028..c7ee0ec72 100644 --- a/internal/controller/trigger/controller.go +++ b/internal/controller/trigger/controller.go @@ -20,6 +20,7 @@ import ( "fmt" "io" "os" + "strings" "sync" "time" @@ -146,6 +147,12 @@ func (ctrl *controller) CreateSubscription(ctx context.Context, }) return nil, err } + // subscription name can't be repeated in an eventbus + _sub := ctrl.subscriptionManager.GetSubscriptionByName(ctx, request.Subscription.EventBus, request.Subscription.Name) + if _sub != nil { + return nil, errors.ErrInvalidRequest.WithMessage( + fmt.Sprintf("subscription name %s has exist", request.Subscription.Name)) + } sub := convert.FromPbSubscriptionRequest(request.Subscription) sub.ID, err = vanus.NewID() sub.CreatedAt = time.Now() @@ -188,6 +195,14 @@ func (ctrl *controller) UpdateSubscription(ctx context.Context, if request.Subscription.EventBus != sub.EventBus { return nil, errors.ErrInvalidRequest.WithMessage("can not change eventbus") } + if request.Subscription.Name != sub.Name { + // subscription name can't be repeated in an eventbus + _sub := ctrl.subscriptionManager.GetSubscriptionByName(ctx, sub.EventBus, request.Subscription.Name) + if _sub != nil { + return nil, errors.ErrInvalidRequest.WithMessage( + fmt.Sprintf("subscription name %s has exist", request.Subscription.Name)) + } + } if request.Subscription.Config != nil { if request.Subscription.Config.DeadLetterEventbus != sub.Config.DeadLetterEventbus { return nil, errors.ErrInvalidRequest.WithMessage("can not change dead letter eventbus") @@ -398,10 +413,16 @@ func (ctrl *controller) UnregisterTriggerWorker(ctx context.Context, } func (ctrl *controller) ListSubscription(ctx context.Context, - _ *emptypb.Empty) (*ctrlpb.ListSubscriptionResponse, error) { + request *ctrlpb.ListSubscriptionRequest) (*ctrlpb.ListSubscriptionResponse, error) { subscriptions := ctrl.subscriptionManager.ListSubscription(ctx) list := make([]*meta.Subscription, 0, len(subscriptions)) for _, sub := range subscriptions { + if request.Eventbus != "" && request.Eventbus != sub.EventBus { + continue + } + if request.Name != "" && !strings.Contains(sub.Name, request.Name) { + continue + } offsets, _ := ctrl.subscriptionManager.GetOffset(ctx, sub.ID) list = append(list, convert.ToPbSubscription(sub, offsets)) } diff --git a/internal/controller/trigger/controller_test.go b/internal/controller/trigger/controller_test.go index 1b865242e..4f7dc556e 100644 --- a/internal/controller/trigger/controller_test.go +++ b/internal/controller/trigger/controller_test.go @@ -124,10 +124,12 @@ func TestController_CreateSubscription(t *testing.T) { ctrl.state = primitive.ServerStateRunning Convey("create subscription", func() { + subManager.EXPECT().GetSubscriptionByName(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(nil) subManager.EXPECT().AddSubscription(gomock.Any(), gomock.Any()).AnyTimes().Return(nil) create := &ctrlpb.CreateSubscriptionRequest{ Subscription: &ctrlpb.SubscriptionRequest{ EventBus: "test-bus", + Name: "test-name", Sink: "test-sink", }, } @@ -176,12 +178,14 @@ func TestController_UpdateSubscription(t *testing.T) { Phase: metadata.SubscriptionPhaseStopped, TriggerWorker: "test-addr", EventBus: "test-eb", + Name: "test-name", Sink: "test-sink", Protocol: primitive.HTTPProtocol, } b, _ := stdJson.Marshal(sub) var _sub *metadata.Subscription _ = stdJson.Unmarshal(b, &_sub) + subManager.EXPECT().GetSubscriptionByName(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(nil) subManager.EXPECT().GetSubscription(gomock.Any(), gomock.Eq(subID)).AnyTimes().Return(_sub) Convey("no change", func() { request := &ctrlpb.UpdateSubscriptionRequest{ @@ -270,6 +274,7 @@ func TestController_UpdateSubscription(t *testing.T) { Id: subID.Uint64(), Subscription: &ctrlpb.SubscriptionRequest{ EventBus: "test-eb", + Name: "test-name", Sink: "arn:aws:lambda:us-west-2:843378899134:function:xdltest", Protocol: metapb.Protocol_AWS_LAMBDA, SinkCredential: &metapb.SinkCredential{ @@ -298,6 +303,7 @@ func TestController_UpdateSubscription(t *testing.T) { Id: subID.Uint64(), Subscription: &ctrlpb.SubscriptionRequest{ EventBus: "test-eb", + Name: "test-name", Sink: "modify-sink", }, } @@ -313,6 +319,7 @@ func TestController_UpdateSubscription(t *testing.T) { Id: subID.Uint64(), Subscription: &ctrlpb.SubscriptionRequest{ EventBus: "test-eb", + Name: "test-name", Sink: "test-sink", Filters: []*metapb.Filter{ { @@ -332,6 +339,7 @@ func TestController_UpdateSubscription(t *testing.T) { Id: subID.Uint64(), Subscription: &ctrlpb.SubscriptionRequest{ EventBus: "test-eb", + Name: "test-name", Sink: "test-sink", Transformer: &metapb.Transformer{ Define: map[string]string{"k": "v"}, @@ -461,7 +469,7 @@ func TestController_ListSubscription(t *testing.T) { } subManager.EXPECT().ListSubscription(gomock.Any()).Return(list) subManager.EXPECT().GetOffset(gomock.Any(), gomock.Any()).AnyTimes().Return(info.ListOffsetInfo{}, nil) - resp, err := ctrl.ListSubscription(ctx, nil) + resp, err := ctrl.ListSubscription(ctx, &ctrlpb.ListSubscriptionRequest{}) So(err, ShouldBeNil) So(len(resp.Subscription), ShouldEqual, 2) }) diff --git a/internal/controller/trigger/subscription/mock_subscription.go b/internal/controller/trigger/subscription/mock_subscription.go index bfee26f78..1e6a6f69b 100644 --- a/internal/controller/trigger/subscription/mock_subscription.go +++ b/internal/controller/trigger/subscription/mock_subscription.go @@ -110,6 +110,20 @@ func (mr *MockManagerMockRecorder) GetSubscription(ctx, id interface{}) *gomock. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubscription", reflect.TypeOf((*MockManager)(nil).GetSubscription), ctx, id) } +// GetSubscriptionByName mocks base method. +func (m *MockManager) GetSubscriptionByName(ctx context.Context, eventbus, name string) *metadata.Subscription { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetSubscriptionByName", ctx, eventbus, name) + ret0, _ := ret[0].(*metadata.Subscription) + return ret0 +} + +// GetSubscriptionByName indicates an expected call of GetSubscriptionByName. +func (mr *MockManagerMockRecorder) GetSubscriptionByName(ctx, eventbus, name interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubscriptionByName", reflect.TypeOf((*MockManager)(nil).GetSubscriptionByName), ctx, eventbus, name) +} + // Heartbeat mocks base method. func (m *MockManager) Heartbeat(ctx context.Context, id vanus.ID, addr string, time time.Time) error { m.ctrl.T.Helper() diff --git a/internal/controller/trigger/subscription/subscription.go b/internal/controller/trigger/subscription/subscription.go index 52fbe5238..a5b5c9f24 100644 --- a/internal/controller/trigger/subscription/subscription.go +++ b/internal/controller/trigger/subscription/subscription.go @@ -43,6 +43,7 @@ type Manager interface { ResetOffsetByTimestamp(ctx context.Context, id vanus.ID, timestamp uint64) (info.ListOffsetInfo, error) ListSubscription(ctx context.Context) []*metadata.Subscription GetSubscription(ctx context.Context, id vanus.ID) *metadata.Subscription + GetSubscriptionByName(ctx context.Context, eventbus, name string) *metadata.Subscription AddSubscription(ctx context.Context, subscription *metadata.Subscription) error UpdateSubscription(ctx context.Context, subscription *metadata.Subscription) error Heartbeat(ctx context.Context, id vanus.ID, addr string, time time.Time) error @@ -90,6 +91,20 @@ func (m *manager) ListSubscription(_ context.Context) []*metadata.Subscription { return list } +func (m *manager) GetSubscriptionByName(ctx context.Context, eventbus, name string) *metadata.Subscription { + m.lock.RLock() + defer m.lock.RUnlock() + for _, sub := range m.subscriptionMap { + if sub.EventBus != eventbus { + continue + } + if sub.Name == name { + return sub + } + } + return nil +} + func (m *manager) GetSubscription(ctx context.Context, id vanus.ID) *metadata.Subscription { m.lock.RLock() defer m.lock.RUnlock() diff --git a/internal/controller/trigger/validation/subscripton.go b/internal/controller/trigger/validation/subscripton.go index 7755bf709..2221edfa3 100644 --- a/internal/controller/trigger/validation/subscripton.go +++ b/internal/controller/trigger/validation/subscripton.go @@ -47,7 +47,10 @@ func ValidateSubscriptionRequest(ctx context.Context, request *ctrlpb.Subscripti return err } if request.EventBus == "" { - return errors.ErrInvalidRequest.WithMessage("eventBus is empty") + return errors.ErrInvalidRequest.WithMessage("eventbus is empty") + } + if request.Name == "" { + return errors.ErrInvalidRequest.WithMessage("name is empty") } if err := validateSubscriptionConfig(ctx, request.Config); err != nil { return err diff --git a/internal/gateway/proxy/direct.go b/internal/gateway/proxy/direct.go index e638769fa..429b11b98 100644 --- a/internal/gateway/proxy/direct.go +++ b/internal/gateway/proxy/direct.go @@ -78,7 +78,7 @@ func (cp *ControllerProxy) GetSubscription(ctx context.Context, } func (cp *ControllerProxy) ListSubscription(ctx context.Context, - req *emptypb.Empty) (*ctrlpb.ListSubscriptionResponse, error) { + req *ctrlpb.ListSubscriptionRequest) (*ctrlpb.ListSubscriptionResponse, error) { return cp.triggerCtrl.ListSubscription(ctx, req) } diff --git a/internal/gateway/proxy/direct_test.go b/internal/gateway/proxy/direct_test.go index f8cfc0c2f..51c44d07e 100644 --- a/internal/gateway/proxy/direct_test.go +++ b/internal/gateway/proxy/direct_test.go @@ -52,6 +52,6 @@ func TestControllerProxy_ProxyMethod(t *testing.T) { _, _ = cp.UpdateSubscription(stdCtx.Background(), &ctrlpb.UpdateSubscriptionRequest{}) _, _ = cp.DeleteSubscription(stdCtx.Background(), &ctrlpb.DeleteSubscriptionRequest{}) _, _ = cp.GetSubscription(stdCtx.Background(), &ctrlpb.GetSubscriptionRequest{}) - _, _ = cp.ListSubscription(stdCtx.Background(), &emptypb.Empty{}) + _, _ = cp.ListSubscription(stdCtx.Background(), &ctrlpb.ListSubscriptionRequest{}) }) } diff --git a/pkg/cluster/raw_client/trigger.go b/pkg/cluster/raw_client/trigger.go index 361039c15..5c734596c 100644 --- a/pkg/cluster/raw_client/trigger.go +++ b/pkg/cluster/raw_client/trigger.go @@ -142,7 +142,7 @@ func (tc *triggerClient) GetSubscription(ctx context.Context, in *ctrlpb.GetSubs return out, nil } -func (tc *triggerClient) ListSubscription(ctx context.Context, in *emptypb.Empty, +func (tc *triggerClient) ListSubscription(ctx context.Context, in *ctrlpb.ListSubscriptionRequest, opts ...grpc.CallOption) (*ctrlpb.ListSubscriptionResponse, error) { out := new(ctrlpb.ListSubscriptionResponse) err := tc.cc.invoke(ctx, "/linkall.vanus.controller.TriggerController/ListSubscription", in, out, opts...) diff --git a/proto/pkg/controller/controller.pb.go b/proto/pkg/controller/controller.pb.go index b3f3a05f7..59f3f3ad9 100644 --- a/proto/pkg/controller/controller.pb.go +++ b/proto/pkg/controller/controller.pb.go @@ -1171,6 +1171,61 @@ func (x *ResumeSubscriptionRequest) GetId() uint64 { return 0 } +type ListSubscriptionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Eventbus string `protobuf:"bytes,1,opt,name=eventbus,proto3" json:"eventbus,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *ListSubscriptionRequest) Reset() { + *x = ListSubscriptionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_controller_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListSubscriptionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSubscriptionRequest) ProtoMessage() {} + +func (x *ListSubscriptionRequest) ProtoReflect() protoreflect.Message { + mi := &file_controller_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSubscriptionRequest.ProtoReflect.Descriptor instead. +func (*ListSubscriptionRequest) Descriptor() ([]byte, []int) { + return file_controller_proto_rawDescGZIP(), []int{20} +} + +func (x *ListSubscriptionRequest) GetEventbus() string { + if x != nil { + return x.Eventbus + } + return "" +} + +func (x *ListSubscriptionRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + type ListSubscriptionResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1182,7 +1237,7 @@ type ListSubscriptionResponse struct { func (x *ListSubscriptionResponse) Reset() { *x = ListSubscriptionResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[20] + mi := &file_controller_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1195,7 +1250,7 @@ func (x *ListSubscriptionResponse) String() string { func (*ListSubscriptionResponse) ProtoMessage() {} func (x *ListSubscriptionResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[20] + mi := &file_controller_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1208,7 +1263,7 @@ func (x *ListSubscriptionResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSubscriptionResponse.ProtoReflect.Descriptor instead. func (*ListSubscriptionResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{20} + return file_controller_proto_rawDescGZIP(), []int{21} } func (x *ListSubscriptionResponse) GetSubscription() []*meta.Subscription { @@ -1229,7 +1284,7 @@ type RegisterTriggerWorkerRequest struct { func (x *RegisterTriggerWorkerRequest) Reset() { *x = RegisterTriggerWorkerRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[21] + mi := &file_controller_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1242,7 +1297,7 @@ func (x *RegisterTriggerWorkerRequest) String() string { func (*RegisterTriggerWorkerRequest) ProtoMessage() {} func (x *RegisterTriggerWorkerRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[21] + mi := &file_controller_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1255,7 +1310,7 @@ func (x *RegisterTriggerWorkerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RegisterTriggerWorkerRequest.ProtoReflect.Descriptor instead. func (*RegisterTriggerWorkerRequest) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{21} + return file_controller_proto_rawDescGZIP(), []int{22} } func (x *RegisterTriggerWorkerRequest) GetAddress() string { @@ -1274,7 +1329,7 @@ type RegisterTriggerWorkerResponse struct { func (x *RegisterTriggerWorkerResponse) Reset() { *x = RegisterTriggerWorkerResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[22] + mi := &file_controller_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1287,7 +1342,7 @@ func (x *RegisterTriggerWorkerResponse) String() string { func (*RegisterTriggerWorkerResponse) ProtoMessage() {} func (x *RegisterTriggerWorkerResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[22] + mi := &file_controller_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1300,7 +1355,7 @@ func (x *RegisterTriggerWorkerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RegisterTriggerWorkerResponse.ProtoReflect.Descriptor instead. func (*RegisterTriggerWorkerResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{22} + return file_controller_proto_rawDescGZIP(), []int{23} } type UnregisterTriggerWorkerRequest struct { @@ -1314,7 +1369,7 @@ type UnregisterTriggerWorkerRequest struct { func (x *UnregisterTriggerWorkerRequest) Reset() { *x = UnregisterTriggerWorkerRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[23] + mi := &file_controller_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1327,7 +1382,7 @@ func (x *UnregisterTriggerWorkerRequest) String() string { func (*UnregisterTriggerWorkerRequest) ProtoMessage() {} func (x *UnregisterTriggerWorkerRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[23] + mi := &file_controller_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1340,7 +1395,7 @@ func (x *UnregisterTriggerWorkerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UnregisterTriggerWorkerRequest.ProtoReflect.Descriptor instead. func (*UnregisterTriggerWorkerRequest) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{23} + return file_controller_proto_rawDescGZIP(), []int{24} } func (x *UnregisterTriggerWorkerRequest) GetAddress() string { @@ -1359,7 +1414,7 @@ type UnregisterTriggerWorkerResponse struct { func (x *UnregisterTriggerWorkerResponse) Reset() { *x = UnregisterTriggerWorkerResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[24] + mi := &file_controller_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1372,7 +1427,7 @@ func (x *UnregisterTriggerWorkerResponse) String() string { func (*UnregisterTriggerWorkerResponse) ProtoMessage() {} func (x *UnregisterTriggerWorkerResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[24] + mi := &file_controller_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1385,7 +1440,7 @@ func (x *UnregisterTriggerWorkerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UnregisterTriggerWorkerResponse.ProtoReflect.Descriptor instead. func (*UnregisterTriggerWorkerResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{24} + return file_controller_proto_rawDescGZIP(), []int{25} } type TriggerWorkerHeartbeatRequest struct { @@ -1401,7 +1456,7 @@ type TriggerWorkerHeartbeatRequest struct { func (x *TriggerWorkerHeartbeatRequest) Reset() { *x = TriggerWorkerHeartbeatRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[25] + mi := &file_controller_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1414,7 +1469,7 @@ func (x *TriggerWorkerHeartbeatRequest) String() string { func (*TriggerWorkerHeartbeatRequest) ProtoMessage() {} func (x *TriggerWorkerHeartbeatRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[25] + mi := &file_controller_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1427,7 +1482,7 @@ func (x *TriggerWorkerHeartbeatRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TriggerWorkerHeartbeatRequest.ProtoReflect.Descriptor instead. func (*TriggerWorkerHeartbeatRequest) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{25} + return file_controller_proto_rawDescGZIP(), []int{26} } func (x *TriggerWorkerHeartbeatRequest) GetAddress() string { @@ -1460,7 +1515,7 @@ type TriggerWorkerHeartbeatResponse struct { func (x *TriggerWorkerHeartbeatResponse) Reset() { *x = TriggerWorkerHeartbeatResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[26] + mi := &file_controller_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1473,7 +1528,7 @@ func (x *TriggerWorkerHeartbeatResponse) String() string { func (*TriggerWorkerHeartbeatResponse) ProtoMessage() {} func (x *TriggerWorkerHeartbeatResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[26] + mi := &file_controller_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1486,7 +1541,7 @@ func (x *TriggerWorkerHeartbeatResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use TriggerWorkerHeartbeatResponse.ProtoReflect.Descriptor instead. func (*TriggerWorkerHeartbeatResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{26} + return file_controller_proto_rawDescGZIP(), []int{27} } type ResetOffsetToTimestampRequest struct { @@ -1502,7 +1557,7 @@ type ResetOffsetToTimestampRequest struct { func (x *ResetOffsetToTimestampRequest) Reset() { *x = ResetOffsetToTimestampRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[27] + mi := &file_controller_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1515,7 +1570,7 @@ func (x *ResetOffsetToTimestampRequest) String() string { func (*ResetOffsetToTimestampRequest) ProtoMessage() {} func (x *ResetOffsetToTimestampRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[27] + mi := &file_controller_proto_msgTypes[28] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1528,7 +1583,7 @@ func (x *ResetOffsetToTimestampRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ResetOffsetToTimestampRequest.ProtoReflect.Descriptor instead. func (*ResetOffsetToTimestampRequest) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{27} + return file_controller_proto_rawDescGZIP(), []int{28} } func (x *ResetOffsetToTimestampRequest) GetSubscriptionId() uint64 { @@ -1556,7 +1611,7 @@ type ResetOffsetToTimestampResponse struct { func (x *ResetOffsetToTimestampResponse) Reset() { *x = ResetOffsetToTimestampResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[28] + mi := &file_controller_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1569,7 +1624,7 @@ func (x *ResetOffsetToTimestampResponse) String() string { func (*ResetOffsetToTimestampResponse) ProtoMessage() {} func (x *ResetOffsetToTimestampResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[28] + mi := &file_controller_proto_msgTypes[29] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1582,7 +1637,7 @@ func (x *ResetOffsetToTimestampResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ResetOffsetToTimestampResponse.ProtoReflect.Descriptor instead. func (*ResetOffsetToTimestampResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{28} + return file_controller_proto_rawDescGZIP(), []int{29} } func (x *ResetOffsetToTimestampResponse) GetOffsets() []*meta.OffsetInfo { @@ -1604,7 +1659,7 @@ type CommitOffsetRequest struct { func (x *CommitOffsetRequest) Reset() { *x = CommitOffsetRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[29] + mi := &file_controller_proto_msgTypes[30] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1617,7 +1672,7 @@ func (x *CommitOffsetRequest) String() string { func (*CommitOffsetRequest) ProtoMessage() {} func (x *CommitOffsetRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[29] + mi := &file_controller_proto_msgTypes[30] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1630,7 +1685,7 @@ func (x *CommitOffsetRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CommitOffsetRequest.ProtoReflect.Descriptor instead. func (*CommitOffsetRequest) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{29} + return file_controller_proto_rawDescGZIP(), []int{30} } func (x *CommitOffsetRequest) GetSubscriptionInfo() []*meta.SubscriptionInfo { @@ -1658,7 +1713,7 @@ type CommitOffsetResponse struct { func (x *CommitOffsetResponse) Reset() { *x = CommitOffsetResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[30] + mi := &file_controller_proto_msgTypes[31] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1671,7 +1726,7 @@ func (x *CommitOffsetResponse) String() string { func (*CommitOffsetResponse) ProtoMessage() {} func (x *CommitOffsetResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[30] + mi := &file_controller_proto_msgTypes[31] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1684,7 +1739,7 @@ func (x *CommitOffsetResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CommitOffsetResponse.ProtoReflect.Descriptor instead. func (*CommitOffsetResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{30} + return file_controller_proto_rawDescGZIP(), []int{31} } func (x *CommitOffsetResponse) GetFailSubscriptionId() []uint64 { @@ -1714,7 +1769,7 @@ type ListSegmentRequest struct { func (x *ListSegmentRequest) Reset() { *x = ListSegmentRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[31] + mi := &file_controller_proto_msgTypes[32] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1727,7 +1782,7 @@ func (x *ListSegmentRequest) String() string { func (*ListSegmentRequest) ProtoMessage() {} func (x *ListSegmentRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[31] + mi := &file_controller_proto_msgTypes[32] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1740,7 +1795,7 @@ func (x *ListSegmentRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSegmentRequest.ProtoReflect.Descriptor instead. func (*ListSegmentRequest) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{31} + return file_controller_proto_rawDescGZIP(), []int{32} } func (x *ListSegmentRequest) GetEventBusId() uint64 { @@ -1789,7 +1844,7 @@ type ListSegmentResponse struct { func (x *ListSegmentResponse) Reset() { *x = ListSegmentResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[32] + mi := &file_controller_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1802,7 +1857,7 @@ func (x *ListSegmentResponse) String() string { func (*ListSegmentResponse) ProtoMessage() {} func (x *ListSegmentResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[32] + mi := &file_controller_proto_msgTypes[33] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1815,7 +1870,7 @@ func (x *ListSegmentResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSegmentResponse.ProtoReflect.Descriptor instead. func (*ListSegmentResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{32} + return file_controller_proto_rawDescGZIP(), []int{33} } func (x *ListSegmentResponse) GetSegments() []*meta.Segment { @@ -1839,7 +1894,7 @@ type GetAppendableSegmentRequest struct { func (x *GetAppendableSegmentRequest) Reset() { *x = GetAppendableSegmentRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[33] + mi := &file_controller_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1852,7 +1907,7 @@ func (x *GetAppendableSegmentRequest) String() string { func (*GetAppendableSegmentRequest) ProtoMessage() {} func (x *GetAppendableSegmentRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[33] + mi := &file_controller_proto_msgTypes[34] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1865,7 +1920,7 @@ func (x *GetAppendableSegmentRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAppendableSegmentRequest.ProtoReflect.Descriptor instead. func (*GetAppendableSegmentRequest) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{33} + return file_controller_proto_rawDescGZIP(), []int{34} } func (x *GetAppendableSegmentRequest) GetEventBusId() uint64 { @@ -1900,7 +1955,7 @@ type GetAppendableSegmentResponse struct { func (x *GetAppendableSegmentResponse) Reset() { *x = GetAppendableSegmentResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_proto_msgTypes[34] + mi := &file_controller_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1913,7 +1968,7 @@ func (x *GetAppendableSegmentResponse) String() string { func (*GetAppendableSegmentResponse) ProtoMessage() {} func (x *GetAppendableSegmentResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_proto_msgTypes[34] + mi := &file_controller_proto_msgTypes[35] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1926,7 +1981,7 @@ func (x *GetAppendableSegmentResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAppendableSegmentResponse.ProtoReflect.Descriptor instead. func (*GetAppendableSegmentResponse) Descriptor() ([]byte, []int) { - return file_controller_proto_rawDescGZIP(), []int{34} + return file_controller_proto_rawDescGZIP(), []int{35} } func (x *GetAppendableSegmentResponse) GetSegments() []*meta.Segment { @@ -2094,306 +2149,313 @@ var file_controller_proto_rawDesc = []byte{ 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2b, 0x0a, 0x19, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x22, 0x60, 0x0a, 0x18, 0x4c, 0x69, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x22, 0x49, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6c, - 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, - 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, - 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x38, 0x0a, 0x1c, - 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, - 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, - 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x1e, 0x55, 0x6e, 0x72, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, - 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x22, 0x21, 0x0a, 0x1f, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, - 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x1d, 0x54, 0x72, 0x69, 0x67, 0x67, - 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, 0x51, 0x0a, 0x11, - 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x66, - 0x6f, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, + 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x60, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x44, 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x10, 0x73, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x22, - 0x20, 0x0a, 0x1e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, - 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x66, 0x0a, 0x1d, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x73, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, - 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x5a, 0x0a, 0x1e, 0x52, 0x65, 0x73, - 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x38, 0x0a, 0x1c, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, + 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x3a, 0x0a, 0x1e, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, + 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x21, + 0x0a, 0x1f, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, + 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x1d, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, + 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, + 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, 0x51, 0x0a, 0x11, 0x73, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, + 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x10, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x20, 0x0a, 0x1e, 0x54, 0x72, + 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, 0x74, + 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x66, 0x0a, 0x1d, + 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, + 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x22, 0x5a, 0x0a, 0x1e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x4f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, + 0x22, 0x8b, 0x01, 0x0a, 0x13, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x51, 0x0a, 0x11, 0x73, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, + 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x10, 0x73, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x21, 0x0a, 0x0c, 0x66, + 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0b, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x22, 0x48, + 0x0a, 0x14, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x66, 0x61, 0x69, 0x6c, 0x5f, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x04, 0x52, 0x12, 0x66, 0x61, 0x69, 0x6c, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xb4, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, + 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x49, + 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, + 0x67, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x6e, 0x64, 0x5f, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x4f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x22, + 0x4e, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x65, + 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, + 0x7b, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, 0x6c, 0x65, + 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, + 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x75, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x49, 0x64, + 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, + 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x22, 0x57, 0x0a, 0x1c, + 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x67, + 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x08, + 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, + 0x65, 0x74, 0x61, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x67, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x32, 0x54, 0x0a, 0x0a, 0x50, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x1a, 0x26, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, + 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x50, + 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xa8, 0x04, 0x0a, 0x12, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x12, 0x5f, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x42, 0x75, 0x73, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, + 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, + 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x42, 0x75, 0x73, 0x12, 0x65, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x2f, 0x2e, 0x6c, 0x69, + 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x42, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, - 0x61, 0x2e, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x73, 0x22, 0x8b, 0x01, 0x0a, 0x13, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, - 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x51, 0x0a, - 0x11, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, - 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, - 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x10, - 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, - 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x43, 0x6f, 0x6d, - 0x6d, 0x69, 0x74, 0x22, 0x48, 0x0a, 0x14, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x66, - 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x12, 0x66, 0x61, 0x69, 0x6c, 0x53, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xb4, 0x01, - 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x75, - 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x42, 0x75, 0x73, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, - 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, - 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x65, - 0x6e, 0x64, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x09, 0x65, 0x6e, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x69, - 0x6d, 0x69, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x69, 0x6d, - 0x69, 0x74, 0x65, 0x64, 0x22, 0x4e, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, - 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x73, - 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, - 0x74, 0x61, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x67, 0x6d, - 0x65, 0x6e, 0x74, 0x73, 0x22, 0x7b, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, - 0x64, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x75, 0x73, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, - 0x42, 0x75, 0x73, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6c, - 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, - 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x69, 0x6d, 0x69, 0x74, - 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x65, - 0x64, 0x22, 0x57, 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, - 0x6c, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x37, 0x0a, 0x08, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, - 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 0x08, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x32, 0x54, 0x0a, 0x0a, 0x50, 0x69, - 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, - 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x26, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, - 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x32, 0xa8, 0x04, 0x0a, 0x12, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x43, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x5f, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, - 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, - 0x42, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, - 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x65, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, - 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, - 0x46, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, + 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x46, 0x0a, 0x0e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x6c, + 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, + 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x12, 0x49, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x1a, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x49, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, - 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x42, 0x75, 0x73, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, - 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, - 0x75, 0x73, 0x12, 0x56, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, - 0x75, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2e, 0x2e, 0x6c, 0x69, 0x6e, - 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x62, - 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x0e, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x2f, 0x2e, 0x6c, - 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, - 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, - 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x32, 0x88, 0x02, 0x0a, 0x12, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x12, 0x6a, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x2c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, - 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x2d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, - 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x85, - 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, 0x6c, 0x65, - 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x35, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, + 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x56, 0x0a, + 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, + 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, 0x6c, 0x65, - 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, - 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, - 0x65, 0x6e, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x83, 0x06, 0x0a, 0x11, 0x53, 0x65, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x88, 0x01, 0x0a, - 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x75, - 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x36, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x32, 0x88, 0x02, 0x0a, 0x12, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x4c, 0x6f, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x6a, 0x0a, + 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2c, 0x2e, 0x6c, + 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6c, 0x69, 0x6e, + 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x85, 0x01, 0x0a, 0x14, 0x47, 0x65, + 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x35, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, + 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x47, 0x65, + 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x61, 0x62, + 0x6c, 0x65, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x32, 0x83, 0x06, 0x0a, 0x11, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x88, 0x01, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x36, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x7b, 0x0a, 0x10, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, + 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x12, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, - 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, - 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, - 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7b, 0x0a, 0x10, 0x53, 0x65, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x12, 0x31, 0x2e, 0x6c, 0x69, - 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x65, - 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, - 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, - 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x28, 0x01, 0x12, 0x88, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, - 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x36, - 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, - 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x72, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, + 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x72, + 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, + 0x88, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, + 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x36, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, + 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8e, 0x01, 0x0a, 0x17, 0x55, + 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x38, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, - 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, - 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x8e, 0x01, 0x0a, 0x17, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, - 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x38, 0x2e, 0x6c, 0x69, - 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, - 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, - 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x2e, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x65, 0x0a, 0x18, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, - 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x73, 0x46, 0x75, 0x6c, 0x6c, 0x12, 0x31, 0x2e, 0x6c, - 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, - 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x72, 0x2e, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, + 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x39, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x6e, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x18, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x49, 0x73, 0x46, 0x75, 0x6c, 0x6c, 0x12, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, + 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x12, 0x63, 0x0a, 0x13, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x65, 0x67, 0x6d, + 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x63, 0x0a, 0x13, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x34, - 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x32, 0x92, 0x0b, 0x0a, - 0x11, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x12, 0x6d, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, - 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x32, 0xad, 0x0b, 0x0a, 0x11, 0x54, 0x72, 0x69, 0x67, + 0x67, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x6d, 0x0a, + 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, + 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, 0x12, 0x6d, 0x0a, 0x12, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, + 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, 0x12, 0x63, 0x0a, 0x12, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, + 0x12, 0x63, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x61, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, + 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x67, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x2e, 0x6c, 0x69, + 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0x00, 0x12, 0x6d, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, - 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, - 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, - 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, - 0x12, 0x63, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, - 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, - 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x63, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, - 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x2e, 0x6c, - 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x61, 0x0a, 0x12, 0x52, 0x65, - 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x75, - 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x67, 0x0a, - 0x0f, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x53, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, - 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x00, 0x12, 0x60, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x1a, 0x32, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, - 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x8d, 0x01, 0x0a, 0x16, 0x54, 0x72, 0x69, - 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, - 0x65, 0x61, 0x74, 0x12, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, - 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x54, - 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, - 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x6c, - 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, - 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x88, 0x01, 0x0a, 0x15, 0x52, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, - 0x65, 0x72, 0x12, 0x36, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, - 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, - 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x6c, 0x69, 0x6e, - 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, - 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x8e, 0x01, 0x0a, 0x17, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, - 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x12, - 0x38, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, + 0x00, 0x12, 0x7b, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, + 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x8d, + 0x01, 0x0a, 0x16, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, + 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x12, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, + 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, + 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x54, 0x72, + 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x48, 0x65, 0x61, 0x72, 0x74, + 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x88, + 0x01, 0x0a, 0x15, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, + 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x12, 0x36, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, + 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8e, 0x01, 0x0a, 0x17, 0x55, 0x6e, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, + 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x12, 0x38, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, + 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, + 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x39, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, - 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x39, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, - 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, - 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x57, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8b, 0x01, 0x0a, 0x16, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, - 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, - 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x8b, 0x01, 0x0a, 0x16, 0x52, + 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, + 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, + 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6d, 0x0a, 0x0c, 0x43, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x2d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, - 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x6d, 0x0a, 0x0c, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x12, 0x2d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, - 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x6f, - 0x6d, 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x2e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, - 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x32, 0xee, 0x01, 0x0a, 0x13, 0x53, 0x6e, 0x6f, 0x77, 0x66, 0x6c, 0x61, 0x6b, 0x65, 0x43, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x13, 0x47, 0x65, 0x74, - 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, - 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x12, 0x44, 0x0a, 0x0c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, - 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x0e, 0x55, 0x6e, - 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, - 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x76, 0x61, - 0x6e, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xee, 0x01, 0x0a, 0x13, 0x53, 0x6e, 0x6f, 0x77, + 0x66, 0x6c, 0x61, 0x6b, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, + 0x49, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, + 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x44, 0x0a, 0x0c, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, + 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x12, 0x46, 0x0a, 0x0e, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x6f, + 0x64, 0x65, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, + 0x61, 0x62, 0x73, 0x2f, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2408,7 +2470,7 @@ func file_controller_proto_rawDescGZIP() []byte { return file_controller_proto_rawDescData } -var file_controller_proto_msgTypes = make([]protoimpl.MessageInfo, 36) +var file_controller_proto_msgTypes = make([]protoimpl.MessageInfo, 37) var file_controller_proto_goTypes = []interface{}{ (*PingResponse)(nil), // 0: linkall.vanus.controller.PingResponse (*CreateEventBusRequest)(nil), // 1: linkall.vanus.controller.CreateEventBusRequest @@ -2430,66 +2492,67 @@ var file_controller_proto_goTypes = []interface{}{ (*DeleteSubscriptionRequest)(nil), // 17: linkall.vanus.controller.DeleteSubscriptionRequest (*DisableSubscriptionRequest)(nil), // 18: linkall.vanus.controller.DisableSubscriptionRequest (*ResumeSubscriptionRequest)(nil), // 19: linkall.vanus.controller.ResumeSubscriptionRequest - (*ListSubscriptionResponse)(nil), // 20: linkall.vanus.controller.ListSubscriptionResponse - (*RegisterTriggerWorkerRequest)(nil), // 21: linkall.vanus.controller.RegisterTriggerWorkerRequest - (*RegisterTriggerWorkerResponse)(nil), // 22: linkall.vanus.controller.RegisterTriggerWorkerResponse - (*UnregisterTriggerWorkerRequest)(nil), // 23: linkall.vanus.controller.UnregisterTriggerWorkerRequest - (*UnregisterTriggerWorkerResponse)(nil), // 24: linkall.vanus.controller.UnregisterTriggerWorkerResponse - (*TriggerWorkerHeartbeatRequest)(nil), // 25: linkall.vanus.controller.TriggerWorkerHeartbeatRequest - (*TriggerWorkerHeartbeatResponse)(nil), // 26: linkall.vanus.controller.TriggerWorkerHeartbeatResponse - (*ResetOffsetToTimestampRequest)(nil), // 27: linkall.vanus.controller.ResetOffsetToTimestampRequest - (*ResetOffsetToTimestampResponse)(nil), // 28: linkall.vanus.controller.ResetOffsetToTimestampResponse - (*CommitOffsetRequest)(nil), // 29: linkall.vanus.controller.CommitOffsetRequest - (*CommitOffsetResponse)(nil), // 30: linkall.vanus.controller.CommitOffsetResponse - (*ListSegmentRequest)(nil), // 31: linkall.vanus.controller.ListSegmentRequest - (*ListSegmentResponse)(nil), // 32: linkall.vanus.controller.ListSegmentResponse - (*GetAppendableSegmentRequest)(nil), // 33: linkall.vanus.controller.GetAppendableSegmentRequest - (*GetAppendableSegmentResponse)(nil), // 34: linkall.vanus.controller.GetAppendableSegmentResponse - nil, // 35: linkall.vanus.controller.RegisterSegmentServerResponse.SegmentsEntry - (*meta.EventBus)(nil), // 36: linkall.vanus.meta.EventBus - (*meta.SegmentHealthInfo)(nil), // 37: linkall.vanus.meta.SegmentHealthInfo - (*meta.SubscriptionConfig)(nil), // 38: linkall.vanus.meta.SubscriptionConfig - (*meta.Filter)(nil), // 39: linkall.vanus.meta.Filter - (*meta.SinkCredential)(nil), // 40: linkall.vanus.meta.SinkCredential - (meta.Protocol)(0), // 41: linkall.vanus.meta.Protocol - (*meta.ProtocolSetting)(nil), // 42: linkall.vanus.meta.ProtocolSetting - (*meta.Transformer)(nil), // 43: linkall.vanus.meta.Transformer - (*meta.Subscription)(nil), // 44: linkall.vanus.meta.Subscription - (*meta.SubscriptionInfo)(nil), // 45: linkall.vanus.meta.SubscriptionInfo - (*meta.OffsetInfo)(nil), // 46: linkall.vanus.meta.OffsetInfo - (*meta.Segment)(nil), // 47: linkall.vanus.meta.Segment - (*emptypb.Empty)(nil), // 48: google.protobuf.Empty - (*wrapperspb.UInt32Value)(nil), // 49: google.protobuf.UInt32Value - (*timestamppb.Timestamp)(nil), // 50: google.protobuf.Timestamp + (*ListSubscriptionRequest)(nil), // 20: linkall.vanus.controller.ListSubscriptionRequest + (*ListSubscriptionResponse)(nil), // 21: linkall.vanus.controller.ListSubscriptionResponse + (*RegisterTriggerWorkerRequest)(nil), // 22: linkall.vanus.controller.RegisterTriggerWorkerRequest + (*RegisterTriggerWorkerResponse)(nil), // 23: linkall.vanus.controller.RegisterTriggerWorkerResponse + (*UnregisterTriggerWorkerRequest)(nil), // 24: linkall.vanus.controller.UnregisterTriggerWorkerRequest + (*UnregisterTriggerWorkerResponse)(nil), // 25: linkall.vanus.controller.UnregisterTriggerWorkerResponse + (*TriggerWorkerHeartbeatRequest)(nil), // 26: linkall.vanus.controller.TriggerWorkerHeartbeatRequest + (*TriggerWorkerHeartbeatResponse)(nil), // 27: linkall.vanus.controller.TriggerWorkerHeartbeatResponse + (*ResetOffsetToTimestampRequest)(nil), // 28: linkall.vanus.controller.ResetOffsetToTimestampRequest + (*ResetOffsetToTimestampResponse)(nil), // 29: linkall.vanus.controller.ResetOffsetToTimestampResponse + (*CommitOffsetRequest)(nil), // 30: linkall.vanus.controller.CommitOffsetRequest + (*CommitOffsetResponse)(nil), // 31: linkall.vanus.controller.CommitOffsetResponse + (*ListSegmentRequest)(nil), // 32: linkall.vanus.controller.ListSegmentRequest + (*ListSegmentResponse)(nil), // 33: linkall.vanus.controller.ListSegmentResponse + (*GetAppendableSegmentRequest)(nil), // 34: linkall.vanus.controller.GetAppendableSegmentRequest + (*GetAppendableSegmentResponse)(nil), // 35: linkall.vanus.controller.GetAppendableSegmentResponse + nil, // 36: linkall.vanus.controller.RegisterSegmentServerResponse.SegmentsEntry + (*meta.EventBus)(nil), // 37: linkall.vanus.meta.EventBus + (*meta.SegmentHealthInfo)(nil), // 38: linkall.vanus.meta.SegmentHealthInfo + (*meta.SubscriptionConfig)(nil), // 39: linkall.vanus.meta.SubscriptionConfig + (*meta.Filter)(nil), // 40: linkall.vanus.meta.Filter + (*meta.SinkCredential)(nil), // 41: linkall.vanus.meta.SinkCredential + (meta.Protocol)(0), // 42: linkall.vanus.meta.Protocol + (*meta.ProtocolSetting)(nil), // 43: linkall.vanus.meta.ProtocolSetting + (*meta.Transformer)(nil), // 44: linkall.vanus.meta.Transformer + (*meta.Subscription)(nil), // 45: linkall.vanus.meta.Subscription + (*meta.SubscriptionInfo)(nil), // 46: linkall.vanus.meta.SubscriptionInfo + (*meta.OffsetInfo)(nil), // 47: linkall.vanus.meta.OffsetInfo + (*meta.Segment)(nil), // 48: linkall.vanus.meta.Segment + (*emptypb.Empty)(nil), // 49: google.protobuf.Empty + (*wrapperspb.UInt32Value)(nil), // 50: google.protobuf.UInt32Value + (*timestamppb.Timestamp)(nil), // 51: google.protobuf.Timestamp } var file_controller_proto_depIdxs = []int32{ - 36, // 0: linkall.vanus.controller.ListEventbusResponse.eventbus:type_name -> linkall.vanus.meta.EventBus - 37, // 1: linkall.vanus.controller.SegmentHeartbeatRequest.health_info:type_name -> linkall.vanus.meta.SegmentHealthInfo - 35, // 2: linkall.vanus.controller.RegisterSegmentServerResponse.segments:type_name -> linkall.vanus.controller.RegisterSegmentServerResponse.SegmentsEntry - 38, // 3: linkall.vanus.controller.SubscriptionRequest.config:type_name -> linkall.vanus.meta.SubscriptionConfig - 39, // 4: linkall.vanus.controller.SubscriptionRequest.filters:type_name -> linkall.vanus.meta.Filter - 40, // 5: linkall.vanus.controller.SubscriptionRequest.sink_credential:type_name -> linkall.vanus.meta.SinkCredential - 41, // 6: linkall.vanus.controller.SubscriptionRequest.protocol:type_name -> linkall.vanus.meta.Protocol - 42, // 7: linkall.vanus.controller.SubscriptionRequest.protocol_settings:type_name -> linkall.vanus.meta.ProtocolSetting - 43, // 8: linkall.vanus.controller.SubscriptionRequest.transformer:type_name -> linkall.vanus.meta.Transformer + 37, // 0: linkall.vanus.controller.ListEventbusResponse.eventbus:type_name -> linkall.vanus.meta.EventBus + 38, // 1: linkall.vanus.controller.SegmentHeartbeatRequest.health_info:type_name -> linkall.vanus.meta.SegmentHealthInfo + 36, // 2: linkall.vanus.controller.RegisterSegmentServerResponse.segments:type_name -> linkall.vanus.controller.RegisterSegmentServerResponse.SegmentsEntry + 39, // 3: linkall.vanus.controller.SubscriptionRequest.config:type_name -> linkall.vanus.meta.SubscriptionConfig + 40, // 4: linkall.vanus.controller.SubscriptionRequest.filters:type_name -> linkall.vanus.meta.Filter + 41, // 5: linkall.vanus.controller.SubscriptionRequest.sink_credential:type_name -> linkall.vanus.meta.SinkCredential + 42, // 6: linkall.vanus.controller.SubscriptionRequest.protocol:type_name -> linkall.vanus.meta.Protocol + 43, // 7: linkall.vanus.controller.SubscriptionRequest.protocol_settings:type_name -> linkall.vanus.meta.ProtocolSetting + 44, // 8: linkall.vanus.controller.SubscriptionRequest.transformer:type_name -> linkall.vanus.meta.Transformer 13, // 9: linkall.vanus.controller.CreateSubscriptionRequest.subscription:type_name -> linkall.vanus.controller.SubscriptionRequest 13, // 10: linkall.vanus.controller.UpdateSubscriptionRequest.subscription:type_name -> linkall.vanus.controller.SubscriptionRequest - 44, // 11: linkall.vanus.controller.ListSubscriptionResponse.subscription:type_name -> linkall.vanus.meta.Subscription - 45, // 12: linkall.vanus.controller.TriggerWorkerHeartbeatRequest.subscription_info:type_name -> linkall.vanus.meta.SubscriptionInfo - 46, // 13: linkall.vanus.controller.ResetOffsetToTimestampResponse.offsets:type_name -> linkall.vanus.meta.OffsetInfo - 45, // 14: linkall.vanus.controller.CommitOffsetRequest.subscription_info:type_name -> linkall.vanus.meta.SubscriptionInfo - 47, // 15: linkall.vanus.controller.ListSegmentResponse.segments:type_name -> linkall.vanus.meta.Segment - 47, // 16: linkall.vanus.controller.GetAppendableSegmentResponse.segments:type_name -> linkall.vanus.meta.Segment - 47, // 17: linkall.vanus.controller.RegisterSegmentServerResponse.SegmentsEntry.value:type_name -> linkall.vanus.meta.Segment - 48, // 18: linkall.vanus.controller.PingServer.Ping:input_type -> google.protobuf.Empty + 45, // 11: linkall.vanus.controller.ListSubscriptionResponse.subscription:type_name -> linkall.vanus.meta.Subscription + 46, // 12: linkall.vanus.controller.TriggerWorkerHeartbeatRequest.subscription_info:type_name -> linkall.vanus.meta.SubscriptionInfo + 47, // 13: linkall.vanus.controller.ResetOffsetToTimestampResponse.offsets:type_name -> linkall.vanus.meta.OffsetInfo + 46, // 14: linkall.vanus.controller.CommitOffsetRequest.subscription_info:type_name -> linkall.vanus.meta.SubscriptionInfo + 48, // 15: linkall.vanus.controller.ListSegmentResponse.segments:type_name -> linkall.vanus.meta.Segment + 48, // 16: linkall.vanus.controller.GetAppendableSegmentResponse.segments:type_name -> linkall.vanus.meta.Segment + 48, // 17: linkall.vanus.controller.RegisterSegmentServerResponse.SegmentsEntry.value:type_name -> linkall.vanus.meta.Segment + 49, // 18: linkall.vanus.controller.PingServer.Ping:input_type -> google.protobuf.Empty 1, // 19: linkall.vanus.controller.EventBusController.CreateEventBus:input_type -> linkall.vanus.controller.CreateEventBusRequest 1, // 20: linkall.vanus.controller.EventBusController.CreateSystemEventBus:input_type -> linkall.vanus.controller.CreateEventBusRequest - 36, // 21: linkall.vanus.controller.EventBusController.DeleteEventBus:input_type -> linkall.vanus.meta.EventBus - 36, // 22: linkall.vanus.controller.EventBusController.GetEventBus:input_type -> linkall.vanus.meta.EventBus - 48, // 23: linkall.vanus.controller.EventBusController.ListEventBus:input_type -> google.protobuf.Empty + 37, // 21: linkall.vanus.controller.EventBusController.DeleteEventBus:input_type -> linkall.vanus.meta.EventBus + 37, // 22: linkall.vanus.controller.EventBusController.GetEventBus:input_type -> linkall.vanus.meta.EventBus + 49, // 23: linkall.vanus.controller.EventBusController.ListEventBus:input_type -> google.protobuf.Empty 3, // 24: linkall.vanus.controller.EventBusController.UpdateEventBus:input_type -> linkall.vanus.controller.UpdateEventBusRequest - 31, // 25: linkall.vanus.controller.EventLogController.ListSegment:input_type -> linkall.vanus.controller.ListSegmentRequest - 33, // 26: linkall.vanus.controller.EventLogController.GetAppendableSegment:input_type -> linkall.vanus.controller.GetAppendableSegmentRequest + 32, // 25: linkall.vanus.controller.EventLogController.ListSegment:input_type -> linkall.vanus.controller.ListSegmentRequest + 34, // 26: linkall.vanus.controller.EventLogController.GetAppendableSegment:input_type -> linkall.vanus.controller.GetAppendableSegmentRequest 4, // 27: linkall.vanus.controller.SegmentController.QuerySegmentRouteInfo:input_type -> linkall.vanus.controller.QuerySegmentRouteInfoRequest 6, // 28: linkall.vanus.controller.SegmentController.SegmentHeartbeat:input_type -> linkall.vanus.controller.SegmentHeartbeatRequest 8, // 29: linkall.vanus.controller.SegmentController.RegisterSegmentServer:input_type -> linkall.vanus.controller.RegisterSegmentServerRequest @@ -2502,45 +2565,45 @@ var file_controller_proto_depIdxs = []int32{ 18, // 36: linkall.vanus.controller.TriggerController.DisableSubscription:input_type -> linkall.vanus.controller.DisableSubscriptionRequest 19, // 37: linkall.vanus.controller.TriggerController.ResumeSubscription:input_type -> linkall.vanus.controller.ResumeSubscriptionRequest 16, // 38: linkall.vanus.controller.TriggerController.GetSubscription:input_type -> linkall.vanus.controller.GetSubscriptionRequest - 48, // 39: linkall.vanus.controller.TriggerController.ListSubscription:input_type -> google.protobuf.Empty - 25, // 40: linkall.vanus.controller.TriggerController.TriggerWorkerHeartbeat:input_type -> linkall.vanus.controller.TriggerWorkerHeartbeatRequest - 21, // 41: linkall.vanus.controller.TriggerController.RegisterTriggerWorker:input_type -> linkall.vanus.controller.RegisterTriggerWorkerRequest - 23, // 42: linkall.vanus.controller.TriggerController.UnregisterTriggerWorker:input_type -> linkall.vanus.controller.UnregisterTriggerWorkerRequest - 27, // 43: linkall.vanus.controller.TriggerController.ResetOffsetToTimestamp:input_type -> linkall.vanus.controller.ResetOffsetToTimestampRequest - 29, // 44: linkall.vanus.controller.TriggerController.CommitOffset:input_type -> linkall.vanus.controller.CommitOffsetRequest - 48, // 45: linkall.vanus.controller.SnowflakeController.GetClusterStartTime:input_type -> google.protobuf.Empty - 49, // 46: linkall.vanus.controller.SnowflakeController.RegisterNode:input_type -> google.protobuf.UInt32Value - 49, // 47: linkall.vanus.controller.SnowflakeController.UnregisterNode:input_type -> google.protobuf.UInt32Value + 20, // 39: linkall.vanus.controller.TriggerController.ListSubscription:input_type -> linkall.vanus.controller.ListSubscriptionRequest + 26, // 40: linkall.vanus.controller.TriggerController.TriggerWorkerHeartbeat:input_type -> linkall.vanus.controller.TriggerWorkerHeartbeatRequest + 22, // 41: linkall.vanus.controller.TriggerController.RegisterTriggerWorker:input_type -> linkall.vanus.controller.RegisterTriggerWorkerRequest + 24, // 42: linkall.vanus.controller.TriggerController.UnregisterTriggerWorker:input_type -> linkall.vanus.controller.UnregisterTriggerWorkerRequest + 28, // 43: linkall.vanus.controller.TriggerController.ResetOffsetToTimestamp:input_type -> linkall.vanus.controller.ResetOffsetToTimestampRequest + 30, // 44: linkall.vanus.controller.TriggerController.CommitOffset:input_type -> linkall.vanus.controller.CommitOffsetRequest + 49, // 45: linkall.vanus.controller.SnowflakeController.GetClusterStartTime:input_type -> google.protobuf.Empty + 50, // 46: linkall.vanus.controller.SnowflakeController.RegisterNode:input_type -> google.protobuf.UInt32Value + 50, // 47: linkall.vanus.controller.SnowflakeController.UnregisterNode:input_type -> google.protobuf.UInt32Value 0, // 48: linkall.vanus.controller.PingServer.Ping:output_type -> linkall.vanus.controller.PingResponse - 36, // 49: linkall.vanus.controller.EventBusController.CreateEventBus:output_type -> linkall.vanus.meta.EventBus - 36, // 50: linkall.vanus.controller.EventBusController.CreateSystemEventBus:output_type -> linkall.vanus.meta.EventBus - 48, // 51: linkall.vanus.controller.EventBusController.DeleteEventBus:output_type -> google.protobuf.Empty - 36, // 52: linkall.vanus.controller.EventBusController.GetEventBus:output_type -> linkall.vanus.meta.EventBus + 37, // 49: linkall.vanus.controller.EventBusController.CreateEventBus:output_type -> linkall.vanus.meta.EventBus + 37, // 50: linkall.vanus.controller.EventBusController.CreateSystemEventBus:output_type -> linkall.vanus.meta.EventBus + 49, // 51: linkall.vanus.controller.EventBusController.DeleteEventBus:output_type -> google.protobuf.Empty + 37, // 52: linkall.vanus.controller.EventBusController.GetEventBus:output_type -> linkall.vanus.meta.EventBus 2, // 53: linkall.vanus.controller.EventBusController.ListEventBus:output_type -> linkall.vanus.controller.ListEventbusResponse - 36, // 54: linkall.vanus.controller.EventBusController.UpdateEventBus:output_type -> linkall.vanus.meta.EventBus - 32, // 55: linkall.vanus.controller.EventLogController.ListSegment:output_type -> linkall.vanus.controller.ListSegmentResponse - 34, // 56: linkall.vanus.controller.EventLogController.GetAppendableSegment:output_type -> linkall.vanus.controller.GetAppendableSegmentResponse + 37, // 54: linkall.vanus.controller.EventBusController.UpdateEventBus:output_type -> linkall.vanus.meta.EventBus + 33, // 55: linkall.vanus.controller.EventLogController.ListSegment:output_type -> linkall.vanus.controller.ListSegmentResponse + 35, // 56: linkall.vanus.controller.EventLogController.GetAppendableSegment:output_type -> linkall.vanus.controller.GetAppendableSegmentResponse 5, // 57: linkall.vanus.controller.SegmentController.QuerySegmentRouteInfo:output_type -> linkall.vanus.controller.QuerySegmentRouteInfoResponse 7, // 58: linkall.vanus.controller.SegmentController.SegmentHeartbeat:output_type -> linkall.vanus.controller.SegmentHeartbeatResponse 9, // 59: linkall.vanus.controller.SegmentController.RegisterSegmentServer:output_type -> linkall.vanus.controller.RegisterSegmentServerResponse 11, // 60: linkall.vanus.controller.SegmentController.UnregisterSegmentServer:output_type -> linkall.vanus.controller.UnregisterSegmentServerResponse - 48, // 61: linkall.vanus.controller.SegmentController.ReportSegmentBlockIsFull:output_type -> google.protobuf.Empty - 48, // 62: linkall.vanus.controller.SegmentController.ReportSegmentLeader:output_type -> google.protobuf.Empty - 44, // 63: linkall.vanus.controller.TriggerController.CreateSubscription:output_type -> linkall.vanus.meta.Subscription - 44, // 64: linkall.vanus.controller.TriggerController.UpdateSubscription:output_type -> linkall.vanus.meta.Subscription - 48, // 65: linkall.vanus.controller.TriggerController.DeleteSubscription:output_type -> google.protobuf.Empty - 48, // 66: linkall.vanus.controller.TriggerController.DisableSubscription:output_type -> google.protobuf.Empty - 48, // 67: linkall.vanus.controller.TriggerController.ResumeSubscription:output_type -> google.protobuf.Empty - 44, // 68: linkall.vanus.controller.TriggerController.GetSubscription:output_type -> linkall.vanus.meta.Subscription - 20, // 69: linkall.vanus.controller.TriggerController.ListSubscription:output_type -> linkall.vanus.controller.ListSubscriptionResponse - 26, // 70: linkall.vanus.controller.TriggerController.TriggerWorkerHeartbeat:output_type -> linkall.vanus.controller.TriggerWorkerHeartbeatResponse - 22, // 71: linkall.vanus.controller.TriggerController.RegisterTriggerWorker:output_type -> linkall.vanus.controller.RegisterTriggerWorkerResponse - 24, // 72: linkall.vanus.controller.TriggerController.UnregisterTriggerWorker:output_type -> linkall.vanus.controller.UnregisterTriggerWorkerResponse - 28, // 73: linkall.vanus.controller.TriggerController.ResetOffsetToTimestamp:output_type -> linkall.vanus.controller.ResetOffsetToTimestampResponse - 30, // 74: linkall.vanus.controller.TriggerController.CommitOffset:output_type -> linkall.vanus.controller.CommitOffsetResponse - 50, // 75: linkall.vanus.controller.SnowflakeController.GetClusterStartTime:output_type -> google.protobuf.Timestamp - 48, // 76: linkall.vanus.controller.SnowflakeController.RegisterNode:output_type -> google.protobuf.Empty - 48, // 77: linkall.vanus.controller.SnowflakeController.UnregisterNode:output_type -> google.protobuf.Empty + 49, // 61: linkall.vanus.controller.SegmentController.ReportSegmentBlockIsFull:output_type -> google.protobuf.Empty + 49, // 62: linkall.vanus.controller.SegmentController.ReportSegmentLeader:output_type -> google.protobuf.Empty + 45, // 63: linkall.vanus.controller.TriggerController.CreateSubscription:output_type -> linkall.vanus.meta.Subscription + 45, // 64: linkall.vanus.controller.TriggerController.UpdateSubscription:output_type -> linkall.vanus.meta.Subscription + 49, // 65: linkall.vanus.controller.TriggerController.DeleteSubscription:output_type -> google.protobuf.Empty + 49, // 66: linkall.vanus.controller.TriggerController.DisableSubscription:output_type -> google.protobuf.Empty + 49, // 67: linkall.vanus.controller.TriggerController.ResumeSubscription:output_type -> google.protobuf.Empty + 45, // 68: linkall.vanus.controller.TriggerController.GetSubscription:output_type -> linkall.vanus.meta.Subscription + 21, // 69: linkall.vanus.controller.TriggerController.ListSubscription:output_type -> linkall.vanus.controller.ListSubscriptionResponse + 27, // 70: linkall.vanus.controller.TriggerController.TriggerWorkerHeartbeat:output_type -> linkall.vanus.controller.TriggerWorkerHeartbeatResponse + 23, // 71: linkall.vanus.controller.TriggerController.RegisterTriggerWorker:output_type -> linkall.vanus.controller.RegisterTriggerWorkerResponse + 25, // 72: linkall.vanus.controller.TriggerController.UnregisterTriggerWorker:output_type -> linkall.vanus.controller.UnregisterTriggerWorkerResponse + 29, // 73: linkall.vanus.controller.TriggerController.ResetOffsetToTimestamp:output_type -> linkall.vanus.controller.ResetOffsetToTimestampResponse + 31, // 74: linkall.vanus.controller.TriggerController.CommitOffset:output_type -> linkall.vanus.controller.CommitOffsetResponse + 51, // 75: linkall.vanus.controller.SnowflakeController.GetClusterStartTime:output_type -> google.protobuf.Timestamp + 49, // 76: linkall.vanus.controller.SnowflakeController.RegisterNode:output_type -> google.protobuf.Empty + 49, // 77: linkall.vanus.controller.SnowflakeController.UnregisterNode:output_type -> google.protobuf.Empty 48, // [48:78] is the sub-list for method output_type 18, // [18:48] is the sub-list for method input_type 18, // [18:18] is the sub-list for extension type_name @@ -2795,7 +2858,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListSubscriptionResponse); i { + switch v := v.(*ListSubscriptionRequest); i { case 0: return &v.state case 1: @@ -2807,7 +2870,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegisterTriggerWorkerRequest); i { + switch v := v.(*ListSubscriptionResponse); i { case 0: return &v.state case 1: @@ -2819,7 +2882,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegisterTriggerWorkerResponse); i { + switch v := v.(*RegisterTriggerWorkerRequest); i { case 0: return &v.state case 1: @@ -2831,7 +2894,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UnregisterTriggerWorkerRequest); i { + switch v := v.(*RegisterTriggerWorkerResponse); i { case 0: return &v.state case 1: @@ -2843,7 +2906,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UnregisterTriggerWorkerResponse); i { + switch v := v.(*UnregisterTriggerWorkerRequest); i { case 0: return &v.state case 1: @@ -2855,7 +2918,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TriggerWorkerHeartbeatRequest); i { + switch v := v.(*UnregisterTriggerWorkerResponse); i { case 0: return &v.state case 1: @@ -2867,7 +2930,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TriggerWorkerHeartbeatResponse); i { + switch v := v.(*TriggerWorkerHeartbeatRequest); i { case 0: return &v.state case 1: @@ -2879,7 +2942,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResetOffsetToTimestampRequest); i { + switch v := v.(*TriggerWorkerHeartbeatResponse); i { case 0: return &v.state case 1: @@ -2891,7 +2954,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ResetOffsetToTimestampResponse); i { + switch v := v.(*ResetOffsetToTimestampRequest); i { case 0: return &v.state case 1: @@ -2903,7 +2966,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommitOffsetRequest); i { + switch v := v.(*ResetOffsetToTimestampResponse); i { case 0: return &v.state case 1: @@ -2915,7 +2978,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommitOffsetResponse); i { + switch v := v.(*CommitOffsetRequest); i { case 0: return &v.state case 1: @@ -2927,7 +2990,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListSegmentRequest); i { + switch v := v.(*CommitOffsetResponse); i { case 0: return &v.state case 1: @@ -2939,7 +3002,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListSegmentResponse); i { + switch v := v.(*ListSegmentRequest); i { case 0: return &v.state case 1: @@ -2951,7 +3014,7 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetAppendableSegmentRequest); i { + switch v := v.(*ListSegmentResponse); i { case 0: return &v.state case 1: @@ -2963,6 +3026,18 @@ func file_controller_proto_init() { } } file_controller_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAppendableSegmentRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_controller_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetAppendableSegmentResponse); i { case 0: return &v.state @@ -2981,7 +3056,7 @@ func file_controller_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_controller_proto_rawDesc, NumEnums: 0, - NumMessages: 36, + NumMessages: 37, NumExtensions: 0, NumServices: 6, }, @@ -3734,7 +3809,7 @@ type TriggerControllerClient interface { DisableSubscription(ctx context.Context, in *DisableSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) ResumeSubscription(ctx context.Context, in *ResumeSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) GetSubscription(ctx context.Context, in *GetSubscriptionRequest, opts ...grpc.CallOption) (*meta.Subscription, error) - ListSubscription(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListSubscriptionResponse, error) + ListSubscription(ctx context.Context, in *ListSubscriptionRequest, opts ...grpc.CallOption) (*ListSubscriptionResponse, error) TriggerWorkerHeartbeat(ctx context.Context, opts ...grpc.CallOption) (TriggerController_TriggerWorkerHeartbeatClient, error) RegisterTriggerWorker(ctx context.Context, in *RegisterTriggerWorkerRequest, opts ...grpc.CallOption) (*RegisterTriggerWorkerResponse, error) UnregisterTriggerWorker(ctx context.Context, in *UnregisterTriggerWorkerRequest, opts ...grpc.CallOption) (*UnregisterTriggerWorkerResponse, error) @@ -3804,7 +3879,7 @@ func (c *triggerControllerClient) GetSubscription(ctx context.Context, in *GetSu return out, nil } -func (c *triggerControllerClient) ListSubscription(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListSubscriptionResponse, error) { +func (c *triggerControllerClient) ListSubscription(ctx context.Context, in *ListSubscriptionRequest, opts ...grpc.CallOption) (*ListSubscriptionResponse, error) { out := new(ListSubscriptionResponse) err := c.cc.Invoke(ctx, "/linkall.vanus.controller.TriggerController/ListSubscription", in, out, opts...) if err != nil { @@ -3891,7 +3966,7 @@ type TriggerControllerServer interface { DisableSubscription(context.Context, *DisableSubscriptionRequest) (*emptypb.Empty, error) ResumeSubscription(context.Context, *ResumeSubscriptionRequest) (*emptypb.Empty, error) GetSubscription(context.Context, *GetSubscriptionRequest) (*meta.Subscription, error) - ListSubscription(context.Context, *emptypb.Empty) (*ListSubscriptionResponse, error) + ListSubscription(context.Context, *ListSubscriptionRequest) (*ListSubscriptionResponse, error) TriggerWorkerHeartbeat(TriggerController_TriggerWorkerHeartbeatServer) error RegisterTriggerWorker(context.Context, *RegisterTriggerWorkerRequest) (*RegisterTriggerWorkerResponse, error) UnregisterTriggerWorker(context.Context, *UnregisterTriggerWorkerRequest) (*UnregisterTriggerWorkerResponse, error) @@ -3921,7 +3996,7 @@ func (*UnimplementedTriggerControllerServer) ResumeSubscription(context.Context, func (*UnimplementedTriggerControllerServer) GetSubscription(context.Context, *GetSubscriptionRequest) (*meta.Subscription, error) { return nil, status.Errorf(codes.Unimplemented, "method GetSubscription not implemented") } -func (*UnimplementedTriggerControllerServer) ListSubscription(context.Context, *emptypb.Empty) (*ListSubscriptionResponse, error) { +func (*UnimplementedTriggerControllerServer) ListSubscription(context.Context, *ListSubscriptionRequest) (*ListSubscriptionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListSubscription not implemented") } func (*UnimplementedTriggerControllerServer) TriggerWorkerHeartbeat(TriggerController_TriggerWorkerHeartbeatServer) error { @@ -4053,7 +4128,7 @@ func _TriggerController_GetSubscription_Handler(srv interface{}, ctx context.Con } func _TriggerController_ListSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(emptypb.Empty) + in := new(ListSubscriptionRequest) if err := dec(in); err != nil { return nil, err } @@ -4065,7 +4140,7 @@ func _TriggerController_ListSubscription_Handler(srv interface{}, ctx context.Co FullMethod: "/linkall.vanus.controller.TriggerController/ListSubscription", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TriggerControllerServer).ListSubscription(ctx, req.(*emptypb.Empty)) + return srv.(TriggerControllerServer).ListSubscription(ctx, req.(*ListSubscriptionRequest)) } return interceptor(ctx, in, info, handler) } diff --git a/proto/pkg/controller/mock_controller.go b/proto/pkg/controller/mock_controller.go index febca4c90..59cd3bede 100644 --- a/proto/pkg/controller/mock_controller.go +++ b/proto/pkg/controller/mock_controller.go @@ -1120,7 +1120,7 @@ func (mr *MockTriggerControllerClientMockRecorder) GetSubscription(ctx, in inter } // ListSubscription mocks base method. -func (m *MockTriggerControllerClient) ListSubscription(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListSubscriptionResponse, error) { +func (m *MockTriggerControllerClient) ListSubscription(ctx context.Context, in *ListSubscriptionRequest, opts ...grpc.CallOption) (*ListSubscriptionResponse, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, in} for _, a := range opts { @@ -1495,7 +1495,7 @@ func (mr *MockTriggerControllerServerMockRecorder) GetSubscription(arg0, arg1 in } // ListSubscription mocks base method. -func (m *MockTriggerControllerServer) ListSubscription(arg0 context.Context, arg1 *emptypb.Empty) (*ListSubscriptionResponse, error) { +func (m *MockTriggerControllerServer) ListSubscription(arg0 context.Context, arg1 *ListSubscriptionRequest) (*ListSubscriptionResponse, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ListSubscription", arg0, arg1) ret0, _ := ret[0].(*ListSubscriptionResponse) diff --git a/proto/pkg/proxy/proxy.pb.go b/proto/pkg/proxy/proxy.pb.go index 917308164..58f7d4759 100644 --- a/proto/pkg/proxy/proxy.pb.go +++ b/proto/pkg/proxy/proxy.pb.go @@ -547,7 +547,7 @@ var file_proxy_proto_rawDesc = []byte{ 0x75, 0x6c, 0x74, 0x12, 0x2d, 0x0a, 0x12, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x32, 0x90, 0x0e, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x6c, 0x74, 0x32, 0xab, 0x0e, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x5f, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, @@ -608,62 +608,64 @@ var file_proxy_proto_rawDesc = []byte{ 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x5e, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, - 0x32, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x2e, 0x6c, 0x69, 0x6e, + 0x69, 0x6f, 0x6e, 0x12, 0x79, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x61, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x75, - 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, - 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, - 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x8b, 0x01, 0x0a, 0x16, - 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, - 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, - 0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x38, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, + 0x0a, 0x13, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, + 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x12, 0x61, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x8b, 0x01, 0x0a, 0x16, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x0b, 0x43, 0x6c, 0x75, - 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x1a, 0x28, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x0c, 0x4c, 0x6f, - 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x28, 0x2e, 0x6c, 0x69, 0x6e, - 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, - 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, - 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x57, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x24, 0x2e, 0x6c, 0x69, + 0x70, 0x12, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, + 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x6c, 0x69, 0x6e, + 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x0b, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x28, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7b, 0x0a, 0x14, 0x56, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, - 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, 0x73, - 0x2f, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, - 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x28, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, + 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, + 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x29, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x08, 0x47, 0x65, + 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x24, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x47, 0x65, 0x74, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6c, + 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x78, 0x79, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x7b, 0x0a, 0x14, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x2e, 0x6c, 0x69, + 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, + 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, + 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x78, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, + 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x78, + 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -699,14 +701,15 @@ var file_proxy_proto_goTypes = []interface{}{ (*controller.UpdateSubscriptionRequest)(nil), // 16: linkall.vanus.controller.UpdateSubscriptionRequest (*controller.DeleteSubscriptionRequest)(nil), // 17: linkall.vanus.controller.DeleteSubscriptionRequest (*controller.GetSubscriptionRequest)(nil), // 18: linkall.vanus.controller.GetSubscriptionRequest - (*controller.DisableSubscriptionRequest)(nil), // 19: linkall.vanus.controller.DisableSubscriptionRequest - (*controller.ResumeSubscriptionRequest)(nil), // 20: linkall.vanus.controller.ResumeSubscriptionRequest - (*controller.ResetOffsetToTimestampRequest)(nil), // 21: linkall.vanus.controller.ResetOffsetToTimestampRequest - (*controller.ListEventbusResponse)(nil), // 22: linkall.vanus.controller.ListEventbusResponse - (*controller.ListSegmentResponse)(nil), // 23: linkall.vanus.controller.ListSegmentResponse - (*meta.Subscription)(nil), // 24: linkall.vanus.meta.Subscription - (*controller.ListSubscriptionResponse)(nil), // 25: linkall.vanus.controller.ListSubscriptionResponse - (*controller.ResetOffsetToTimestampResponse)(nil), // 26: linkall.vanus.controller.ResetOffsetToTimestampResponse + (*controller.ListSubscriptionRequest)(nil), // 19: linkall.vanus.controller.ListSubscriptionRequest + (*controller.DisableSubscriptionRequest)(nil), // 20: linkall.vanus.controller.DisableSubscriptionRequest + (*controller.ResumeSubscriptionRequest)(nil), // 21: linkall.vanus.controller.ResumeSubscriptionRequest + (*controller.ResetOffsetToTimestampRequest)(nil), // 22: linkall.vanus.controller.ResetOffsetToTimestampRequest + (*controller.ListEventbusResponse)(nil), // 23: linkall.vanus.controller.ListEventbusResponse + (*controller.ListSegmentResponse)(nil), // 24: linkall.vanus.controller.ListSegmentResponse + (*meta.Subscription)(nil), // 25: linkall.vanus.meta.Subscription + (*controller.ListSubscriptionResponse)(nil), // 26: linkall.vanus.controller.ListSubscriptionResponse + (*controller.ResetOffsetToTimestampResponse)(nil), // 27: linkall.vanus.controller.ResetOffsetToTimestampResponse } var file_proxy_proto_depIdxs = []int32{ 7, // 0: linkall.vanus.proxy.LookupOffsetResponse.offsets:type_name -> linkall.vanus.proxy.LookupOffsetResponse.OffsetsEntry @@ -722,10 +725,10 @@ var file_proxy_proto_depIdxs = []int32{ 16, // 10: linkall.vanus.proxy.ControllerProxy.UpdateSubscription:input_type -> linkall.vanus.controller.UpdateSubscriptionRequest 17, // 11: linkall.vanus.proxy.ControllerProxy.DeleteSubscription:input_type -> linkall.vanus.controller.DeleteSubscriptionRequest 18, // 12: linkall.vanus.proxy.ControllerProxy.GetSubscription:input_type -> linkall.vanus.controller.GetSubscriptionRequest - 12, // 13: linkall.vanus.proxy.ControllerProxy.ListSubscription:input_type -> google.protobuf.Empty - 19, // 14: linkall.vanus.proxy.ControllerProxy.DisableSubscription:input_type -> linkall.vanus.controller.DisableSubscriptionRequest - 20, // 15: linkall.vanus.proxy.ControllerProxy.ResumeSubscription:input_type -> linkall.vanus.controller.ResumeSubscriptionRequest - 21, // 16: linkall.vanus.proxy.ControllerProxy.ResetOffsetToTimestamp:input_type -> linkall.vanus.controller.ResetOffsetToTimestampRequest + 19, // 13: linkall.vanus.proxy.ControllerProxy.ListSubscription:input_type -> linkall.vanus.controller.ListSubscriptionRequest + 20, // 14: linkall.vanus.proxy.ControllerProxy.DisableSubscription:input_type -> linkall.vanus.controller.DisableSubscriptionRequest + 21, // 15: linkall.vanus.proxy.ControllerProxy.ResumeSubscription:input_type -> linkall.vanus.controller.ResumeSubscriptionRequest + 22, // 16: linkall.vanus.proxy.ControllerProxy.ResetOffsetToTimestamp:input_type -> linkall.vanus.controller.ResetOffsetToTimestampRequest 12, // 17: linkall.vanus.proxy.ControllerProxy.ClusterInfo:input_type -> google.protobuf.Empty 0, // 18: linkall.vanus.proxy.ControllerProxy.LookupOffset:input_type -> linkall.vanus.proxy.LookupOffsetRequest 2, // 19: linkall.vanus.proxy.ControllerProxy.GetEvent:input_type -> linkall.vanus.proxy.GetEventRequest @@ -733,17 +736,17 @@ var file_proxy_proto_depIdxs = []int32{ 11, // 21: linkall.vanus.proxy.ControllerProxy.CreateEventBus:output_type -> linkall.vanus.meta.EventBus 12, // 22: linkall.vanus.proxy.ControllerProxy.DeleteEventBus:output_type -> google.protobuf.Empty 11, // 23: linkall.vanus.proxy.ControllerProxy.GetEventBus:output_type -> linkall.vanus.meta.EventBus - 22, // 24: linkall.vanus.proxy.ControllerProxy.ListEventBus:output_type -> linkall.vanus.controller.ListEventbusResponse + 23, // 24: linkall.vanus.proxy.ControllerProxy.ListEventBus:output_type -> linkall.vanus.controller.ListEventbusResponse 11, // 25: linkall.vanus.proxy.ControllerProxy.UpdateEventBus:output_type -> linkall.vanus.meta.EventBus - 23, // 26: linkall.vanus.proxy.ControllerProxy.ListSegment:output_type -> linkall.vanus.controller.ListSegmentResponse - 24, // 27: linkall.vanus.proxy.ControllerProxy.CreateSubscription:output_type -> linkall.vanus.meta.Subscription - 24, // 28: linkall.vanus.proxy.ControllerProxy.UpdateSubscription:output_type -> linkall.vanus.meta.Subscription + 24, // 26: linkall.vanus.proxy.ControllerProxy.ListSegment:output_type -> linkall.vanus.controller.ListSegmentResponse + 25, // 27: linkall.vanus.proxy.ControllerProxy.CreateSubscription:output_type -> linkall.vanus.meta.Subscription + 25, // 28: linkall.vanus.proxy.ControllerProxy.UpdateSubscription:output_type -> linkall.vanus.meta.Subscription 12, // 29: linkall.vanus.proxy.ControllerProxy.DeleteSubscription:output_type -> google.protobuf.Empty - 24, // 30: linkall.vanus.proxy.ControllerProxy.GetSubscription:output_type -> linkall.vanus.meta.Subscription - 25, // 31: linkall.vanus.proxy.ControllerProxy.ListSubscription:output_type -> linkall.vanus.controller.ListSubscriptionResponse + 25, // 30: linkall.vanus.proxy.ControllerProxy.GetSubscription:output_type -> linkall.vanus.meta.Subscription + 26, // 31: linkall.vanus.proxy.ControllerProxy.ListSubscription:output_type -> linkall.vanus.controller.ListSubscriptionResponse 12, // 32: linkall.vanus.proxy.ControllerProxy.DisableSubscription:output_type -> google.protobuf.Empty 12, // 33: linkall.vanus.proxy.ControllerProxy.ResumeSubscription:output_type -> google.protobuf.Empty - 26, // 34: linkall.vanus.proxy.ControllerProxy.ResetOffsetToTimestamp:output_type -> linkall.vanus.controller.ResetOffsetToTimestampResponse + 27, // 34: linkall.vanus.proxy.ControllerProxy.ResetOffsetToTimestamp:output_type -> linkall.vanus.controller.ResetOffsetToTimestampResponse 4, // 35: linkall.vanus.proxy.ControllerProxy.ClusterInfo:output_type -> linkall.vanus.proxy.ClusterInfoResponse 1, // 36: linkall.vanus.proxy.ControllerProxy.LookupOffset:output_type -> linkall.vanus.proxy.LookupOffsetResponse 3, // 37: linkall.vanus.proxy.ControllerProxy.GetEvent:output_type -> linkall.vanus.proxy.GetEventResponse @@ -890,7 +893,7 @@ type ControllerProxyClient interface { UpdateSubscription(ctx context.Context, in *controller.UpdateSubscriptionRequest, opts ...grpc.CallOption) (*meta.Subscription, error) DeleteSubscription(ctx context.Context, in *controller.DeleteSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) GetSubscription(ctx context.Context, in *controller.GetSubscriptionRequest, opts ...grpc.CallOption) (*meta.Subscription, error) - ListSubscription(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*controller.ListSubscriptionResponse, error) + ListSubscription(ctx context.Context, in *controller.ListSubscriptionRequest, opts ...grpc.CallOption) (*controller.ListSubscriptionResponse, error) DisableSubscription(ctx context.Context, in *controller.DisableSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) ResumeSubscription(ctx context.Context, in *controller.ResumeSubscriptionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) ResetOffsetToTimestamp(ctx context.Context, in *controller.ResetOffsetToTimestampRequest, opts ...grpc.CallOption) (*controller.ResetOffsetToTimestampResponse, error) @@ -999,7 +1002,7 @@ func (c *controllerProxyClient) GetSubscription(ctx context.Context, in *control return out, nil } -func (c *controllerProxyClient) ListSubscription(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*controller.ListSubscriptionResponse, error) { +func (c *controllerProxyClient) ListSubscription(ctx context.Context, in *controller.ListSubscriptionRequest, opts ...grpc.CallOption) (*controller.ListSubscriptionResponse, error) { out := new(controller.ListSubscriptionResponse) err := c.cc.Invoke(ctx, "/linkall.vanus.proxy.ControllerProxy/ListSubscription", in, out, opts...) if err != nil { @@ -1085,7 +1088,7 @@ type ControllerProxyServer interface { UpdateSubscription(context.Context, *controller.UpdateSubscriptionRequest) (*meta.Subscription, error) DeleteSubscription(context.Context, *controller.DeleteSubscriptionRequest) (*emptypb.Empty, error) GetSubscription(context.Context, *controller.GetSubscriptionRequest) (*meta.Subscription, error) - ListSubscription(context.Context, *emptypb.Empty) (*controller.ListSubscriptionResponse, error) + ListSubscription(context.Context, *controller.ListSubscriptionRequest) (*controller.ListSubscriptionResponse, error) DisableSubscription(context.Context, *controller.DisableSubscriptionRequest) (*emptypb.Empty, error) ResumeSubscription(context.Context, *controller.ResumeSubscriptionRequest) (*emptypb.Empty, error) ResetOffsetToTimestamp(context.Context, *controller.ResetOffsetToTimestampRequest) (*controller.ResetOffsetToTimestampResponse, error) @@ -1130,7 +1133,7 @@ func (*UnimplementedControllerProxyServer) DeleteSubscription(context.Context, * func (*UnimplementedControllerProxyServer) GetSubscription(context.Context, *controller.GetSubscriptionRequest) (*meta.Subscription, error) { return nil, status.Errorf(codes.Unimplemented, "method GetSubscription not implemented") } -func (*UnimplementedControllerProxyServer) ListSubscription(context.Context, *emptypb.Empty) (*controller.ListSubscriptionResponse, error) { +func (*UnimplementedControllerProxyServer) ListSubscription(context.Context, *controller.ListSubscriptionRequest) (*controller.ListSubscriptionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListSubscription not implemented") } func (*UnimplementedControllerProxyServer) DisableSubscription(context.Context, *controller.DisableSubscriptionRequest) (*emptypb.Empty, error) { @@ -1340,7 +1343,7 @@ func _ControllerProxy_GetSubscription_Handler(srv interface{}, ctx context.Conte } func _ControllerProxy_ListSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(emptypb.Empty) + in := new(controller.ListSubscriptionRequest) if err := dec(in); err != nil { return nil, err } @@ -1352,7 +1355,7 @@ func _ControllerProxy_ListSubscription_Handler(srv interface{}, ctx context.Cont FullMethod: "/linkall.vanus.proxy.ControllerProxy/ListSubscription", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ControllerProxyServer).ListSubscription(ctx, req.(*emptypb.Empty)) + return srv.(ControllerProxyServer).ListSubscription(ctx, req.(*controller.ListSubscriptionRequest)) } return interceptor(ctx, in, info, handler) } diff --git a/proto/proto/controller.proto b/proto/proto/controller.proto index a9f811343..f493b9ade 100644 --- a/proto/proto/controller.proto +++ b/proto/proto/controller.proto @@ -75,7 +75,7 @@ service TriggerController { returns (google.protobuf.Empty); rpc GetSubscription(GetSubscriptionRequest) returns (linkall.vanus.meta.Subscription) {} - rpc ListSubscription(google.protobuf.Empty) + rpc ListSubscription(ListSubscriptionRequest) returns (ListSubscriptionResponse) {} rpc TriggerWorkerHeartbeat(stream TriggerWorkerHeartbeatRequest) returns (TriggerWorkerHeartbeatResponse); @@ -194,6 +194,11 @@ message ResumeSubscriptionRequest { uint64 id = 1; } +message ListSubscriptionRequest { + string eventbus = 1; + string name = 2; +} + message ListSubscriptionResponse { repeated linkall.vanus.meta.Subscription subscription = 1; } diff --git a/proto/proto/proxy.proto b/proto/proto/proxy.proto index 165514b2e..b7a3a9bbf 100644 --- a/proto/proto/proxy.proto +++ b/proto/proto/proxy.proto @@ -43,7 +43,7 @@ service ControllerProxy { returns (google.protobuf.Empty); rpc GetSubscription(controller.GetSubscriptionRequest) returns (meta.Subscription); - rpc ListSubscription(google.protobuf.Empty) + rpc ListSubscription(controller.ListSubscriptionRequest) returns (controller.ListSubscriptionResponse); rpc DisableSubscription(controller.DisableSubscriptionRequest) returns (google.protobuf.Empty); diff --git a/vsctl/command/subscription.go b/vsctl/command/subscription.go index d4442f029..ed63d6102 100644 --- a/vsctl/command/subscription.go +++ b/vsctl/command/subscription.go @@ -24,7 +24,6 @@ import ( "github.com/aws/aws-sdk-go-v2/aws/arn" "github.com/fatih/color" - "github.com/golang/protobuf/ptypes/empty" "github.com/jedib0t/go-pretty/v6/table" "github.com/jedib0t/go-pretty/v6/text" "github.com/linkall-labs/vanus/internal/convert" @@ -410,13 +409,18 @@ func listSubscriptionCommand() *cobra.Command { Use: "list", Short: "list the subscription ", Run: func(cmd *cobra.Command, args []string) { - res, err := client.ListSubscription(context.Background(), &empty.Empty{}) + res, err := client.ListSubscription(context.Background(), &ctrlpb.ListSubscriptionRequest{ + Eventbus: eventbus, + Name: subscriptionName, + }) if err != nil { cmdFailedf(cmd, "list subscription failed: %s", err) } printSubscription(cmd, true, false, false, res.Subscription...) }, } + cmd.Flags().StringVar(&eventbus, "eventbus", "", "eventbus name to consuming") + cmd.Flags().StringVar(&subscriptionName, "name", "", "subscription name") return cmd } From 9bfa6eabe4812c1c17c252176446d46e7f0af451 Mon Sep 17 00:00:00 2001 From: Maria Stavrianopoulou <74065206+stavrmaria@users.noreply.github.com> Date: Tue, 10 Jan 2023 17:14:52 +0200 Subject: [PATCH 38/46] feat: add function replace string #375 (#404) * feat: add function replace string --- .../action/strings/replace_string.go | 57 ++++++++++++++++ .../action/strings/replace_string_test.go | 68 +++++++++++++++++++ internal/primitive/transform/runtime/init.go | 1 + 3 files changed, 126 insertions(+) create mode 100644 internal/primitive/transform/action/strings/replace_string.go create mode 100644 internal/primitive/transform/action/strings/replace_string_test.go diff --git a/internal/primitive/transform/action/strings/replace_string.go b/internal/primitive/transform/action/strings/replace_string.go new file mode 100644 index 000000000..c742829e8 --- /dev/null +++ b/internal/primitive/transform/action/strings/replace_string.go @@ -0,0 +1,57 @@ +// Copyright 2023 Linkall Inc. +// +// 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 strings + +import ( + "strings" + + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/common" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" +) + +type replaceStringAction struct { + action.CommonAction +} + +// NewReplaceStringAction ["path", "subValue", "targetValue"]. +func NewReplaceStringAction() action.Action { + return &replaceStringAction{ + CommonAction: action.CommonAction{ + ActionName: "REPLACE_STRING", + FixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All}, + }, + } +} + +func (a *replaceStringAction) Init(args []arg.Arg) error { + a.TargetArg = args[0] + a.Args = args + a.ArgTypes = []common.Type{common.String, common.String, common.String} + return nil +} + +func (a *replaceStringAction) Execute(ceCtx *context.EventContext) error { + args, err := a.RunArgs(ceCtx) + if err != nil { + return err + } + originalString, _ := args[0].(string) + subVal, _ := args[1].(string) + targetVal, _ := args[2].(string) + newString := strings.ReplaceAll(originalString, subVal, targetVal) + return a.TargetArg.SetValue(ceCtx, newString) +} diff --git a/internal/primitive/transform/action/strings/replace_string_test.go b/internal/primitive/transform/action/strings/replace_string_test.go new file mode 100644 index 000000000..170364e7a --- /dev/null +++ b/internal/primitive/transform/action/strings/replace_string_test.go @@ -0,0 +1,68 @@ +// Copyright 2023 Linkall Inc. +// +// 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 strings_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/strings" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestReplaceStringAction(t *testing.T) { + funcName := strings.NewReplaceStringAction().Name() + + Convey("test replace string", t, func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "old", "new"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "this is the old test value") + ceCtx := &context.EventContext{ + Event: &e, + } + err = a.Execute(ceCtx) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, "this is the new test value") + }) + + Convey("test replace string multiple instances", t, func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "old", "new"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "this is the old test value (replace old)") + ceCtx := &context.EventContext{ + Event: &e, + } + err = a.Execute(ceCtx) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, "this is the new test value (replace new)") + }) + + Convey("test replace string zero instances", t, func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", "old", "new"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "this is the a test value") + ceCtx := &context.EventContext{ + Event: &e, + } + err = a.Execute(ceCtx) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, "this is the a test value") + }) +} diff --git a/internal/primitive/transform/runtime/init.go b/internal/primitive/transform/runtime/init.go index ce4ceba29..48987e5b8 100644 --- a/internal/primitive/transform/runtime/init.go +++ b/internal/primitive/transform/runtime/init.go @@ -49,6 +49,7 @@ func init() { strings.NewAddPrefixAction, strings.NewAddSuffixAction, strings.NewReplaceWithRegexAction, + strings.NewReplaceStringAction, // condition condition.NewConditionIfAction, // render From 568213b2ff0959ba78be4cf5125c20d6a7c4631e Mon Sep 17 00:00:00 2001 From: soumyadeep589 Date: Tue, 10 Jan 2023 23:14:40 +0530 Subject: [PATCH 39/46] docs: update quickstart link in CONTRIBUTING.md (#405) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 027077a79..7b09d14e1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,7 +39,7 @@ If you want to contribute to the codebase of Vanus, it's better to set up a deve 1. Install Go version 1.17 or above. Refer to [How to Write Go Code](https://go.dev/doc/code) for more information. 2. Install [minikube](https://minikube.sigs.k8s.io/docs/start/)(Users from China mainland may have network issues that need to be addressed for using minikube). Vanus is a k8s based project. -3. Learning [QuickStart](https://github.com/linkall-labs/docs/blob/main/vanus/quick-start.md) how to deploy the Vanus to k8s. Deploying a specified component to minikube for testing. +3. Learning [QuickStart](https://docs.linkall.com/getting-started/quick-start) how to deploy the Vanus to k8s. Deploying a specified component to minikube for testing. Click [here](#) for details. ## Issues From 7a4fb73e0729439ee5b4dd4ab8ff1130e5f6e70b Mon Sep 17 00:00:00 2001 From: wenfeng Date: Wed, 11 Jan 2023 16:12:08 +0800 Subject: [PATCH 40/46] observability: enhance go runtime and node export (#407) * observability: enhance go runtime and node export Signed-off-by: wenfeng * update * restructure Signed-off-by: wenfeng --- cmd/controller/main.go | 2 +- cmd/gateway/main.go | 4 +- cmd/store/main.go | 26 +- cmd/timer/main.go | 2 +- cmd/trigger/main.go | 2 +- deploy/REDEME.md | 111 +--- deploy/aws-eks/README.md | 1 + deploy/aws-eks/aws-eks.yml | 607 ++++++++++++++++++ deploy/aws-eks/kustomization.yaml | 10 + deploy/aws-eks/yaml/controller.yaml | 151 +++++ .../aws-eks/yaml/gateway.yaml | 28 +- .../ns.yml => deploy/aws-eks/yaml/ns.yaml | 0 .../sc.yml => deploy/aws-eks/yaml/sc.yaml | 0 .../aws-eks/yaml/store.yaml | 28 +- .../aws-eks/yaml/timer.yaml | 29 +- .../aws-eks/yaml/trigger.yaml | 28 +- deploy/bare-metal/README.md | 1 + .../benchmark => deploy/bare-metal}/sc.yml | 0 .../benchmark => deploy/bare-metal}/vanus.yml | 0 deploy/on-premises/REDEME.md | 3 + deploy/{yaml => on-premises}/controller.yaml | 0 deploy/{yaml => on-premises}/gateway.yaml | 0 deploy/on-premises/kustomization.yaml | 9 + deploy/{yaml => on-premises}/namespace.yaml | 0 deploy/{yaml => on-premises}/store.yaml | 0 deploy/{yaml => on-premises}/timer.yaml | 0 deploy/{yaml => on-premises}/trigger.yaml | 0 deploy/poc/README.md | 1 + deploy/{ => poc}/kustomization.yaml | 2 +- deploy/poc/poc.yaml | 544 ++++++++++++++++ .../poc/yaml/controller.yaml | 36 +- deploy/poc/yaml/gateway.yaml | 91 +++ deploy/poc/yaml/ns.yaml | 4 + deploy/poc/yaml/store.yaml | 121 ++++ deploy/poc/yaml/timer.yaml | 90 +++ deploy/poc/yaml/trigger.yaml | 91 +++ deploy/{all-in-one.cn.yaml => vanus.cn.yaml} | 0 deploy/{all-in-one.yaml => vanus.yaml} | 0 observability/go.sum | 15 + observability/metrics/config.go | 13 + observability/metrics/metrics.go | 269 +++----- observability/metrics/otel/api.go | 147 +++++ .../metrics/{ => otel}/prometheus.go | 2 +- observability/observability.go | 41 +- test/infra/aws-eks/deploy.sh | 6 - .../benchmark => playbook}/benchmark.yml | 0 .../producer => playbook/pubsub}/play.sh | 0 .../producer => playbook/pubsub}/producer.yml | 0 48 files changed, 2154 insertions(+), 361 deletions(-) create mode 100644 deploy/aws-eks/README.md create mode 100644 deploy/aws-eks/aws-eks.yml create mode 100644 deploy/aws-eks/kustomization.yaml create mode 100644 deploy/aws-eks/yaml/controller.yaml rename test/infra/aws-eks/gateway.yml => deploy/aws-eks/yaml/gateway.yaml (65%) rename test/infra/aws-eks/ns.yml => deploy/aws-eks/yaml/ns.yaml (100%) rename test/infra/aws-eks/sc.yml => deploy/aws-eks/yaml/sc.yaml (100%) rename test/infra/aws-eks/store.yml => deploy/aws-eks/yaml/store.yaml (73%) rename test/infra/aws-eks/timer.yml => deploy/aws-eks/yaml/timer.yaml (66%) rename test/infra/aws-eks/trigger.yml => deploy/aws-eks/yaml/trigger.yaml (70%) create mode 100644 deploy/bare-metal/README.md rename {test/infra/benchmark => deploy/bare-metal}/sc.yml (100%) rename {test/infra/benchmark => deploy/bare-metal}/vanus.yml (100%) create mode 100644 deploy/on-premises/REDEME.md rename deploy/{yaml => on-premises}/controller.yaml (100%) rename deploy/{yaml => on-premises}/gateway.yaml (100%) create mode 100644 deploy/on-premises/kustomization.yaml rename deploy/{yaml => on-premises}/namespace.yaml (100%) rename deploy/{yaml => on-premises}/store.yaml (100%) rename deploy/{yaml => on-premises}/timer.yaml (100%) rename deploy/{yaml => on-premises}/trigger.yaml (100%) create mode 100644 deploy/poc/README.md rename deploy/{ => poc}/kustomization.yaml (88%) create mode 100644 deploy/poc/poc.yaml rename test/infra/aws-eks/controller.yml => deploy/poc/yaml/controller.yaml (81%) create mode 100644 deploy/poc/yaml/gateway.yaml create mode 100644 deploy/poc/yaml/ns.yaml create mode 100644 deploy/poc/yaml/store.yaml create mode 100644 deploy/poc/yaml/timer.yaml create mode 100644 deploy/poc/yaml/trigger.yaml rename deploy/{all-in-one.cn.yaml => vanus.cn.yaml} (100%) rename deploy/{all-in-one.yaml => vanus.yaml} (100%) create mode 100644 observability/metrics/config.go create mode 100644 observability/metrics/otel/api.go rename observability/metrics/{ => otel}/prometheus.go (98%) delete mode 100644 test/infra/aws-eks/deploy.sh rename test/{infra/benchmark => playbook}/benchmark.yml (100%) rename test/{infra/producer => playbook/pubsub}/play.sh (100%) rename test/{infra/producer => playbook/pubsub}/producer.yml (100%) diff --git a/cmd/controller/main.go b/cmd/controller/main.go index 154bcc407..32ae5200b 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -67,7 +67,7 @@ func main() { } ctx := signal.SetupSignalContext() - _ = observability.Initialize(cfg.Observability, metrics.RegisterControllerMetrics) + _ = observability.Initialize(ctx, cfg.Observability, metrics.GetControllerMetrics) etcd := embedetcd.New(cfg.Topology) if err = etcd.Init(ctx, cfg.GetEtcdConfig()); err != nil { log.Error(ctx, "failed to init etcd", map[string]interface{}{ diff --git a/cmd/gateway/main.go b/cmd/gateway/main.go index 0bc6eada6..275385d6d 100644 --- a/cmd/gateway/main.go +++ b/cmd/gateway/main.go @@ -49,9 +49,9 @@ func main() { }) os.Exit(-1) } - + cfg.Observability.T.ServerName = "Vanus Gateway" - _ = observability.Initialize(cfg.Observability, nil) + _ = observability.Initialize(ctx, cfg.Observability, nil) log.Info(ctx, "Gateway has started", nil) select { case <-ctx.Done(): diff --git a/cmd/store/main.go b/cmd/store/main.go index 5988c506e..7893eb34a 100644 --- a/cmd/store/main.go +++ b/cmd/store/main.go @@ -19,6 +19,7 @@ import ( "context" "flag" "fmt" + "github.com/linkall-labs/vanus/pkg/util/signal" "net" "os" @@ -55,10 +56,9 @@ func main() { os.Exit(-1) } + ctx := signal.SetupSignalContext() cfg.Observability.T.ServerName = "Vanus Store" - _ = observability.Initialize(cfg.Observability, metrics.RegisterSegmentServerMetrics) - - ctx := context.Background() + _ = observability.Initialize(ctx, cfg.Observability, metrics.GetSegmentServerMetrics) srv := segment.NewServer(*cfg) if err = srv.Initialize(ctx); err != nil { @@ -83,15 +83,19 @@ func main() { } defer vanus.DestroySnowflake() - if err = srv.Serve(listener); err != nil { - log.Error(ctx, "The SegmentServer occurred an error.", map[string]interface{}{ - log.KeyError: err, - }) - return - } + go func() { + if err = srv.Serve(listener); err != nil { + log.Error(ctx, "The SegmentServer occurred an error.", map[string]interface{}{ + log.KeyError: err, + }) + return + } + }() + select { + case <-ctx.Done(): + log.Info(ctx, "received system signal, preparing exit", nil) + } raw.CloseAllEngine() - - // TODO: is it gracefully? log.Info(ctx, "The SegmentServer has been shutdown.", nil) } diff --git a/cmd/timer/main.go b/cmd/timer/main.go index dba58f14d..2c9a972ab 100644 --- a/cmd/timer/main.go +++ b/cmd/timer/main.go @@ -48,7 +48,7 @@ func main() { os.Exit(-1) } - _ = observability.Initialize(cfg.Observability, metrics.RegisterTimerMetrics) + _ = observability.Initialize(ctx, cfg.Observability, metrics.GetTimerMetrics) // new leaderelection manager leaderelectionMgr := leaderelection.NewLeaderElection(cfg.GetLeaderElectionConfig()) diff --git a/cmd/trigger/main.go b/cmd/trigger/main.go index 4bfa59f50..d8da75b53 100644 --- a/cmd/trigger/main.go +++ b/cmd/trigger/main.go @@ -54,7 +54,7 @@ func main() { os.Exit(-1) } ctx := signal.SetupSignalContext() - _ = observability.Initialize(cfg.Observability, metrics.RegisterTriggerMetrics) + _ = observability.Initialize(ctx, cfg.Observability, metrics.GetTriggerMetrics) var opts []grpc.ServerOption grpcServer := grpc.NewServer(opts...) srv := trigger.NewTriggerServer(*cfg) diff --git a/deploy/REDEME.md b/deploy/REDEME.md index 25e6a99ba..2693ebc9a 100644 --- a/deploy/REDEME.md +++ b/deploy/REDEME.md @@ -1,110 +1,3 @@ -# Deploy Vanus +# How to Deploy Vanus -Vanus is runtime in Kubernetes cluster - -## Declare - -File structure: - -> ```text -> ├── all-in-one.yaml -> └── yaml -> ├── controller.yaml -> ├── gateway.yaml -> ├── namespace.yaml -> ├── store.yaml -> ├── trigger.yaml -> └── vsctl.yaml -> -> ``` - -- yaml folder is yaml file of vanus core components - - - controller.yaml is yaml file of vanus controller which is responsible for service discovery, metadata management, and resource scheduling - - - gateway.yaml is yaml file of vanus gateway which receive CloudEvent and write them to SegmentServer - - - store.yaml is yaml file of vanus segmentServer which store CloudEvent data - - - trigger.yaml is yaml file of vanus triggerWorker which process events and route them to user workload or Sink Connector - -- all-in-one.yaml is yaml file auto generate by [kustomize] use below command - -```shell -kubectl kustomize deploy > deploy/all-in-one.yaml -``` - -## Installation - -### Pre-requisites - -- [Kubernetes cluster](https://kubernetes.io/docs/setup/) - -### Install - -```shell -kubectl apply -f all-in-one.yml -``` - -### Verifying the installation - -When all resources creating done, the result will be liking below: - -```shell -kubectl get po -n vanus -``` - -Output format: - -> ```text -> vanus-controller-0 1/1 Running 0 30s -> vanus-controller-1 1/1 Running 0 30s -> vanus-controller-2 1/1 Running 0 30s -> vanus-gateway-5fd85c7c-vnzcw 1/1 Running 0 30s -> vanus-store-0 1/1 Running 0 30s -> vanus-store-1 1/1 Running 0 30s -> vanus-store-2 1/1 Running 0 30s -> vanus-trigger-75cb74dbbf-k8jsm 1/1 Running 0 30s -> ``` - -### Uninstall - -```shell -kubectl delete -f all-in-one.yml -``` - -## Install step by step - -Install vanus use step by step - -### Create namespace vanus - -```shell -kubectl create namespace vanus -``` - -### Install Controller - -```shell -kubectl apply -f yaml/controller.yml -``` - -### Install GateWay - -```shell -kubectl apply -f yaml/gateway.yml -``` - -### Install SegmentServer - -```shell -kubectl apply -f yaml/store.yml -``` - -### Install TriggerWorker - -```shell -kubectl apply -f yaml/trigger.yml -``` - -[kustomize]: https://kustomize.io/ +TODO \ No newline at end of file diff --git a/deploy/aws-eks/README.md b/deploy/aws-eks/README.md new file mode 100644 index 000000000..af4186748 --- /dev/null +++ b/deploy/aws-eks/README.md @@ -0,0 +1 @@ +# How to deploy Vanus on AWS EKS \ No newline at end of file diff --git a/deploy/aws-eks/aws-eks.yml b/deploy/aws-eks/aws-eks.yml new file mode 100644 index 000000000..73ef2716e --- /dev/null +++ b/deploy/aws-eks/aws-eks.yml @@ -0,0 +1,607 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: vanus +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + annotations: + storageclass.kubernetes.io/is-default-class: "false" + name: gp3 +parameters: + fsType: xfs + type: gp3 +provisioner: ebs.csi.aws.com +reclaimPolicy: Delete +volumeBindingMode: WaitForFirstConsumer +--- +apiVersion: v1 +data: + controller.yaml: |- + node_id: ${NODE_ID} + name: ${POD_NAME} + ip: ${POD_IP} + port: 2048 + etcd: + - vanus-controller-0.vanus-controller:2379 + - vanus-controller-1.vanus-controller:2379 + - vanus-controller-2.vanus-controller:2379 + data_dir: /data + segment_capacity: 268435456 + replicas: 3 + metadata: + key_prefix: /vanus + topology: + vanus-controller-0: vanus-controller-0.vanus-controller.vanus.svc:2048 + vanus-controller-1: vanus-controller-1.vanus-controller.vanus.svc:2048 + vanus-controller-2: vanus-controller-2.vanus-controller.vanus.svc:2048 + embed_etcd: + # relative path to ${data_dir} above + data_dir: etcd/data + listen_client_addr: 0.0.0.0:2379 + listen_peer_addr: 0.0.0.0:2380 + advertise_client_addr: ${POD_NAME}.vanus-controller:2379 + advertise_peer_addr: ${POD_NAME}.vanus-controller:2380 + clusters: + - vanus-controller-0=http://vanus-controller-0.vanus-controller:2380 + - vanus-controller-1=http://vanus-controller-1.vanus-controller:2380 + - vanus-controller-2=http://vanus-controller-2.vanus-controller:2380 + observability: + metrics: + enable: true + tracing: + enable: false +kind: ConfigMap +metadata: + name: config-controller + namespace: vanus +--- +apiVersion: v1 +data: + gateway.yaml: |- + port: 8080 + controllers: + - vanus-controller-0.vanus-controller:2048 + - vanus-controller-1.vanus-controller:2048 + - vanus-controller-2.vanus-controller:2048 + observability: + metrics: + enable: true + tracing: + enable: false +kind: ConfigMap +metadata: + name: config-gateway + namespace: vanus +--- +apiVersion: v1 +data: + store.yaml: |- + port: 11811 + ip: ${POD_IP} + controllers: + - vanus-controller-0.vanus-controller:2048 + - vanus-controller-1.vanus-controller:2048 + - vanus-controller-2.vanus-controller:2048 + volume: + id: ${VOLUME_ID} + dir: /data + capacity: 1073741824 + meta_store: + wal: + io: + engine: psync + offset_store: + wal: + io: + engine: psync + raft: + wal: + block_size: 16384 + io: + engine: psync + parallel: 16 + vsb: + flush_batch_size: 16384 + io: + engine: psync + parallel: 16 + observability: + metrics: + enable: true + tracing: + enable: false +kind: ConfigMap +metadata: + name: config-store + namespace: vanus +--- +apiVersion: v1 +data: + timer.yaml: |- + name: "timer" + ip: ${POD_IP} + etcd: + - vanus-controller-0.vanus-controller:2379 + - vanus-controller-1.vanus-controller:2379 + - vanus-controller-2.vanus-controller:2379 + metadata: + key_prefix: "/vanus" + leaderelection: + lease_duration: 15 + timingwheel: + tick: 1 + wheel_size: 32 + layers: 4 + controllers: + - vanus-controller-0.vanus-controller.vanus.svc:2048 + - vanus-controller-1.vanus-controller.vanus.svc:2048 + - vanus-controller-2.vanus-controller.vanus.svc:2048 + observability: + metrics: + enable: true + tracing: + enable: false +kind: ConfigMap +metadata: + name: config-timer + namespace: vanus +--- +apiVersion: v1 +data: + trigger.yaml: |- + port: 2148 + ip : ${POD_IP} + send_event_goroutine_size: 1000 + send_event_batch_size: 32 + pull_event_batch_size: 32 + max_uack_event_number: 10000 + controllers: + - vanus-controller-0.vanus-controller.vanus.svc:2048 + - vanus-controller-1.vanus-controller.vanus.svc:2048 + - vanus-controller-2.vanus-controller.vanus.svc:2048 + observability: + metrics: + enable: true + tracing: + enable: false +kind: ConfigMap +metadata: + name: config-trigger + namespace: vanus +--- +apiVersion: v1 +kind: Service +metadata: + name: vanus-controller + namespace: vanus +spec: + clusterIP: None + ports: + - name: vanus-controller + port: 2048 + selector: + app: vanus-controller +--- +apiVersion: v1 +kind: Service +metadata: + name: vanus-gateway + namespace: vanus +spec: + ports: + - name: proxy + port: 8080 + targetPort: 8080 + - name: cloudevents + port: 8081 + targetPort: 8081 + selector: + app: vanus-gateway + type: NodePort +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: vanus-gateway + name: vanus-gateway + namespace: vanus +spec: + replicas: 1 + selector: + matchLabels: + app: vanus-gateway + template: + metadata: + annotations: + prometheus.io/scrape: "true" + labels: + app: vanus-gateway + spec: + containers: + - image: public.ecr.aws/vanus/gateway:3ebbdfe + imagePullPolicy: IfNotPresent + name: gateway + ports: + - containerPort: 8080 + name: proxy + - containerPort: 8081 + name: cloudevents + - containerPort: 2112 + name: metrics + protocol: TCP + resources: + limits: + cpu: 2000m + memory: 2000Mi + requests: + cpu: 2000m + memory: 2000Mi + volumeMounts: + - mountPath: /vanus/config + name: config-gateway + - args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + image: prom/node-exporter + name: node-exporter + ports: + - containerPort: 9100 + name: metrics + protocol: TCP + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + nodeSelector: + type: calculation + volumes: + - configMap: + name: config-gateway + name: config-gateway +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: vanus-timer + name: vanus-timer + namespace: vanus +spec: + replicas: 1 + selector: + matchLabels: + app: vanus-timer + template: + metadata: + annotations: + prometheus.io/scrape: "true" + labels: + app: vanus-timer + spec: + containers: + - env: + - name: VANUS_LOG_LEVEL + value: DEBUG + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/timer:3ebbdfe + imagePullPolicy: IfNotPresent + name: timer + ports: + - containerPort: 2112 + name: metrics + protocol: TCP + resources: + limits: + cpu: 2000m + memory: 4000Mi + requests: + cpu: 2000m + memory: 4000Mi + volumeMounts: + - mountPath: /vanus/config + name: config-timer + - args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + image: prom/node-exporter + name: node-exporter + ports: + - containerPort: 9100 + name: metrics + protocol: TCP + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + nodeSelector: + type: calculation + volumes: + - configMap: + name: config-timer + name: config-timer +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: vanus-trigger + name: vanus-trigger + namespace: vanus +spec: + replicas: 1 + selector: + matchLabels: + app: vanus-trigger + template: + metadata: + annotations: + prometheus.io/scrape: "true" + labels: + app: vanus-trigger + spec: + containers: + - env: + - name: VANUS_LOG_LEVEL + value: INFO + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/trigger:3ebbdfe + imagePullPolicy: IfNotPresent + name: trigger + ports: + - containerPort: 2148 + name: grpc + - containerPort: 2112 + name: metrics + protocol: TCP + resources: + limits: + cpu: 2000m + memory: 2000Mi + requests: + cpu: 2000m + memory: 2000Mi + volumeMounts: + - mountPath: /vanus/config + name: config-trigger + - args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + image: prom/node-exporter + name: node-exporter + ports: + - containerPort: 9100 + name: metrics + protocol: TCP + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + initContainers: + - command: + - /bin/sh + - -c + - sysctl -w net.ipv4.tcp_tw_reuse=1 && sysctl -w net.ipv4.tcp_fin_timeout=10 + && sysctl -w net.ipv4.ip_local_port_range='4096 65000' && sysctl -p + image: busybox + name: set-system-parameters + securityContext: + capabilities: {} + privileged: true + nodeSelector: + type: storage + volumes: + - configMap: + name: config-trigger + name: config-trigger +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app: vanus-controller + name: vanus-controller + namespace: vanus +spec: + replicas: 3 + selector: + matchLabels: + app: vanus-controller + serviceName: vanus-controller + template: + metadata: + annotations: + prometheus.io/scrape: "true" + labels: + app: vanus-controller + spec: + containers: + - command: + - /bin/sh + - -c + - NODE_ID=${HOSTNAME##*-} /vanus/bin/controller + env: + - name: VANUS_LOG_LEVEL + value: DEBUG + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/controller:3ebbdfe + imagePullPolicy: IfNotPresent + name: controller + ports: + - containerPort: 2048 + name: grpc + - containerPort: 2379 + name: etcd-client + - containerPort: 2380 + name: etcd-peer + - containerPort: 2112 + name: metrics + protocol: TCP + resources: + limits: + cpu: 1000m + memory: 4000Mi + requests: + cpu: 1000m + memory: 4000Mi + volumeMounts: + - mountPath: /vanus/config + name: config-controller + - mountPath: /data + name: data + - args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + image: prom/node-exporter + name: node-exporter + ports: + - containerPort: 9100 + name: metrics + protocol: TCP + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + nodeSelector: + type: storage + volumes: + - configMap: + name: config-controller + name: config-controller + volumeClaimTemplates: + - metadata: + labels: + app: vanus-controller + name: data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi + storageClassName: gp3 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app: vanus-store + name: vanus-store + namespace: vanus +spec: + replicas: 3 + selector: + matchLabels: + app: vanus-store + serviceName: vanus-store + template: + metadata: + annotations: + prometheus.io/scrape: "true" + labels: + app: vanus-store + spec: + containers: + - command: + - /bin/sh + - -c + - VOLUME_ID=${HOSTNAME##*-} /vanus/bin/store + env: + - name: VANUS_LOG_LEVEL + value: INFO + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/store:3ebbdfe + imagePullPolicy: IfNotPresent + name: store + ports: + - containerPort: 11811 + name: grpc + - containerPort: 2112 + name: metrics + protocol: TCP + resources: + limits: + cpu: 2000m + memory: 8000Mi + requests: + cpu: 2000m + memory: 8000Mi + volumeMounts: + - mountPath: /vanus/config + name: config-store + - mountPath: /data + name: data + - args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + image: prom/node-exporter + name: node-exporter + ports: + - containerPort: 9100 + name: metrics + protocol: TCP + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + nodeSelector: + type: storage + volumes: + - configMap: + name: config-store + name: config-store + volumeClaimTemplates: + - metadata: + labels: + app: vanus-store + name: data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 200Gi + storageClassName: gp3 diff --git a/deploy/aws-eks/kustomization.yaml b/deploy/aws-eks/kustomization.yaml new file mode 100644 index 000000000..53cf44492 --- /dev/null +++ b/deploy/aws-eks/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - yaml/ns.yaml + - yaml/sc.yaml + - yaml/controller.yaml + - yaml/trigger.yaml + - yaml/gateway.yaml + - yaml/store.yaml + - yaml/timer.yaml diff --git a/deploy/aws-eks/yaml/controller.yaml b/deploy/aws-eks/yaml/controller.yaml new file mode 100644 index 000000000..f4b5103a3 --- /dev/null +++ b/deploy/aws-eks/yaml/controller.yaml @@ -0,0 +1,151 @@ +kind: ConfigMap +metadata: + name: config-controller + namespace: vanus +apiVersion: v1 +data: + controller.yaml: |- + node_id: ${NODE_ID} + name: ${POD_NAME} + ip: ${POD_IP} + port: 2048 + etcd: + - vanus-controller-0.vanus-controller:2379 + - vanus-controller-1.vanus-controller:2379 + - vanus-controller-2.vanus-controller:2379 + data_dir: /data + segment_capacity: 268435456 + replicas: 3 + metadata: + key_prefix: /vanus + topology: + vanus-controller-0: vanus-controller-0.vanus-controller.vanus.svc:2048 + vanus-controller-1: vanus-controller-1.vanus-controller.vanus.svc:2048 + vanus-controller-2: vanus-controller-2.vanus-controller.vanus.svc:2048 + embed_etcd: + # relative path to ${data_dir} above + data_dir: etcd/data + listen_client_addr: 0.0.0.0:2379 + listen_peer_addr: 0.0.0.0:2380 + advertise_client_addr: ${POD_NAME}.vanus-controller:2379 + advertise_peer_addr: ${POD_NAME}.vanus-controller:2380 + clusters: + - vanus-controller-0=http://vanus-controller-0.vanus-controller:2380 + - vanus-controller-1=http://vanus-controller-1.vanus-controller:2380 + - vanus-controller-2=http://vanus-controller-2.vanus-controller:2380 + observability: + metrics: + enable: true + tracing: + enable: false +--- +apiVersion: v1 +kind: Service +metadata: + name: vanus-controller + namespace: vanus +spec: + clusterIP: None + ports: + - name: vanus-controller + port: 2048 + selector: + app: vanus-controller +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app: vanus-controller + name: vanus-controller + namespace: vanus +spec: + replicas: 3 + selector: + matchLabels: + app: vanus-controller + serviceName: vanus-controller + template: + metadata: + annotations: + prometheus.io/scrape: 'true' + labels: + app: vanus-controller + spec: + nodeSelector: + type: storage + containers: + - command: + - /bin/sh + - -c + - NODE_ID=${HOSTNAME##*-} /vanus/bin/controller + env: + - name: VANUS_LOG_LEVEL + value: DEBUG + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/controller:6b23e5a + imagePullPolicy: IfNotPresent + name: controller + resources: + limits: + cpu: 1000m + memory: 4000Mi + requests: + cpu: 1000m + memory: 4000Mi + ports: + - containerPort: 2048 + name: grpc + - containerPort: 2379 + name: etcd-client + - containerPort: 2380 + name: etcd-peer + - containerPort: 2112 + protocol: TCP + name: metrics + volumeMounts: + - mountPath: /vanus/config + name: config-controller + - mountPath: /data + name: data + - name: node-exporter + image: prom/node-exporter + args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + ports: + - containerPort: 9100 + protocol: TCP + name: metrics + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + volumes: + - configMap: + name: config-controller + name: config-controller + volumeClaimTemplates: + - metadata: + labels: + app: vanus-controller + name: data + spec: + accessModes: + - ReadWriteOnce + storageClassName: gp3 + resources: + requests: + storage: 20Gi \ No newline at end of file diff --git a/test/infra/aws-eks/gateway.yml b/deploy/aws-eks/yaml/gateway.yaml similarity index 65% rename from test/infra/aws-eks/gateway.yml rename to deploy/aws-eks/yaml/gateway.yaml index 554db1b6c..cf0bcb085 100644 --- a/test/infra/aws-eks/gateway.yml +++ b/deploy/aws-eks/yaml/gateway.yaml @@ -10,6 +10,11 @@ data: - vanus-controller-0.vanus-controller:2048 - vanus-controller-1.vanus-controller:2048 - vanus-controller-2.vanus-controller:2048 + observability: + metrics: + enable: true + tracing: + enable: false --- apiVersion: v1 kind: Service @@ -43,7 +48,7 @@ spec: template: metadata: annotations: - vanus.dev/metrics.port: "2112" + prometheus.io/scrape: 'true' labels: app: vanus-gateway spec: @@ -65,9 +70,30 @@ spec: name: proxy - containerPort: 8081 name: cloudevents +# - containerPort: 2112 +# protocol: TCP +# name: metrics volumeMounts: - mountPath: /vanus/config name: config-gateway + - name: node-exporter + image: prom/node-exporter + args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + ports: + - containerPort: 9100 + protocol: TCP + name: metrics + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi volumes: - configMap: name: config-gateway diff --git a/test/infra/aws-eks/ns.yml b/deploy/aws-eks/yaml/ns.yaml similarity index 100% rename from test/infra/aws-eks/ns.yml rename to deploy/aws-eks/yaml/ns.yaml diff --git a/test/infra/aws-eks/sc.yml b/deploy/aws-eks/yaml/sc.yaml similarity index 100% rename from test/infra/aws-eks/sc.yml rename to deploy/aws-eks/yaml/sc.yaml diff --git a/test/infra/aws-eks/store.yml b/deploy/aws-eks/yaml/store.yaml similarity index 73% rename from test/infra/aws-eks/store.yml rename to deploy/aws-eks/yaml/store.yaml index 6b6e30474..a13a0c93b 100644 --- a/test/infra/aws-eks/store.yml +++ b/deploy/aws-eks/yaml/store.yaml @@ -34,6 +34,11 @@ data: io: engine: psync parallel: 16 + observability: + metrics: + enable: true + tracing: + enable: false --- apiVersion: apps/v1 kind: StatefulSet @@ -51,7 +56,7 @@ spec: template: metadata: annotations: - vanus.dev/metrics.port: "2112" + prometheus.io/scrape: 'true' labels: app: vanus-store spec: @@ -82,11 +87,32 @@ spec: ports: - containerPort: 11811 name: grpc + - containerPort: 2112 + protocol: TCP + name: metrics volumeMounts: - mountPath: /vanus/config name: config-store - mountPath: /data name: data + - name: node-exporter + image: prom/node-exporter + args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + ports: + - containerPort: 9100 + protocol: TCP + name: metrics + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi volumes: - configMap: name: config-store diff --git a/test/infra/aws-eks/timer.yml b/deploy/aws-eks/yaml/timer.yaml similarity index 66% rename from test/infra/aws-eks/timer.yml rename to deploy/aws-eks/yaml/timer.yaml index 15c411770..0a20bfacc 100644 --- a/test/infra/aws-eks/timer.yml +++ b/deploy/aws-eks/yaml/timer.yaml @@ -19,6 +19,11 @@ data: - vanus-controller-0.vanus-controller.vanus.svc:2048 - vanus-controller-1.vanus-controller.vanus.svc:2048 - vanus-controller-2.vanus-controller.vanus.svc:2048 + observability: + metrics: + enable: true + tracing: + enable: false kind: ConfigMap metadata: name: config-timer @@ -39,7 +44,7 @@ spec: template: metadata: annotations: - vanus.dev/metrics.port: "2112" + prometheus.io/scrape: 'true' labels: app: vanus-timer spec: @@ -59,6 +64,10 @@ spec: volumeMounts: - mountPath: /vanus/config name: config-timer + ports: + - containerPort: 2112 + protocol: TCP + name: metrics resources: limits: cpu: 2000m @@ -66,6 +75,24 @@ spec: requests: cpu: 2000m memory: 4000Mi + - name: node-exporter + image: prom/node-exporter + args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + ports: + - containerPort: 9100 + protocol: TCP + name: metrics + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi volumes: - configMap: name: config-timer diff --git a/test/infra/aws-eks/trigger.yml b/deploy/aws-eks/yaml/trigger.yaml similarity index 70% rename from test/infra/aws-eks/trigger.yml rename to deploy/aws-eks/yaml/trigger.yaml index 93d42db34..c91f67743 100644 --- a/test/infra/aws-eks/trigger.yml +++ b/deploy/aws-eks/yaml/trigger.yaml @@ -11,6 +11,11 @@ data: - vanus-controller-0.vanus-controller.vanus.svc:2048 - vanus-controller-1.vanus-controller.vanus.svc:2048 - vanus-controller-2.vanus-controller.vanus.svc:2048 + observability: + metrics: + enable: true + tracing: + enable: false kind: ConfigMap metadata: name: config-trigger @@ -31,7 +36,7 @@ spec: template: metadata: annotations: - vanus.dev/metrics.port: "2112" + prometheus.io/scrape: 'true' labels: app: vanus-trigger spec: @@ -65,9 +70,30 @@ spec: ports: - containerPort: 2148 name: grpc + - containerPort: 2112 + protocol: TCP + name: metrics volumeMounts: - mountPath: /vanus/config name: config-trigger + - name: node-exporter + image: prom/node-exporter + args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + ports: + - containerPort: 9100 + protocol: TCP + name: metrics + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi volumes: - configMap: name: config-trigger diff --git a/deploy/bare-metal/README.md b/deploy/bare-metal/README.md new file mode 100644 index 000000000..6e01af884 --- /dev/null +++ b/deploy/bare-metal/README.md @@ -0,0 +1 @@ +# How to deploy Vanus on bare-metal machine \ No newline at end of file diff --git a/test/infra/benchmark/sc.yml b/deploy/bare-metal/sc.yml similarity index 100% rename from test/infra/benchmark/sc.yml rename to deploy/bare-metal/sc.yml diff --git a/test/infra/benchmark/vanus.yml b/deploy/bare-metal/vanus.yml similarity index 100% rename from test/infra/benchmark/vanus.yml rename to deploy/bare-metal/vanus.yml diff --git a/deploy/on-premises/REDEME.md b/deploy/on-premises/REDEME.md new file mode 100644 index 000000000..d5bdbc5d2 --- /dev/null +++ b/deploy/on-premises/REDEME.md @@ -0,0 +1,3 @@ +# How to Deploy Vanus on premises + +TODO \ No newline at end of file diff --git a/deploy/yaml/controller.yaml b/deploy/on-premises/controller.yaml similarity index 100% rename from deploy/yaml/controller.yaml rename to deploy/on-premises/controller.yaml diff --git a/deploy/yaml/gateway.yaml b/deploy/on-premises/gateway.yaml similarity index 100% rename from deploy/yaml/gateway.yaml rename to deploy/on-premises/gateway.yaml diff --git a/deploy/on-premises/kustomization.yaml b/deploy/on-premises/kustomization.yaml new file mode 100644 index 000000000..86845697f --- /dev/null +++ b/deploy/on-premises/kustomization.yaml @@ -0,0 +1,9 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - namespace.yaml + - controller.yaml + - trigger.yaml + - gateway.yaml + - store.yaml + - timer.yaml diff --git a/deploy/yaml/namespace.yaml b/deploy/on-premises/namespace.yaml similarity index 100% rename from deploy/yaml/namespace.yaml rename to deploy/on-premises/namespace.yaml diff --git a/deploy/yaml/store.yaml b/deploy/on-premises/store.yaml similarity index 100% rename from deploy/yaml/store.yaml rename to deploy/on-premises/store.yaml diff --git a/deploy/yaml/timer.yaml b/deploy/on-premises/timer.yaml similarity index 100% rename from deploy/yaml/timer.yaml rename to deploy/on-premises/timer.yaml diff --git a/deploy/yaml/trigger.yaml b/deploy/on-premises/trigger.yaml similarity index 100% rename from deploy/yaml/trigger.yaml rename to deploy/on-premises/trigger.yaml diff --git a/deploy/poc/README.md b/deploy/poc/README.md new file mode 100644 index 000000000..158049737 --- /dev/null +++ b/deploy/poc/README.md @@ -0,0 +1 @@ +# How to deploy Vanus for POC \ No newline at end of file diff --git a/deploy/kustomization.yaml b/deploy/poc/kustomization.yaml similarity index 88% rename from deploy/kustomization.yaml rename to deploy/poc/kustomization.yaml index cf74e6ffa..2726a9220 100644 --- a/deploy/kustomization.yaml +++ b/deploy/poc/kustomization.yaml @@ -1,7 +1,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - yaml/namespace.yaml + - yaml/ns.yaml - yaml/controller.yaml - yaml/trigger.yaml - yaml/gateway.yaml diff --git a/deploy/poc/poc.yaml b/deploy/poc/poc.yaml new file mode 100644 index 000000000..2e4190a9e --- /dev/null +++ b/deploy/poc/poc.yaml @@ -0,0 +1,544 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: vanus +--- +apiVersion: v1 +data: + controller.yaml: |- + node_id: ${NODE_ID} + name: ${POD_NAME} + ip: ${POD_IP} + port: 2048 + etcd: + - vanus-controller-0.vanus-controller:2379 + - vanus-controller-1.vanus-controller:2379 + - vanus-controller-2.vanus-controller:2379 + data_dir: /data + segment_capacity: 268435456 + replicas: 3 + metadata: + key_prefix: /vanus + topology: + vanus-controller-0: vanus-controller-0.vanus-controller.vanus.svc:2048 + vanus-controller-1: vanus-controller-1.vanus-controller.vanus.svc:2048 + vanus-controller-2: vanus-controller-2.vanus-controller.vanus.svc:2048 + embed_etcd: + # relative path to ${data_dir} above + data_dir: etcd/data + listen_client_addr: 0.0.0.0:2379 + listen_peer_addr: 0.0.0.0:2380 + advertise_client_addr: ${POD_NAME}.vanus-controller:2379 + advertise_peer_addr: ${POD_NAME}.vanus-controller:2380 + clusters: + - vanus-controller-0=http://vanus-controller-0.vanus-controller:2380 + - vanus-controller-1=http://vanus-controller-1.vanus-controller:2380 + - vanus-controller-2=http://vanus-controller-2.vanus-controller:2380 + observability: + metrics: + enable: true + tracing: + enable: false +kind: ConfigMap +metadata: + name: config-controller + namespace: vanus +--- +apiVersion: v1 +data: + gateway.yaml: |- + port: 8080 + controllers: + - vanus-controller-0.vanus-controller:2048 + - vanus-controller-1.vanus-controller:2048 + - vanus-controller-2.vanus-controller:2048 + observability: + metrics: + enable: true + tracing: + enable: false +kind: ConfigMap +metadata: + name: config-gateway + namespace: vanus +--- +apiVersion: v1 +data: + store.yaml: |- + port: 11811 + ip: ${POD_IP} + controllers: + - vanus-controller-0.vanus-controller:2048 + - vanus-controller-1.vanus-controller:2048 + - vanus-controller-2.vanus-controller:2048 + volume: + id: ${VOLUME_ID} + dir: /data + capacity: 1073741824 + meta_store: + wal: + io: + engine: psync + offset_store: + wal: + io: + engine: psync + raft: + wal: + block_size: 16384 + io: + engine: psync + parallel: 16 + vsb: + flush_batch_size: 16384 + io: + engine: psync + parallel: 16 + observability: + metrics: + enable: true + tracing: + enable: false +kind: ConfigMap +metadata: + name: config-store + namespace: vanus +--- +apiVersion: v1 +data: + timer.yaml: |- + name: "timer" + ip: ${POD_IP} + etcd: + - vanus-controller-0.vanus-controller:2379 + - vanus-controller-1.vanus-controller:2379 + - vanus-controller-2.vanus-controller:2379 + metadata: + key_prefix: "/vanus" + leaderelection: + lease_duration: 15 + timingwheel: + tick: 1 + wheel_size: 32 + layers: 4 + controllers: + - vanus-controller-0.vanus-controller.vanus.svc:2048 + - vanus-controller-1.vanus-controller.vanus.svc:2048 + - vanus-controller-2.vanus-controller.vanus.svc:2048 + observability: + metrics: + enable: true + tracing: + enable: false +kind: ConfigMap +metadata: + name: config-timer + namespace: vanus +--- +apiVersion: v1 +data: + trigger.yaml: |- + port: 2148 + ip : ${POD_IP} + send_event_goroutine_size: 1000 + send_event_batch_size: 32 + pull_event_batch_size: 32 + max_uack_event_number: 10000 + controllers: + - vanus-controller-0.vanus-controller.vanus.svc:2048 + - vanus-controller-1.vanus-controller.vanus.svc:2048 + - vanus-controller-2.vanus-controller.vanus.svc:2048 + observability: + metrics: + enable: true + tracing: + enable: false +kind: ConfigMap +metadata: + name: config-trigger + namespace: vanus +--- +apiVersion: v1 +kind: Service +metadata: + name: vanus-controller + namespace: vanus +spec: + clusterIP: None + ports: + - name: vanus-controller + port: 2048 + selector: + app: vanus-controller +--- +apiVersion: v1 +kind: Service +metadata: + name: vanus-gateway + namespace: vanus +spec: + ports: + - name: proxy + port: 8080 + targetPort: 8080 + - name: cloudevents + port: 8081 + targetPort: 8081 + selector: + app: vanus-gateway + type: NodePort +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: vanus-gateway + name: vanus-gateway + namespace: vanus +spec: + replicas: 1 + selector: + matchLabels: + app: vanus-gateway + template: + metadata: + annotations: + prometheus.io/scrape: "true" + labels: + app: vanus-gateway + spec: + containers: + - image: public.ecr.aws/vanus/gateway:6b23e5a + imagePullPolicy: IfNotPresent + name: gateway + ports: + - containerPort: 8080 + name: proxy + - containerPort: 8081 + name: cloudevents + volumeMounts: + - mountPath: /vanus/config + name: config-gateway + - args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + image: prom/node-exporter + name: node-exporter + ports: + - containerPort: 9100 + name: metrics + protocol: TCP + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + volumes: + - configMap: + name: config-gateway + name: config-gateway +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: vanus-timer + name: vanus-timer + namespace: vanus +spec: + replicas: 1 + selector: + matchLabels: + app: vanus-timer + template: + metadata: + annotations: + prometheus.io/scrape: "true" + labels: + app: vanus-timer + spec: + containers: + - env: + - name: VANUS_LOG_LEVEL + value: DEBUG + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/timer:6b23e5a + imagePullPolicy: IfNotPresent + name: timer + ports: + - containerPort: 2112 + name: metrics + protocol: TCP + volumeMounts: + - mountPath: /vanus/config + name: config-timer + - args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + image: prom/node-exporter + name: node-exporter + ports: + - containerPort: 9100 + name: metrics + protocol: TCP + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + volumes: + - configMap: + name: config-timer + name: config-timer +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: vanus-trigger + name: vanus-trigger + namespace: vanus +spec: + replicas: 1 + selector: + matchLabels: + app: vanus-trigger + template: + metadata: + annotations: + prometheus.io/scrape: "true" + labels: + app: vanus-trigger + spec: + containers: + - env: + - name: VANUS_LOG_LEVEL + value: INFO + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/trigger:6b23e5a + imagePullPolicy: IfNotPresent + name: trigger + ports: + - containerPort: 2148 + name: grpc + - containerPort: 2112 + name: metrics + protocol: TCP + volumeMounts: + - mountPath: /vanus/config + name: config-trigger + - args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + image: prom/node-exporter + name: node-exporter + ports: + - containerPort: 9100 + name: metrics + protocol: TCP + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + initContainers: + - command: + - /bin/sh + - -c + - sysctl -w net.ipv4.tcp_tw_reuse=1 && sysctl -w net.ipv4.tcp_fin_timeout=10 + && sysctl -w net.ipv4.ip_local_port_range='4096 65000' && sysctl -p + image: busybox + name: set-system-parameters + securityContext: + capabilities: {} + privileged: true + volumes: + - configMap: + name: config-trigger + name: config-trigger +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app: vanus-controller + name: vanus-controller + namespace: vanus +spec: + replicas: 3 + selector: + matchLabels: + app: vanus-controller + serviceName: vanus-controller + template: + metadata: + annotations: + prometheus.io/scrape: "true" + labels: + app: vanus-controller + spec: + containers: + - command: + - /bin/sh + - -c + - NODE_ID=${HOSTNAME##*-} /vanus/bin/controller + env: + - name: VANUS_LOG_LEVEL + value: DEBUG + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/controller:6b23e5a + imagePullPolicy: IfNotPresent + name: controller + ports: + - containerPort: 2048 + name: grpc + - containerPort: 2379 + name: etcd-client + - containerPort: 2380 + name: etcd-peer + - containerPort: 2112 + name: metrics + protocol: TCP + volumeMounts: + - mountPath: /vanus/config + name: config-controller + - mountPath: /data + name: data + - args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + image: prom/node-exporter + name: node-exporter + ports: + - containerPort: 9100 + name: metrics + protocol: TCP + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + volumes: + - configMap: + name: config-controller + name: config-controller + volumeClaimTemplates: + - metadata: + labels: + app: vanus-controller + name: data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 20Gi +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app: vanus-store + name: vanus-store + namespace: vanus +spec: + replicas: 3 + selector: + matchLabels: + app: vanus-store + serviceName: vanus-store + template: + metadata: + annotations: + prometheus.io/scrape: "true" + labels: + app: vanus-store + spec: + containers: + - command: + - /bin/sh + - -c + - VOLUME_ID=${HOSTNAME##*-} /vanus/bin/store + env: + - name: VANUS_LOG_LEVEL + value: INFO + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/store:6b23e5a + imagePullPolicy: IfNotPresent + name: store + ports: + - containerPort: 11811 + name: grpc + - containerPort: 2112 + name: metrics + protocol: TCP + volumeMounts: + - mountPath: /vanus/config + name: config-store + - mountPath: /data + name: data + - args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + image: prom/node-exporter + name: node-exporter + ports: + - containerPort: 9100 + name: metrics + protocol: TCP + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + volumes: + - configMap: + name: config-store + name: config-store + volumeClaimTemplates: + - metadata: + labels: + app: vanus-store + name: data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 50Gi diff --git a/test/infra/aws-eks/controller.yml b/deploy/poc/yaml/controller.yaml similarity index 81% rename from test/infra/aws-eks/controller.yml rename to deploy/poc/yaml/controller.yaml index 72c3872ed..ca044802f 100644 --- a/test/infra/aws-eks/controller.yml +++ b/deploy/poc/yaml/controller.yaml @@ -33,6 +33,11 @@ data: - vanus-controller-0=http://vanus-controller-0.vanus-controller:2380 - vanus-controller-1=http://vanus-controller-1.vanus-controller:2380 - vanus-controller-2=http://vanus-controller-2.vanus-controller:2380 + observability: + metrics: + enable: true + tracing: + enable: false --- apiVersion: v1 kind: Service @@ -63,12 +68,10 @@ spec: template: metadata: annotations: - vanus.dev/metrics.port: "2112" + prometheus.io/scrape: 'true' labels: app: vanus-controller spec: - nodeSelector: - type: storage containers: - command: - /bin/sh @@ -88,13 +91,6 @@ spec: image: public.ecr.aws/vanus/controller:6b23e5a imagePullPolicy: IfNotPresent name: controller - resources: - limits: - cpu: 1000m - memory: 4000Mi - requests: - cpu: 1000m - memory: 4000Mi ports: - containerPort: 2048 name: grpc @@ -103,12 +99,31 @@ spec: - containerPort: 2380 name: etcd-peer - containerPort: 2112 + protocol: TCP name: metrics volumeMounts: - mountPath: /vanus/config name: config-controller - mountPath: /data name: data + - name: node-exporter + image: prom/node-exporter + args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + ports: + - containerPort: 9100 + protocol: TCP + name: metrics + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi volumes: - configMap: name: config-controller @@ -121,7 +136,6 @@ spec: spec: accessModes: - ReadWriteOnce - storageClassName: gp3 resources: requests: storage: 20Gi \ No newline at end of file diff --git a/deploy/poc/yaml/gateway.yaml b/deploy/poc/yaml/gateway.yaml new file mode 100644 index 000000000..db2f487f1 --- /dev/null +++ b/deploy/poc/yaml/gateway.yaml @@ -0,0 +1,91 @@ +kind: ConfigMap +metadata: + name: config-gateway + namespace: vanus +apiVersion: v1 +data: + gateway.yaml: |- + port: 8080 + controllers: + - vanus-controller-0.vanus-controller:2048 + - vanus-controller-1.vanus-controller:2048 + - vanus-controller-2.vanus-controller:2048 + observability: + metrics: + enable: true + tracing: + enable: false +--- +apiVersion: v1 +kind: Service +metadata: + name: vanus-gateway + namespace: vanus +spec: + ports: + - name: proxy + targetPort: 8080 + port: 8080 + - name: cloudevents + targetPort: 8081 + port: 8081 + selector: + app: vanus-gateway + type: NodePort +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: vanus-gateway + name: vanus-gateway + namespace: vanus +spec: + replicas: 1 + selector: + matchLabels: + app: vanus-gateway + template: + metadata: + annotations: + prometheus.io/scrape: 'true' + labels: + app: vanus-gateway + spec: + containers: + - image: public.ecr.aws/vanus/gateway:6b23e5a + imagePullPolicy: IfNotPresent + name: gateway + ports: + - containerPort: 8080 + name: proxy + - containerPort: 8081 + name: cloudevents +# - containerPort: 2112 +# protocol: TCP +# name: metrics + volumeMounts: + - mountPath: /vanus/config + name: config-gateway + - name: node-exporter + image: prom/node-exporter + args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + ports: + - containerPort: 9100 + protocol: TCP + name: metrics + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + volumes: + - configMap: + name: config-gateway + name: config-gateway \ No newline at end of file diff --git a/deploy/poc/yaml/ns.yaml b/deploy/poc/yaml/ns.yaml new file mode 100644 index 000000000..b4fe73b27 --- /dev/null +++ b/deploy/poc/yaml/ns.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: vanus \ No newline at end of file diff --git a/deploy/poc/yaml/store.yaml b/deploy/poc/yaml/store.yaml new file mode 100644 index 000000000..d1b29171d --- /dev/null +++ b/deploy/poc/yaml/store.yaml @@ -0,0 +1,121 @@ +kind: ConfigMap +metadata: + name: config-store + namespace: vanus +apiVersion: v1 +data: + store.yaml: |- + port: 11811 + ip: ${POD_IP} + controllers: + - vanus-controller-0.vanus-controller:2048 + - vanus-controller-1.vanus-controller:2048 + - vanus-controller-2.vanus-controller:2048 + volume: + id: ${VOLUME_ID} + dir: /data + capacity: 1073741824 + meta_store: + wal: + io: + engine: psync + offset_store: + wal: + io: + engine: psync + raft: + wal: + block_size: 16384 + io: + engine: psync + parallel: 16 + vsb: + flush_batch_size: 16384 + io: + engine: psync + parallel: 16 + observability: + metrics: + enable: true + tracing: + enable: false +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + labels: + app: vanus-store + name: vanus-store + namespace: vanus +spec: + replicas: 3 + selector: + matchLabels: + app: vanus-store + serviceName: vanus-store + template: + metadata: + annotations: + prometheus.io/scrape: 'true' + labels: + app: vanus-store + spec: + containers: + - command: + - /bin/sh + - -c + - VOLUME_ID=${HOSTNAME##*-} /vanus/bin/store + env: + - name: VANUS_LOG_LEVEL + value: INFO + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/store:6b23e5a + imagePullPolicy: IfNotPresent + name: store + ports: + - containerPort: 11811 + name: grpc + - containerPort: 2112 + protocol: TCP + name: metrics + volumeMounts: + - mountPath: /vanus/config + name: config-store + - mountPath: /data + name: data + - name: node-exporter + image: prom/node-exporter + args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + ports: + - containerPort: 9100 + protocol: TCP + name: metrics + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + volumes: + - configMap: + name: config-store + name: config-store + volumeClaimTemplates: + - metadata: + labels: + app: vanus-store + name: data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 50Gi \ No newline at end of file diff --git a/deploy/poc/yaml/timer.yaml b/deploy/poc/yaml/timer.yaml new file mode 100644 index 000000000..7856a6b8e --- /dev/null +++ b/deploy/poc/yaml/timer.yaml @@ -0,0 +1,90 @@ +apiVersion: v1 +data: + timer.yaml: |- + name: "timer" + ip: ${POD_IP} + etcd: + - vanus-controller-0.vanus-controller:2379 + - vanus-controller-1.vanus-controller:2379 + - vanus-controller-2.vanus-controller:2379 + metadata: + key_prefix: "/vanus" + leaderelection: + lease_duration: 15 + timingwheel: + tick: 1 + wheel_size: 32 + layers: 4 + controllers: + - vanus-controller-0.vanus-controller.vanus.svc:2048 + - vanus-controller-1.vanus-controller.vanus.svc:2048 + - vanus-controller-2.vanus-controller.vanus.svc:2048 + observability: + metrics: + enable: true + tracing: + enable: false +kind: ConfigMap +metadata: + name: config-timer + namespace: vanus +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: vanus-timer + name: vanus-timer + namespace: vanus +spec: + replicas: 1 + selector: + matchLabels: + app: vanus-timer + template: + metadata: + annotations: + prometheus.io/scrape: 'true' + labels: + app: vanus-timer + spec: + containers: + - env: + - name: VANUS_LOG_LEVEL + value: DEBUG + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/timer:6b23e5a + imagePullPolicy: IfNotPresent + name: timer + volumeMounts: + - mountPath: /vanus/config + name: config-timer + ports: + - containerPort: 2112 + protocol: TCP + name: metrics + - name: node-exporter + image: prom/node-exporter + args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + ports: + - containerPort: 9100 + protocol: TCP + name: metrics + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + volumes: + - configMap: + name: config-timer + name: config-timer \ No newline at end of file diff --git a/deploy/poc/yaml/trigger.yaml b/deploy/poc/yaml/trigger.yaml new file mode 100644 index 000000000..3842161a7 --- /dev/null +++ b/deploy/poc/yaml/trigger.yaml @@ -0,0 +1,91 @@ +apiVersion: v1 +data: + trigger.yaml: |- + port: 2148 + ip : ${POD_IP} + send_event_goroutine_size: 1000 + send_event_batch_size: 32 + pull_event_batch_size: 32 + max_uack_event_number: 10000 + controllers: + - vanus-controller-0.vanus-controller.vanus.svc:2048 + - vanus-controller-1.vanus-controller.vanus.svc:2048 + - vanus-controller-2.vanus-controller.vanus.svc:2048 + observability: + metrics: + enable: true + tracing: + enable: false +kind: ConfigMap +metadata: + name: config-trigger + namespace: vanus +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: vanus-trigger + name: vanus-trigger + namespace: vanus +spec: + replicas: 1 + selector: + matchLabels: + app: vanus-trigger + template: + metadata: + annotations: + prometheus.io/scrape: 'true' + labels: + app: vanus-trigger + spec: + initContainers: + - name: set-system-parameters + image: busybox + securityContext: + capabilities: { } + privileged: true + command: ["/bin/sh", "-c", "sysctl -w net.ipv4.tcp_tw_reuse=1 && sysctl -w net.ipv4.tcp_fin_timeout=10 && sysctl -w net.ipv4.ip_local_port_range='4096 65000' && sysctl -p"] + containers: + - env: + - name: VANUS_LOG_LEVEL + value: INFO + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + image: public.ecr.aws/vanus/trigger:6b23e5a + imagePullPolicy: IfNotPresent + name: trigger + ports: + - containerPort: 2148 + name: grpc + - containerPort: 2112 + protocol: TCP + name: metrics + volumeMounts: + - mountPath: /vanus/config + name: config-trigger + - name: node-exporter + image: prom/node-exporter + args: + - --no-collector.wifi + - --no-collector.hwmon + - --collector.filesystem.ignored-mount-points=^/(dev|proc|sys|var/lib/docker/.+|var/lib/kubelet/pods/.+)($|/) + - --collector.netclass.ignored-devices=^(veth.*)$ + ports: + - containerPort: 9100 + protocol: TCP + name: metrics + resources: + limits: + cpu: 250m + memory: 180Mi + requests: + cpu: 102m + memory: 180Mi + volumes: + - configMap: + name: config-trigger + name: config-trigger \ No newline at end of file diff --git a/deploy/all-in-one.cn.yaml b/deploy/vanus.cn.yaml similarity index 100% rename from deploy/all-in-one.cn.yaml rename to deploy/vanus.cn.yaml diff --git a/deploy/all-in-one.yaml b/deploy/vanus.yaml similarity index 100% rename from deploy/all-in-one.yaml rename to deploy/vanus.yaml diff --git a/observability/go.sum b/observability/go.sum index ea864381d..2968e51fd 100644 --- a/observability/go.sum +++ b/observability/go.sum @@ -45,6 +45,7 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -189,11 +190,13 @@ github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= +github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= @@ -232,13 +235,20 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= +go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 h1:htgM8vZIF8oPSCxa341e3IZ4yr/sKxgu8KZYllByiVY= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2/go.mod h1:rqbht/LlhVBgn5+k3M5QK96K5Xb0DvXpMJ5SFQpY6uw= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 h1:fqR1kli93643au1RKo0Uma3d2aPQKT+WBKfTSBaKbOc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2/go.mod h1:5Qn6qvgkMsLDX+sYK64rHb1FPhpn0UtxF+ouX1uhyJE= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 h1:ERwKPn9Aer7Gxsc0+ZlutlH1bEEAUXAUhqm3Y45ABbk= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2/go.mod h1:jWZUM2MWhWCJ9J9xVbRx7tzK1mXKpAlze4CeulycwVY= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= +go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= +go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= +go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -309,6 +319,7 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b h1:tvrvnPFcdzp294diPnrdZZZ8XUt2Tyj7svb7X52iDuU= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -368,6 +379,7 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -379,6 +391,7 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -480,6 +493,7 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c h1:QgY/XxIAIeccR+Ca/rDdKubLIU9rcJ3xfy1DC/Wd2Oo= +google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c/go.mod h1:CGI5F/G+E5bKwmfYo09AXuVN4dD894kIKUFmVbP2/Fo= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -497,6 +511,7 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/observability/metrics/config.go b/observability/metrics/config.go new file mode 100644 index 000000000..9043ea44c --- /dev/null +++ b/observability/metrics/config.go @@ -0,0 +1,13 @@ +package metrics + +type Config struct { + Enable bool `yaml:"enable"` + Port int `yaml:"port"` +} + +func (c Config) GetPort() int { + if c.Port == 0 { + return 2112 + } + return c.Port +} diff --git a/observability/metrics/metrics.go b/observability/metrics/metrics.go index cc165806d..75b4ded86 100644 --- a/observability/metrics/metrics.go +++ b/observability/metrics/metrics.go @@ -16,201 +16,116 @@ package metrics import ( "context" - "sync" - + "fmt" + "github.com/linkall-labs/vanus/observability/log" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/collectors" - "go.opentelemetry.io/otel/attribute" + "github.com/prometheus/client_golang/prometheus/promhttp" + "net/http" + "regexp" ) const ( namespace = "vanus" ) -func RegisterControllerMetrics() { - registerGoRuntimeMetrics() - prometheus.MustRegister(EventbusGauge) - prometheus.MustRegister(EventlogGaugeVec) - prometheus.MustRegister(SegmentGaugeVec) - prometheus.MustRegister(SegmentCreationRuntimeCounterVec) - prometheus.MustRegister(SegmentDeletedCounterVec) - prometheus.MustRegister(SubscriptionGauge) - prometheus.MustRegister(SubscriptionTransformerGauge) - prometheus.MustRegister(CtrlTriggerGauge) -} - -func RegisterTriggerMetrics() { - registerGoRuntimeMetrics() - prometheus.MustRegister(TriggerGauge) - prometheus.MustRegister(TriggerPullEventCounter) - prometheus.MustRegister(TriggerFilterCostSecond) - prometheus.MustRegister(TriggerTransformCostSecond) - prometheus.MustRegister(TriggerFilterMatchEventCounter) - prometheus.MustRegister(TriggerFilterMatchRetryEventCounter) - prometheus.MustRegister(TriggerRetryEventCounter) - prometheus.MustRegister(TriggerRetryEventAppendSecond) - prometheus.MustRegister(TriggerDeadLetterEventCounter) - prometheus.MustRegister(TriggerDeadLetterEventAppendSecond) - prometheus.MustRegister(TriggerPushEventCounter) - prometheus.MustRegister(TriggerPushEventTime) -} - -func RegisterTimerMetrics() { - prometheus.MustRegister(TimingWheelTickGauge) - prometheus.MustRegister(TimingWheelSizeGauge) - prometheus.MustRegister(TimingWheelLayersGauge) - prometheus.MustRegister(TimerPushEventTPSCounterVec) - prometheus.MustRegister(TimerDeliverEventTPSCounterVec) - prometheus.MustRegister(TimerScheduledEventDelayTime) - prometheus.MustRegister(TimerPushEventTime) - prometheus.MustRegister(TimerDeliverEventTime) -} - -func RegisterSegmentServerMetrics() { - prometheus.MustRegister(WriteTPSCounterVec) - prometheus.MustRegister(WriteThroughputCounterVec) - prometheus.MustRegister(ReadTPSCounterVec) - prometheus.MustRegister(ReadThroughputCounterVec) -} - -func registerGoRuntimeMetrics() { - collectors.NewBuildInfoCollector() - collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}) - collectors.NewGoCollector(collectors.WithGoCollections(collectors.GoRuntimeMetricsCollection)) -} - -type Config struct { - ModuleName string -} - -var mCfg Config - -func Init(cfg Config) { - mCfg = cfg -} - -type unit string - -const ( - UnitMillisecond = unit("ms") - UnitByte = unit("byte") - UnitDimensionless = unit("1") -) - -var ( - metricCreateMutex = sync.Mutex{} - countMap = make(map[string]ICounter, 0) - gaugeMap = make(map[string]IGauge, 0) - histogramMap = make(map[string]IHistogram, 0) - emptyCount = &promCounter{} - emptyGauge = &promGauge{} - emptyHistogram = &promHistogram{} -) - -type metricKey struct { - name string - description string - unit unit -} - -func NewMetricKey(name string, u unit, desc string) *metricKey { - return &metricKey{ - name: name, - description: desc, - unit: u, +func Init(ctx context.Context, cfg Config, getCollectors func() []prometheus.Collector) { + if !cfg.Enable { + log.Info(ctx, "metrics module has been disabled", nil) + return } -} - -type ICounter interface { - IncrInt(int64, ...attribute.KeyValue) - IncrFloat(float64, ...attribute.KeyValue) - Async(func(context.Context, ICounter)) -} - -func newCounter(k *metricKey) ICounter { - return emptyCount -} - -type IGauge interface { - IncrInt(int64, ...attribute.KeyValue) - IncrFloat(float64, ...attribute.KeyValue) - Async(func(context.Context, IGauge)) -} - -func newGauge(k *metricKey) IGauge { - return emptyGauge -} - -type IHistogram interface { - RecordInt(int64, ...attribute.KeyValue) - RecordFloat(float64, ...attribute.KeyValue) - Async(func(context.Context, IHistogram)) -} - -func newHistogram(k *metricKey) IHistogram { - return emptyHistogram -} - -func GetCounter(key *metricKey) ICounter { - if !isValidKey(key) { - return emptyCount + if getCollectors == nil { + log.Info(ctx, "metrics module has been disabled due to empty collectors", nil) + return } - v, exist := countMap[key.name] - if !exist { - metricCreateMutex.Lock() - v, exist = countMap[key.name] - if !exist { - v = newCounter(key) - countMap[key.name] = v - } - metricCreateMutex.Unlock() + colls := getCollectors() + if len(colls) == 0 { + log.Info(ctx, "metrics module has been disabled due to empty collectors", nil) + return } - return v -} -func GetGauge(key *metricKey) IGauge { - if !isValidKey(key) { - return emptyGauge - } - v, exist := gaugeMap[key.name] - if !exist { - metricCreateMutex.Lock() - v, exist = gaugeMap[key.name] - if !exist { - v = newGauge(key) - gaugeMap[key.name] = v + reg := prometheus.NewRegistry() + reg.MustRegister(colls...) + http.Handle("/metrics", promhttp.HandlerFor( + reg, + promhttp.HandlerOpts{ + EnableOpenMetrics: false, + }, + )) + go func() { + if err := http.ListenAndServe(fmt.Sprintf(":%d", cfg.GetPort()), nil); err != nil { + log.Error(context.Background(), "Metrics listen and serve failed.", map[string]interface{}{ + log.KeyError: err, + }) } - metricCreateMutex.Unlock() + }() + log.Info(context.Background(), "metrics module started", map[string]interface{}{ + "port": cfg.GetPort, + }) +} + +func GetControllerMetrics() []prometheus.Collector { + coll := []prometheus.Collector{ + EventbusGauge, + EventlogGaugeVec, + SegmentGaugeVec, + SegmentCreationRuntimeCounterVec, + SegmentDeletedCounterVec, + SubscriptionGauge, + SubscriptionTransformerGauge, + CtrlTriggerGauge, } - return v -} - -func GetHistogram(key *metricKey) IHistogram { - if !isValidKey(key) { - return emptyHistogram + return append(coll, getGoRuntimeMetrics()...) +} + +func GetTriggerMetrics() []prometheus.Collector { + coll := []prometheus.Collector{ + TriggerGauge, + TriggerPullEventCounter, + TriggerFilterCostSecond, + TriggerTransformCostSecond, + TriggerFilterMatchEventCounter, + TriggerFilterMatchRetryEventCounter, + TriggerRetryEventCounter, + TriggerRetryEventAppendSecond, + TriggerDeadLetterEventCounter, + TriggerDeadLetterEventAppendSecond, + TriggerPushEventCounter, + TriggerPushEventTime, } - v, exist := histogramMap[key.name] - if !exist { - metricCreateMutex.Lock() - v, exist = histogramMap[key.name] - if !exist { - v = newHistogram(key) - histogramMap[key.name] = v - } - metricCreateMutex.Unlock() + return append(coll, getGoRuntimeMetrics()...) +} + +func GetTimerMetrics() []prometheus.Collector { + coll := []prometheus.Collector{ + TimingWheelTickGauge, + TimingWheelSizeGauge, + TimingWheelLayersGauge, + TimerPushEventTPSCounterVec, + TimerDeliverEventTPSCounterVec, + TimerScheduledEventDelayTime, + TimerPushEventTime, + TimerDeliverEventTime, } - return v + return append(coll, getGoRuntimeMetrics()...) } -func isValidKey(k *metricKey) bool { - if k == nil { - return false - } - if k.name == "" { - return false +func GetSegmentServerMetrics() []prometheus.Collector { + coll := []prometheus.Collector{ + WriteThroughputCounterVec, + WriteTPSCounterVec, + ReadTPSCounterVec, + ReadThroughputCounterVec, } - if k.unit == "" { - return false + return append(coll, getGoRuntimeMetrics()...) +} + +func getGoRuntimeMetrics() []prometheus.Collector { + return []prometheus.Collector{ + collectors.NewBuildInfoCollector(), + collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}), + collectors.NewGoCollector(collectors.WithGoCollectorRuntimeMetrics( + collectors.GoRuntimeMetricsRule{Matcher: regexp.MustCompile("/.*")}, + )), } - return true } diff --git a/observability/metrics/otel/api.go b/observability/metrics/otel/api.go new file mode 100644 index 000000000..245a9144b --- /dev/null +++ b/observability/metrics/otel/api.go @@ -0,0 +1,147 @@ +// Copyright 2023 Linkall Inc. +// +// 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 otel + +import ( + "context" + "go.opentelemetry.io/otel/attribute" + "sync" +) + +var ( + countMap = make(map[string]ICounter, 0) + gaugeMap = make(map[string]IGauge, 0) + histogramMap = make(map[string]IHistogram, 0) + metricCreateMutex = sync.Mutex{} + emptyCount = &promCounter{} + emptyGauge = &promGauge{} + emptyHistogram = &promHistogram{} +) + +type ICounter interface { + IncrInt(int64, ...attribute.KeyValue) + IncrFloat(float64, ...attribute.KeyValue) + Async(func(context.Context, ICounter)) +} + +type unit string + +const ( + UnitMillisecond = unit("ms") + UnitByte = unit("byte") + UnitDimensionless = unit("1") +) + +type metricKey struct { + name string + description string + unit unit +} + +func NewMetricKey(name string, u unit, desc string) *metricKey { + return &metricKey{ + name: name, + description: desc, + unit: u, + } +} + +func newCounter(k *metricKey) ICounter { + return emptyCount +} + +type IGauge interface { + IncrInt(int64, ...attribute.KeyValue) + IncrFloat(float64, ...attribute.KeyValue) + Async(func(context.Context, IGauge)) +} + +func newGauge(k *metricKey) IGauge { + return emptyGauge +} + +type IHistogram interface { + RecordInt(int64, ...attribute.KeyValue) + RecordFloat(float64, ...attribute.KeyValue) + Async(func(context.Context, IHistogram)) +} + +func newHistogram(k *metricKey) IHistogram { + return emptyHistogram +} + +func GetCounter(key *metricKey) ICounter { + if !isValidKey(key) { + return emptyCount + } + v, exist := countMap[key.name] + if !exist { + metricCreateMutex.Lock() + v, exist = countMap[key.name] + if !exist { + v = newCounter(key) + countMap[key.name] = v + } + metricCreateMutex.Unlock() + } + return v +} + +func GetGauge(key *metricKey) IGauge { + if !isValidKey(key) { + return emptyGauge + } + v, exist := gaugeMap[key.name] + if !exist { + metricCreateMutex.Lock() + v, exist = gaugeMap[key.name] + if !exist { + v = newGauge(key) + gaugeMap[key.name] = v + } + metricCreateMutex.Unlock() + } + return v +} + +func GetHistogram(key *metricKey) IHistogram { + if !isValidKey(key) { + return emptyHistogram + } + v, exist := histogramMap[key.name] + if !exist { + metricCreateMutex.Lock() + v, exist = histogramMap[key.name] + if !exist { + v = newHistogram(key) + histogramMap[key.name] = v + } + metricCreateMutex.Unlock() + } + return v +} + +func isValidKey(k *metricKey) bool { + if k == nil { + return false + } + if k.name == "" { + return false + } + if k.unit == "" { + return false + } + return true +} diff --git a/observability/metrics/prometheus.go b/observability/metrics/otel/prometheus.go similarity index 98% rename from observability/metrics/prometheus.go rename to observability/metrics/otel/prometheus.go index 406d719b0..726509a56 100644 --- a/observability/metrics/prometheus.go +++ b/observability/metrics/otel/prometheus.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package metrics +package otel import ( "context" diff --git a/observability/observability.go b/observability/observability.go index 9082bd0cf..19cf4aac5 100644 --- a/observability/observability.go +++ b/observability/observability.go @@ -16,49 +16,18 @@ package observability import ( "context" - "fmt" - "net/http" - - "github.com/linkall-labs/vanus/observability/log" + "github.com/linkall-labs/vanus/observability/metrics" "github.com/linkall-labs/vanus/observability/tracing" - "github.com/prometheus/client_golang/prometheus/promhttp" + "github.com/prometheus/client_golang/prometheus" ) -func Initialize(cfg Config, metricsFunc func()) error { - if cfg.M.Enable { - if metricsFunc != nil { - metricsFunc() - } - go func() { - http.Handle("/metrics", promhttp.Handler()) - if err := http.ListenAndServe(fmt.Sprintf(":%d", cfg.M.GetPort()), nil); err != nil { - log.Error(context.Background(), "Metrics listen and serve failed.", map[string]interface{}{ - log.KeyError: err, - }) - } - }() - log.Info(context.Background(), "metrics module started", map[string]interface{}{ - "port": cfg.M.Port, - }) - } - +func Initialize(ctx context.Context, cfg Config, getCollectors func() []prometheus.Collector) error { + metrics.Init(ctx, cfg.M, getCollectors) tracing.Init(cfg.T) return nil } type Config struct { - M Metrics `yaml:"metrics"` + M metrics.Config `yaml:"metrics"` T tracing.Config `yaml:"tracing"` } - -type Metrics struct { - Enable bool `yaml:"enable"` - Port int `yaml:"port"` -} - -func (m Metrics) GetPort() int { - if m.Port == 0 { - return 2112 - } - return m.Port -} diff --git a/test/infra/aws-eks/deploy.sh b/test/infra/aws-eks/deploy.sh deleted file mode 100644 index 860432664..000000000 --- a/test/infra/aws-eks/deploy.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env sh -kubectl apply -f sc.yml -kubectl apply -f controller.yml -kubectl apply -f store.yml -kubectl apply -f trigger.yml -kubectl apply -f timer.yml diff --git a/test/infra/benchmark/benchmark.yml b/test/playbook/benchmark.yml similarity index 100% rename from test/infra/benchmark/benchmark.yml rename to test/playbook/benchmark.yml diff --git a/test/infra/producer/play.sh b/test/playbook/pubsub/play.sh similarity index 100% rename from test/infra/producer/play.sh rename to test/playbook/pubsub/play.sh diff --git a/test/infra/producer/producer.yml b/test/playbook/pubsub/producer.yml similarity index 100% rename from test/infra/producer/producer.yml rename to test/playbook/pubsub/producer.yml From 29f5430d650258149991a2624ab8afa2d8e45859 Mon Sep 17 00:00:00 2001 From: Jeffrey Whewhetu <106184818+c0d33ngr@users.noreply.github.com> Date: Wed, 11 Jan 2023 14:09:38 +0100 Subject: [PATCH 41/46] feat: add function replace_between_positions (#406) * implement the function replace_between_positions * Update code to be more robust with checks and test cases * fix errors in code * fix tests in replace-between-positions * Fix bug * fix: fix code error --- .../strings/replace_between_positions.go | 32 ++++++++ .../strings/replace_between_positions_test.go | 81 +++++++++++++++++++ internal/primitive/transform/common/cast.go | 2 + .../transform/function/strings_functions.go | 22 +++++ internal/primitive/transform/runtime/init.go | 1 + 5 files changed, 138 insertions(+) create mode 100644 internal/primitive/transform/action/strings/replace_between_positions.go create mode 100644 internal/primitive/transform/action/strings/replace_between_positions_test.go diff --git a/internal/primitive/transform/action/strings/replace_between_positions.go b/internal/primitive/transform/action/strings/replace_between_positions.go new file mode 100644 index 000000000..892227c39 --- /dev/null +++ b/internal/primitive/transform/action/strings/replace_between_positions.go @@ -0,0 +1,32 @@ +// Copyright 2023 Linkall Inc. +// +// 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 strings + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/function" +) + +// NewReplaceBetweenPositionsAction ["path","startPosition","endPosition","targetValue"]. +func NewReplaceBetweenPositionsAction() action.Action { + a := &action.SourceTargetSameAction{} + a.CommonAction = action.CommonAction{ + ActionName: "REPLACE_BETWEEN_POSITIONS", + FixedArgs: []arg.TypeList{arg.EventList, arg.All, arg.All, arg.All}, + Fn: function.ReplaceBetweenPositionsFunction, + } + return a +} diff --git a/internal/primitive/transform/action/strings/replace_between_positions_test.go b/internal/primitive/transform/action/strings/replace_between_positions_test.go new file mode 100644 index 000000000..b6faf0f64 --- /dev/null +++ b/internal/primitive/transform/action/strings/replace_between_positions_test.go @@ -0,0 +1,81 @@ +// Copyright 2023 Linkall Inc. +// +// 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 strings_test + +import ( + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/strings" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestReplaceBetweenPositionsAction(t *testing.T) { + funcName := strings.NewReplaceBetweenPositionsAction().Name() + + Convey("test Positive testcase", t, func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", 7, 12, "Vanus"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "Hello, World!") + ceCtx := &context.EventContext{ + Event: &e, + } + err = a.Execute(ceCtx) + So(err, ShouldBeNil) + So(e.Extensions()["test"], ShouldEqual, "Hello, Vanus!") + }) + + Convey("test Negative testcase: startPosition greater than string length", t, func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", 100, 8, "Dan"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "Start position must be less than the length of the string") + ceCtx := &context.EventContext{ + Event: &e, + } + err = a.Execute(ceCtx) + So(err, ShouldNotBeNil) + So(e.Extensions()["test"], ShouldEqual, "Start position must be less than the length of the string") + }) + + Convey("test Negative testcase: endPosition greater than string length", t, func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", 8, 60, "free to use"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "End position must be less than the length of the string") + ceCtx := &context.EventContext{ + Event: &e, + } + err = a.Execute(ceCtx) + So(err, ShouldNotBeNil) + So(e.Extensions()["test"], ShouldEqual, "End position must be less than the length of the string") + }) + + Convey("test Negative testcase: startPosition greater than endPosition", t, func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.test", 12, 5, "Python"}) + So(err, ShouldBeNil) + e := cetest.MinEvent() + e.SetExtension("test", "Start position must be less than end position") + ceCtx := &context.EventContext{ + Event: &e, + } + err = a.Execute(ceCtx) + So(err, ShouldNotBeNil) + So(e.Extensions()["test"], ShouldEqual, "Start position must be less than end position") + }) +} diff --git a/internal/primitive/transform/common/cast.go b/internal/primitive/transform/common/cast.go index 89f1b0973..7218e8395 100644 --- a/internal/primitive/transform/common/cast.go +++ b/internal/primitive/transform/common/cast.go @@ -50,6 +50,8 @@ func Cast(val interface{}, target Type) (interface{}, error) { return float64(value), nil case int64: return float64(value), nil + case int: + return float64(value), nil } return 0, fmt.Errorf("undefined cast from %v to %v", TypeFromVal(val), target) case Bool: diff --git a/internal/primitive/transform/function/strings_functions.go b/internal/primitive/transform/function/strings_functions.go index 590430980..386a42db6 100644 --- a/internal/primitive/transform/function/strings_functions.go +++ b/internal/primitive/transform/function/strings_functions.go @@ -15,6 +15,7 @@ package function import ( + "fmt" "strings" "github.com/linkall-labs/vanus/internal/primitive/transform/common" @@ -81,3 +82,24 @@ var SplitWithSepFunction = function{ return strings.SplitN(s, sep, int(args[2].(float64))), nil }, } + +var ReplaceBetweenPositionsFunction = function{ + name: "REPLACE_BETWEEN_POSITIONS", + fixedArgs: []common.Type{common.String, common.Number, common.Number, common.String}, + fn: func(args []interface{}) (interface{}, error) { + path, _ := args[0].(string) + startPosition := int(args[1].(float64)) + endPosition := int(args[2].(float64)) + targetValue, _ := args[3].(string) + if startPosition >= len(path) { + return nil, fmt.Errorf("start position must be less than the length of the string") + } + if endPosition >= len(path) { + return nil, fmt.Errorf("end position must be less than the length of the string") + } + if startPosition >= endPosition { + return nil, fmt.Errorf("start position must be less than end position") + } + return path[:startPosition] + targetValue + path[endPosition:], nil + }, +} diff --git a/internal/primitive/transform/runtime/init.go b/internal/primitive/transform/runtime/init.go index 48987e5b8..27bf52286 100644 --- a/internal/primitive/transform/runtime/init.go +++ b/internal/primitive/transform/runtime/init.go @@ -50,6 +50,7 @@ func init() { strings.NewAddSuffixAction, strings.NewReplaceWithRegexAction, strings.NewReplaceStringAction, + strings.NewReplaceBetweenPositionsAction, // condition condition.NewConditionIfAction, // render From 6eea51a7968fcadaa85166daf802e54b1b569f3a Mon Sep 17 00:00:00 2001 From: delu Date: Fri, 13 Jan 2023 14:07:02 +0800 Subject: [PATCH 42/46] feat: vsctl add subscription update command (#402) * feat: vsctl add subscription update command Signed-off-by: xdlbdy * feat: vsctl add subscription update command Signed-off-by: xdlbdy Signed-off-by: xdlbdy --- internal/controller/trigger/metadata/info.go | 4 + vsctl/command/flag.go | 5 +- vsctl/command/subscription.go | 368 +++++++++++++------ 3 files changed, 258 insertions(+), 119 deletions(-) diff --git a/internal/controller/trigger/metadata/info.go b/internal/controller/trigger/metadata/info.go index cf8fed938..e0a6bd104 100644 --- a/internal/controller/trigger/metadata/info.go +++ b/internal/controller/trigger/metadata/info.go @@ -94,6 +94,10 @@ func (s *Subscription) Update(update *Subscription) bool { change = true s.Source = update.Source } + if s.Name != update.Name { + change = true + s.Name = update.Name + } if s.Description != update.Description { change = true s.Description = update.Description diff --git a/vsctl/command/flag.go b/vsctl/command/flag.go index eaef4c524..685f39418 100644 --- a/vsctl/command/flag.go +++ b/vsctl/command/flag.go @@ -35,11 +35,10 @@ var ( eventbus string eventlogID uint64 eventlogNum int32 - source string sink string filters string transformer string - rateLimit uint32 + rateLimit int32 from string subscriptionIDStr string description string @@ -50,7 +49,7 @@ var ( subProtocol string sinkCredentialType string sinkCredential string - deliveryTimeout uint32 + deliveryTimeout int32 maxRetryAttempts int32 offsetTimestamp uint64 diff --git a/vsctl/command/subscription.go b/vsctl/command/subscription.go index ed63d6102..5b78e4e71 100644 --- a/vsctl/command/subscription.go +++ b/vsctl/command/subscription.go @@ -20,6 +20,7 @@ import ( "fmt" "io/ioutil" "os" + "reflect" "time" "github.com/aws/aws-sdk-go-v2/aws/arn" @@ -48,6 +49,7 @@ func NewSubscriptionCommand() *cobra.Command { }, } cmd.AddCommand(createSubscriptionCommand()) + cmd.AddCommand(updateSubscriptionCommand()) cmd.AddCommand(deleteSubscriptionCommand()) cmd.AddCommand(disableSubscriptionCommand()) cmd.AddCommand(resumeSubscriptionCommand()) @@ -68,128 +70,22 @@ func createSubscriptionCommand() *cobra.Command { if sink == "" { cmdFailedWithHelpNotice(cmd, "sink name can't be empty\n") } - - var p meta.Protocol - switch subProtocol { - case "http", "": - p = meta.Protocol_HTTP - case "aws-lambda": - p = meta.Protocol_AWS_LAMBDA - if _, err := arn.Parse(sink); err != nil { - cmdFailedf(cmd, "protocol is aws-lambda sink is aws arn, arn parse error: %s\n", err.Error()) - } - if sinkCredentialType != AWSCredentialType { - cmdFailedf(cmd, "protocol is aws-lambda, credential-type must be %s\n", AWSCredentialType) - } - case "gcloud-functions": - p = meta.Protocol_GCLOUD_FUNCTIONS - if sinkCredentialType != GCloudCredentialType { - cmdFailedf(cmd, "protocol is aws-lambda, credential-type must be %s\n", GCloudCredentialType) - } - case "grpc": - p = meta.Protocol_GRPC - default: - cmdFailedf(cmd, "protocol is invalid\n") - } - - var credential *meta.SinkCredential - if sinkCredentialType != "" { - if sinkCredential == "" { - cmdFailedf(cmd, "credential-type is set but sinkCredential empty\n") - } - if sinkCredential[0] == '@' { - credentialBytes, err := ioutil.ReadFile(sinkCredential[1:]) - if err != nil { - cmdFailedf(cmd, "read sinkCredential file:%s error:%s\n", sinkCredential, err.Error()) - } - sinkCredential = string(credentialBytes) - fmt.Println(sinkCredential) - } - // expand value from env - sinkCredential = os.ExpandEnv(sinkCredential) - switch sinkCredentialType { - case AWSCredentialType: - var akSK *meta.AKSKCredential - err := json.Unmarshal([]byte(sinkCredential), &akSK) - if err != nil { - cmdFailedf(cmd, "the sink credential unmarshal json error: %s", err.Error()) - } - if akSK.AccessKeyId == "" || akSK.SecretAccessKey == "" { - cmdFailedf(cmd, "credential-type is aws, access_key_id and secret_access_key must not be empty\n") - } - credential = &meta.SinkCredential{ - CredentialType: meta.SinkCredential_AWS, - Credential: &meta.SinkCredential_Aws{ - Aws: akSK, - }, - } - case GCloudCredentialType: - var m map[string]string - err := json.Unmarshal([]byte(sinkCredential), &m) - if err != nil { - cmdFailedf(cmd, "the sink credential unmarshal json error: %s", err.Error()) - } - credential = &meta.SinkCredential{ - CredentialType: meta.SinkCredential_GCLOUD, - Credential: &meta.SinkCredential_Gcloud{ - Gcloud: &meta.GCloudCredential{ - CredentialsJson: sinkCredential, - }, - }, - } - default: - cmdFailedf(cmd, "credential-type is invalid\n") - } - } - - var filter []*meta.Filter - if filters != "" { - err := json.Unmarshal([]byte(filters), &filter) - if err != nil { - cmdFailedf(cmd, "the filter invalid: %s", err) - } + if subscriptionName == "" { + cmdFailedWithHelpNotice(cmd, "subscription name can't be empty\n") } - var trans *meta.Transformer - if transformer != "" { - var _transformer *primitive.Transformer - err := json.Unmarshal([]byte(transformer), &_transformer) - if err != nil { - cmdFailedf(cmd, "the transformer invalid: %s", err) - } - trans = convert.ToPbTransformer(_transformer) - } + p := getProtocol(cmd) + credential := getSinkCredential(cmd) + filter := getFilters(cmd) + trans := getTransformer(cmd) // subscription config config := &meta.SubscriptionConfig{ - RateLimit: rateLimit, - DeliveryTimeout: deliveryTimeout, - OrderedEvent: orderedPushEvent, - } - if maxRetryAttempts >= 0 { - value := uint32(maxRetryAttempts) - config.MaxRetryAttempts = &value - } - if from != "" { - switch from { - case "latest": - config.OffsetType = meta.SubscriptionConfig_LATEST - case "earliest": - config.OffsetType = meta.SubscriptionConfig_EARLIEST - default: - t, err := time.Parse(time.RFC3339, from) - if err != nil { - cmdFailedf(cmd, "consumer from time format is invalid: %s", err) - } - ts := uint64(t.Unix()) - config.OffsetTimestamp = &ts - config.OffsetType = meta.SubscriptionConfig_TIMESTAMP - } + OrderedEvent: orderedPushEvent, } - + getSubscriptionConfig(cmd, config) res, err := client.CreateSubscription(context.Background(), &ctrlpb.CreateSubscriptionRequest{ Subscription: &ctrlpb.SubscriptionRequest{ - Source: source, Config: config, Filters: filter, Sink: sink, @@ -212,12 +108,12 @@ func createSubscriptionCommand() *cobra.Command { cmd.Flags().StringVar(&sink, "sink", "", "the event you want to send to") cmd.Flags().StringVar(&filters, "filters", "", "filter event you interested, JSON format required") cmd.Flags().StringVar(&transformer, "transformer", "", "transformer, JSON format required") - cmd.Flags().Uint32Var(&rateLimit, "rate-limit", 0, "max event number pushing to sink per second, default is 0, means unlimited") + cmd.Flags().Int32Var(&rateLimit, "rate-limit", 0, "max event number pushing to sink per second, default is 0, means unlimited") cmd.Flags().StringVar(&from, "from", "", "consume events from, latest,earliest or RFC3339 format time") cmd.Flags().StringVar(&subProtocol, "protocol", "http", "protocol,http or aws-lambda or gcloud-functions or grpc") cmd.Flags().StringVar(&sinkCredentialType, "credential-type", "", "sink credential type: aws or gcloud") cmd.Flags().StringVar(&sinkCredential, "credential", "", "sink credential info, JSON format or @file") - cmd.Flags().Uint32Var(&deliveryTimeout, "delivery-timeout", 0, "event delivery to sink timeout by millisecond, default is 0, means using server-side default value: 5s") + cmd.Flags().Int32Var(&deliveryTimeout, "delivery-timeout", 0, "event delivery to sink timeout by millisecond, default is 0, means using server-side default value: 5s") cmd.Flags().Int32Var(&maxRetryAttempts, "max-retry-attempts", -1, "event delivery fail max retry attempts, default is -1, means using server-side max retry attempts: 32") cmd.Flags().StringVar(&subscriptionName, "name", "", "subscription name") cmd.Flags().StringVar(&description, "description", "", "subscription description") @@ -228,6 +124,246 @@ func createSubscriptionCommand() *cobra.Command { return cmd } +func getProtocol(cmd *cobra.Command) meta.Protocol { + var p meta.Protocol + switch subProtocol { + case "http", "": + p = meta.Protocol_HTTP + case "aws-lambda": + p = meta.Protocol_AWS_LAMBDA + if _, err := arn.Parse(sink); err != nil { + cmdFailedf(cmd, "protocol is aws-lambda sink is aws arn, arn parse error: %s\n", err.Error()) + } + if sinkCredentialType != AWSCredentialType { + cmdFailedf(cmd, "protocol is aws-lambda, credential-type must be %s\n", AWSCredentialType) + } + case "gcloud-functions": + p = meta.Protocol_GCLOUD_FUNCTIONS + if sinkCredentialType != GCloudCredentialType { + cmdFailedf(cmd, "protocol is aws-lambda, credential-type must be %s\n", GCloudCredentialType) + } + case "grpc": + p = meta.Protocol_GRPC + default: + cmdFailedf(cmd, "protocol is invalid\n") + } + return p +} + +func getSinkCredential(cmd *cobra.Command) *meta.SinkCredential { + if sinkCredentialType == "" { + return nil + } + if sinkCredential == "" { + cmdFailedf(cmd, "credential-type is set but sinkCredential empty\n") + } + if sinkCredential[0] == '@' { + credentialBytes, err := ioutil.ReadFile(sinkCredential[1:]) + if err != nil { + cmdFailedf(cmd, "read sinkCredential file:%s error:%s\n", sinkCredential, err.Error()) + } + sinkCredential = string(credentialBytes) + fmt.Println(sinkCredential) + } + // expand value from env + sinkCredential = os.ExpandEnv(sinkCredential) + switch sinkCredentialType { + case AWSCredentialType: + var akSK *meta.AKSKCredential + err := json.Unmarshal([]byte(sinkCredential), &akSK) + if err != nil { + cmdFailedf(cmd, "the sink credential unmarshal json error: %s", err.Error()) + } + if akSK.AccessKeyId == "" || akSK.SecretAccessKey == "" { + cmdFailedf(cmd, "credential-type is aws, access_key_id and secret_access_key must not be empty\n") + } + return &meta.SinkCredential{ + CredentialType: meta.SinkCredential_AWS, + Credential: &meta.SinkCredential_Aws{ + Aws: akSK, + }, + } + case GCloudCredentialType: + var m map[string]string + err := json.Unmarshal([]byte(sinkCredential), &m) + if err != nil { + cmdFailedf(cmd, "the sink credential unmarshal json error: %s", err.Error()) + } + return &meta.SinkCredential{ + CredentialType: meta.SinkCredential_GCLOUD, + Credential: &meta.SinkCredential_Gcloud{ + Gcloud: &meta.GCloudCredential{ + CredentialsJson: sinkCredential, + }, + }, + } + default: + cmdFailedf(cmd, "credential-type is invalid\n") + } + return nil +} + +func getFilters(cmd *cobra.Command) []*meta.Filter { + if filters == "" { + return nil + } + var filter []*meta.Filter + err := json.Unmarshal([]byte(filters), &filter) + if err != nil { + cmdFailedf(cmd, "the filter invalid: %s", err) + } + return filter +} + +func getTransformer(cmd *cobra.Command) *meta.Transformer { + if transformer == "" { + return nil + } + var _transformer *primitive.Transformer + err := json.Unmarshal([]byte(transformer), &_transformer) + if err != nil { + cmdFailedf(cmd, "the transformer invalid: %s", err) + } + return convert.ToPbTransformer(_transformer) +} + +func getSubscriptionConfig(cmd *cobra.Command, config *meta.SubscriptionConfig) { + if rateLimit >= 0 { + config.RateLimit = uint32(rateLimit) + } + if deliveryTimeout >= 0 { + config.DeliveryTimeout = uint32(deliveryTimeout) + } + if maxRetryAttempts >= 0 { + value := uint32(maxRetryAttempts) + config.MaxRetryAttempts = &value + } + if from != "" { + switch from { + case "latest": + config.OffsetType = meta.SubscriptionConfig_LATEST + case "earliest": + config.OffsetType = meta.SubscriptionConfig_EARLIEST + default: + t, err := time.Parse(time.RFC3339, from) + if err != nil { + cmdFailedf(cmd, "consumer from time format is invalid: %s", err) + } + ts := uint64(t.Unix()) + config.OffsetTimestamp = &ts + config.OffsetType = meta.SubscriptionConfig_TIMESTAMP + } + } +} + +func updateSubscriptionCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "update", + Short: "update a subscription", + Run: func(cmd *cobra.Command, args []string) { + id, err := vanus.NewIDFromString(subscriptionIDStr) + if err != nil { + cmdFailedWithHelpNotice(cmd, fmt.Sprintf("invalid subscription id: %s\n", err.Error())) + } + sub, err := client.GetSubscription(context.Background(), &ctrlpb.GetSubscriptionRequest{ + Id: id.Uint64(), + }) + if err != nil { + cmdFailedf(cmd, "get subscription %s error: %s", subscriptionIDStr, err) + } + var change bool + if sink != "" && sink != sub.Sink { + change = true + sub.Sink = sink + } + if subscriptionName != "" && subscriptionName != sub.Name { + change = true + sub.Name = subscriptionName + } + if description != "" && description != sub.Description { + sub.Description = description + } + if subProtocol != "" { + p := getProtocol(cmd) + if p != sub.Protocol { + change = true + sub.Protocol = p + } + } + if sinkCredentialType != "" { + credential := getSinkCredential(cmd) + if credential != sub.SinkCredential { + change = true + sub.SinkCredential = credential + } + } + if filters != "" { + filter := getFilters(cmd) + if !reflect.DeepEqual(filter, sub.Filters) { + change = true + sub.Filters = filter + } + } + if transformer != "" { + trans := getTransformer(cmd) + if !reflect.DeepEqual(trans, sub.Transformer) { + change = true + sub.Transformer = trans + } + } + + // subscription config + config := sub.Config + if config == nil { + config = &meta.SubscriptionConfig{} + } + getSubscriptionConfig(cmd, config) + if !reflect.DeepEqual(config, sub.Config) { + change = true + } + if !change { + cmdFailedf(cmd, "update subscription no change") + } + res, err := client.UpdateSubscription(context.Background(), &ctrlpb.UpdateSubscriptionRequest{ + Id: id.Uint64(), + Subscription: &ctrlpb.SubscriptionRequest{ + Source: sub.Source, + Types: sub.Types, + Config: config, + Filters: sub.Filters, + Sink: sub.Sink, + SinkCredential: sub.SinkCredential, + Protocol: sub.Protocol, + EventBus: sub.EventBus, + Transformer: sub.Transformer, + Name: sub.Name, + Description: sub.Description, + }, + }) + if err != nil { + cmdFailedf(cmd, "update subscription failed: %s", err) + } + printSubscription(cmd, false, true, true, res) + }, + } + cmd.Flags().StringVar(&subscriptionIDStr, "id", "", "subscription id to update") + cmd.Flags().StringVar(&sink, "sink", "", "the event you want to send to") + cmd.Flags().StringVar(&filters, "filters", "", "filter event you interested, JSON format required") + cmd.Flags().StringVar(&transformer, "transformer", "", "transformer, JSON format required") + cmd.Flags().Int32Var(&rateLimit, "rate-limit", -1, "max event number pushing to sink per second, 0 means unlimited") + cmd.Flags().StringVar(&subProtocol, "protocol", "", "protocol,http or aws-lambda or gcloud-functions or grpc") + cmd.Flags().StringVar(&sinkCredentialType, "credential-type", "", "sink credential type: aws or gcloud") + cmd.Flags().StringVar(&sinkCredential, "credential", "", "sink credential info, JSON format or @file") + cmd.Flags().Int32Var(&deliveryTimeout, "delivery-timeout", -1, "event delivery to sink timeout by millisecond, 0 means using server-side default value: 5s") + cmd.Flags().Int32Var(&maxRetryAttempts, "max-retry-attempts", -1, "event delivery fail max retry attempts") + cmd.Flags().StringVar(&subscriptionName, "name", "", "subscription name") + cmd.Flags().StringVar(&description, "description", "", "subscription description") + // todo the value is user set or default value + //cmd.Flags().BoolVar(&orderedPushEvent, "ordered-event", false, "whether push the "+ + // "event with ordered") + return cmd +} + func deleteSubscriptionCommand() *cobra.Command { cmd := &cobra.Command{ Use: "delete", From 4a13057cb77a8aa90a1dd2405aa1c272306e916c Mon Sep 17 00:00:00 2001 From: wenfeng Date: Mon, 16 Jan 2023 11:42:22 +0800 Subject: [PATCH 43/46] feat: enhance metrics of controller and gateway (#408) * feat: enhance metrics of controller * add gateway metrics * update --- cmd/gateway/main.go | 3 +- deploy/poc/poc.yaml | 10 +-- deploy/poc/yaml/controller.yaml | 2 +- deploy/poc/yaml/gateway.yaml | 2 +- deploy/poc/yaml/store.yaml | 2 +- deploy/poc/yaml/timer.yaml | 2 +- deploy/poc/yaml/trigger.yaml | 2 +- internal/controller/eventbus/controller.go | 67 +++++++++++---- .../controller/eventbus/controller_test.go | 5 +- .../controller/eventbus/eventlog/eventlog.go | 86 +++++++++++++------ .../eventbus/eventlog/eventlog_test.go | 2 +- .../eventbus/eventlog/mock_eventlog.go | 8 +- internal/gateway/gateway.go | 28 +++++- internal/gateway/proxy/proxy.go | 24 +++++- observability/metrics/controller.go | 69 +++++++++++---- observability/metrics/gateway.go | 60 +++++++++++++ observability/metrics/label.go | 17 ++-- observability/metrics/metrics.go | 20 ++++- 18 files changed, 319 insertions(+), 90 deletions(-) create mode 100644 observability/metrics/gateway.go diff --git a/cmd/gateway/main.go b/cmd/gateway/main.go index 275385d6d..dbac0b934 100644 --- a/cmd/gateway/main.go +++ b/cmd/gateway/main.go @@ -22,6 +22,7 @@ import ( "github.com/linkall-labs/vanus/internal/gateway" "github.com/linkall-labs/vanus/observability" "github.com/linkall-labs/vanus/observability/log" + "github.com/linkall-labs/vanus/observability/metrics" "github.com/linkall-labs/vanus/pkg/util/signal" ) @@ -51,7 +52,7 @@ func main() { } cfg.Observability.T.ServerName = "Vanus Gateway" - _ = observability.Initialize(ctx, cfg.Observability, nil) + _ = observability.Initialize(ctx, cfg.Observability, metrics.GetGatewayMetrics) log.Info(ctx, "Gateway has started", nil) select { case <-ctx.Done(): diff --git a/deploy/poc/poc.yaml b/deploy/poc/poc.yaml index 2e4190a9e..f7a70d4f6 100644 --- a/deploy/poc/poc.yaml +++ b/deploy/poc/poc.yaml @@ -208,7 +208,7 @@ spec: app: vanus-gateway spec: containers: - - image: public.ecr.aws/vanus/gateway:6b23e5a + - image: public.ecr.aws/vanus/gateway:6b76eb8 imagePullPolicy: IfNotPresent name: gateway ports: @@ -269,7 +269,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/timer:6b23e5a + image: public.ecr.aws/vanus/timer:6b76eb8 imagePullPolicy: IfNotPresent name: timer ports: @@ -329,7 +329,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/trigger:6b23e5a + image: public.ecr.aws/vanus/trigger:6b76eb8 imagePullPolicy: IfNotPresent name: trigger ports: @@ -411,7 +411,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/controller:6b23e5a + image: public.ecr.aws/vanus/controller:6b76eb8 imagePullPolicy: IfNotPresent name: controller ports: @@ -495,7 +495,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/store:6b23e5a + image: public.ecr.aws/vanus/store:6b76eb8 imagePullPolicy: IfNotPresent name: store ports: diff --git a/deploy/poc/yaml/controller.yaml b/deploy/poc/yaml/controller.yaml index ca044802f..ee441fcba 100644 --- a/deploy/poc/yaml/controller.yaml +++ b/deploy/poc/yaml/controller.yaml @@ -88,7 +88,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/controller:6b23e5a + image: public.ecr.aws/vanus/controller:02c5b59 imagePullPolicy: IfNotPresent name: controller ports: diff --git a/deploy/poc/yaml/gateway.yaml b/deploy/poc/yaml/gateway.yaml index db2f487f1..3131ebe66 100644 --- a/deploy/poc/yaml/gateway.yaml +++ b/deploy/poc/yaml/gateway.yaml @@ -53,7 +53,7 @@ spec: app: vanus-gateway spec: containers: - - image: public.ecr.aws/vanus/gateway:6b23e5a + - image: public.ecr.aws/vanus/gateway:6b76eb8 imagePullPolicy: IfNotPresent name: gateway ports: diff --git a/deploy/poc/yaml/store.yaml b/deploy/poc/yaml/store.yaml index d1b29171d..942b50ec8 100644 --- a/deploy/poc/yaml/store.yaml +++ b/deploy/poc/yaml/store.yaml @@ -72,7 +72,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/store:6b23e5a + image: public.ecr.aws/vanus/store:6b76eb8 imagePullPolicy: IfNotPresent name: store ports: diff --git a/deploy/poc/yaml/timer.yaml b/deploy/poc/yaml/timer.yaml index 7856a6b8e..0b52b0093 100644 --- a/deploy/poc/yaml/timer.yaml +++ b/deploy/poc/yaml/timer.yaml @@ -56,7 +56,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/timer:6b23e5a + image: public.ecr.aws/vanus/timer:6b76eb8 imagePullPolicy: IfNotPresent name: timer volumeMounts: diff --git a/deploy/poc/yaml/trigger.yaml b/deploy/poc/yaml/trigger.yaml index 3842161a7..d3f724408 100644 --- a/deploy/poc/yaml/trigger.yaml +++ b/deploy/poc/yaml/trigger.yaml @@ -55,7 +55,7 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP - image: public.ecr.aws/vanus/trigger:6b23e5a + image: public.ecr.aws/vanus/trigger:6b76eb8 imagePullPolicy: IfNotPresent name: trigger ports: diff --git a/internal/controller/eventbus/controller.go b/internal/controller/eventbus/controller.go index 0c894fa45..64b56aaee 100644 --- a/internal/controller/eventbus/controller.go +++ b/internal/controller/eventbus/controller.go @@ -21,8 +21,10 @@ import ( "fmt" "io" "path/filepath" + "strconv" "strings" "sync" + "sync/atomic" "time" embedetcd "github.com/linkall-labs/embed-etcd" @@ -73,20 +75,22 @@ func NewController(cfg Config, member embedetcd.Member) *controller { } type controller struct { - cfg *Config - kvStore kv.Client - volumeMgr volume.Manager - eventLogMgr eventlog.Manager - ssMgr server.Manager - eventBusMap map[string]*metadata.Eventbus - member embedetcd.Member - cancelCtx context.Context - cancelFunc context.CancelFunc - membershipMutex sync.Mutex - isLeader bool - readyNotify chan error - stopNotify chan error - mutex sync.Mutex + cfg *Config + kvStore kv.Client + volumeMgr volume.Manager + eventLogMgr eventlog.Manager + ssMgr server.Manager + eventBusMap map[string]*metadata.Eventbus + member embedetcd.Member + cancelCtx context.Context + cancelFunc context.CancelFunc + membershipMutex sync.Mutex + isLeader bool + readyNotify chan error + stopNotify chan error + mutex sync.Mutex + eventbusUpdatedCount int64 + eventbusDeletedCount int64 } func (ctrl *controller) Start(_ context.Context) error { @@ -97,6 +101,7 @@ func (ctrl *controller) Start(_ context.Context) error { ctrl.kvStore = store ctrl.cancelCtx, ctrl.cancelFunc = context.WithCancel(context.Background()) go ctrl.member.RegisterMembershipChangedProcessor(ctrl.membershipChangedProcessor) + go ctrl.recordMetrics() return nil } @@ -188,7 +193,7 @@ func (ctrl *controller) createEventBus(ctx context.Context, return nil, errors.ErrResourceAlreadyExist.WithMessage("the eventbus already exist") } for idx := 0; idx < eb.LogNumber; idx++ { - el, err := ctrl.eventLogMgr.AcquireEventLog(ctx, eb.ID) + el, err := ctrl.eventLogMgr.AcquireEventLog(ctx, eb.ID, eb.Name) if err != nil { return nil, err } @@ -202,7 +207,6 @@ func (ctrl *controller) createEventBus(ctx context.Context, return nil, err } } - metrics.EventbusGauge.Set(float64(len(ctrl.eventBusMap))) return ctrl.getEventbus(eb.Name) } @@ -231,7 +235,7 @@ func (ctrl *controller) DeleteEventBus(ctx context.Context, eb *metapb.EventBus) }(v.ID) } wg.Wait() - metrics.EventbusGauge.Set(float64(len(ctrl.eventBusMap))) + atomic.AddInt64(&ctrl.eventbusDeletedCount, 1) return &emptypb.Empty{}, nil } @@ -271,6 +275,7 @@ func (ctrl *controller) ListEventBus(ctx context.Context, _ *emptypb.Empty) (*ct func (ctrl *controller) UpdateEventBus(ctx context.Context, req *ctrlpb.UpdateEventBusRequest) (*metapb.EventBus, error) { + atomic.AddInt64(&ctrl.eventbusUpdatedCount, 1) return &metapb.EventBus{}, nil } @@ -516,6 +521,33 @@ func (ctrl *controller) ReportSegmentLeader(ctx context.Context, return &emptypb.Empty{}, nil } +func (ctrl *controller) recordMetrics() { + t := time.NewTicker(time.Second) + defer t.Stop() + for { + select { + case <-t.C: + ctrl.membershipMutex.Lock() + if ctrl.isLeader { + metrics.ControllerLeaderGaugeVec.DeleteLabelValues(strconv.FormatBool(!ctrl.isLeader)) + metrics.ControllerLeaderGaugeVec.WithLabelValues(strconv.FormatBool(ctrl.isLeader)).Set(1) + } else { + metrics.ControllerLeaderGaugeVec.WithLabelValues(strconv.FormatBool(!ctrl.isLeader)).Set(0) + } + ctrl.membershipMutex.Unlock() + + ctrl.mutex.Lock() + metrics.EventbusGauge.Set(float64(len(ctrl.eventBusMap))) + metrics.EventbusUpdatedGauge.Set(float64(atomic.LoadInt64(&ctrl.eventbusUpdatedCount))) + metrics.EventbusDeletedGauge.Set(float64(atomic.LoadInt64(&ctrl.eventbusDeletedCount))) + ctrl.mutex.Unlock() + case <-ctrl.cancelCtx.Done(): + log.Info(ctrl.cancelCtx, "record leadership exiting...", nil) + return + } + } +} + func (ctrl *controller) membershipChangedProcessor(ctx context.Context, event embedetcd.MembershipChangedEvent) error { ctrl.membershipMutex.Lock() defer ctrl.membershipMutex.Unlock() @@ -571,7 +603,6 @@ func (ctrl *controller) loadEventbus(ctx context.Context) error { } ctrl.eventBusMap[filepath.Base(pair.Key)] = busInfo } - metrics.EventbusGauge.Set(float64(len(ctrl.eventBusMap))) return nil } diff --git a/internal/controller/eventbus/controller_test.go b/internal/controller/eventbus/controller_test.go index 7de6c2cbb..49e5fabf7 100644 --- a/internal/controller/eventbus/controller_test.go +++ b/internal/controller/eventbus/controller_test.go @@ -57,9 +57,10 @@ func TestController_CreateEventBus(t *testing.T) { el := &metadata.Eventlog{ ID: vanus.NewTestID(), } - elMgr.EXPECT().AcquireEventLog(ctx, gomock.Any()).Times(1).DoAndReturn(func(ctx stdCtx.Context, - eventbusID vanus.ID) (*metadata.Eventlog, error) { + elMgr.EXPECT().AcquireEventLog(ctx, gomock.Any(), gomock.Any()).Times(1).DoAndReturn(func(ctx stdCtx.Context, + eventbusID vanus.ID, ebName string) (*metadata.Eventlog, error) { el.ID = eventbusID + el.EventbusName = ebName el.SegmentNumber = 2 return el, nil }) diff --git a/internal/controller/eventbus/eventlog/eventlog.go b/internal/controller/eventbus/eventlog/eventlog.go index dd546e328..301a9e5d7 100644 --- a/internal/controller/eventbus/eventlog/eventlog.go +++ b/internal/controller/eventbus/eventlog/eventlog.go @@ -34,7 +34,6 @@ import ( "github.com/linkall-labs/vanus/observability/log" "github.com/linkall-labs/vanus/observability/metrics" "github.com/linkall-labs/vanus/pkg/errors" - "github.com/linkall-labs/vanus/pkg/util" "github.com/linkall-labs/vanus/proto/pkg/segment" ) @@ -50,7 +49,7 @@ const ( type Manager interface { Run(ctx context.Context, kvClient kv.Client, startTask bool) error Stop() - AcquireEventLog(ctx context.Context, eventbusID vanus.ID) (*metadata.Eventlog, error) + AcquireEventLog(ctx context.Context, eventbusID vanus.ID, eventbusName string) (*metadata.Eventlog, error) GetEventLog(ctx context.Context, id vanus.ID) *metadata.Eventlog DeleteEventlog(ctx context.Context, id vanus.ID) GetEventLogSegmentList(elID vanus.ID) []*Segment @@ -124,7 +123,6 @@ func (mgr *eventlogManager) Run(ctx context.Context, kvClient kv.Client, startTa if err != nil { return err } - metrics.EventlogGaugeVec.Set(0) for idx := range pairs { pair := pairs[idx] elMD := &metadata.Eventlog{} @@ -149,14 +147,15 @@ func (mgr *eventlogManager) Run(ctx context.Context, kvClient kv.Client, startTa } } } - metrics.EventlogGaugeVec.Set(float64(util.MapLen(&mgr.eventLogMap))) + + cancelCtx, cancel := context.WithCancel(ctx) + mgr.cancel = cancel if startTask { - cancelCtx, cancel := context.WithCancel(ctx) - mgr.cancel = cancel go mgr.dynamicScaleUpEventLog(cancelCtx) go mgr.cleanAbnormalSegment(cancelCtx) go mgr.checkSegmentExpired(cancelCtx) } + go mgr.recordMetrics(cancelCtx) return nil } @@ -165,7 +164,8 @@ func (mgr *eventlogManager) Stop() { mgr.allocator.Stop() } -func (mgr *eventlogManager) AcquireEventLog(ctx context.Context, eventbusID vanus.ID) (*metadata.Eventlog, error) { +func (mgr *eventlogManager) AcquireEventLog(ctx context.Context, eventbusID vanus.ID, + eventbusName string) (*metadata.Eventlog, error) { mgr.mutex.Lock() defer mgr.mutex.Unlock() @@ -178,8 +178,9 @@ func (mgr *eventlogManager) AcquireEventLog(ctx context.Context, eventbusID vanu return nil, err } elMD := &metadata.Eventlog{ - ID: id, - EventbusID: eventbusID, + ID: id, + EventbusName: eventbusName, + EventbusID: eventbusID, } data, _ := json.Marshal(elMD) if err := mgr.kvClient.Set(ctx, metadata.GetEventlogMetadataKey(elMD.ID), data); err != nil { @@ -197,7 +198,6 @@ func (mgr *eventlogManager) AcquireEventLog(ctx context.Context, eventbusID vanu "eventbus_id": elMD.EventbusID.Key(), "eventlog_id": elMD.ID.Key(), }) - metrics.EventlogGaugeVec.Set(float64(util.MapLen(&mgr.eventLogMap))) return elMD, nil } @@ -224,7 +224,6 @@ func (mgr *eventlogManager) DeleteEventlog(ctx context.Context, id vanus.ID) { if !exist { return } - metrics.EventlogGaugeVec.Set(float64(util.MapLen(&mgr.eventLogMap))) el, _ := v.(*eventlog) head := el.head() for head != nil { @@ -238,7 +237,7 @@ func (mgr *eventlogManager) DeleteEventlog(ctx context.Context, id vanus.ID) { } _, ok := mgr.segmentNeedBeClean.LoadOrStore(head.ID.Key(), head) if ok { - metrics.SegmentDeletedCounterVec.WithLabelValues(metrics.LabelSegmentDeletedBecauseDeleted).Add(1) + metrics.SegmentDeletedCounterVec.WithLabelValues(metrics.LabelSegmentDeletedBecauseDeleted).Inc() } head = el.head() } @@ -279,11 +278,11 @@ func (mgr *eventlogManager) GetAppendableSegment(ctx context.Context, }) _, ok := mgr.segmentNeedBeClean.LoadOrStore(seg.ID.Key(), seg) if !ok { - metrics.SegmentDeletedCounterVec.WithLabelValues(metrics.LabelSegmentDeletedBecauseCreateFailed).Add(1) + metrics.SegmentDeletedCounterVec.WithLabelValues(metrics.LabelSegmentDeletedBecauseCreateFailed).Inc() } return nil, err } - metrics.SegmentCreationRuntimeCounterVec.WithLabelValues(metrics.LabelValueResourceManualCreate).Inc() + metrics.SegmentCreatedByCacheMissing.Inc() s = el.currentAppendableSegment() } @@ -444,11 +443,11 @@ func (mgr *eventlogManager) initializeEventLog(ctx context.Context, md *metadata }) _, ok := mgr.segmentNeedBeClean.LoadOrStore(seg.ID.Key(), seg) if !ok { - metrics.SegmentDeletedCounterVec.WithLabelValues(metrics.LabelSegmentDeletedBecauseCreateFailed).Add(1) + metrics.SegmentDeletedCounterVec.WithLabelValues(metrics.LabelSegmentDeletedBecauseCreateFailed).Inc() } return nil, err } - metrics.SegmentCreationRuntimeCounterVec.WithLabelValues(metrics.LabelValueResourceManualCreate).Inc() + metrics.SegmentCreatedByCacheMissing.Inc() } return el, nil } @@ -488,11 +487,12 @@ func (mgr *eventlogManager) dynamicScaleUpEventLog(ctx context.Context) { }) _, ok := mgr.segmentNeedBeClean.LoadOrStore(seg.ID.Key(), seg) if !ok { - metrics.SegmentDeletedCounterVec.WithLabelValues(metrics.LabelSegmentDeletedBecauseCreateFailed).Add(1) + metrics.SegmentDeletedCounterVec.WithLabelValues(metrics.LabelSegmentDeletedBecauseCreateFailed).Inc() } return true } - metrics.SegmentCreationRuntimeCounterVec.WithLabelValues(metrics.LabelValueResourceDynamicCreate).Inc() + + metrics.SegmentCreatedByScaleTask.Inc() log.Info(ctx, "the new segment created", map[string]interface{}{ "segment_id": seg.ID.Key(), "eventlog_id": el.md.ID.Key(), @@ -501,6 +501,9 @@ func (mgr *eventlogManager) dynamicScaleUpEventLog(ctx context.Context) { } return true }) + log.Debug(ctx, "finished to provisioning segments", map[string]interface{}{ + "count": count, + }) } } } @@ -627,7 +630,7 @@ func (mgr *eventlogManager) checkSegmentExpired(ctx context.Context) { }) _, ok := mgr.segmentNeedBeClean.LoadOrStore(head.ID.Key(), head) if !ok { - metrics.SegmentDeletedCounterVec.WithLabelValues(metrics.LabelSegmentDeletedBecauseExpired).Add(1) + metrics.SegmentDeletedCounterVec.WithLabelValues(metrics.LabelSegmentDeletedBecauseExpired).Inc() } default: return true @@ -644,6 +647,44 @@ func (mgr *eventlogManager) checkSegmentExpired(ctx context.Context) { } } +func (mgr *eventlogManager) recordMetrics(ctx context.Context) { + t := time.NewTicker(time.Second) + for { + select { + case <-t.C: + mgr.mutex.Lock() + + nameMap := map[string]string{} + metrics.EventlogGaugeVec.Reset() + mgr.eventLogMap.Range(func(_, value any) bool { + el, _ := value.(*eventlog) + metrics.EventlogGaugeVec.WithLabelValues(el.md.Eventbus()).Inc() + nameMap[el.md.ID.Key()] = el.md.EventbusName + return true + }) + + metrics.SegmentGaugeVec.Reset() + metrics.SegmentCapacityGaugeVec.Reset() + metrics.SegmentSizeGaugeVec.Reset() + metrics.SegmentEventNumberGaugeVec.Reset() + mgr.globalSegmentMap.Range(func(key, value any) bool { + seg, _ := value.(*Segment) + elID := seg.EventLogID.Key() + + metrics.SegmentGaugeVec.WithLabelValues(nameMap[elID], elID, string(seg.State)).Inc() + metrics.SegmentCapacityGaugeVec.WithLabelValues(nameMap[elID], elID, string(seg.State)).Add(float64(seg.Capacity)) + metrics.SegmentSizeGaugeVec.WithLabelValues(nameMap[elID], elID, string(seg.State)).Add(float64(seg.Size)) + metrics.SegmentEventNumberGaugeVec.WithLabelValues(nameMap[elID], elID, string(seg.State)).Add(float64(seg.Number)) + return true + }) + mgr.mutex.Unlock() + case <-ctx.Done(): + log.Info(ctx, "record leadership exiting...", nil) + return + } + } +} + func (mgr *eventlogManager) createSegment(ctx context.Context, el *eventlog) (*Segment, error) { mgr.createSegmentMutex.Lock() defer mgr.createSegmentMutex.Unlock() @@ -655,7 +696,7 @@ func (mgr *eventlogManager) createSegment(ctx context.Context, el *eventlog) (*S if seg != nil { _, ok := mgr.segmentNeedBeClean.LoadOrStore(seg.ID.Key(), seg) if !ok { - metrics.SegmentDeletedCounterVec.WithLabelValues(metrics.LabelSegmentDeletedBecauseCreateFailed).Add(1) + metrics.SegmentDeletedCounterVec.WithLabelValues(metrics.LabelSegmentDeletedBecauseCreateFailed).Inc() } } } @@ -804,7 +845,7 @@ func (mgr *eventlogManager) generateSegment(ctx context.Context, el *eventlog) ( }) _, ok := mgr.segmentNeedBeClean.LoadOrStore(seg.ID.Key(), seg) if !ok { - metrics.SegmentDeletedCounterVec.WithLabelValues(metrics.LabelSegmentDeletedBecauseCreateFailed).Add(1) + metrics.SegmentDeletedCounterVec.WithLabelValues(metrics.LabelSegmentDeletedBecauseCreateFailed).Inc() } return nil, err } @@ -888,7 +929,6 @@ func newEventlog(ctx context.Context, md *metadata.Eventlog, kvClient kv.Client, } el.segmentList.Set(seg.ID.Uint64(), seg) } - metrics.SegmentGaugeVec.WithLabelValues(el.md.Eventbus()).Set(float64(el.segmentList.Len())) return el, nil } @@ -985,7 +1025,6 @@ func (el *eventlog) add(ctx context.Context, seg *Segment) error { } el.segments = append(el.segments, seg.ID) el.segmentList.Set(seg.ID.Uint64(), seg) - metrics.SegmentGaugeVec.WithLabelValues(el.md.Eventbus()).Inc() return nil } @@ -1127,7 +1166,6 @@ func (el *eventlog) deleteHead(ctx context.Context) error { } _ = el.segmentList.RemoveFront() el.segments = segments - metrics.SegmentGaugeVec.WithLabelValues(el.md.Eventbus()).Dec() return nil } diff --git a/internal/controller/eventbus/eventlog/eventlog_test.go b/internal/controller/eventbus/eventlog/eventlog_test.go index 4c19a67a4..57fe3b1c6 100644 --- a/internal/controller/eventbus/eventlog/eventlog_test.go +++ b/internal/controller/eventbus/eventlog/eventlog_test.go @@ -479,7 +479,7 @@ func TestEventlogManager_CreateAndGetEventlog(t *testing.T) { grpcCli.EXPECT().ActivateSegment(ctx, gomock.Any()).Times(2).Return(nil, nil) eventbusID := vanus.NewTestID() - logMD, err := utMgr.AcquireEventLog(ctx, eventbusID) + logMD, err := utMgr.AcquireEventLog(ctx, eventbusID, "ut") Convey("validate metadata", func() { So(err, ShouldBeNil) So(logMD.EventbusID, ShouldEqual, eventbusID) diff --git a/internal/controller/eventbus/eventlog/mock_eventlog.go b/internal/controller/eventbus/eventlog/mock_eventlog.go index 9e08aa06a..bcac927dc 100644 --- a/internal/controller/eventbus/eventlog/mock_eventlog.go +++ b/internal/controller/eventbus/eventlog/mock_eventlog.go @@ -38,18 +38,18 @@ func (m *MockManager) EXPECT() *MockManagerMockRecorder { } // AcquireEventLog mocks base method. -func (m *MockManager) AcquireEventLog(ctx context.Context, eventbusID vanus.ID) (*metadata.Eventlog, error) { +func (m *MockManager) AcquireEventLog(ctx context.Context, eventbusID vanus.ID, eventbusName string) (*metadata.Eventlog, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AcquireEventLog", ctx, eventbusID) + ret := m.ctrl.Call(m, "AcquireEventLog", ctx, eventbusID, eventbusName) ret0, _ := ret[0].(*metadata.Eventlog) ret1, _ := ret[1].(error) return ret0, ret1 } // AcquireEventLog indicates an expected call of AcquireEventLog. -func (mr *MockManagerMockRecorder) AcquireEventLog(ctx, eventbusID interface{}) *gomock.Call { +func (mr *MockManagerMockRecorder) AcquireEventLog(ctx, eventbusID, eventbusName interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcquireEventLog", reflect.TypeOf((*MockManager)(nil).AcquireEventLog), ctx, eventbusID) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcquireEventLog", reflect.TypeOf((*MockManager)(nil).AcquireEventLog), ctx, eventbusID, eventbusName) } // DeleteEventlog mocks base method. diff --git a/internal/gateway/gateway.go b/internal/gateway/gateway.go index 2bfce7775..b5e35d567 100644 --- a/internal/gateway/gateway.go +++ b/internal/gateway/gateway.go @@ -19,8 +19,10 @@ import ( "fmt" "net" "net/http" + "strconv" "strings" "sync" + "time" v2 "github.com/cloudevents/sdk-go/v2" "github.com/cloudevents/sdk-go/v2/client" @@ -33,6 +35,7 @@ import ( "github.com/linkall-labs/vanus/internal/gateway/proxy" "github.com/linkall-labs/vanus/internal/primitive" "github.com/linkall-labs/vanus/observability/log" + "github.com/linkall-labs/vanus/observability/metrics" "github.com/linkall-labs/vanus/observability/tracing" "go.opentelemetry.io/otel/trace" ) @@ -108,10 +111,27 @@ func (ga *ceGateway) startCloudEventsReceiver(ctx context.Context) error { return nil } -func (ga *ceGateway) receive(ctx context.Context, event v2.Event) (*v2.Event, protocol.Result) { +func (ga *ceGateway) receive(ctx context.Context, event v2.Event) (re *v2.Event, result protocol.Result) { _ctx, span := ga.tracer.Start(ctx, "receive") - defer span.End() + + start := time.Now() ebName := getEventBusFromPath(requestDataFromContext(_ctx)) + defer func() { + used := float64(time.Since(start)) / float64(time.Millisecond) + metrics.GatewayEventReceivedCountVec.WithLabelValues( + ebName, + metrics.LabelValueProtocolHTTP, + strconv.FormatInt(1, 10), + "unknown", + ).Inc() + + metrics.GatewayEventWriteLatencySummaryVec.WithLabelValues( + ebName, + metrics.LabelValueProtocolHTTP, + strconv.FormatInt(1, 10), + ).Observe(used) + span.End() + }() if ebName == "" { return nil, v2.NewHTTPResult(http.StatusBadRequest, "invalid eventbus name") @@ -153,11 +173,11 @@ func (ga *ceGateway) receive(ctx context.Context, event v2.Event) (*v2.Event, pr BusName: ebName, EventID: eventID, } - resEvent, err := createResponseEvent(eventData) + re, err = createResponseEvent(eventData) if err != nil { return nil, v2.NewHTTPResult(http.StatusInternalServerError, err.Error()) } - return resEvent, v2.ResultACK + return re, v2.ResultACK } func checkExtension(extensions map[string]interface{}) error { diff --git a/internal/gateway/proxy/proxy.go b/internal/gateway/proxy/proxy.go index 0b8b095a6..1dd245358 100644 --- a/internal/gateway/proxy/proxy.go +++ b/internal/gateway/proxy/proxy.go @@ -23,6 +23,7 @@ import ( "net/http" "os" "runtime/debug" + "strconv" "strings" "sync" "sync/atomic" @@ -46,6 +47,7 @@ import ( "github.com/linkall-labs/vanus/internal/trigger/filter" "github.com/linkall-labs/vanus/internal/trigger/transform" "github.com/linkall-labs/vanus/observability/log" + "github.com/linkall-labs/vanus/observability/metrics" "github.com/linkall-labs/vanus/observability/tracing" "github.com/linkall-labs/vanus/pkg/cluster" "github.com/linkall-labs/vanus/pkg/errors" @@ -143,13 +145,29 @@ type ControllerProxy struct { } func (cp *ControllerProxy) Publish(ctx context.Context, req *vanuspb.PublishRequest) (*emptypb.Empty, error) { - _ctx, span := cp.tracer.Start(ctx, "Publish") - defer span.End() - if req.EventbusName == "" { return nil, v2.NewHTTPResult(http.StatusBadRequest, "invalid eventbus name") } + _ctx, span := cp.tracer.Start(ctx, "Publish") + start := stdtime.Now() + defer func() { + span.End() + used := float64(stdtime.Since(start)) / float64(stdtime.Millisecond) + metrics.GatewayEventReceivedCountVec.WithLabelValues( + req.EventbusName, + metrics.LabelValueProtocolHTTP, + strconv.FormatInt(int64(len(req.Events.Events)), 10), + "unknown", + ).Inc() + + metrics.GatewayEventWriteLatencySummaryVec.WithLabelValues( + req.EventbusName, + metrics.LabelValueProtocolHTTP, + strconv.FormatInt(int64(len(req.Events.Events)), 10), + ).Observe(used) + }() + for idx := range req.Events.Events { e := req.Events.Events[idx] err := checkExtension(e.Attributes) diff --git a/observability/metrics/controller.go b/observability/metrics/controller.go index d1efe0c0e..1e2d91a4e 100644 --- a/observability/metrics/controller.go +++ b/observability/metrics/controller.go @@ -19,40 +19,79 @@ import "github.com/prometheus/client_golang/prometheus" var ( moduleOfController = "controller" - EventbusGauge = prometheus.NewGauge(prometheus.GaugeOpts{ + ControllerLeaderGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ // visualized + Namespace: namespace, + Subsystem: moduleOfController, + Name: "leader_flag", + Help: "if is this controller leader", + }, []string{LabelIsLeader}) + + EventbusGauge = prometheus.NewGauge(prometheus.GaugeOpts{ // visualized Namespace: namespace, Subsystem: moduleOfController, Name: "eventbus_number_total", - Help: "The number of EventbusService.", }) - EventlogGaugeVec = prometheus.NewGauge(prometheus.GaugeOpts{ + EventbusUpdatedGauge = prometheus.NewGauge(prometheus.GaugeOpts{ + Namespace: namespace, + Subsystem: moduleOfController, + Name: "eventbus_number_updated_total", + }) + + EventbusDeletedGauge = prometheus.NewGauge(prometheus.GaugeOpts{ Namespace: namespace, Subsystem: moduleOfController, - Name: "eventlog_number_total", - Help: "The Eventlog number.", + Name: "eventbus_number_deleted_total", }) - SegmentGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ + // EventlogGaugeVec TODO wenfeng clean values? + EventlogGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ // visualized Namespace: namespace, Subsystem: moduleOfController, - Name: "segment_number_per_eventbus_total", - Help: "The Segment's number of each eventbus .", + Name: "eventlog_number_total_per_eventbus", }, []string{LabelEventbus}) - SegmentCreationRuntimeCounterVec = prometheus.NewCounterVec(prometheus.CounterOpts{ + SegmentGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ // visualized + Namespace: namespace, + Subsystem: moduleOfController, + Name: "segment_number_total_per_eventlog", + }, []string{LabelEventbus, LabelEventlog, LabelSegmentState}) + + SegmentSizeGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ // visualized + Namespace: namespace, + Subsystem: moduleOfController, + Name: "segment_size_total_per_eventlog", + }, []string{LabelEventbus, LabelEventlog, LabelSegmentState}) + + SegmentCapacityGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ // visualized + Namespace: namespace, + Subsystem: moduleOfController, + Name: "segment_capacity_total_per_eventlog", + }, []string{LabelEventbus, LabelEventlog, LabelSegmentState}) + + SegmentEventNumberGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ // visualized + Namespace: namespace, + Subsystem: moduleOfController, + Name: "segment_event_number_total_per_eventlog", + }, []string{LabelEventbus, LabelEventlog, LabelSegmentState}) + + SegmentCreatedByCacheMissing = prometheus.NewGauge(prometheus.GaugeOpts{ // visualized + Namespace: namespace, + Subsystem: moduleOfController, + Name: "segment_created_by_cache_missing_total", + }) + + SegmentCreatedByScaleTask = prometheus.NewGauge(prometheus.GaugeOpts{ // visualized Namespace: namespace, Subsystem: moduleOfController, - Name: "segment_creation_runtime", - Help: "The runtime info about segment creation.", - }, []string{LabelType}) + Name: "segment_created_by_scale_task_total", + }) SegmentDeletedCounterVec = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: namespace, Subsystem: moduleOfController, - Name: "deleted_segment_number_runtime", - Help: "The number of deleted Segment.", - }, []string{LabelType}) + Name: "segment_deleted_number_runtime", + }, []string{LabelDeletedReason}) SubscriptionGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: namespace, diff --git a/observability/metrics/gateway.go b/observability/metrics/gateway.go new file mode 100644 index 000000000..dfe0ace01 --- /dev/null +++ b/observability/metrics/gateway.go @@ -0,0 +1,60 @@ +// Copyright 2023 Linkall Inc. +// +// 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 metrics + +import "github.com/prometheus/client_golang/prometheus" + +var ( + moduleOfGateway = "gateway" + + GatewayEventReceivedCountVec = prometheus.NewCounterVec(prometheus.CounterOpts{ + Namespace: namespace, + Subsystem: moduleOfGateway, + Name: "event_received_total", + }, []string{LabelEventbus, LabelProtocol, LabelBatchSize, LabelResponseCode}) + + GatewayEventWriteLatencyHistogramVec = prometheus.NewHistogramVec(prometheus.HistogramOpts{ + Namespace: namespace, + Subsystem: moduleOfGateway, + Name: "send_event_request_latency_histogram", + Buckets: []float64{0.4, 0.7, 1, 2, 3, 5, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, + 100, 200, 300, 400, 500, 1000}, // ms + NativeHistogramBucketFactor: 0, + NativeHistogramZeroThreshold: 0, + NativeHistogramMaxBucketNumber: 0, + NativeHistogramMinResetDuration: 0, + NativeHistogramMaxZeroThreshold: 0, + }, []string{LabelEventbus, LabelProtocol, LabelBatchSize}) + + GatewayEventWriteLatencySummaryVec = prometheus.NewSummaryVec(prometheus.SummaryOpts{ + Namespace: namespace, + Subsystem: moduleOfGateway, + Name: "send_event_request_latency_summary", + Objectives: map[float64]float64{ + 0.25: 0.1, + 0.50: 0.1, + 0.75: 0.1, + 0.80: 0.05, + 0.85: 0.05, + 0.9: 0.05, + 0.95: 0.01, + 0.96: 0.01, + 0.97: 0.01, + 0.98: 0.01, + 0.99: 0.001, + 0.999: 0.0001, + 0.9999: 0.00001}, + }, []string{LabelEventbus, LabelProtocol, LabelBatchSize}) +) diff --git a/observability/metrics/label.go b/observability/metrics/label.go index f92862a21..7bd414753 100644 --- a/observability/metrics/label.go +++ b/observability/metrics/label.go @@ -15,10 +15,15 @@ package metrics const ( - LabelType = "type" - LabelVolume = "volume" - LabelEventbus = "eventbus" - LabelEventlog = "eventlog" + LabelDeletedReason = "deleted_reason" + LabelVolume = "volume" + LabelEventbus = "eventbus" + LabelEventlog = "eventlog" + LabelSegmentState = "segment_state" + LabelIsLeader = "is_leader" + LabelProtocol = "protocol" + LabelBatchSize = "batch_size" + LabelResponseCode = "response_code" LabelTriggerWorker = "trigger_worker" LabelTrigger = "trigger" @@ -29,13 +34,13 @@ const ( ) const ( - LabelValueResourceDynamicCreate = "dynamic" - LabelValueResourceManualCreate = "manual" LabelValuePushEventSuccess = "success" LabelValuePushEventFail = "fail" LabelSegmentDeletedBecauseExpired = "segment_expired" LabelSegmentDeletedBecauseCreateFailed = "segment_create_failed" LabelSegmentDeletedBecauseDeleted = "segment_deleted" + LabelValueProtocolHTTP = "http" + LabelValueProtocolGRPC = "grpc" ) const ( diff --git a/observability/metrics/metrics.go b/observability/metrics/metrics.go index 75b4ded86..aadff17c7 100644 --- a/observability/metrics/metrics.go +++ b/observability/metrics/metrics.go @@ -60,16 +60,23 @@ func Init(ctx context.Context, cfg Config, getCollectors func() []prometheus.Col } }() log.Info(context.Background(), "metrics module started", map[string]interface{}{ - "port": cfg.GetPort, + "port": cfg.GetPort(), }) } func GetControllerMetrics() []prometheus.Collector { coll := []prometheus.Collector{ + ControllerLeaderGaugeVec, EventbusGauge, + EventbusUpdatedGauge, + EventbusDeletedGauge, EventlogGaugeVec, SegmentGaugeVec, - SegmentCreationRuntimeCounterVec, + SegmentSizeGaugeVec, + SegmentCapacityGaugeVec, + SegmentEventNumberGaugeVec, + SegmentCreatedByCacheMissing, + SegmentCreatedByScaleTask, SegmentDeletedCounterVec, SubscriptionGauge, SubscriptionTransformerGauge, @@ -78,6 +85,15 @@ func GetControllerMetrics() []prometheus.Collector { return append(coll, getGoRuntimeMetrics()...) } +func GetGatewayMetrics() []prometheus.Collector { + coll := []prometheus.Collector{ + GatewayEventReceivedCountVec, + //GatewayEventWriteLatencyHistogramVec, + GatewayEventWriteLatencySummaryVec, + } + return append(coll, getGoRuntimeMetrics()...) +} + func GetTriggerMetrics() []prometheus.Collector { coll := []prometheus.Collector{ TriggerGauge, From b762f1e3d5dfe91381d3e6e7a5aa122e6feb4774 Mon Sep 17 00:00:00 2001 From: delu Date: Mon, 16 Jan 2023 16:47:17 +0800 Subject: [PATCH 44/46] feat: add functio array foreach (#403) * feat: add function foreach array Signed-off-by: xdlbdy * feat: add function foreach array Signed-off-by: xdlbdy * feat: add function foreach array Signed-off-by: xdlbdy * feat: add function foreach array Signed-off-by: xdlbdy * feat: add function foreach array Signed-off-by: xdlbdy * fix: ut error Signed-off-by: xdlbdy * feat: add function foreach array Signed-off-by: xdlbdy * feat: add function foreach array Signed-off-by: xdlbdy * feat: feat: add function array foreach Signed-off-by: xdlbdy * feat: feat: add function array foreach Signed-off-by: xdlbdy Signed-off-by: xdlbdy --- .../trigger/validation/suscription_test.go | 4 +- internal/primitive/transform/action/action.go | 15 +++ .../transform/action/array/foreach.go | 64 ++++++++++++ .../transform/action/array/foreach_test.go | 68 +++++++++++++ .../{render/array.go => array/render.go} | 2 +- .../array_test.go => array/render_test.go} | 6 +- internal/primitive/transform/arg/arg.go | 8 +- internal/primitive/transform/arg/event.go | 3 +- .../primitive/transform/runtime/action.go | 59 ++++++++--- .../transform/runtime/action_bench_test.go | 3 +- internal/primitive/transform/runtime/init.go | 7 +- internal/trigger/util/event.go | 97 ++++++++++++++++--- internal/trigger/util/event_test.go | 59 ++++++++++- 13 files changed, 345 insertions(+), 50 deletions(-) create mode 100644 internal/primitive/transform/action/array/foreach.go create mode 100644 internal/primitive/transform/action/array/foreach_test.go rename internal/primitive/transform/action/{render/array.go => array/render.go} (99%) rename internal/primitive/transform/action/{render/array_test.go => array/render_test.go} (98%) diff --git a/internal/controller/trigger/validation/suscription_test.go b/internal/controller/trigger/validation/suscription_test.go index cbf686b9a..78998d752 100644 --- a/internal/controller/trigger/validation/suscription_test.go +++ b/internal/controller/trigger/validation/suscription_test.go @@ -18,12 +18,10 @@ import ( "context" "testing" - "google.golang.org/protobuf/types/known/structpb" - ctrlpb "github.com/linkall-labs/vanus/proto/pkg/controller" metapb "github.com/linkall-labs/vanus/proto/pkg/meta" - . "github.com/smartystreets/goconvey/convey" + "google.golang.org/protobuf/types/known/structpb" ) func TestSubscriptionRequestValidator(t *testing.T) { diff --git a/internal/primitive/transform/action/action.go b/internal/primitive/transform/action/action.go index d844f17ab..909fe9bec 100644 --- a/internal/primitive/transform/action/action.go +++ b/internal/primitive/transform/action/action.go @@ -143,3 +143,18 @@ var ( ErrExist = fmt.Errorf("action have exist") ErrArgNumber = fmt.Errorf("action arg number invalid") ) + +type NestAction interface { + Action + InitAction(actions []Action) error +} + +type NestActionImpl struct { + CommonAction + Actions []Action +} + +func (c *NestActionImpl) InitAction(actions []Action) error { + c.Actions = actions + return nil +} diff --git a/internal/primitive/transform/action/array/foreach.go b/internal/primitive/transform/action/array/foreach.go new file mode 100644 index 000000000..470626893 --- /dev/null +++ b/internal/primitive/transform/action/array/foreach.go @@ -0,0 +1,64 @@ +// Copyright 2023 Linkall Inc. +// +// 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 array + +import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action" + "github.com/linkall-labs/vanus/internal/primitive/transform/arg" + "github.com/linkall-labs/vanus/internal/primitive/transform/common" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/pkg/errors" +) + +// ["array_foreach","array root", function]. +type arrayForeachAction struct { + action.NestActionImpl +} + +func NewArrayForeachAction() action.Action { + a := &arrayForeachAction{} + a.CommonAction = action.CommonAction{ + ActionName: "ARRAY_FOREACH", + FixedArgs: []arg.TypeList{[]arg.Type{arg.EventData}}, + } + return a +} + +func (a *arrayForeachAction) Init(args []arg.Arg) error { + a.TargetArg = args[0] + a.Args = args + a.ArgTypes = []common.Type{common.Array} + return nil +} + +func (a *arrayForeachAction) Execute(ceCtx *context.EventContext) error { + args, err := a.RunArgs(ceCtx) + if err != nil { + return err + } + arrayValue, _ := args[0].([]interface{}) + for i := range arrayValue { + newCtx := &context.EventContext{ + Data: arrayValue[i], + } + for i := range a.Actions { + err = a.Actions[i].Execute(newCtx) + if err != nil { + return errors.Wrapf(err, "action %dst execute error", i+1) + } + } + } + return a.TargetArg.SetValue(ceCtx, arrayValue) +} diff --git a/internal/primitive/transform/action/array/foreach_test.go b/internal/primitive/transform/action/array/foreach_test.go new file mode 100644 index 000000000..59f47d473 --- /dev/null +++ b/internal/primitive/transform/action/array/foreach_test.go @@ -0,0 +1,68 @@ +// Copyright 2023 Linkall Inc. +// +// 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 array_test + +import ( + stdJson "encoding/json" + "testing" + + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/array" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" + "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" + . "github.com/smartystreets/goconvey/convey" +) + +func TestReplaceArrayAction(t *testing.T) { + funcName := array.NewArrayForeachAction().Name() + Convey("test replace array valid", t, func() { + jsonStr := `{ + "array": [ + { + "name": "name1", + "number": 1 + }, + { + "name": "name2", + "number": "2" + }, + { + "name": "name3", + "number": "3" + } + ] + }` + Convey("replace valid", func() { + a, err := runtime.NewAction([]interface{}{funcName, "$.data.array", []interface{}{"add_prefix", "@.name", "prefix"}}) + So(err, ShouldBeNil) + + e := cetest.MinEvent() + var data map[string]interface{} + err = stdJson.Unmarshal([]byte(jsonStr), &data) + So(err, ShouldBeNil) + err = a.Execute(&context.EventContext{ + Event: &e, + Data: data, + }) + So(err, ShouldBeNil) + value, exist := data["array"] + So(exist, ShouldBeTrue) + So(len(value.([]interface{})), ShouldEqual, 3) + So(value.([]interface{})[0].(map[string]interface{})["name"], ShouldEqual, "prefixname1") + So(value.([]interface{})[1].(map[string]interface{})["name"], ShouldEqual, "prefixname2") + So(value.([]interface{})[2].(map[string]interface{})["name"], ShouldEqual, "prefixname3") + }) + }) +} diff --git a/internal/primitive/transform/action/render/array.go b/internal/primitive/transform/action/array/render.go similarity index 99% rename from internal/primitive/transform/action/render/array.go rename to internal/primitive/transform/action/array/render.go index 5d34c6290..b7341bd29 100644 --- a/internal/primitive/transform/action/render/array.go +++ b/internal/primitive/transform/action/array/render.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package render +package array import ( "fmt" diff --git a/internal/primitive/transform/action/render/array_test.go b/internal/primitive/transform/action/array/render_test.go similarity index 98% rename from internal/primitive/transform/action/render/array_test.go rename to internal/primitive/transform/action/array/render_test.go index bf6ba7c3f..5ae1090b2 100644 --- a/internal/primitive/transform/action/render/array_test.go +++ b/internal/primitive/transform/action/array/render_test.go @@ -12,21 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -package render_test +package array_test import ( stdJson "encoding/json" "testing" cetest "github.com/cloudevents/sdk-go/v2/test" - "github.com/linkall-labs/vanus/internal/primitive/transform/action/render" + "github.com/linkall-labs/vanus/internal/primitive/transform/action/array" "github.com/linkall-labs/vanus/internal/primitive/transform/context" "github.com/linkall-labs/vanus/internal/primitive/transform/runtime" . "github.com/smartystreets/goconvey/convey" ) func TestRenderArrayAction(t *testing.T) { - funcName := render.NewRenderArrayAction().Name() + funcName := array.NewRenderArrayAction().Name() Convey("test render array invalid", t, func() { jsonStr := `{ "array": [ diff --git a/internal/primitive/transform/arg/arg.go b/internal/primitive/transform/arg/arg.go index a928ed070..3c2a1020e 100644 --- a/internal/primitive/transform/arg/arg.go +++ b/internal/primitive/transform/arg/arg.go @@ -83,6 +83,9 @@ func NewArg(arg interface{}) (Arg, error) { if argLen >= 2 && argName[:2] == EventArgPrefix { return newEventAttribute(argName) } + if argLen >= 2 && argName[:2] == EventDataSubArgPrefix { + return newEventData(EventDataArgPrefix + "." + argName[2:]), nil + } if argLen >= 3 && argName[0] == '<' && argName[argLen-1] == '>' && argName[1] != '@' { return newDefine(argName), nil } @@ -91,6 +94,7 @@ func NewArg(arg interface{}) (Arg, error) { } const ( - EventArgPrefix = "$." - EventDataArgPrefix = EventArgPrefix + "data" + EventArgPrefix = "$." + EventDataArgPrefix = EventArgPrefix + "data" + EventDataSubArgPrefix = "@." ) diff --git a/internal/primitive/transform/arg/event.go b/internal/primitive/transform/arg/event.go index 3c67c1f18..dd43751c7 100644 --- a/internal/primitive/transform/arg/event.go +++ b/internal/primitive/transform/arg/event.go @@ -115,8 +115,7 @@ func (arg eventData) Evaluate(ceCtx *context.EventContext) (interface{}, error) } func (arg eventData) SetValue(ceCtx *context.EventContext, value interface{}) error { - util.SetData(ceCtx.Data, arg.path, value) - return nil + return util.SetData(ceCtx.Data, arg.path, value) } func (arg eventData) DeleteValue(ceCtx *context.EventContext) error { diff --git a/internal/primitive/transform/runtime/action.go b/internal/primitive/transform/runtime/action.go index 12dd0e760..6d4ca0838 100644 --- a/internal/primitive/transform/runtime/action.go +++ b/internal/primitive/transform/runtime/action.go @@ -15,8 +15,7 @@ package runtime import ( - "fmt" - stdStrs "strings" + "strings" "github.com/linkall-labs/vanus/internal/primitive/transform/action" "github.com/linkall-labs/vanus/internal/primitive/transform/arg" @@ -29,9 +28,9 @@ var actionMap = map[string]newAction{} func AddAction(actionFn newAction) error { a := actionFn() - name := stdStrs.ToUpper(a.Name()) + name := strings.ToUpper(a.Name()) if _, exist := actionMap[name]; exist { - return fmt.Errorf("action %s has exist", name) + return errors.Errorf("action %s has exist", name) } actionMap[name] = actionFn return nil @@ -40,36 +39,64 @@ func AddAction(actionFn newAction) error { func NewAction(command []interface{}) (action.Action, error) { funcName, ok := command[0].(string) if !ok { - return nil, fmt.Errorf("command name must be string") + return nil, errors.Errorf("command name must be string") } - actionFn, exist := actionMap[stdStrs.ToUpper(funcName)] + actionFn, exist := actionMap[strings.ToUpper(funcName)] if !exist { - return nil, fmt.Errorf("command %s not exist", funcName) + return nil, errors.Errorf("command %s not exist", funcName) } a := actionFn() argNum := len(command) - 1 if argNum < a.Arity() { - return nil, fmt.Errorf("command %s arg number is not enough, it need %d but only have %d", + return nil, errors.Errorf("command %s arg number is not enough, it need %d but only have %d", funcName, a.Arity(), argNum) } - if argNum > a.Arity() && !a.IsVariadic() { - return nil, fmt.Errorf("command %s arg number is too many, it need %d but have %d", funcName, a.Arity(), argNum) + nestAction, isNestAction := a.(action.NestAction) + if !isNestAction { + if argNum > a.Arity() && !a.IsVariadic() { + return nil, errors.Errorf("command %s arg number is too many, it need %d but have %d", funcName, a.Arity(), argNum) + } + } else { + argNum = a.Arity() } args := make([]arg.Arg, argNum) - for i := 1; i < len(command); i++ { - _arg, err := arg.NewArg(command[i]) + for i := 0; i < len(args); i++ { + index := i + 1 + _arg, err := arg.NewArg(command[index]) if err != nil { - return nil, errors.Wrapf(err, "command %s arg %d is invalid", funcName, i) + return nil, errors.Wrapf(err, "command %s arg %d is invalid", funcName, index) } - argType := a.ArgType(i - 1) + argType := a.ArgType(i) if !argType.Contains(_arg) { - return nil, fmt.Errorf("command %s arg %d not support type %s", funcName, i, _arg.Type()) + return nil, errors.Errorf("command %s arg %d not support type %s", funcName, index, _arg.Type()) } - args[i-1] = _arg + args[i] = _arg } err := a.Init(args) if err != nil { return nil, errors.Wrapf(err, "command %s init error", funcName) } + if isNestAction { + actions := make([]action.Action, len(command)-1-argNum) + if len(actions) == 0 { + return nil, errors.Errorf("command %s arg number is not enough, lost function arg", funcName) + } + for i := 0; i < len(actions); i++ { + index := i + 1 + argNum + if arr, ok := command[index].([]interface{}); ok { + _a, err := NewAction(arr) + if err != nil { + return nil, errors.Wrapf(err, "action %s arg %d new action failed", funcName, index) + } + actions[i] = _a + } else { + return nil, errors.Errorf("arg %d is invalid", index) + } + } + err = nestAction.InitAction(actions) + if err != nil { + return nil, errors.Wrapf(err, "command %s init action error", funcName) + } + } return a, nil } diff --git a/internal/primitive/transform/runtime/action_bench_test.go b/internal/primitive/transform/runtime/action_bench_test.go index 13699d78a..fdcb2e65c 100644 --- a/internal/primitive/transform/runtime/action_bench_test.go +++ b/internal/primitive/transform/runtime/action_bench_test.go @@ -17,10 +17,9 @@ package runtime import ( "testing" - "github.com/linkall-labs/vanus/internal/primitive/transform/context" - ce "github.com/cloudevents/sdk-go/v2" cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/linkall-labs/vanus/internal/primitive/transform/context" ) func actionBenchmark(command []interface{}) func(b *testing.B) { diff --git a/internal/primitive/transform/runtime/init.go b/internal/primitive/transform/runtime/init.go index 27bf52286..e204edfb3 100644 --- a/internal/primitive/transform/runtime/init.go +++ b/internal/primitive/transform/runtime/init.go @@ -15,11 +15,11 @@ package runtime import ( + "github.com/linkall-labs/vanus/internal/primitive/transform/action/array" "github.com/linkall-labs/vanus/internal/primitive/transform/action/common" "github.com/linkall-labs/vanus/internal/primitive/transform/action/condition" "github.com/linkall-labs/vanus/internal/primitive/transform/action/datetime" "github.com/linkall-labs/vanus/internal/primitive/transform/action/math" - "github.com/linkall-labs/vanus/internal/primitive/transform/action/render" "github.com/linkall-labs/vanus/internal/primitive/transform/action/source" "github.com/linkall-labs/vanus/internal/primitive/transform/action/strings" "github.com/linkall-labs/vanus/internal/primitive/transform/action/structs" @@ -53,8 +53,9 @@ func init() { strings.NewReplaceBetweenPositionsAction, // condition condition.NewConditionIfAction, - // render - render.NewRenderArrayAction, + // array + array.NewRenderArrayAction, + array.NewArrayForeachAction, // common common.NewLengthAction, // source diff --git a/internal/trigger/util/event.go b/internal/trigger/util/event.go index 16e9b181e..114634ccc 100644 --- a/internal/trigger/util/event.go +++ b/internal/trigger/util/event.go @@ -17,12 +17,14 @@ package util import ( "encoding/json" "fmt" + "strconv" "strings" "time" ce "github.com/cloudevents/sdk-go/v2" "github.com/ohler55/ojg/jp" "github.com/ohler55/ojg/oj" + "github.com/pkg/errors" ) // LookupAttribute lookup event attribute value by attribute name. @@ -147,7 +149,7 @@ func SetAttribute(e *ce.Event, attr string, value interface{}) error { } return event.SetDataSchema(v) case "datacontenttype", "specversion": - return fmt.Errorf("attribute %s not support modify", attr) + return errors.Errorf("attribute %s not support modify", attr) default: return event.SetExtension(attr, value) } @@ -166,32 +168,101 @@ func DeleteAttribute(e *ce.Event, attr string) error { } // SetData set value to data path, now data must is map, not support array. -func SetData(data interface{}, path string, value interface{}) { +func SetData(data interface{}, path string, value interface{}) error { paths := strings.Split(path, ".") switch data.(type) { case map[string]interface{}: - setData(data, paths, value) + return setData(data, paths, value) case []interface{}: // todo ,now not support } + return errors.New("not support") } -func setData(data interface{}, paths []string, value interface{}) { +func setData(data interface{}, paths []string, value interface{}) error { + pathType, key, index, err := getPathIndex(paths[0]) + if err != nil { + return err + } switch m := data.(type) { case map[string]interface{}: + switch pathType { + case pathMap: + // key . + if len(paths) == 1 { + m[key] = value + return nil + } + v, ok := m[key] + if !ok || v == nil { + v = map[string]interface{}{} + m[key] = v + } + return setData(v, paths[1:], value) + case pathArray: + // arr[2] . + v, ok := m[key] + if !ok || v == nil { + m[key] = make([]interface{}, index+1) + } else { + vv, ok := v.([]interface{}) + if !ok { + return errors.Errorf("json path %s is array, but value is not array", paths[0]) + } + for i := len(vv); i <= index; i++ { + vv = append(vv, nil) + } + m[key] = vv + } + return setData(m[key], paths, value) + } + case []interface{}: if len(paths) == 1 { - m[paths[0]] = value - return + // arr[2]. + m[index] = value + return nil } - v, ok := m[paths[0]] - if !ok { - v = make(map[string]interface{}) - m[paths[0]] = v + v := m[index] + if v == nil { + m[index] = map[string]interface{}{} + } else { + _, ok := v.(map[string]interface{}) + if !ok { + // todo multidimensional array + return errors.Errorf("json path %s is array, but index %d value is not map", paths[0], index) + } } - setData(v, paths[1:], value) - case []interface{}: - // todo ,now not support + return setData(m[index], paths[1:], value) + } + return errors.New("not support") +} + +type pathType string + +const ( + pathMap pathType = "map" + pathArray pathType = "array" +) + +func getPathIndex(path string) (pathType, string, int, error) { + x := strings.Index(path, "[") + if x <= 0 { + return pathMap, path, 0, nil + } + y := strings.Index(path[x+1:], "]") + if y <= 0 { + return pathMap, path, 0, nil + } + index := path[x+1 : x+1+y] + v, err := strconv.ParseInt(index, 10, 32) + if err != nil { + // todo map or array + return pathMap, path, 0, errors.Wrapf(err, "json path %s get array index error, get a not number value", path) + } + if v < 0 { + return pathArray, path[:x], 0, errors.Errorf("json path %s get array index get a negative number", path) } + return pathArray, path[:x], int(v), nil } func DeleteData(data interface{}, path string) error { diff --git a/internal/trigger/util/event_test.go b/internal/trigger/util/event_test.go index 7165f2acc..cb47b720e 100644 --- a/internal/trigger/util/event_test.go +++ b/internal/trigger/util/event_test.go @@ -151,6 +151,24 @@ func TestSetData(t *testing.T) { }, "str": "stringV", "array": []interface{}{1.1, "str"}, + "arrayObj": []interface{}{ + map[string]interface{}{ + "map": map[string]interface{}{ + "number": 123.4, + "str": "str", + }, + "str": "stringV", + "array": []interface{}{1.1, "str"}, + }, + map[string]interface{}{ + "map": map[string]interface{}{ + "number": 123.4, + "str": "str", + }, + "str": "stringV", + "array": []interface{}{1.1, "str"}, + }, + }, } Convey("test add root key", func() { Convey("add common", func() { @@ -173,13 +191,21 @@ func TestSetData(t *testing.T) { So(exist, ShouldBeTrue) So(v, ShouldEqual, "v") }) - Convey("add array", func() { + Convey("add array value", func() { SetData(data, "addKey", []interface{}{123, "str"}) v, exist := data["addKey"].([]interface{}) So(exist, ShouldBeTrue) So(v[0], ShouldEqual, 123) So(v[1], ShouldEqual, "str") }) + Convey("array value add element", func() { + SetData(data, "array[3]", []interface{}{123, "str"}) + vv, exist := data["array"].([]interface{}) + So(exist, ShouldBeTrue) + v := vv[3].([]interface{}) + So(v[0], ShouldEqual, 123) + So(v[1], ShouldEqual, "str") + }) }) Convey("test replace root key", func() { SetData(data, "str", 1.1) @@ -208,18 +234,41 @@ func TestSetData(t *testing.T) { So(exist, ShouldBeTrue) So(v, ShouldEqual, "v") }) - Convey("add array", func() { + Convey("add value array", func() { SetData(data, "map.addKey", []interface{}{123, "string"}) v, exist := data["map"].(map[string]interface{})["addKey"].([]interface{}) So(exist, ShouldBeTrue) So(v[0], ShouldEqual, 123) So(v[1], ShouldEqual, "string") }) + Convey("add no exist array with object", func() { + SetData(data, "map.addKey[0].array", []interface{}{123, "string"}) + v, exist := data["map"].(map[string]interface{})["addKey"].([]interface{})[0].(map[string]interface{})["array"].([]interface{}) + So(exist, ShouldBeTrue) + So(v[0], ShouldEqual, 123) + So(v[1], ShouldEqual, "string") + }) + Convey("array object value add key", func() { + SetData(data, "arrayObj[0].addArray", []interface{}{123, "string"}) + v, exist := data["arrayObj"].([]interface{})[0].(map[string]interface{})["addArray"].([]interface{}) + So(exist, ShouldBeTrue) + So(v[0], ShouldEqual, 123) + So(v[1], ShouldEqual, "string") + }) }) Convey("test replace second key", func() { - SetData(data, "map.str", map[string]interface{}{"k": "v"}) - _, exist := data["map"].(map[string]interface{})["str"] - So(exist, ShouldBeTrue) + Convey("replace str", func() { + SetData(data, "map.str", map[string]interface{}{"k": "v"}) + v, exist := data["map"].(map[string]interface{})["str"] + So(exist, ShouldBeTrue) + So(v.(map[string]interface{})["k"], ShouldEqual, "v") + }) + Convey("array object value replace key", func() { + SetData(data, "arrayObj[1].str", map[string]interface{}{"k": "v"}) + v, exist := data["arrayObj"].([]interface{})[1].(map[string]interface{})["str"] + So(exist, ShouldBeTrue) + So(v.(map[string]interface{})["k"], ShouldEqual, "v") + }) }) Convey("test add third key", func() { Convey("add map", func() { From 197c576dd50fb2fb774c756aca99c02bf485f10e Mon Sep 17 00:00:00 2001 From: jyjiangkai Date: Wed, 1 Feb 2023 15:08:02 +0800 Subject: [PATCH 45/46] feat: add cluster subcommand for vsctl (#411) Signed-off-by: jyjiangkai --- vsctl/command/cluster.go | 466 ++++++++++++++++++++++++++++++++++ vsctl/command/connector.go | 423 ++++++++++++++++++++++++++++++ vsctl/command/event.go | 2 +- vsctl/command/eventbus.go | 2 +- vsctl/command/flag.go | 18 +- vsctl/command/global.go | 16 +- vsctl/command/meta.go | 72 ------ vsctl/command/subscription.go | 2 +- vsctl/command/util.go | 21 +- vsctl/main.go | 9 +- vsctl/version.go | 2 +- 11 files changed, 949 insertions(+), 84 deletions(-) create mode 100644 vsctl/command/cluster.go create mode 100644 vsctl/command/connector.go delete mode 100644 vsctl/command/meta.go diff --git a/vsctl/command/cluster.go b/vsctl/command/cluster.go new file mode 100644 index 000000000..ea1f2b7ba --- /dev/null +++ b/vsctl/command/cluster.go @@ -0,0 +1,466 @@ +// Copyright 2023 Linkall Inc. +// +// 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 command + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "os" + + "github.com/fatih/color" + "github.com/jedib0t/go-pretty/v6/table" + "github.com/jedib0t/go-pretty/v6/text" + "github.com/spf13/cobra" +) + +type ClusterCreate struct { + ControllerReplicas int32 `json:"controller_replicas,omitempty"` + ControllerStorageSize string `json:"controller_storage_size,omitempty"` + StoreReplicas int32 `json:"store_replicas,omitempty"` + StoreStorageSize string `json:"store_storage_size,omitempty"` + Version string `json:"version,omitempty"` +} + +type ClusterDelete struct { + Force *bool `json:"force,omitempty"` +} + +type ClusterPatch struct { + ControllerReplicas int32 `json:"controller_replicas,omitempty"` + StoreReplicas int32 `json:"store_replicas,omitempty"` + TriggerReplicas int32 `json:"trigger_replicas,omitempty"` + Version string `json:"version,omitempty"` +} + +type ClusterInfo struct { + Status string `json:"status,omitempty"` + Version string `json:"version,omitempty"` +} + +type GetClusterOKBody struct { + Code *int32 `json:"code"` + Data *ClusterInfo `json:"data"` + Message *string `json:"message"` +} + +func NewClusterCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "cluster sub-command ", + Short: "vanus cluster operations", + } + cmd.AddCommand(createClusterCommand()) + cmd.AddCommand(deleteClusterCommand()) + cmd.AddCommand(upgradeClusterCommand()) + cmd.AddCommand(scaleClusterCommand()) + cmd.AddCommand(getClusterCommand()) + return cmd +} + +func createClusterCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "create", + Short: "create a cluster", + Run: func(cmd *cobra.Command, args []string) { + operator_endpoint, err := cmd.Flags().GetString("operator-endpoint") + if err != nil { + cmdFailedf(cmd, "get operator endpoint failed: %s", err) + } + + if !operatorIsDeployed(cmd, operator_endpoint) { + cmdFailedWithHelpNotice(cmd, "The vanus operator has not been deployed. Please use the following command to deploy: \n\n kubectl apply -f https://download.linkall.com/vanus/operator/latest.yml") + } + + client := &http.Client{} + url := fmt.Sprintf("%s%s%s/cluster", HttpPrefix, operator_endpoint, BaseUrl) + cluster := ClusterCreate{ + ControllerReplicas: controllerReplicas, + ControllerStorageSize: controllerStorageSize, + StoreReplicas: storeReplicas, + StoreStorageSize: storeStorageSize, + Version: clusterVersion, + } + dataByte, err := json.Marshal(cluster) + if err != nil { + cmdFailedf(cmd, "json marshal cluster failed: %s", err) + } + bodyReader := bytes.NewReader(dataByte) + req, err := http.NewRequest("POST", url, bodyReader) + if err != nil { + cmdFailedf(cmd, "new http request failed: %s", err) + } + + req.Header.Set("Content-Type", "application/json") + resp, err := client.Do(req) + if err != nil { + cmdFailedf(cmd, "create cluster failed: %s", err) + } + defer resp.Body.Close() + + if IsFormatJSON(cmd) { + data, _ := json.Marshal(map[string]interface{}{"Result": "Create Cluster Success"}) + color.Green(string(data)) + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"Result"}) + t.AppendRow(table.Row{"Create Cluster Success"}) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + {Number: 2, AlignHeader: text.AlignCenter}, + }) + t.SetOutputMirror(os.Stdout) + t.Render() + } + }, + } + cmd.Flags().StringVar(&clusterVersion, "version", "v0.6.0", "cluster version") + cmd.Flags().Int32Var(&controllerReplicas, "controller-replicas", 3, "controller replicas") + cmd.Flags().StringVar(&controllerStorageSize, "controller-storage-size", "1Gi", "controller storage size") + cmd.Flags().Int32Var(&storeReplicas, "store-replicas", 3, "store replicas") + cmd.Flags().StringVar(&storeStorageSize, "store-storage-size", "1Gi", "store storage size") + return cmd +} + +func deleteClusterCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "delete", + Short: "delete a cluster", + Run: func(cmd *cobra.Command, args []string) { + operator_endpoint, err := cmd.Flags().GetString("operator-endpoint") + if err != nil { + cmdFailedf(cmd, "get operator endpoint failed: %s", err) + } + + client := &http.Client{} + url := fmt.Sprintf("%s%s%s/cluster", HttpPrefix, operator_endpoint, BaseUrl) + force := false + cluster := ClusterDelete{ + Force: &force, + } + dataByte, err := json.Marshal(cluster) + if err != nil { + cmdFailedf(cmd, "json marshal cluster failed: %s", err) + } + bodyReader := bytes.NewReader(dataByte) + req, err := http.NewRequest("DELETE", url, bodyReader) + if err != nil { + cmdFailedf(cmd, "new http request failed: %s", err) + } + + req.Header.Set("Content-Type", "application/json") + resp, err := client.Do(req) + if err != nil { + cmdFailedf(cmd, "delete cluster failed: %s", err) + } + defer resp.Body.Close() + + if IsFormatJSON(cmd) { + data, _ := json.Marshal(map[string]interface{}{"Result": "Delete Cluster Success"}) + color.Green(string(data)) + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"Result"}) + t.AppendRow(table.Row{"Delete Cluster Success"}) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + {Number: 2, AlignHeader: text.AlignCenter}, + }) + t.SetOutputMirror(os.Stdout) + t.Render() + } + }, + } + return cmd +} + +func upgradeClusterCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "upgrade", + Short: "upgeade cluster", + Run: func(cmd *cobra.Command, args []string) { + operator_endpoint, err := cmd.Flags().GetString("operator-endpoint") + if err != nil { + cmdFailedf(cmd, "get operator endpoint failed: %s", err) + } + + client := &http.Client{} + url := fmt.Sprintf("%s%s%s/cluster", HttpPrefix, operator_endpoint, BaseUrl) + cluster := ClusterPatch{ + Version: clusterVersion, + } + dataByte, err := json.Marshal(cluster) + if err != nil { + cmdFailedf(cmd, "json marshal cluster failed: %s", err) + } + bodyReader := bytes.NewReader(dataByte) + req, err := http.NewRequest("PATCH", url, bodyReader) + if err != nil { + cmdFailedf(cmd, "new http request failed: %s", err) + } + + req.Header.Set("Content-Type", "application/json") + resp, err := client.Do(req) + if err != nil { + cmdFailedf(cmd, "upgrade cluster failed: %s", err) + } + defer resp.Body.Close() + + if IsFormatJSON(cmd) { + data, _ := json.Marshal(map[string]interface{}{"Result": "Upgrade Cluster Success"}) + color.Green(string(data)) + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"Result"}) + t.AppendRow(table.Row{"Upgrade Cluster Success"}) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + {Number: 2, AlignHeader: text.AlignCenter}, + }) + t.SetOutputMirror(os.Stdout) + t.Render() + } + }, + } + cmd.Flags().StringVar(&clusterVersion, "version", "v0.6.0", "cluster version") + return cmd +} + +func scaleClusterCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "scale", + Short: "scale cluster components", + } + cmd.AddCommand(scaleControllerReplicas()) + cmd.AddCommand(scaleStoreReplicas()) + cmd.AddCommand(scaleTriggerReplicas()) + return cmd +} + +func scaleControllerReplicas() *cobra.Command { + cmd := &cobra.Command{ + Use: "controller", + Short: "scale controller replicas", + Run: func(cmd *cobra.Command, args []string) { + operator_endpoint, err := cmd.Flags().GetString("operator-endpoint") + if err != nil { + cmdFailedf(cmd, "get operator endpoint failed: %s", err) + } + + client := &http.Client{} + url := fmt.Sprintf("%s%s%s/cluster", HttpPrefix, operator_endpoint, BaseUrl) + cluster := ClusterPatch{ + ControllerReplicas: controllerReplicas, + } + dataByte, err := json.Marshal(cluster) + if err != nil { + cmdFailedf(cmd, "json marshal cluster failed: %s", err) + } + bodyReader := bytes.NewReader(dataByte) + req, err := http.NewRequest("PATCH", url, bodyReader) + if err != nil { + cmdFailedf(cmd, "new http request failed: %s", err) + } + + req.Header.Set("Content-Type", "application/json") + resp, err := client.Do(req) + if err != nil { + cmdFailedf(cmd, "scale controller failed: %s", err) + } + defer resp.Body.Close() + + if IsFormatJSON(cmd) { + data, _ := json.Marshal(map[string]interface{}{"Result": "Scale Controller Success"}) + color.Green(string(data)) + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"Result"}) + t.AppendRow(table.Row{"Scale Controller Success"}) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + {Number: 2, AlignHeader: text.AlignCenter}, + }) + t.SetOutputMirror(os.Stdout) + t.Render() + } + }, + } + cmd.Flags().Int32Var(&controllerReplicas, "replicas", 3, "replicas") + return cmd +} + +func scaleStoreReplicas() *cobra.Command { + cmd := &cobra.Command{ + Use: "store", + Short: "scale store replicas", + Run: func(cmd *cobra.Command, args []string) { + operator_endpoint, err := cmd.Flags().GetString("operator-endpoint") + if err != nil { + cmdFailedf(cmd, "get operator endpoint failed: %s", err) + } + + client := &http.Client{} + url := fmt.Sprintf("%s%s%s/cluster", HttpPrefix, operator_endpoint, BaseUrl) + cluster := ClusterPatch{ + StoreReplicas: storeReplicas, + } + dataByte, err := json.Marshal(cluster) + if err != nil { + cmdFailedf(cmd, "json marshal cluster failed: %s", err) + } + bodyReader := bytes.NewReader(dataByte) + req, err := http.NewRequest("PATCH", url, bodyReader) + if err != nil { + cmdFailedf(cmd, "new http request failed: %s", err) + } + + req.Header.Set("Content-Type", "application/json") + resp, err := client.Do(req) + if err != nil { + cmdFailedf(cmd, "scale Store failed: %s", err) + } + defer resp.Body.Close() + + if IsFormatJSON(cmd) { + data, _ := json.Marshal(map[string]interface{}{"Result": "Scale Store Success"}) + color.Green(string(data)) + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"Result"}) + t.AppendRow(table.Row{"Scale Store Success"}) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + {Number: 2, AlignHeader: text.AlignCenter}, + }) + t.SetOutputMirror(os.Stdout) + t.Render() + } + }, + } + cmd.Flags().Int32Var(&storeReplicas, "replicas", 3, "replicas") + return cmd +} + +func scaleTriggerReplicas() *cobra.Command { + cmd := &cobra.Command{ + Use: "trigger", + Short: "scale trigger replicas", + Run: func(cmd *cobra.Command, args []string) { + operator_endpoint, err := cmd.Flags().GetString("operator-endpoint") + if err != nil { + cmdFailedf(cmd, "get operator endpoint failed: %s", err) + } + + client := &http.Client{} + url := fmt.Sprintf("%s%s%s/cluster", HttpPrefix, operator_endpoint, BaseUrl) + cluster := ClusterPatch{ + TriggerReplicas: triggerReplicas, + } + dataByte, err := json.Marshal(cluster) + if err != nil { + cmdFailedf(cmd, "json marshal cluster failed: %s", err) + } + bodyReader := bytes.NewReader(dataByte) + req, err := http.NewRequest("PATCH", url, bodyReader) + if err != nil { + cmdFailedf(cmd, "new http request failed: %s", err) + } + + req.Header.Set("Content-Type", "application/json") + resp, err := client.Do(req) + if err != nil { + cmdFailedf(cmd, "scale trigger failed: %s", err) + } + defer resp.Body.Close() + + if IsFormatJSON(cmd) { + data, _ := json.Marshal(map[string]interface{}{"Result": "Scale Trigger Success"}) + color.Green(string(data)) + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"Result"}) + t.AppendRow(table.Row{"Scale Trigger Success"}) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + {Number: 2, AlignHeader: text.AlignCenter}, + }) + t.SetOutputMirror(os.Stdout) + t.Render() + } + }, + } + cmd.Flags().Int32Var(&triggerReplicas, "replicas", 3, "replicas") + return cmd +} + +func getClusterCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "status", + Short: "get cluster status", + Run: func(cmd *cobra.Command, args []string) { + operator_endpoint, err := cmd.Flags().GetString("operator-endpoint") + if err != nil { + cmdFailedf(cmd, "get operator endpoint failed: %s", err) + } + + client := &http.Client{} + url := fmt.Sprintf("%s%s%s/cluster", HttpPrefix, operator_endpoint, BaseUrl) + req, err := http.NewRequest("GET", url, &bytes.Reader{}) + if err != nil { + cmdFailedf(cmd, "new http request failed: %s", err) + } + + req.Header.Set("Content-Type", "application/json") + resp, err := client.Do(req) + if err != nil { + cmdFailedf(cmd, "get cluster failed: %s", err) + } + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + cmdFailedf(cmd, "read response body: %s", err) + } + info := &GetClusterOKBody{} + err = json.Unmarshal(body, info) + if err != nil { + cmdFailedf(cmd, "json unmarshal failed: %s", err) + } + + if IsFormatJSON(cmd) { + color.Yellow("WARN: this command doesn't support --output-format\n") + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"Name", "Result"}) + t.AppendRows([]table.Row{ + {"Gateway Endpoints", mustGetGatewayEndpoint(cmd)}, + {"CloudEvents Endpoints", mustGetGatewayCloudEventsEndpoint(cmd)}, + {"Cluster Version", info.Data.Version}, + {"Cluster Status", info.Data.Status}, + }) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + {Number: 2, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + }) + t.SetStyle(table.StyleLight) + t.Style().Options.SeparateRows = true + t.Style().Box = table.StyleBoxDefault + t.SetOutputMirror(os.Stdout) + t.Render() + } + }, + } + return cmd +} diff --git a/vsctl/command/connector.go b/vsctl/command/connector.go new file mode 100644 index 000000000..265b92163 --- /dev/null +++ b/vsctl/command/connector.go @@ -0,0 +1,423 @@ +// Copyright 2023 Linkall Inc. +// +// 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 command + +import ( + "bufio" + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "os" + + "github.com/fatih/color" + "github.com/jedib0t/go-pretty/v6/table" + "github.com/jedib0t/go-pretty/v6/text" + "github.com/spf13/cobra" +) + +var ( + supportedConnectors = []ConnectorSpec{ + { + Kind: "source", + Type: "http", + Version: "latest", + }, + { + Kind: "sink", + Type: "feishu", + Version: "latest", + }, + } +) + +type ConnectorSpec struct { + Kind string + Type string + Version string +} + +type ConnectorCreate struct { + Config string `json:"config,omitempty"` + Kind string `json:"kind,omitempty"` + Name string `json:"name,omitempty"` + Type string `json:"type,omitempty"` + Version string `json:"version,omitempty"` +} + +type ConnectorDelete struct { + Force *bool `json:"force,omitempty"` +} + +type ConnectorPatch struct { + ControllerReplicas int32 `json:"controller_replicas,omitempty"` + StoreReplicas int32 `json:"store_replicas,omitempty"` + TriggerReplicas int32 `json:"trigger_replicas,omitempty"` + Version string `json:"version,omitempty"` +} + +type ConnectorInfo struct { + Kind string `json:"kind,omitempty"` + Name string `json:"name,omitempty"` + Version string `json:"version,omitempty"` + Status string `json:"status,omitempty"` +} + +type GetConnectorOKBody struct { + Code *int32 `json:"code"` + Data *ConnectorInfo `json:"data"` + Message *string `json:"message"` +} + +type ListConnectorOKBody struct { + Code *int32 `json:"code"` + Data []*ConnectorInfo `json:"data"` + Message *string `json:"message"` +} + +func NewConnectorCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "connector sub-command ", + Short: "vanus connector operations", + } + cmd.AddCommand(installConnectorCommand()) + cmd.AddCommand(uninstallConnectorCommand()) + cmd.AddCommand(getConnectorCommand()) + cmd.AddCommand(listConnectorCommand()) + return cmd +} + +func installConnectorCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "install", + Short: "install a connector", + Run: func(cmd *cobra.Command, args []string) { + operator_endpoint, err := cmd.Flags().GetString("operator-endpoint") + if err != nil { + cmdFailedf(cmd, "get operator endpoint failed: %s", err) + } + + if showConnectors { + if IsFormatJSON(cmd) { + color.Yellow("WARN: this command doesn't support --output-format\n") + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"Kind", "Type", "Version"}) + t.AppendRows([]table.Row{ + {"Source", "http", "latest"}, + {"Sink", "feishu", "latest"}, + }) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + {Number: 2, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + {Number: 3, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + }) + t.SetStyle(table.StyleLight) + t.Style().Options.SeparateRows = true + t.Style().Box = table.StyleBoxDefault + t.SetOutputMirror(os.Stdout) + t.Render() + } + return + } + + if kind == "" { + cmdFailedf(cmd, "the --kind flag MUST be set") + } + if kind != "source" && kind != "sink" { + cmdFailedf(cmd, "the --kind flag Only support 'source' or 'sink'") + } + if name == "" { + cmdFailedf(cmd, "the --name flag MUST be set") + } + if ctype == "" { + cmdFailedf(cmd, "the --ctype flag MUST be set") + } + if configfile == "" { + cmdFailedf(cmd, "the --config-file flag MUST be set") + } + + if !operatorIsDeployed(cmd, operator_endpoint) { + cmdFailedWithHelpNotice(cmd, "The vanus operator has not been deployed. Please use the following command to deploy: \n\n kubectl apply -f https://download.linkall.com/vanus/operator/latest.yml") + } + + if isUnsupported(kind, ctype, connectorVersion) { + cmdFailedf(cmd, "Unsupported connector. Please use 'vsctl connector install --list' command to query the list of supported connectors") + } + + client := &http.Client{} + url := fmt.Sprintf("%s%s%s/connectors", HttpPrefix, operator_endpoint, BaseUrl) + data, err := getConfig(configfile) + if err != nil { + cmdFailedf(cmd, "get config failed, file: %s, err: %s", configfile, err) + } + connector := ConnectorCreate{ + Config: data, + Kind: kind, + Name: name, + Type: ctype, + Version: connectorVersion, + } + dataByte, err := json.Marshal(connector) + if err != nil { + cmdFailedf(cmd, "json marshal connector failed: %s", err) + } + bodyReader := bytes.NewReader(dataByte) + req, err := http.NewRequest("POST", url, bodyReader) + if err != nil { + cmdFailedf(cmd, "new http request failed: %s", err) + } + + req.Header.Set("Content-Type", "application/json") + resp, err := client.Do(req) + if err != nil { + cmdFailedf(cmd, "install connector failed: %s", err) + } + defer resp.Body.Close() + + if IsFormatJSON(cmd) { + data, _ := json.Marshal(map[string]interface{}{"Result": "Install Connector Success"}) + color.Green(string(data)) + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"Result"}) + t.AppendRow(table.Row{"Install Connector Success"}) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + {Number: 2, AlignHeader: text.AlignCenter}, + }) + t.SetOutputMirror(os.Stdout) + t.Render() + } + }, + } + cmd.Flags().StringVar(&connectorVersion, "version", "latest", "connector version") + cmd.Flags().StringVar(&configfile, "config-file", "", "connector config file") + cmd.Flags().StringVar(&kind, "kind", "", "connector kind, support 'source' or 'sink'") + cmd.Flags().StringVar(&name, "name", "", "connector name") + cmd.Flags().StringVar(&ctype, "type", "", "connector type") + cmd.Flags().BoolVar(&showConnectors, "list", false, "if show all connector of installable") + return cmd +} + +func uninstallConnectorCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "uninstall", + Short: "uninstall a connector", + Run: func(cmd *cobra.Command, args []string) { + operator_endpoint, err := cmd.Flags().GetString("operator-endpoint") + if err != nil { + cmdFailedf(cmd, "get operator endpoint failed: %s", err) + } + + if name == "" { + cmdFailedf(cmd, "the --name flag MUST be set") + } + + client := &http.Client{} + url := fmt.Sprintf("%s%s%s/connectors?name=%s", HttpPrefix, operator_endpoint, BaseUrl, name) + req, err := http.NewRequest("DELETE", url, &bytes.Reader{}) + if err != nil { + cmdFailedf(cmd, "new http request failed: %s", err) + } + + req.Header.Set("Content-Type", "application/json") + resp, err := client.Do(req) + if err != nil { + cmdFailedf(cmd, "uninstall connector failed: %s", err) + } + defer resp.Body.Close() + + if IsFormatJSON(cmd) { + data, _ := json.Marshal(map[string]interface{}{"Result": "Uninstall Connector Success"}) + color.Green(string(data)) + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"Result"}) + t.AppendRow(table.Row{"Uninstall Connector Success"}) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + {Number: 2, AlignHeader: text.AlignCenter}, + }) + t.SetOutputMirror(os.Stdout) + t.Render() + } + }, + } + cmd.Flags().StringVar(&name, "name", "", "connector name") + return cmd +} + +func listConnectorCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "list connectors", + Run: func(cmd *cobra.Command, args []string) { + operator_endpoint, err := cmd.Flags().GetString("operator-endpoint") + if err != nil { + cmdFailedf(cmd, "list operator endpoint failed: %s", err) + } + + if !operatorIsDeployed(cmd, operator_endpoint) { + cmdFailedWithHelpNotice(cmd, "The vanus operator has not been deployed. Please use the following command to deploy: \n\n kubectl apply -f https://download.linkall.com/vanus/operator/latest.yml") + } + + client := &http.Client{} + url := fmt.Sprintf("%s%s%s/connectors", HttpPrefix, operator_endpoint, BaseUrl) + req, err := http.NewRequest("GET", url, &bytes.Reader{}) + if err != nil { + cmdFailedf(cmd, "new http request failed: %s", err) + } + + req.Header.Set("Content-Type", "application/json") + resp, err := client.Do(req) + if err != nil { + cmdFailedf(cmd, "get connector failed: %s", err) + } + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + cmdFailedf(cmd, "read response body: %s", err) + } + info := &ListConnectorOKBody{} + err = json.Unmarshal(body, info) + if err != nil { + cmdFailedf(cmd, "json unmarshal failed: %s", err) + } + + if IsFormatJSON(cmd) { + color.Yellow("WARN: this command doesn't support --output-format\n") + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"Connector", "Result"}) + for i := range info.Data { + t.AppendRows([]table.Row{ + {"Kind", info.Data[i].Kind}, + {"Name", info.Data[i].Name}, + {"Version", info.Data[i].Version}, + {"Status", info.Data[i].Status}, + }) + } + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + {Number: 2, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + }) + t.SetStyle(table.StyleLight) + t.Style().Options.SeparateRows = true + t.Style().Box = table.StyleBoxDefault + t.SetOutputMirror(os.Stdout) + t.Render() + } + }, + } + return cmd +} + +func getConnectorCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "info", + Short: "get connector info", + Run: func(cmd *cobra.Command, args []string) { + operator_endpoint, err := cmd.Flags().GetString("operator-endpoint") + if err != nil { + cmdFailedf(cmd, "get operator endpoint failed: %s", err) + } + + if name == "" { + cmdFailedf(cmd, "the --name flag MUST be set") + } + + client := &http.Client{} + url := fmt.Sprintf("%s%s%s/connector/%s", HttpPrefix, operator_endpoint, BaseUrl, name) + req, err := http.NewRequest("GET", url, &bytes.Reader{}) + if err != nil { + cmdFailedf(cmd, "new http request failed: %s", err) + } + + req.Header.Set("Content-Type", "application/json") + resp, err := client.Do(req) + if err != nil { + cmdFailedf(cmd, "get connector failed: %s", err) + } + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + cmdFailedf(cmd, "read response body: %s", err) + } + info := &GetConnectorOKBody{} + err = json.Unmarshal(body, info) + if err != nil { + cmdFailedf(cmd, "json unmarshal failed: %s", err) + } + + if IsFormatJSON(cmd) { + color.Yellow("WARN: this command doesn't support --output-format\n") + } else { + t := table.NewWriter() + t.AppendHeader(table.Row{"Connector", "Result"}) + t.AppendRows([]table.Row{ + {"Kind", info.Data.Kind}, + {"Name", info.Data.Name}, + {"Version", info.Data.Version}, + {"Status", info.Data.Status}, + }) + t.SetColumnConfigs([]table.ColumnConfig{ + {Number: 1, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + {Number: 2, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, + }) + t.SetStyle(table.StyleLight) + t.Style().Options.SeparateRows = true + t.Style().Box = table.StyleBoxDefault + t.SetOutputMirror(os.Stdout) + t.Render() + } + }, + } + cmd.Flags().StringVar(&name, "name", "", "connector name") + return cmd +} + +func getConfig(file string) (string, error) { + f, err := os.Open(file) + if err != nil { + return "", err + } + defer f.Close() + value := bytes.Buffer{} + br := bufio.NewReader(f) + for { + line, _, err := br.ReadLine() + if err != nil { + if err == io.EOF { + break + } + return "", err + } + value.Write(line) + value.WriteString("\n") + } + return value.String(), nil +} + +func isUnsupported(kind, ctype, version string) bool { + for _, c := range supportedConnectors { + if c.Kind == kind && c.Type == ctype && c.Version == version { + return false + } + } + return true +} diff --git a/vsctl/command/event.go b/vsctl/command/event.go index a2d92ddc1..29454f366 100644 --- a/vsctl/command/event.go +++ b/vsctl/command/event.go @@ -1,4 +1,4 @@ -// Copyright 2022 Linkall Inc. +// Copyright 2023 Linkall Inc. // // 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/vsctl/command/eventbus.go b/vsctl/command/eventbus.go index abda877c0..c09f64b8e 100644 --- a/vsctl/command/eventbus.go +++ b/vsctl/command/eventbus.go @@ -1,4 +1,4 @@ -// Copyright 2022 Linkall Inc. +// Copyright 2023 Linkall Inc. // // 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/vsctl/command/flag.go b/vsctl/command/flag.go index 685f39418..d4124ca25 100644 --- a/vsctl/command/flag.go +++ b/vsctl/command/flag.go @@ -1,4 +1,4 @@ -// Copyright 2022 Linkall Inc. +// Copyright 2023 Linkall Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -55,6 +55,22 @@ var ( showSegment bool showBlock bool + + // for cluster + clusterVersion string + controllerReplicas int32 + controllerStorageSize string + storeReplicas int32 + storeStorageSize string + triggerReplicas int32 + + // for connector + configfile string + kind string + name string + ctype string + connectorVersion string + showConnectors bool ) const ( diff --git a/vsctl/command/global.go b/vsctl/command/global.go index 5dbb21494..ba5a5e6d7 100644 --- a/vsctl/command/global.go +++ b/vsctl/command/global.go @@ -1,4 +1,4 @@ -// Copyright 2022 Linkall Inc. +// Copyright 2023 Linkall Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -32,11 +32,17 @@ const ( FormatJSON = "json" ) +const ( + HttpPrefix = "http://" + BaseUrl = "/api/v1" +) + type GlobalFlags struct { - Endpoint string - Debug bool - ConfigFile string - Format string + Endpoint string + OperatorEndpoint string + Debug bool + ConfigFile string + Format string } var ( diff --git a/vsctl/command/meta.go b/vsctl/command/meta.go deleted file mode 100644 index 3d433e663..000000000 --- a/vsctl/command/meta.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2022 Linkall Inc. -// -// 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 command - -import ( - "os" - - "github.com/jedib0t/go-pretty/v6/table" - "github.com/jedib0t/go-pretty/v6/text" - "github.com/spf13/cobra" -) - -func NewClusterCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "cluster sub-command ", - Short: "vanus cluster operations", - PersistentPreRun: func(cmd *cobra.Command, args []string) { - InitGatewayClient(cmd) - }, - PersistentPostRun: func(cmd *cobra.Command, args []string) { - DestroyGatewayClient() - }, - } - cmd.AddCommand(controllerCommand()) - return cmd -} - -func controllerCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "controller sub-command", - Short: "get controller metadata", - } - cmd.AddCommand(getControllerTopology()) - return cmd -} - -func getControllerTopology() *cobra.Command { - cmd := &cobra.Command{ - Use: "topology", - Short: "get topology", - Run: func(cmd *cobra.Command, args []string) { - t := table.NewWriter() - t.AppendHeader(table.Row{"Name", "Endpoint"}) - t.AppendRows([]table.Row{ - {"Gateway Endpoints", mustGetGatewayEndpoint(cmd)}, - {"CloudEvents Endpoints", mustGetGatewayCloudEventsEndpoint(cmd)}, - }) - t.SetColumnConfigs([]table.ColumnConfig{ - {Number: 1, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, - {Number: 2, VAlign: text.VAlignMiddle, Align: text.AlignCenter, AlignHeader: text.AlignCenter}, - }) - t.SetStyle(table.StyleLight) - t.Style().Options.SeparateRows = true - t.Style().Box = table.StyleBoxDefault - t.SetOutputMirror(os.Stdout) - t.Render() - }, - } - return cmd -} diff --git a/vsctl/command/subscription.go b/vsctl/command/subscription.go index 5b78e4e71..63c22da17 100644 --- a/vsctl/command/subscription.go +++ b/vsctl/command/subscription.go @@ -1,4 +1,4 @@ -// Copyright 2022 Linkall Inc. +// Copyright 2023 Linkall Inc. // // 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/vsctl/command/util.go b/vsctl/command/util.go index a18c4a732..46259a684 100644 --- a/vsctl/command/util.go +++ b/vsctl/command/util.go @@ -1,4 +1,4 @@ -// Copyright 2022 Linkall Inc. +// Copyright 2023 Linkall Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,8 +15,10 @@ package command import ( + "bytes" "encoding/json" "fmt" + "net/http" "os" "github.com/fatih/color" @@ -55,3 +57,20 @@ func cmdFailedWithHelpNotice(cmd *cobra.Command, format string) { _ = cmd.Help() os.Exit(-1) } + +func operatorIsDeployed(cmd *cobra.Command, endpoint string) bool { + client := &http.Client{} + url := fmt.Sprintf("http://%s/api/v1/vanus/healthz", endpoint) + req, err := http.NewRequest("GET", url, &bytes.Reader{}) + if err != nil { + return false + } + + req.Header.Set("Content-Type", "application/json") + resp, err := client.Do(req) + if err != nil { + return false + } + defer resp.Body.Close() + return true +} diff --git a/vsctl/main.go b/vsctl/main.go index 4c30ff5ee..8466cd210 100644 --- a/vsctl/main.go +++ b/vsctl/main.go @@ -1,4 +1,4 @@ -// Copyright 2022 Linkall Inc. +// Copyright 2023 Linkall Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -42,6 +42,8 @@ func init() { cobra.EnableCommandSorting = false rootCmd.PersistentFlags().StringVar(&globalFlags.Endpoint, "endpoint", "127.0.0.1:8080", "the endpoints of vanus controller") + rootCmd.PersistentFlags().StringVar(&globalFlags.OperatorEndpoint, "operator-endpoint", + "127.0.0.1:8080", "the endpoints of vanus operator") rootCmd.PersistentFlags().StringVarP(&globalFlags.ConfigFile, "config", "C", "~/.vanus/vanus.yml", "the config file of vsctl") rootCmd.PersistentFlags().BoolVarP(&globalFlags.Debug, "debug", "D", false, @@ -53,11 +55,16 @@ func init() { globalFlags.Endpoint = os.Getenv("VANUS_GATEWAY") } + if os.Getenv("VANUS_OPERATOR") != "" { + globalFlags.OperatorEndpoint = os.Getenv("VANUS_OPERATOR") + } + rootCmd.AddCommand( command.NewEventCommand(), command.NewEventbusCommand(), command.NewSubscriptionCommand(), command.NewClusterCommand(), + command.NewConnectorCommand(), newVersionCommand(), ) rootCmd.CompletionOptions.DisableDefaultCmd = true diff --git a/vsctl/version.go b/vsctl/version.go index 71e2d5b7b..71536b094 100644 --- a/vsctl/version.go +++ b/vsctl/version.go @@ -1,4 +1,4 @@ -// Copyright 2022 Linkall Inc. +// Copyright 2023 Linkall Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From 115734791dcf8a6d5c0ce70981bde4e6008ecf9b Mon Sep 17 00:00:00 2001 From: jyjiangkai Date: Thu, 2 Feb 2023 11:07:07 +0800 Subject: [PATCH 46/46] feat: unified proto definition (#412) Signed-off-by: jyjiangkai --- internal/gateway/proxy/proxy.go | 19 +- proto/pkg/proxy/proxy.pb.go | 1027 +++++++++++++++++++++++-------- proto/proto/proxy.proto | 30 +- 3 files changed, 822 insertions(+), 254 deletions(-) diff --git a/internal/gateway/proxy/proxy.go b/internal/gateway/proxy/proxy.go index 1dd245358..7c5ad6104 100644 --- a/internal/gateway/proxy/proxy.go +++ b/internal/gateway/proxy/proxy.go @@ -35,7 +35,6 @@ import ( cehttp "github.com/cloudevents/sdk-go/v2/protocol/http" "github.com/cloudevents/sdk-go/v2/types" recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery" - vanuspb "github.com/linkall-labs/sdk/proto/pkg/vanus" eb "github.com/linkall-labs/vanus/client" "github.com/linkall-labs/vanus/client/pkg/api" "github.com/linkall-labs/vanus/client/pkg/option" @@ -95,7 +94,7 @@ type Config struct { } var ( - _ vanuspb.ClientServer = &ControllerProxy{} + _ proxypb.StoreProxyServer = &ControllerProxy{} ) type ackCallback func(bool) @@ -108,12 +107,12 @@ type message struct { type subscribeCache struct { sequenceID uint64 subscriptionID string - subscribeStream vanuspb.Client_SubscribeServer + subscribeStream proxypb.StoreProxy_SubscribeServer acks sync.Map eventc chan message } -func newSubscribeCache(subscriptionID string, stream vanuspb.Client_SubscribeServer) *subscribeCache { +func newSubscribeCache(subscriptionID string, stream proxypb.StoreProxy_SubscribeServer) *subscribeCache { return &subscribeCache{ sequenceID: 0, subscriptionID: subscriptionID, @@ -127,7 +126,7 @@ func (s *subscribeCache) ch() chan message { return s.eventc } -func (s *subscribeCache) stream() vanuspb.Client_SubscribeServer { +func (s *subscribeCache) stream() proxypb.StoreProxy_SubscribeServer { return s.subscribeStream } @@ -144,7 +143,7 @@ type ControllerProxy struct { cache sync.Map } -func (cp *ControllerProxy) Publish(ctx context.Context, req *vanuspb.PublishRequest) (*emptypb.Empty, error) { +func (cp *ControllerProxy) Publish(ctx context.Context, req *proxypb.PublishRequest) (*emptypb.Empty, error) { if req.EventbusName == "" { return nil, v2.NewHTTPResult(http.StatusBadRequest, "invalid eventbus name") } @@ -213,7 +212,7 @@ func (cp *ControllerProxy) Publish(ctx context.Context, req *vanuspb.PublishRequ return &emptypb.Empty{}, nil } -func (cp *ControllerProxy) Subscribe(req *vanuspb.SubscribeRequest, stream vanuspb.Client_SubscribeServer) error { +func (cp *ControllerProxy) Subscribe(req *proxypb.SubscribeRequest, stream proxypb.StoreProxy_SubscribeServer) error { _ctx, span := cp.tracer.Start(context.Background(), "Subscribe") defer span.End() @@ -291,7 +290,7 @@ func (cp *ControllerProxy) Subscribe(req *vanuspb.SubscribeRequest, stream vanus log.KeyError: err, "eventpb": eventpb.String(), }) - err = subscribe.stream().Send(&vanuspb.SubscribeResponse{ + err = subscribe.stream().Send(&proxypb.SubscribeResponse{ SequenceId: msg.sequenceID, Events: &cloudevents.CloudEventBatch{ Events: []*cloudevents.CloudEvent{eventpb}, @@ -311,7 +310,7 @@ func (cp *ControllerProxy) Subscribe(req *vanuspb.SubscribeRequest, stream vanus } } -func (cp *ControllerProxy) Ack(stream vanuspb.Client_AckServer) error { +func (cp *ControllerProxy) Ack(stream proxypb.StoreProxy_AckServer) error { _ctx, span := cp.tracer.Start(context.Background(), "Ack") defer span.End() for { @@ -484,7 +483,7 @@ func (cp *ControllerProxy) Start() error { } proxypb.RegisterControllerProxyServer(cp.grpcSrv, cp) - vanuspb.RegisterClientServer(cp.grpcSrv, cp) + proxypb.RegisterStoreProxyServer(cp.grpcSrv, cp) proxyListen, err := net.Listen("tcp", fmt.Sprintf(":%d", cp.cfg.ProxyPort)) if err != nil { diff --git a/proto/pkg/proxy/proxy.pb.go b/proto/pkg/proxy/proxy.pb.go index 58f7d4759..24541d591 100644 --- a/proto/pkg/proxy/proxy.pb.go +++ b/proto/pkg/proxy/proxy.pb.go @@ -15,13 +15,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.26.0 -// protoc v3.19.1 +// protoc v3.19.4 // source: proxy.proto package proxy import ( context "context" + cloudevents "github.com/linkall-labs/vanus/proto/pkg/cloudevents" controller "github.com/linkall-labs/vanus/proto/pkg/controller" meta "github.com/linkall-labs/vanus/proto/pkg/meta" grpc "google.golang.org/grpc" @@ -475,6 +476,234 @@ func (x *ValidateSubscriptionResponse) GetTransformerResult() []byte { return nil } +type PublishRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + EventbusName string `protobuf:"bytes,1,opt,name=eventbus_name,json=eventbusName,proto3" json:"eventbus_name,omitempty"` + Events *cloudevents.CloudEventBatch `protobuf:"bytes,2,opt,name=events,proto3" json:"events,omitempty"` +} + +func (x *PublishRequest) Reset() { + *x = PublishRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proxy_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PublishRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublishRequest) ProtoMessage() {} + +func (x *PublishRequest) ProtoReflect() protoreflect.Message { + mi := &file_proxy_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PublishRequest.ProtoReflect.Descriptor instead. +func (*PublishRequest) Descriptor() ([]byte, []int) { + return file_proxy_proto_rawDescGZIP(), []int{7} +} + +func (x *PublishRequest) GetEventbusName() string { + if x != nil { + return x.EventbusName + } + return "" +} + +func (x *PublishRequest) GetEvents() *cloudevents.CloudEventBatch { + if x != nil { + return x.Events + } + return nil +} + +type SubscribeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + EventbusName string `protobuf:"bytes,1,opt,name=eventbus_name,json=eventbusName,proto3" json:"eventbus_name,omitempty"` + SubscriptionId string `protobuf:"bytes,2,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` +} + +func (x *SubscribeRequest) Reset() { + *x = SubscribeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proxy_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeRequest) ProtoMessage() {} + +func (x *SubscribeRequest) ProtoReflect() protoreflect.Message { + mi := &file_proxy_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscribeRequest.ProtoReflect.Descriptor instead. +func (*SubscribeRequest) Descriptor() ([]byte, []int) { + return file_proxy_proto_rawDescGZIP(), []int{8} +} + +func (x *SubscribeRequest) GetEventbusName() string { + if x != nil { + return x.EventbusName + } + return "" +} + +func (x *SubscribeRequest) GetSubscriptionId() string { + if x != nil { + return x.SubscriptionId + } + return "" +} + +type SubscribeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SequenceId uint64 `protobuf:"varint,1,opt,name=sequence_id,json=sequenceId,proto3" json:"sequence_id,omitempty"` + Events *cloudevents.CloudEventBatch `protobuf:"bytes,2,opt,name=events,proto3" json:"events,omitempty"` +} + +func (x *SubscribeResponse) Reset() { + *x = SubscribeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proxy_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeResponse) ProtoMessage() {} + +func (x *SubscribeResponse) ProtoReflect() protoreflect.Message { + mi := &file_proxy_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscribeResponse.ProtoReflect.Descriptor instead. +func (*SubscribeResponse) Descriptor() ([]byte, []int) { + return file_proxy_proto_rawDescGZIP(), []int{9} +} + +func (x *SubscribeResponse) GetSequenceId() uint64 { + if x != nil { + return x.SequenceId + } + return 0 +} + +func (x *SubscribeResponse) GetEvents() *cloudevents.CloudEventBatch { + if x != nil { + return x.Events + } + return nil +} + +type AckRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SequenceId uint64 `protobuf:"varint,1,opt,name=sequence_id,json=sequenceId,proto3" json:"sequence_id,omitempty"` + SubscriptionId string `protobuf:"bytes,2,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` + Success bool `protobuf:"varint,3,opt,name=success,proto3" json:"success,omitempty"` +} + +func (x *AckRequest) Reset() { + *x = AckRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proxy_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AckRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AckRequest) ProtoMessage() {} + +func (x *AckRequest) ProtoReflect() protoreflect.Message { + mi := &file_proxy_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AckRequest.ProtoReflect.Descriptor instead. +func (*AckRequest) Descriptor() ([]byte, []int) { + return file_proxy_proto_rawDescGZIP(), []int{10} +} + +func (x *AckRequest) GetSequenceId() uint64 { + if x != nil { + return x.SequenceId + } + return 0 +} + +func (x *AckRequest) GetSubscriptionId() string { + if x != nil { + return x.SubscriptionId + } + return "" +} + +func (x *AckRequest) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + var File_proxy_proto protoreflect.FileDescriptor var file_proxy_proto_rawDesc = []byte{ @@ -484,188 +713,233 @@ var file_proxy_proto_rawDesc = []byte{ 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x70, 0x0a, - 0x13, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, - 0x12, 0x1f, 0x0a, 0x0b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x6c, 0x6f, 0x67, 0x49, - 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, - 0xa4, 0x01, 0x0a, 0x14, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x07, 0x6f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, - 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, - 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x52, 0x07, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x4f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x99, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x76, - 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x76, - 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x6c, - 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, - 0x6e, 0x74, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x11, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x70, 0x0a, 0x13, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x62, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x62, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x6c, 0x6f, 0x67, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x6c, + 0x6f, 0x67, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x22, 0xa4, 0x01, 0x0a, 0x14, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x07, 0x6f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x6c, + 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x78, 0x79, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x1a, 0x3a, 0x0a, + 0x0c, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x99, 0x01, 0x0a, 0x0f, 0x47, 0x65, + 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, + 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x6c, 0x6f, 0x67, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x47, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, 0x74, 0x65, + 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x5f, + 0x0a, 0x13, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x0f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x6f, 0x72, 0x74, + 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x50, 0x6f, 0x72, 0x74, 0x22, + 0xff, 0x01, 0x0a, 0x1b, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1a, 0x0a, 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x6c, 0x6f, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x6c, 0x6f, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, - 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, - 0x49, 0x64, 0x22, 0x47, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x5f, 0x0a, 0x13, 0x43, - 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, - 0x73, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x63, 0x6c, - 0x6f, 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x1d, 0x0a, - 0x0a, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x50, 0x6f, 0x72, 0x74, 0x22, 0xff, 0x01, 0x0a, - 0x1b, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, - 0x65, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x65, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x6c, 0x6f, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x6c, 0x6f, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x27, 0x0a, 0x0f, - 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x64, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x0c, 0x73, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x65, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x52, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x72, - 0x0a, 0x1c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, - 0x0a, 0x0d, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x12, 0x2d, 0x0a, 0x12, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, - 0x65, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x32, 0xab, 0x0e, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, - 0x72, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x5f, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, - 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, - 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, - 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x46, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, - 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, - 0x49, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x1c, - 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, - 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x1a, 0x1c, 0x2e, 0x6c, - 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, - 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x56, 0x0a, 0x0c, 0x4c, 0x69, - 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x1a, 0x2e, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, - 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, + 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, + 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x51, + 0x0a, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x65, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, + 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x52, 0x0c, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x22, 0x72, 0x0a, 0x1c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x2d, 0x0a, 0x12, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x79, 0x0a, 0x0e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x62, 0x75, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x42, 0x0a, 0x06, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6c, + 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x6f, + 0x75, 0x64, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, + 0x22, 0x60, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x62, 0x75, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x64, 0x22, 0x78, 0x0a, 0x11, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x71, 0x75, 0x65, + 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x73, 0x65, + 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x42, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, + 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, + 0x61, 0x74, 0x63, 0x68, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x70, 0x0a, 0x0a, + 0x41, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, + 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0a, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x32, 0xab, + 0x0e, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x50, 0x72, 0x6f, + 0x78, 0x79, 0x12, 0x5f, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x52, 0x65, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, - 0x42, 0x75, 0x73, 0x12, 0x6a, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x2c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, - 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2d, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x6b, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, - 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x69, 0x6e, + 0x42, 0x75, 0x73, 0x12, 0x46, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, + 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x42, 0x75, 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x49, 0x0a, 0x0b, 0x47, + 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, - 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x6b, 0x0a, 0x12, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, - 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, - 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x61, 0x0a, 0x12, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x65, 0x0a, 0x0f, - 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x79, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, - 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x6c, 0x69, 0x6e, - 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, - 0x0a, 0x13, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x34, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, - 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x12, 0x61, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, - 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x8b, 0x01, 0x0a, 0x16, 0x52, 0x65, 0x73, 0x65, 0x74, - 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x12, 0x37, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, - 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x6c, 0x69, 0x6e, - 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x0b, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x28, 0x2e, 0x6c, 0x69, - 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x28, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, - 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, - 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x29, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x08, 0x47, 0x65, - 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x24, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, - 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x47, 0x65, 0x74, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6c, - 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x78, 0x79, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x7b, 0x0a, 0x14, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x56, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2e, + 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x62, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, + 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, + 0x12, 0x2f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x73, 0x12, + 0x6a, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2c, + 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, + 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6c, + 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x67, 0x6d, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6b, 0x0a, 0x12, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x6b, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, + 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, + 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x61, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, + 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x65, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x2e, 0x6c, 0x69, + 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, + 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x6d, 0x65, + 0x74, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x79, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, + 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x13, 0x44, 0x69, + 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x34, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x73, + 0x61, 0x62, 0x6c, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, + 0x61, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, + 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, + 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x12, 0x8b, 0x01, 0x0a, 0x16, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x37, 0x2e, + 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x38, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, + 0x72, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x54, 0x6f, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x4f, 0x0a, 0x0b, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x28, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x43, 0x6c, + 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x63, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x12, 0x28, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, - 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, - 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x76, 0x61, 0x6e, 0x75, - 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x12, 0x24, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, + 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x47, + 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x7b, 0x0a, 0x14, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, + 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, + 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xf4, 0x01, 0x0a, + 0x0a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x46, 0x0a, 0x07, 0x50, + 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x12, 0x23, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, + 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x50, 0x75, 0x62, + 0x6c, 0x69, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x12, 0x5c, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, + 0x12, 0x25, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, + 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, + 0x01, 0x12, 0x40, 0x0a, 0x03, 0x41, 0x63, 0x6b, 0x12, 0x1f, 0x2e, 0x6c, 0x69, 0x6e, 0x6b, 0x61, + 0x6c, 0x6c, 0x2e, 0x76, 0x61, 0x6e, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x41, + 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x28, 0x01, 0x42, 0x2f, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x61, 0x6c, 0x6c, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x76, + 0x61, 0x6e, 0x75, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, + 0x72, 0x6f, 0x78, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -680,7 +954,7 @@ func file_proxy_proto_rawDescGZIP() []byte { return file_proxy_proto_rawDescData } -var file_proxy_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_proxy_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_proxy_proto_goTypes = []interface{}{ (*LookupOffsetRequest)(nil), // 0: linkall.vanus.proxy.LookupOffsetRequest (*LookupOffsetResponse)(nil), // 1: linkall.vanus.proxy.LookupOffsetResponse @@ -689,73 +963,86 @@ var file_proxy_proto_goTypes = []interface{}{ (*ClusterInfoResponse)(nil), // 4: linkall.vanus.proxy.ClusterInfoResponse (*ValidateSubscriptionRequest)(nil), // 5: linkall.vanus.proxy.ValidateSubscriptionRequest (*ValidateSubscriptionResponse)(nil), // 6: linkall.vanus.proxy.ValidateSubscriptionResponse - nil, // 7: linkall.vanus.proxy.LookupOffsetResponse.OffsetsEntry - (*wrapperspb.BytesValue)(nil), // 8: google.protobuf.BytesValue - (*controller.SubscriptionRequest)(nil), // 9: linkall.vanus.controller.SubscriptionRequest - (*controller.CreateEventBusRequest)(nil), // 10: linkall.vanus.controller.CreateEventBusRequest - (*meta.EventBus)(nil), // 11: linkall.vanus.meta.EventBus - (*emptypb.Empty)(nil), // 12: google.protobuf.Empty - (*controller.UpdateEventBusRequest)(nil), // 13: linkall.vanus.controller.UpdateEventBusRequest - (*controller.ListSegmentRequest)(nil), // 14: linkall.vanus.controller.ListSegmentRequest - (*controller.CreateSubscriptionRequest)(nil), // 15: linkall.vanus.controller.CreateSubscriptionRequest - (*controller.UpdateSubscriptionRequest)(nil), // 16: linkall.vanus.controller.UpdateSubscriptionRequest - (*controller.DeleteSubscriptionRequest)(nil), // 17: linkall.vanus.controller.DeleteSubscriptionRequest - (*controller.GetSubscriptionRequest)(nil), // 18: linkall.vanus.controller.GetSubscriptionRequest - (*controller.ListSubscriptionRequest)(nil), // 19: linkall.vanus.controller.ListSubscriptionRequest - (*controller.DisableSubscriptionRequest)(nil), // 20: linkall.vanus.controller.DisableSubscriptionRequest - (*controller.ResumeSubscriptionRequest)(nil), // 21: linkall.vanus.controller.ResumeSubscriptionRequest - (*controller.ResetOffsetToTimestampRequest)(nil), // 22: linkall.vanus.controller.ResetOffsetToTimestampRequest - (*controller.ListEventbusResponse)(nil), // 23: linkall.vanus.controller.ListEventbusResponse - (*controller.ListSegmentResponse)(nil), // 24: linkall.vanus.controller.ListSegmentResponse - (*meta.Subscription)(nil), // 25: linkall.vanus.meta.Subscription - (*controller.ListSubscriptionResponse)(nil), // 26: linkall.vanus.controller.ListSubscriptionResponse - (*controller.ResetOffsetToTimestampResponse)(nil), // 27: linkall.vanus.controller.ResetOffsetToTimestampResponse + (*PublishRequest)(nil), // 7: linkall.vanus.proxy.PublishRequest + (*SubscribeRequest)(nil), // 8: linkall.vanus.proxy.SubscribeRequest + (*SubscribeResponse)(nil), // 9: linkall.vanus.proxy.SubscribeResponse + (*AckRequest)(nil), // 10: linkall.vanus.proxy.AckRequest + nil, // 11: linkall.vanus.proxy.LookupOffsetResponse.OffsetsEntry + (*wrapperspb.BytesValue)(nil), // 12: google.protobuf.BytesValue + (*controller.SubscriptionRequest)(nil), // 13: linkall.vanus.controller.SubscriptionRequest + (*cloudevents.CloudEventBatch)(nil), // 14: linkall.vanus.cloudevents.CloudEventBatch + (*controller.CreateEventBusRequest)(nil), // 15: linkall.vanus.controller.CreateEventBusRequest + (*meta.EventBus)(nil), // 16: linkall.vanus.meta.EventBus + (*emptypb.Empty)(nil), // 17: google.protobuf.Empty + (*controller.UpdateEventBusRequest)(nil), // 18: linkall.vanus.controller.UpdateEventBusRequest + (*controller.ListSegmentRequest)(nil), // 19: linkall.vanus.controller.ListSegmentRequest + (*controller.CreateSubscriptionRequest)(nil), // 20: linkall.vanus.controller.CreateSubscriptionRequest + (*controller.UpdateSubscriptionRequest)(nil), // 21: linkall.vanus.controller.UpdateSubscriptionRequest + (*controller.DeleteSubscriptionRequest)(nil), // 22: linkall.vanus.controller.DeleteSubscriptionRequest + (*controller.GetSubscriptionRequest)(nil), // 23: linkall.vanus.controller.GetSubscriptionRequest + (*controller.ListSubscriptionRequest)(nil), // 24: linkall.vanus.controller.ListSubscriptionRequest + (*controller.DisableSubscriptionRequest)(nil), // 25: linkall.vanus.controller.DisableSubscriptionRequest + (*controller.ResumeSubscriptionRequest)(nil), // 26: linkall.vanus.controller.ResumeSubscriptionRequest + (*controller.ResetOffsetToTimestampRequest)(nil), // 27: linkall.vanus.controller.ResetOffsetToTimestampRequest + (*controller.ListEventbusResponse)(nil), // 28: linkall.vanus.controller.ListEventbusResponse + (*controller.ListSegmentResponse)(nil), // 29: linkall.vanus.controller.ListSegmentResponse + (*meta.Subscription)(nil), // 30: linkall.vanus.meta.Subscription + (*controller.ListSubscriptionResponse)(nil), // 31: linkall.vanus.controller.ListSubscriptionResponse + (*controller.ResetOffsetToTimestampResponse)(nil), // 32: linkall.vanus.controller.ResetOffsetToTimestampResponse } var file_proxy_proto_depIdxs = []int32{ - 7, // 0: linkall.vanus.proxy.LookupOffsetResponse.offsets:type_name -> linkall.vanus.proxy.LookupOffsetResponse.OffsetsEntry - 8, // 1: linkall.vanus.proxy.GetEventResponse.events:type_name -> google.protobuf.BytesValue - 9, // 2: linkall.vanus.proxy.ValidateSubscriptionRequest.subscription:type_name -> linkall.vanus.controller.SubscriptionRequest - 10, // 3: linkall.vanus.proxy.ControllerProxy.CreateEventBus:input_type -> linkall.vanus.controller.CreateEventBusRequest - 11, // 4: linkall.vanus.proxy.ControllerProxy.DeleteEventBus:input_type -> linkall.vanus.meta.EventBus - 11, // 5: linkall.vanus.proxy.ControllerProxy.GetEventBus:input_type -> linkall.vanus.meta.EventBus - 12, // 6: linkall.vanus.proxy.ControllerProxy.ListEventBus:input_type -> google.protobuf.Empty - 13, // 7: linkall.vanus.proxy.ControllerProxy.UpdateEventBus:input_type -> linkall.vanus.controller.UpdateEventBusRequest - 14, // 8: linkall.vanus.proxy.ControllerProxy.ListSegment:input_type -> linkall.vanus.controller.ListSegmentRequest - 15, // 9: linkall.vanus.proxy.ControllerProxy.CreateSubscription:input_type -> linkall.vanus.controller.CreateSubscriptionRequest - 16, // 10: linkall.vanus.proxy.ControllerProxy.UpdateSubscription:input_type -> linkall.vanus.controller.UpdateSubscriptionRequest - 17, // 11: linkall.vanus.proxy.ControllerProxy.DeleteSubscription:input_type -> linkall.vanus.controller.DeleteSubscriptionRequest - 18, // 12: linkall.vanus.proxy.ControllerProxy.GetSubscription:input_type -> linkall.vanus.controller.GetSubscriptionRequest - 19, // 13: linkall.vanus.proxy.ControllerProxy.ListSubscription:input_type -> linkall.vanus.controller.ListSubscriptionRequest - 20, // 14: linkall.vanus.proxy.ControllerProxy.DisableSubscription:input_type -> linkall.vanus.controller.DisableSubscriptionRequest - 21, // 15: linkall.vanus.proxy.ControllerProxy.ResumeSubscription:input_type -> linkall.vanus.controller.ResumeSubscriptionRequest - 22, // 16: linkall.vanus.proxy.ControllerProxy.ResetOffsetToTimestamp:input_type -> linkall.vanus.controller.ResetOffsetToTimestampRequest - 12, // 17: linkall.vanus.proxy.ControllerProxy.ClusterInfo:input_type -> google.protobuf.Empty - 0, // 18: linkall.vanus.proxy.ControllerProxy.LookupOffset:input_type -> linkall.vanus.proxy.LookupOffsetRequest - 2, // 19: linkall.vanus.proxy.ControllerProxy.GetEvent:input_type -> linkall.vanus.proxy.GetEventRequest - 5, // 20: linkall.vanus.proxy.ControllerProxy.ValidateSubscription:input_type -> linkall.vanus.proxy.ValidateSubscriptionRequest - 11, // 21: linkall.vanus.proxy.ControllerProxy.CreateEventBus:output_type -> linkall.vanus.meta.EventBus - 12, // 22: linkall.vanus.proxy.ControllerProxy.DeleteEventBus:output_type -> google.protobuf.Empty - 11, // 23: linkall.vanus.proxy.ControllerProxy.GetEventBus:output_type -> linkall.vanus.meta.EventBus - 23, // 24: linkall.vanus.proxy.ControllerProxy.ListEventBus:output_type -> linkall.vanus.controller.ListEventbusResponse - 11, // 25: linkall.vanus.proxy.ControllerProxy.UpdateEventBus:output_type -> linkall.vanus.meta.EventBus - 24, // 26: linkall.vanus.proxy.ControllerProxy.ListSegment:output_type -> linkall.vanus.controller.ListSegmentResponse - 25, // 27: linkall.vanus.proxy.ControllerProxy.CreateSubscription:output_type -> linkall.vanus.meta.Subscription - 25, // 28: linkall.vanus.proxy.ControllerProxy.UpdateSubscription:output_type -> linkall.vanus.meta.Subscription - 12, // 29: linkall.vanus.proxy.ControllerProxy.DeleteSubscription:output_type -> google.protobuf.Empty - 25, // 30: linkall.vanus.proxy.ControllerProxy.GetSubscription:output_type -> linkall.vanus.meta.Subscription - 26, // 31: linkall.vanus.proxy.ControllerProxy.ListSubscription:output_type -> linkall.vanus.controller.ListSubscriptionResponse - 12, // 32: linkall.vanus.proxy.ControllerProxy.DisableSubscription:output_type -> google.protobuf.Empty - 12, // 33: linkall.vanus.proxy.ControllerProxy.ResumeSubscription:output_type -> google.protobuf.Empty - 27, // 34: linkall.vanus.proxy.ControllerProxy.ResetOffsetToTimestamp:output_type -> linkall.vanus.controller.ResetOffsetToTimestampResponse - 4, // 35: linkall.vanus.proxy.ControllerProxy.ClusterInfo:output_type -> linkall.vanus.proxy.ClusterInfoResponse - 1, // 36: linkall.vanus.proxy.ControllerProxy.LookupOffset:output_type -> linkall.vanus.proxy.LookupOffsetResponse - 3, // 37: linkall.vanus.proxy.ControllerProxy.GetEvent:output_type -> linkall.vanus.proxy.GetEventResponse - 6, // 38: linkall.vanus.proxy.ControllerProxy.ValidateSubscription:output_type -> linkall.vanus.proxy.ValidateSubscriptionResponse - 21, // [21:39] is the sub-list for method output_type - 3, // [3:21] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 11, // 0: linkall.vanus.proxy.LookupOffsetResponse.offsets:type_name -> linkall.vanus.proxy.LookupOffsetResponse.OffsetsEntry + 12, // 1: linkall.vanus.proxy.GetEventResponse.events:type_name -> google.protobuf.BytesValue + 13, // 2: linkall.vanus.proxy.ValidateSubscriptionRequest.subscription:type_name -> linkall.vanus.controller.SubscriptionRequest + 14, // 3: linkall.vanus.proxy.PublishRequest.events:type_name -> linkall.vanus.cloudevents.CloudEventBatch + 14, // 4: linkall.vanus.proxy.SubscribeResponse.events:type_name -> linkall.vanus.cloudevents.CloudEventBatch + 15, // 5: linkall.vanus.proxy.ControllerProxy.CreateEventBus:input_type -> linkall.vanus.controller.CreateEventBusRequest + 16, // 6: linkall.vanus.proxy.ControllerProxy.DeleteEventBus:input_type -> linkall.vanus.meta.EventBus + 16, // 7: linkall.vanus.proxy.ControllerProxy.GetEventBus:input_type -> linkall.vanus.meta.EventBus + 17, // 8: linkall.vanus.proxy.ControllerProxy.ListEventBus:input_type -> google.protobuf.Empty + 18, // 9: linkall.vanus.proxy.ControllerProxy.UpdateEventBus:input_type -> linkall.vanus.controller.UpdateEventBusRequest + 19, // 10: linkall.vanus.proxy.ControllerProxy.ListSegment:input_type -> linkall.vanus.controller.ListSegmentRequest + 20, // 11: linkall.vanus.proxy.ControllerProxy.CreateSubscription:input_type -> linkall.vanus.controller.CreateSubscriptionRequest + 21, // 12: linkall.vanus.proxy.ControllerProxy.UpdateSubscription:input_type -> linkall.vanus.controller.UpdateSubscriptionRequest + 22, // 13: linkall.vanus.proxy.ControllerProxy.DeleteSubscription:input_type -> linkall.vanus.controller.DeleteSubscriptionRequest + 23, // 14: linkall.vanus.proxy.ControllerProxy.GetSubscription:input_type -> linkall.vanus.controller.GetSubscriptionRequest + 24, // 15: linkall.vanus.proxy.ControllerProxy.ListSubscription:input_type -> linkall.vanus.controller.ListSubscriptionRequest + 25, // 16: linkall.vanus.proxy.ControllerProxy.DisableSubscription:input_type -> linkall.vanus.controller.DisableSubscriptionRequest + 26, // 17: linkall.vanus.proxy.ControllerProxy.ResumeSubscription:input_type -> linkall.vanus.controller.ResumeSubscriptionRequest + 27, // 18: linkall.vanus.proxy.ControllerProxy.ResetOffsetToTimestamp:input_type -> linkall.vanus.controller.ResetOffsetToTimestampRequest + 17, // 19: linkall.vanus.proxy.ControllerProxy.ClusterInfo:input_type -> google.protobuf.Empty + 0, // 20: linkall.vanus.proxy.ControllerProxy.LookupOffset:input_type -> linkall.vanus.proxy.LookupOffsetRequest + 2, // 21: linkall.vanus.proxy.ControllerProxy.GetEvent:input_type -> linkall.vanus.proxy.GetEventRequest + 5, // 22: linkall.vanus.proxy.ControllerProxy.ValidateSubscription:input_type -> linkall.vanus.proxy.ValidateSubscriptionRequest + 7, // 23: linkall.vanus.proxy.StoreProxy.Publish:input_type -> linkall.vanus.proxy.PublishRequest + 8, // 24: linkall.vanus.proxy.StoreProxy.Subscribe:input_type -> linkall.vanus.proxy.SubscribeRequest + 10, // 25: linkall.vanus.proxy.StoreProxy.Ack:input_type -> linkall.vanus.proxy.AckRequest + 16, // 26: linkall.vanus.proxy.ControllerProxy.CreateEventBus:output_type -> linkall.vanus.meta.EventBus + 17, // 27: linkall.vanus.proxy.ControllerProxy.DeleteEventBus:output_type -> google.protobuf.Empty + 16, // 28: linkall.vanus.proxy.ControllerProxy.GetEventBus:output_type -> linkall.vanus.meta.EventBus + 28, // 29: linkall.vanus.proxy.ControllerProxy.ListEventBus:output_type -> linkall.vanus.controller.ListEventbusResponse + 16, // 30: linkall.vanus.proxy.ControllerProxy.UpdateEventBus:output_type -> linkall.vanus.meta.EventBus + 29, // 31: linkall.vanus.proxy.ControllerProxy.ListSegment:output_type -> linkall.vanus.controller.ListSegmentResponse + 30, // 32: linkall.vanus.proxy.ControllerProxy.CreateSubscription:output_type -> linkall.vanus.meta.Subscription + 30, // 33: linkall.vanus.proxy.ControllerProxy.UpdateSubscription:output_type -> linkall.vanus.meta.Subscription + 17, // 34: linkall.vanus.proxy.ControllerProxy.DeleteSubscription:output_type -> google.protobuf.Empty + 30, // 35: linkall.vanus.proxy.ControllerProxy.GetSubscription:output_type -> linkall.vanus.meta.Subscription + 31, // 36: linkall.vanus.proxy.ControllerProxy.ListSubscription:output_type -> linkall.vanus.controller.ListSubscriptionResponse + 17, // 37: linkall.vanus.proxy.ControllerProxy.DisableSubscription:output_type -> google.protobuf.Empty + 17, // 38: linkall.vanus.proxy.ControllerProxy.ResumeSubscription:output_type -> google.protobuf.Empty + 32, // 39: linkall.vanus.proxy.ControllerProxy.ResetOffsetToTimestamp:output_type -> linkall.vanus.controller.ResetOffsetToTimestampResponse + 4, // 40: linkall.vanus.proxy.ControllerProxy.ClusterInfo:output_type -> linkall.vanus.proxy.ClusterInfoResponse + 1, // 41: linkall.vanus.proxy.ControllerProxy.LookupOffset:output_type -> linkall.vanus.proxy.LookupOffsetResponse + 3, // 42: linkall.vanus.proxy.ControllerProxy.GetEvent:output_type -> linkall.vanus.proxy.GetEventResponse + 6, // 43: linkall.vanus.proxy.ControllerProxy.ValidateSubscription:output_type -> linkall.vanus.proxy.ValidateSubscriptionResponse + 17, // 44: linkall.vanus.proxy.StoreProxy.Publish:output_type -> google.protobuf.Empty + 9, // 45: linkall.vanus.proxy.StoreProxy.Subscribe:output_type -> linkall.vanus.proxy.SubscribeResponse + 17, // 46: linkall.vanus.proxy.StoreProxy.Ack:output_type -> google.protobuf.Empty + 26, // [26:47] is the sub-list for method output_type + 5, // [5:26] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_proxy_proto_init() } @@ -848,6 +1135,54 @@ func file_proxy_proto_init() { return nil } } + file_proxy_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PublishRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proxy_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proxy_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proxy_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AckRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -855,9 +1190,9 @@ func file_proxy_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proxy_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 12, NumExtensions: 0, - NumServices: 1, + NumServices: 2, }, GoTypes: file_proxy_proto_goTypes, DependencyIndexes: file_proxy_proto_depIdxs, @@ -1566,3 +1901,209 @@ var _ControllerProxy_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "proxy.proto", } + +// StoreProxyClient is the client API for StoreProxy service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type StoreProxyClient interface { + Publish(ctx context.Context, in *PublishRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (StoreProxy_SubscribeClient, error) + Ack(ctx context.Context, opts ...grpc.CallOption) (StoreProxy_AckClient, error) +} + +type storeProxyClient struct { + cc grpc.ClientConnInterface +} + +func NewStoreProxyClient(cc grpc.ClientConnInterface) StoreProxyClient { + return &storeProxyClient{cc} +} + +func (c *storeProxyClient) Publish(ctx context.Context, in *PublishRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/linkall.vanus.proxy.StoreProxy/Publish", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storeProxyClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (StoreProxy_SubscribeClient, error) { + stream, err := c.cc.NewStream(ctx, &_StoreProxy_serviceDesc.Streams[0], "/linkall.vanus.proxy.StoreProxy/Subscribe", opts...) + if err != nil { + return nil, err + } + x := &storeProxySubscribeClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type StoreProxy_SubscribeClient interface { + Recv() (*SubscribeResponse, error) + grpc.ClientStream +} + +type storeProxySubscribeClient struct { + grpc.ClientStream +} + +func (x *storeProxySubscribeClient) Recv() (*SubscribeResponse, error) { + m := new(SubscribeResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *storeProxyClient) Ack(ctx context.Context, opts ...grpc.CallOption) (StoreProxy_AckClient, error) { + stream, err := c.cc.NewStream(ctx, &_StoreProxy_serviceDesc.Streams[1], "/linkall.vanus.proxy.StoreProxy/Ack", opts...) + if err != nil { + return nil, err + } + x := &storeProxyAckClient{stream} + return x, nil +} + +type StoreProxy_AckClient interface { + Send(*AckRequest) error + CloseAndRecv() (*emptypb.Empty, error) + grpc.ClientStream +} + +type storeProxyAckClient struct { + grpc.ClientStream +} + +func (x *storeProxyAckClient) Send(m *AckRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *storeProxyAckClient) CloseAndRecv() (*emptypb.Empty, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(emptypb.Empty) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// StoreProxyServer is the server API for StoreProxy service. +type StoreProxyServer interface { + Publish(context.Context, *PublishRequest) (*emptypb.Empty, error) + Subscribe(*SubscribeRequest, StoreProxy_SubscribeServer) error + Ack(StoreProxy_AckServer) error +} + +// UnimplementedStoreProxyServer can be embedded to have forward compatible implementations. +type UnimplementedStoreProxyServer struct { +} + +func (*UnimplementedStoreProxyServer) Publish(context.Context, *PublishRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method Publish not implemented") +} +func (*UnimplementedStoreProxyServer) Subscribe(*SubscribeRequest, StoreProxy_SubscribeServer) error { + return status.Errorf(codes.Unimplemented, "method Subscribe not implemented") +} +func (*UnimplementedStoreProxyServer) Ack(StoreProxy_AckServer) error { + return status.Errorf(codes.Unimplemented, "method Ack not implemented") +} + +func RegisterStoreProxyServer(s *grpc.Server, srv StoreProxyServer) { + s.RegisterService(&_StoreProxy_serviceDesc, srv) +} + +func _StoreProxy_Publish_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PublishRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoreProxyServer).Publish(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/linkall.vanus.proxy.StoreProxy/Publish", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoreProxyServer).Publish(ctx, req.(*PublishRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _StoreProxy_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SubscribeRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(StoreProxyServer).Subscribe(m, &storeProxySubscribeServer{stream}) +} + +type StoreProxy_SubscribeServer interface { + Send(*SubscribeResponse) error + grpc.ServerStream +} + +type storeProxySubscribeServer struct { + grpc.ServerStream +} + +func (x *storeProxySubscribeServer) Send(m *SubscribeResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _StoreProxy_Ack_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(StoreProxyServer).Ack(&storeProxyAckServer{stream}) +} + +type StoreProxy_AckServer interface { + SendAndClose(*emptypb.Empty) error + Recv() (*AckRequest, error) + grpc.ServerStream +} + +type storeProxyAckServer struct { + grpc.ServerStream +} + +func (x *storeProxyAckServer) SendAndClose(m *emptypb.Empty) error { + return x.ServerStream.SendMsg(m) +} + +func (x *storeProxyAckServer) Recv() (*AckRequest, error) { + m := new(AckRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _StoreProxy_serviceDesc = grpc.ServiceDesc{ + ServiceName: "linkall.vanus.proxy.StoreProxy", + HandlerType: (*StoreProxyServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Publish", + Handler: _StoreProxy_Publish_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Subscribe", + Handler: _StoreProxy_Subscribe_Handler, + ServerStreams: true, + }, + { + StreamName: "Ack", + Handler: _StoreProxy_Ack_Handler, + ClientStreams: true, + }, + }, + Metadata: "proxy.proto", +} diff --git a/proto/proto/proxy.proto b/proto/proto/proxy.proto index b7a3a9bbf..f08ddf1b6 100644 --- a/proto/proto/proxy.proto +++ b/proto/proto/proxy.proto @@ -18,6 +18,7 @@ package linkall.vanus.proxy; import "google/protobuf/empty.proto"; import "google/protobuf/wrappers.proto"; +import "cloudevents.proto"; import "controller.proto"; import "meta.proto"; @@ -99,4 +100,31 @@ message ValidateSubscriptionRequest { message ValidateSubscriptionResponse { bool filter_result = 1; bytes transformer_result = 2; -} \ No newline at end of file +} + +service StoreProxy { + rpc Publish(PublishRequest) returns (google.protobuf.Empty); + rpc Subscribe(SubscribeRequest) returns (stream SubscribeResponse); + rpc Ack(stream AckRequest) returns (google.protobuf.Empty); +} + +message PublishRequest { + string eventbus_name = 1; + cloudevents.CloudEventBatch events = 2; +} + +message SubscribeRequest { + string eventbus_name = 1; + string subscription_id = 2; +} + +message SubscribeResponse { + uint64 sequence_id = 1; + cloudevents.CloudEventBatch events = 2; +} + +message AckRequest { + uint64 sequence_id = 1; + string subscription_id = 2; + bool success = 3; +}