util

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: BSD-2-Clause Imports: 3 Imported by: 5

Documentation

Overview

Package util provides UUIDs for CarbonAPI and CarbonZipper HTTP requests.

Index

Constants

View Source
const (
	StepSize = 50
)

Variables

This section is empty.

Functions

func Bounds

func Bounds(bucket int) (lower, upper int)

Bounds returns the lower and upper bounds of bucket number 'bucket'.

func Bucket

func Bucket(n int64, buckets int) int

Bucket finds the number of the bucket that 'n' falls into out of 'buckets' buckets.

func GetPriority added in v0.2.0

func GetPriority(ctx context.Context) int

GetPriority returns the current request priority. Less is more If not set, returns highest priority(0)

func GetUUID

func GetUUID(ctx context.Context) string

GetUUID gets the Carbon UUID of a request.

func MarshalCtx

func MarshalCtx(ctx context.Context, request *http.Request) *http.Request

MarshalCtx ensures that outgoing HTTP requests have a Carbon UUID.

func UUIDHandler

func UUIDHandler(h http.Handler) http.Handler

UUIDHandler is middleware that adds a Carbon UUID to all HTTP requests.

func WithPriority added in v0.2.0

func WithPriority(ctx context.Context, priority int) context.Context

WithPriority returns new context with priority set

func WithUUID

func WithUUID(ctx context.Context) context.Context

WithUUID ensures that a context has a Carbon UUID.

Types

This section is empty.

Jump to

Keyboard shortcuts

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