package idle
Import Path
	google.golang.org/grpc/internal/idle (on go.dev)
Dependency Relation
	imports 5 packages, and imported by one package
Involved Source Files
	
		Package idle contains a component for managing idleness (entering and exiting)
		based on RPC activity.
Package-Level Type Names (total 2, both are exported)
	
		Enforcer is the functionality provided by grpc.ClientConn to enter
		and exit from idle mode.
		
			( Enforcer) EnterIdleMode()
			( Enforcer) ExitIdleMode() error
		
			
			*google.golang.org/grpc.idler
		
			func NewManager(enforcer Enforcer, timeout time.Duration) *Manager
	
		Manager implements idleness detection and calls the configured Enforcer to
		enter/exit idle mode when appropriate.  Must be created by NewManager.
		
			
			
				// Count of active RPCs; -math.MaxInt32 means channel is idle or is trying to get there.
			
				// Boolean; True if there was an RPC since the last timer callback.
			actuallyIdle bool
			
				// Boolean; True when the manager is closed.
			
				Can be accessed without atomics or mutex since these are set at creation
				time and read-only after that.
				// Functionality provided by grpc.ClientConn.
			
				idleMu is used to guarantee mutual exclusion in two scenarios:
				- Opposing intentions:
				  - a: Idle timeout has fired and handleIdleTimeout() is trying to put
				    the channel in idle mode because the channel has been inactive.
				  - b: At the same time an RPC is made on the channel, and OnCallBegin()
				    is trying to prevent the channel from going idle.
				- Competing intentions:
				  - The channel is in idle mode and there are multiple RPCs starting at
				    the same time, all trying to move the channel out of idle. Only one
				    of them should succeed in doing so, while the other RPCs should
				    piggyback on the first one and be successfully handled.
			
				State accessed atomically.
				// Unix timestamp in nanos; time when the most recent RPC completed.
			timeout time.Duration
			timer *time.Timer
		
			
				Close stops the timer associated with the Manager, if it exists.
			
				EnterIdleModeForTesting instructs the channel to enter idle mode.
			
				ExitIdleMode instructs m to call the enforcer's ExitIdleMode and update m's
				internal state.
			
				OnCallBegin is invoked at the start of every RPC.
			
				OnCallEnd is invoked at the end of every RPC.
			
			
				handleIdleTimeout is the timer callback that is invoked upon expiry of the
				configured idle timeout. The channel is considered inactive if there are no
				ongoing calls and no RPC activity since the last time the timer fired.
			(*Manager) isClosed() bool
			(*Manager) resetIdleTimer(d time.Duration)
			
				resetIdleTimerLocked resets the idle timer to the given duration.  Called
				when exiting idle mode or when the timer fires and we need to reset it.
			
				tryEnterIdleMode instructs the channel to enter idle mode. But before
				that, it performs a last minute check to ensure that no new RPC has come in,
				making the channel active.
				
				Return value indicates whether or not the channel moved to idle mode.
				
				Holds idleMu which ensures mutual exclusion with exitIdleMode.
		
			func NewManager(enforcer Enforcer, timeout time.Duration) *Manager
Package-Level Functions (only one, which is exported)
	
		NewManager creates a new idleness manager implementation for the
		given idle timeout.  It begins in idle mode.
Package-Level Variables (only one, which is unexported)
	The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64)