9 "git.curoverse.com/arvados.git/sdk/go/arvados"
13 errQueueFull = errors.New("client queue full")
14 errFrameTooBig = errors.New("frame too big")
17 type sessionV0 struct {
19 proxyClient *proxyClient
20 subscribed map[string]bool
25 func NewSessionV0(ws wsConn, ac arvados.Client) (session, error) {
28 proxyClient: NewProxyClient(ac),
29 subscribed: make(map[string]bool),
32 err := ws.Request().ParseForm()
34 log.Printf("%s ParseForm: %s", ws.Request().RemoteAddr, err)
37 token := ws.Request().Form.Get("api_token")
38 sess.proxyClient.SetToken(token)
39 sess.debugLogf("handlerV0: token = %+q", token)
44 func (sess *sessionV0) debugLogf(s string, args ...interface{}) {
45 args = append([]interface{}{sess.ws.Request().RemoteAddr}, args...)
46 debugLogf("%s "+s, args...)
49 func (sess *sessionV0) Receive(msg map[string]interface{}) {
50 sess.debugLogf("received message: %+v", msg)
51 sess.debugLogf("subscribing to *")
52 sess.subscribed["*"] = true
55 func (sess *sessionV0) EventMessage(e *event) ([]byte, error) {
60 ok, err := sess.proxyClient.CheckReadPermission(detail.UUID)
61 if err != nil || !ok {
65 return json.Marshal(map[string]interface{}{
69 "object_uuid": detail.ObjectUUID,
70 "object_owner_uuid": detail.ObjectOwnerUUID,
71 "event_type": detail.EventType,
75 func (sess *sessionV0) Filter(e *event) bool {
78 defer sess.mtx.Unlock()
80 case sess.subscribed["*"]:
84 case sess.subscribed[detail.ObjectUUID]:
86 case sess.subscribed[detail.ObjectOwnerUUID]: