19088: Document S3 properties-as-metadata feature.
[arvados.git] / services / ws / session.go
index a0658d964cb8d2b97e32e83c22dc39370813fad5..c0cfbd6d02f6ff37083f426c85084effae45f212 100644 (file)
@@ -1,10 +1,20 @@
-package main
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+package ws
+
+import (
+       "database/sql"
+
+       "git.arvados.org/arvados.git/sdk/go/arvados"
+)
 
 type session interface {
-       // Receive processes a message received from the client. If
-       // the returned list of messages is non-nil, they will be
-       // queued for sending to the client.
-       Receive(map[string]interface{}, []byte) [][]byte
+       // Receive processes a message received from the client. If a
+       // non-nil error is returned, the connection will be
+       // terminated.
+       Receive([]byte) error
 
        // Filter returns true if the event should be queued for
        // sending to the client. It should return as fast as
@@ -22,6 +32,6 @@ type session interface {
        // incoming events will be queued. If the event queue fills
        // up, the connection will be dropped.
        EventMessage(*event) ([]byte, error)
-
-       debugLogf(string, ...interface{})
 }
+
+type sessionFactory func(wsConn, chan<- interface{}, *sql.DB, permChecker, *arvados.Client) (session, error)