package idle

import "google.golang.org/grpc/internal/idle"

Package idle contains a component for managing idleness (entering and exiting) based on RPC activity.

Index

Types

type ClientConn

type ClientConn interface {
	ExitIdleMode()
	EnterIdleMode()
}

ClientConn is the functionality provided by grpc.ClientConn to enter and exit from idle mode.

type Manager

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

Manager implements idleness detection and calls the ClientConn to enter/exit idle mode when appropriate. Must be created by NewManager.

func NewManager

func NewManager(cc ClientConn, timeout time.Duration) *Manager

NewManager creates a new idleness manager implementation for the given idle timeout. It begins in idle mode.

func (*Manager) Close

func (m *Manager) Close()

Close stops the timer associated with the Manager, if it exists.

func (*Manager) EnterIdleModeForTesting

func (m *Manager) EnterIdleModeForTesting()

EnterIdleModeForTesting instructs the channel to enter idle mode.

func (*Manager) ExitIdleMode

func (m *Manager) ExitIdleMode()

ExitIdleMode instructs m to call the ClientConn's ExitIdleMode and update its internal state.

func (*Manager) OnCallBegin

func (m *Manager) OnCallBegin()

OnCallBegin is invoked at the start of every RPC.

func (*Manager) OnCallEnd

func (m *Manager) OnCallEnd()

OnCallEnd is invoked at the end of every RPC.

func (*Manager) UnsafeSetNotIdle

func (m *Manager) UnsafeSetNotIdle()

UnsafeSetNotIdle instructs the Manager to update its internal state to reflect the reality that the channel is no longer in IDLE mode.

N.B. This method is intended only for internal use by the gRPC client when it exits IDLE mode **manually** from `Dial`. The callsite must ensure:

Source Files

idle.go

Version
v1.80.0-dev
Published
Jan 21, 2026
Platform
js/wasm
Imports
4 packages
Last checked
11 minutes ago

Tools for package owners.