lujiajing1126 commented on a change in pull request #63:
URL: https://github.com/apache/skywalking-banyandb/pull/63#discussion_r778896423



##########
File path: pkg/test/setup.go
##########
@@ -0,0 +1,127 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you 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 test
+
+import (
+       "context"
+
+       "github.com/hashicorp/go-multierror"
+       "github.com/pkg/errors"
+)
+
+type StartFunc func() error
+type StopFunc func()
+
+type Flow interface {
+       // PushErrorHandler only pushes a stopFunc
+       PushErrorHandler(StopFunc) Flow
+
+       // Run calls the startFunc and expects no error returned.
+       // If a non-nil error is returned or panic, shutdown must be called at 
once.
+       // The error will be stored and thus could be checked by the caller 
later.
+       Run(context.Context, StartFunc, StopFunc) Flow
+
+       // RunWithoutSideEffect calls the startFunc and does not expect any 
side effects from it.
+       // If a non-nil error is returned or panic, shutdown must be called at 
once.
+       // The error will be stored and thus could be checked by the caller 
later.
+       RunWithoutSideEffect(context.Context, StartFunc) Flow
+
+       // Shutdown does not actually shutdown the flow,
+       // but only returns a function containing all stopFunc(s) to be 
executed.
+       // The timing to do the real shutdown can be determined by users.
+       Shutdown() StopFunc
+
+       ErrorOrNil() error

Review comment:
       Changed




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to