request

package
v1.0.0-beta.7 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultNamespaceName is for "default" namespace in the cluster which means all the databases created are under a single
	// namespace.
	// It is totally fine for a deployment to choose this and just have one namespace. The default assigned value for
	// this namespace is 1.
	DefaultNamespaceName string = "default_namespace"

	DefaultNamespaceId = uint32(1)

	UnknownValue = "unknown"
)

Variables

View Source
var ErrNamespaceNotFound = errors.NotFound("namespace not found")

Functions

func GetMetadataFromHeader

func GetMetadataFromHeader(ctx context.Context) (string, bool)

func GetNamespace

func GetNamespace(ctx context.Context) (string, error)

func IsAdminApi

func IsAdminApi(fullMethodName string) bool

func IsHumanUser

func IsHumanUser(ctx context.Context) bool

func IsRead

func IsRead(ctx context.Context) bool

func IsWrite

func IsWrite(ctx context.Context) bool

func SetAccessToken

func SetAccessToken(ctx context.Context, token *AccessToken) context.Context

func SetNamespace

func SetNamespace(ctx context.Context, namespace string) context.Context

func SetRequestMetadata

func SetRequestMetadata(ctx context.Context, metadata Metadata) context.Context

Types

type AccessToken

type AccessToken struct {
	Namespace string
	Sub       string
}

func GetAccessToken

func GetAccessToken(ctx context.Context) (*AccessToken, error)

type AccessTokenNamespaceExtractor

type AccessTokenNamespaceExtractor struct{}

func (*AccessTokenNamespaceExtractor) Extract

func (tokenNamespaceExtractor *AccessTokenNamespaceExtractor) Extract(ctx context.Context) (string, error)

type Metadata

type Metadata struct {
	IsHuman bool
	// contains filtered or unexported fields
}

func GetGrpcEndPointMetadataFromFullMethod

func GetGrpcEndPointMetadataFromFullMethod(ctx context.Context, fullMethod string, methodType string) Metadata

func GetRequestMetadata

func GetRequestMetadata(ctx context.Context) (*Metadata, error)

func NewRequestEndpointMetadata

func NewRequestEndpointMetadata(ctx context.Context, serviceName string, methodInfo grpc.MethodInfo) Metadata

func (*Metadata) GetFullMethod

func (r *Metadata) GetFullMethod() string

func (*Metadata) GetInitialTags

func (r *Metadata) GetInitialTags() map[string]string

func (*Metadata) GetMethodInfo

func (r *Metadata) GetMethodInfo() grpc.MethodInfo

func (*Metadata) GetMethodName

func (r *Metadata) GetMethodName() string

func (*Metadata) GetServiceName

func (r *Metadata) GetServiceName() string

func (*Metadata) GetServiceType

func (r *Metadata) GetServiceType() string

func (*Metadata) GetUnAuthenticatedNamespaceName

func (r *Metadata) GetUnAuthenticatedNamespaceName() string

type MetadataCtxKey

type MetadataCtxKey struct{}

type NamespaceExtractor

type NamespaceExtractor interface {
	Extract(ctx context.Context) (string, error)
}

NamespaceExtractor - extract the namespace from context.

Jump to

Keyboard shortcuts

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