fix some typo (#131)

* fix some typo

* log format

* remove useless code
This commit is contained in:
gaoxinge 2021-01-26 10:15:56 +08:00 committed by GitHub
parent 7a4b57c436
commit ee170a232a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 25 deletions

View File

@ -48,16 +48,16 @@ type Client interface {
// InvokeMethodWithCustomContent invokes app with custom content (struct + content type).
InvokeMethodWithCustomContent(ctx context.Context, appID, methodName, verb string, contentType string, content interface{}) (out []byte, err error)
// PublishEvent pubishes data onto topic in specific pubsub component.
// PublishEvent publishes data onto topic in specific pubsub component.
PublishEvent(ctx context.Context, pubsubName, topicName string, data []byte) error
// PublishEventfromCustomContent serializes an struct and pubishes its contents as data (JSON) onto topic in specific pubsub component.
// PublishEventfromCustomContent serializes an struct and publishes its contents as data (JSON) onto topic in specific pubsub component.
PublishEventfromCustomContent(ctx context.Context, pubsubName, topicName string, data interface{}) error
// GetSecret retrieves preconfigred secret from specified store using key.
// GetSecret retrieves preconfigured secret from specified store using key.
GetSecret(ctx context.Context, storeName, key string, meta map[string]string) (data map[string]string, err error)
// GetBulkSecret retrieves all preconfigred secrets for this application.
// GetBulkSecret retrieves all preconfigured secrets for this application.
GetBulkSecret(ctx context.Context, storeName string, meta map[string]string) (data map[string]string, err error)
// SaveState saves the raw data into store using default state options.
@ -124,7 +124,7 @@ func NewClientWithPort(port string) (client Client, err error) {
return NewClientWithAddress(net.JoinHostPort("127.0.0.1", port))
}
// NewClientWithAddress instantiates Dapr using specific address (inclding port).
// NewClientWithAddress instantiates Dapr using specific address (including port).
func NewClientWithAddress(address string) (client Client, err error) {
if address == "" {
return nil, errors.New("nil address")

View File

@ -8,7 +8,7 @@ import (
"github.com/pkg/errors"
)
// PublishEvent pubishes data onto specific pubsub topic.
// PublishEvent publishes data onto specific pubsub topic.
func (c *GRPCClient) PublishEvent(ctx context.Context, pubsubName, topicName string, data []byte) error {
if pubsubName == "" {
return errors.New("pubsubName name required")
@ -31,7 +31,7 @@ func (c *GRPCClient) PublishEvent(ctx context.Context, pubsubName, topicName str
return nil
}
// PublishEventfromCustomContent serializes an struct and pubishes its contents as data (JSON) onto topic in specific pubsub component.
// PublishEventfromCustomContent serializes an struct and publishes its contents as data (JSON) onto topic in specific pubsub component.
func (c *GRPCClient) PublishEventfromCustomContent(ctx context.Context, pubsubName, topicName string, data interface{}) error {
if pubsubName == "" {
return errors.New("pubsubName name required")

View File

@ -7,7 +7,7 @@ import (
"github.com/pkg/errors"
)
// GetSecret retrieves preconfigred secret from specified store using key.
// GetSecret retrieves preconfigured secret from specified store using key.
func (c *GRPCClient) GetSecret(ctx context.Context, storeName, key string, meta map[string]string) (data map[string]string, err error) {
if storeName == "" {
return nil, errors.New("nil storeName")
@ -34,7 +34,7 @@ func (c *GRPCClient) GetSecret(ctx context.Context, storeName, key string, meta
return
}
// GetBulkSecret retrieves all preconfigred secrets for this application.
// GetBulkSecret retrieves all preconfigured secrets for this application.
func (c *GRPCClient) GetBulkSecret(ctx context.Context, storeName string, meta map[string]string) (data map[string]string, err error) {
if storeName == "" {
return nil, errors.New("nil storeName")

View File

@ -6,7 +6,7 @@ import (
v1 "github.com/dapr/go-sdk/dapr/proto/common/v1"
pb "github.com/dapr/go-sdk/dapr/proto/runtime/v1"
duration "github.com/golang/protobuf/ptypes/duration"
"github.com/golang/protobuf/ptypes/duration"
"github.com/pkg/errors"
)
@ -146,8 +146,8 @@ func toProtoStateOptions(so *StateOptions) (opts *v1.StateOptions) {
return stateOptionDefault
}
return &v1.StateOptions{
Concurrency: (v1.StateOptions_StateConcurrency(so.Concurrency)),
Consistency: (v1.StateOptions_StateConsistency(so.Consistency)),
Concurrency: v1.StateOptions_StateConcurrency(so.Concurrency),
Consistency: v1.StateOptions_StateConsistency(so.Consistency),
}
}
@ -278,7 +278,7 @@ func (c *GRPCClient) GetStateWithConsistency(ctx context.Context, storeName, key
req := &pb.GetStateRequest{
StoreName: storeName,
Key: key,
Consistency: (v1.StateOptions_StateConsistency(sc)),
Consistency: v1.StateOptions_StateConsistency(sc),
Metadata: meta,
}

View File

@ -32,7 +32,7 @@ dapr run --app-id serving \
## Client
Once one of the above services is running is running, launch the client:
Once one of the above services is running, launch the client:
```
cd example/client

View File

@ -76,7 +76,7 @@ func main() {
if err != nil {
panic(err)
}
fmt.Printf("service method invoked, response: %s", string(resp))
fmt.Printf("service method invoked, response: %s\n", string(resp))
in := &dapr.InvokeBindingRequest{
Name: "example-http-binding",
@ -86,5 +86,6 @@ func main() {
panic(err)
}
fmt.Println("output binding invoked")
fmt.Println("DONE (CTRL+C to Exit)")
}

View File

@ -29,18 +29,16 @@ func (s *Server) OnInvoke(ctx context.Context, in *cpb.InvokeRequest) (*cpb.Invo
}
if fn, ok := s.invokeHandlers[in.Method]; ok {
e := &cc.InvocationEvent{}
if in != nil {
e.ContentType = in.ContentType
e.ContentType = in.ContentType
if in.Data != nil {
e.Data = in.Data.Value
e.DataTypeURL = in.Data.TypeUrl
}
if in.Data != nil {
e.Data = in.Data.Value
e.DataTypeURL = in.Data.TypeUrl
}
if in.HttpExtension != nil {
e.Verb = in.HttpExtension.Verb.String()
e.QueryString = in.HttpExtension.Querystring
}
if in.HttpExtension != nil {
e.Verb = in.HttpExtension.Verb.String()
e.QueryString = in.HttpExtension.Querystring
}
ct, er := fn(ctx, e)