Documentation
¶
Overview ¶
Copyright (c) Microsoft Corporation. Licensed under the MIT License.
Index ¶
- Constants
- Variables
- func BlobUrl(c *gin.Context) string
- func FillCorrelationId(c *gin.Context)
- func IsRequestFromAPeer(c *gin.Context) bool
- func Logger(c *gin.Context) zerolog.Logger
- func Merge[T any](cs ...<-chan T) <-chan T
- func RangeStartIndex(rangeValue string) (int64, error)
- func SetOutboundHeaders(r *http.Request, c *gin.Context)
Constants ¶
const ( P2pLookupCacheTtl = 500 * time.Millisecond P2pLookupNotFoundValue = "PEER_NOT_FOUND" )
Cache constants.
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.
const ( P2PHeaderKey = "X-MS-Cluster-P2P-RequestFromPeer" CorrelationHeaderKey = "X-MS-Cluster-P2P-CorrelationId" NodeHeaderKey = "X-MS-Cluster-P2P-Node" )
Request headers.
const ( PeerResolutionStartLog = "peer resolution start" PeerResolutionStopLog = "peer resolution stop" PeerNotFoundLog = "peer not found" PeerResolutionExhaustedLog = "peer resolution exhausted" PeerRequestErrorLog = "peer request error" )
Log messages.
const (
KeyTTL = 30 * time.Minute
)
P2P network.
Variables ¶
var (
NodeName, _ = os.Hostname()
Namespace = "peerd-ns"
// KubeConfigPath is the path of the kubeconfig file.
KubeConfigPath = "/opt/peerd/kubeconfig"
)
Functions ¶
func FillCorrelationId ¶
func IsRequestFromAPeer ¶
IsRequestFromAPeer indicates if the current request is from a peer.
func Merge ¶
func Merge[T any](cs ...<-chan T) <-chan T
Merge merges multiple input channels into a single output channel. It starts a goroutine for each input channel and sends the values from each input channel to the output channel. Once all input channels are closed, it closes the output channel. The function returns the output channel.
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".
Types ¶
This section is empty.