sctx

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2021 License: BSD-3-Clause Imports: 6 Imported by: 9

Documentation

Overview

Package sctx provides convenience methods for context value injection and extraction.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTargetPrefix is returned when target prefix decoding fails.
	ErrTargetPrefix = errors.New("error decoding prefix string")
)

Functions

func GetHost

func GetHost(ctx context.Context) string

GetHost gets the request host from the context

func GetTag

func GetTag(ctx context.Context) *tags.Tag

GetTag gets the tag instance from the context

func GetTargets added in v0.2.0

func GetTargets(ctx context.Context) pss.Targets

GetTargets returns the specific target pinners for a corresponding chunk by reading the prefix targets sent in the download API.

func SetHost

func SetHost(ctx context.Context, domain string) context.Context

SetHost sets the http request host in the context

func SetTag

func SetTag(ctx context.Context, tagId *tags.Tag) context.Context

SetTag sets the tag instance in the context

func SetTargets added in v0.2.0

func SetTargets(ctx context.Context, targets string) context.Context

SetTargets set the target string in the context to be used downstream in netstore

Types

type HTTPRequestIDKey

type HTTPRequestIDKey struct{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL