Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrActive is the refusal of a session while another one runs, and // the session beginning does not preempt it. ErrActive = errors.New("an audit session is already running") // ErrBusy is the refusal of a session that waited too long for the // one beginning before it: that one is activating, which waits for // the bus to accept its publication. ErrBusy = errors.New("another audit session is beginning") )
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func (*Registry) Begin ¶
func (r *Registry) Begin(ctx context.Context, q chan plog.LogMessage, subsystems []string, preemptC chan struct{}, user string, preempt bool, activate func()) (Session, error)
Begin makes a session the current one, or says why it did not: there is at most one. A current session is returned and kept, with ErrActive, unless preempt asks to end it: it is then told so, by the close of its PreemptC, and replaced.
The check and the replacement are one step, so two sessions beginning at once can not both find none.
activate, when not nil, is called for a session that begins, before the next session can begin: it tells the subsystems to send their logs to q. A session preempted right after it registered has then told them before the session preempting it, which they hear last and keep. The stop of the preempted session, naming a queue they no longer send to, changes nothing.
A session waits for the one beginning before it until ctx is done, and is then refused with ErrBusy.
func (*Registry) Stop ¶
func (r *Registry) Stop(q chan plog.LogMessage)