{"modulePath":"github.com/maschmid/serving","version":"v0.2.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package queue\n\n## Constants\n\n```go\nconst (\n\t// RequestQueuePortName specifies the port name to use for http requests\n\t// in queue-proxy container.\n\tRequestQueuePortName string = \"queue-port\"\n\n\t// RequestQueuePort specifies the port number to use for http requests\n\t// in queue-proxy container.\n\tRequestQueuePort = 8012\n\n\t// RequestQueueAdminPortName specifies the port name for\n\t// health check and lifecyle hooks for queue-proxy.\n\tRequestQueueAdminPortName string = \"queueadm-port\"\n\n\t// RequestQueueAdminPort specifies the port number for\n\t// health check and lifecyle hooks for queue-proxy.\n\tRequestQueueAdminPort = 8022\n\n\t// RequestQueueQuitPath specifies the path to send quit request to\n\t// queue-proxy. This is used for preStop hook of queue-proxy. It:\n\t// - marks the service as not ready, so that requests will no longer\n\t//   be routed to it,\n\t// - adds a small delay, so that the container doesn't get killed at\n\t//   the same time the pod is marked for removal.\n\tRequestQueueQuitPath = \"quitquitquit\"\n\n\t// RequestQueueHealthPath specifies the path for health checks for\n\t// queue-proxy.\n\tRequestQueueHealthPath = \"health\"\n)\n```\n\n## Types\n\n```go\ntype Breaker struct {\n\t// contains filtered or unexported fields\n}\n```\nBreaker is a component that enforces a concurrency limit on the execution of a function. It also maintains a queue of function executions in excess of the concurrency limit. Function call attempts beyond the limit of the queue are failed immediately.\n\n```go\nfunc NewBreaker(queueDepth, maxConcurrency int32) *Breaker\n```\nNewBreaker creates a Breaker with the desired queue depth and concurrency limit.\n\n```go\nfunc (b *Breaker) Maybe(thunk func()) bool\n```\nMaybe conditionally executes thunk based on the Breaker concurrency and queue parameters. If the concurrency limit and queue capacity are already consumed, Maybe returns immediately without calling thunk. If the thunk was executed, Maybe returns true, else false.\n\n```go\ntype Channels struct {\n\t// Ticks with every request arrived/completed respectively\n\tReqChan chan ReqEvent\n\t// Ticks with every stat report request\n\tReportChan \u003c-chan time.Time\n\t// Stat reporting channel\n\tStatChan chan *autoscaler.Stat\n}\n```\nChannels is a structure for holding the channels for driving Stats. It's just to make the NewStats signature easier to read.\n\n```go\ntype ReqEvent struct {\n\tTime      time.Time\n\tEventType ReqEventType\n}\n```\nReqEvent represents either an incoming or closed request.\n\n```go\ntype ReqEventType int\n```\nReqEventType denotes the type (incoming/closed) of a ReqEvent.\n\n```go\nconst (\n\t// ReqIn represents an incoming request\n\tReqIn ReqEventType = iota\n\t// ReqOut represents a finished request\n\tReqOut\n)\n```\n\n```go\ntype Stats struct {\n\t// contains filtered or unexported fields\n}\n```\nStats is a structure for holding channels per pod.\n\n```go\nfunc NewStats(podName string, channels Channels, startedAt time.Time) *Stats\n```\nNewStats instantiates a new instance of Stats.\n\n","path":"github.com/maschmid/serving/pkg/queue","name":"queue","synopsis":"","isRedistributable":true}
