utils

package
v0.0.0-...-02374a7 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XML_PREFIX  = "xml"
	JSON_PREFIX = "json"
)

These strings are prefixed onto data put in the backend, to designate its type.

View Source
const (
	CASSANDRA_DEFAULT_TTL_SECONDS    = 2400
	REDIS_DEFAULT_EXPIRATION_MINUTES = 60
	RATE_LIMITER_NUM_REQUESTS        = 100
	REQUEST_MAX_SIZE_BYTES           = 10 * 1024
	REQUEST_MAX_NUM_VALUES           = 10
	REQUEST_MAX_TTL_SECONDS          = 3600
)

The following numeric constants serve as configuration defaults

View Source
const (
	MISSING_KEY               = iota // GET http.StatusBadRequest 400
	RECORD_EXISTS                    // PUT http.StatusBadRequest 400
	PUT_MAX_NUM_VALUES               // PUT http.StatusBadRequest 400
	PUT_BAD_REQUEST                  // PUT http.StatusBadRequest 400
	NEGATIVE_TTL                     // PUT http.StatusBadRequest 400
	MALFORMED_XML                    // PUT http.StatusBadRequest 400
	UNSUPPORTED_DATA_TO_STORE        // PUT http.StatusBadRequest 400
	MISSING_VALUE                    // PUT http.StatusBadRequest 400
	BAD_PAYLOAD_SIZE                 // PUT http.StatusBadRequest 400
	KEY_NOT_FOUND                    // GET http.StatusNotFound 404
	KEY_LENGTH                       // GET http.StatusNotFound 404
	UNKNOWN_STORED_DATA_TYPE         // GET http.StatusInternalServerError 500
	PUT_INTERNAL_SERVER              // PUT http.StatusInternalServerError 500
	MARSHAL_RESPONSE                 // PUT http.StatusInternalServerError 500
	PUT_DEADLINE_EXCEEDED            // PUT HttpDependencyTimeout 597
)

Prebid Cache error types

View Source
const HTTPDependencyTimeout = 597

HTTPDependencyTimeout is the status code for errors due to a downstream dependency timeout.

Variables

This section is empty.

Functions

func GenerateRandomID

func GenerateRandomID() (string, error)

GenerateRandomID generates a "github.com/gofrs/uuid" UUID

func GetServerName

func GetServerName() string

GetServerName Generates server name from node and pod name in K8S environment

Types

type PBCError

type PBCError struct {
	Type       int
	StatusCode int
	// contains filtered or unexported fields
}

PBCError implements the error interface

func NewPBCError

func NewPBCError(errType int, msgs ...string) PBCError

NewPBCError returns an error with either a custom error message or not. The only required parameter is errType

func (PBCError) Error

func (e PBCError) Error() string

Error() implementation

Jump to

Keyboard shortcuts

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