calldecision

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package calldecision decides how a shared call to the store ended, exactly once, under one lock: either the store returned in time or its deadline fired first. Whichever takes the lock first wins; the other then counts for nothing.

The rule is by the order of the two events at the lock, not by the instants of the reply and of the deadline: the deadline of a call is a runtime timer, and the clock package of the repository cannot stand in for it, so a comparison of instants would not be deterministic in a test. A reply that comes a hair before the deadline but takes the lock after the callback counts as overdue; the window is the time between the return of the store and the next few instructions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decision

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

Decision is the verdict on one call. The zero value is a call that is still running.

func (*Decision) Expire

func (d *Decision) Expire(onOverdue func()) bool

Expire is called when the deadline of the call fires. It runs onOverdue, under the lock of the decision, unless the store has already returned in time, and reports whether it ran.

func (*Decision) Return

func (d *Decision) Return() bool

Return is called when the store returned. It reports whether the deadline had fired first, so the reply is late. After it, Expire runs nothing.

Jump to

Keyboard shortcuts

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