Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
gostnops
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wei.xuan
gostnops
Commits
826129ca
Commit
826129ca
authored
Apr 18, 2021
by
AlexStocks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add dubbo-go protocol
parent
38392533
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
125 additions
and
0 deletions
+125
-0
invocation.go
dubbogo/protocol/invocation.go
+51
-0
invoker.go
dubbogo/protocol/invoker.go
+35
-0
result.go
dubbogo/protocol/result.go
+39
-0
No files found.
dubbogo/protocol/invocation.go
0 → 100644
View file @
826129ca
/*
* Licensed to the 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.
* The 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
gxprotocol
import
(
"reflect"
)
// Invocation is a invocation for each remote method.
type
Invocation
interface
{
// MethodName gets invocation method name.
MethodName
()
string
// ParameterTypeNames gets invocation parameter type names.
ParameterTypeNames
()
[]
string
// ParameterTypes gets invocation parameter types.
ParameterTypes
()
[]
reflect
.
Type
// ParameterValues gets invocation parameter values.
ParameterValues
()
[]
reflect
.
Value
// Arguments gets arguments.
Arguments
()
[]
interface
{}
// Reply gets response of request
Reply
()
interface
{}
// Attachments gets all attachments
Attachments
()
map
[
string
]
interface
{}
// AttachmentsByKey gets attachment by key , if nil then return default value. (It will be deprecated in the future)
AttachmentsByKey
(
string
,
string
)
string
Attachment
(
string
)
interface
{}
// Attributes refers to dubbo 2.7.6. It is different from attachment. It is used in internal process.
Attributes
()
map
[
string
]
interface
{}
// AttributeByKey gets attribute by key , if nil then return default value
AttributeByKey
(
string
,
interface
{})
interface
{}
// SetAttachments sets attribute by @key and @value.
SetAttachments
(
key
string
,
value
interface
{})
// Invoker gets the invoker in current context.
Invoker
()
Invoker
}
dubbogo/protocol/invoker.go
0 → 100644
View file @
826129ca
/*
* Licensed to the 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.
* The 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
gxprotocol
import
(
"context"
)
import
(
"github.com/dubbogo/gost/dubbogo"
)
// Invoker the service invocation interface for the consumer
//go:generate mockgen -source invoker.go -destination mock/mock_invoker.go -self_package github.com/apache/dubbo-go/protocol/mock --package mock Invoker
// Extension - Invoker
type
Invoker
interface
{
gxdubbogo
.
Node
// Invoke the invocation and return result.
Invoke
(
context
.
Context
,
Invocation
)
Result
}
dubbogo/protocol/result.go
0 → 100644
View file @
826129ca
/*
* Licensed to the 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.
* The 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
gxprotocol
// Result is a RPC result
type
Result
interface
{
// SetError sets error.
SetError
(
error
)
// Error gets error.
Error
()
error
// SetResult sets invoker result.
SetResult
(
interface
{})
// Result gets invoker result.
Result
()
interface
{}
// SetAttachments replaces the existing attachments with the specified param.
SetAttachments
(
map
[
string
]
interface
{})
// Attachments gets all attachments
Attachments
()
map
[
string
]
interface
{}
// AddAttachment adds the specified map to existing attachments in this instance.
AddAttachment
(
string
,
interface
{})
// Attachment gets attachment by key with default value.
Attachment
(
string
,
interface
{})
interface
{}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment