1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
10 "git.curoverse.com/arvados.git/sdk/go/arvados"
13 type session interface {
14 // Receive processes a message received from the client. If a
15 // non-nil error is returned, the connection will be
19 // Filter returns true if the event should be queued for
20 // sending to the client. It should return as fast as
21 // possible, and must not block.
24 // EventMessage encodes the given event (from the front of the
25 // queue) into a form suitable to send to the client. If a
26 // non-nil error is returned, the connection is terminated. If
27 // the returned buffer is empty, nothing is sent to the client
28 // and the event is not counted in statistics.
30 // Unlike Filter, EventMessage can block without affecting
31 // other connections. If EventMessage is slow, additional
32 // incoming events will be queued. If the event queue fills
33 // up, the connection will be dropped.
34 EventMessage(*event) ([]byte, error)
37 type sessionFactory func(wsConn, chan<- interface{}, *sql.DB, permChecker, *arvados.Client) (session, error)