memoryprotection

package
v1.49.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RequestsProcessed = promauto.NewCounterVec(prometheus.CounterOpts{
	Namespace: "spicedb",
	Subsystem: "memory_middleware",
	Name:      "requests_processed_total",
	Help:      "Total requests processed by the memory protection middleware (flag --memory-protection-enabled)",
}, []string{"endpoint", "accepted"})

RequestsProcessed tracks requests that were processed by this middleware.

Functions

This section is empty.

Types

type HarcodedMemoryUsageProvider

type HarcodedMemoryUsageProvider struct {
	AcceptAllRequests bool
}

func (*HarcodedMemoryUsageProvider) IsMemLimitReached

func (n *HarcodedMemoryUsageProvider) IsMemLimitReached() bool

type MemoryProtectionMiddleware

type MemoryProtectionMiddleware struct {
	// contains filtered or unexported fields
}

func New

func New(usageProvider MemoryUsageProvider, name string) *MemoryProtectionMiddleware

func (*MemoryProtectionMiddleware) StreamServerInterceptor

func (am *MemoryProtectionMiddleware) StreamServerInterceptor() grpc.StreamServerInterceptor

StreamServerInterceptor returns a stream server interceptor that rejects incoming requests is memory usage is too high

func (*MemoryProtectionMiddleware) UnaryServerInterceptor

func (am *MemoryProtectionMiddleware) UnaryServerInterceptor() grpc.UnaryServerInterceptor

UnaryServerInterceptor returns a unary server interceptor that rejects incoming requests is memory usage is too high

type MemoryUsageProvider

type MemoryUsageProvider interface {
	IsMemLimitReached() bool
}

type NoopMemoryUsageProvider

type NoopMemoryUsageProvider struct{}

func NewNoopMemoryUsageProvider

func NewNoopMemoryUsageProvider() *NoopMemoryUsageProvider

func (*NoopMemoryUsageProvider) IsMemLimitReached

func (n *NoopMemoryUsageProvider) IsMemLimitReached() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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