Documentation
¶
Overview ¶
Copyright (c) Microsoft Corporation. Licensed under the MIT License.
Index ¶
Constants ¶
View Source
const ( CorrelationIdCtxKey = "correlation_id" DigestCtxKey = "digest" FileChunkCtxKey = "file_chunk" BlobUrlCtxKey = "blob_url" BlobRangeCtxKey = "blob_range" NamespaceCtxKey = "namespace" ReferenceCtxKey = "reference" RefTypeCtxKey = "ref_type" LoggerCtxKey = "logger" )
Context keys.
View Source
const ( P2PHeaderKey = "X-MS-Peerd-RequestFromPeer" CorrelationHeaderKey = "X-MS-Peerd-CorrelationId" NodeHeaderKey = "X-MS-Peerd-Node" )
Request headers.
View Source
const ( PeerResolutionStartLog = "peer resolution start" PeerResolutionStopLog = "peer resolution stop" PeerNotFoundLog = "peer not found" PeerResolutionExhaustedLog = "peer resolution exhausted" PeerRequestErrorLog = "peer request error" )
Log messages.
View Source
const (
// KubeConfigPath is the path of the kubeconfig file.
KubeConfigPath = "/opt/peerd/kubeconfig"
)
Variables ¶
View Source
var (
NodeName, _ = os.Hostname()
)
Functions ¶
func FillCorrelationId ¶
func FillCorrelationId(c Context)
FillCorrelationId fills the correlation ID in the context.
func IsRequestFromAPeer ¶
IsRequestFromAPeer indicates if the current request is from a peer.
func RangeStartIndex ¶
RangeStartIndex returns the start index of a byte range specified in the given range header value. It expects the range value to be in the format "bytes=startIndex-endIndex".
func SetOutboundHeaders ¶
SetOutboundHeaders sets the mandatory headers for all outbound requests.
Types ¶
type Context ¶
Context is the request context that can be passed around to various components to provide request specific information.
func FromContext ¶
FromContext creates a new context from the given gin context.
Click to show internal directories.
Click to hide internal directories.