go.temporal.io/server/common/protocol/naming.go
75 LOC · 24 covered · 51 uncovered · 11 ranges · 41 concepts · 8 introducers · 19 tests
File neighbourhood
The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.
Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.
package protocol
import (
"fmt"
"strings"
protocolpb "go.temporal.io/api/protocol/v1"
)
type (
// Type is a protocol type of which there may be many instances like the
// update protocol or the query protocol.
Type string
// MessageType is the type of a message within a protocol.
MessageType string
constErr string
)
const (
MessageTypeUnknown = MessageType("__message_type_unknown")
TypeUnknown = Type("__protocol_type_unknown")
errNilMsg = constErr("nil message")
errNilBody = constErr("nil message body")
errProtoFmt = constErr("failed to extract protocol type")
errNoName = constErr("no message name specified")
)
// String transforms a MessageType into a string
return string(mt)
}
// String tranforms a Type into a string
return string(pt)
}
// Identify is a function that given a protocol message gives the specific
// message type of the body and the type of the protocol to which this message
// belongs.
if msg == nil {
}
if bodyTypeName == "" {
}
lastDot := strings.LastIndex(bodyTypeName, ".")
if lastDot < 0 {
err := fmt.Errorf("%w: no . found in %q", errProtoFmt, bodyTypeName)
return TypeUnknown, msgType, err
}
}
// IdentifyOrUnknown wraps Identify to return TypeUnknown and/or
// MessageTypeUnknown in the case where either one cannot be determined due to
// an error.
pt, mt, _ := Identify(msg)
return pt, mt
}
func (cerr constErr) Error() string {
return string(cerr)
}