X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/bdb92619b5f6d920119b8c32c3027cf4b751ed16..1667f9860de21d29bbe32bb827db29eca62d9aeb:/services/ws/session_v0.go diff --git a/services/ws/session_v0.go b/services/ws/session_v0.go index 1cb302170b..44e2a1deb5 100644 --- a/services/ws/session_v0.go +++ b/services/ws/session_v0.go @@ -8,6 +8,7 @@ import ( "sync/atomic" "time" + "git.curoverse.com/arvados.git/sdk/go/arvados" "github.com/Sirupsen/logrus" ) @@ -15,13 +16,14 @@ var ( errQueueFull = errors.New("client queue full") errFrameTooBig = errors.New("frame too big") - sendObjectAttributes = []string{"state", "name"} + sendObjectAttributes = []string{"state", "name", "owner_uuid", "portable_data_hash"} v0subscribeOK = []byte(`{"status":200}`) v0subscribeFail = []byte(`{"status":400}`) ) type v0session struct { + ac *arvados.Client ws wsConn sendq chan<- interface{} db *sql.DB @@ -33,11 +35,15 @@ type v0session struct { setupOnce sync.Once } -func newSessionV0(ws wsConn, sendq chan<- interface{}, db *sql.DB, pc permChecker) (session, error) { +// newSessionV0 returns a v0 session: a partial port of the Rails/puma +// implementation, with just enough functionality to support Workbench +// and arv-mount. +func newSessionV0(ws wsConn, sendq chan<- interface{}, db *sql.DB, pc permChecker, ac *arvados.Client) (session, error) { sess := &v0session{ sendq: sendq, ws: ws, db: db, + ac: ac, permChecker: pc, log: logger(ws.Request().Context()), } @@ -85,13 +91,16 @@ func (sess *v0session) EventMessage(e *event) ([]byte, error) { return nil, err } + kind, _ := sess.ac.KindForUUID(detail.ObjectUUID) msg := map[string]interface{}{ "msgID": atomic.AddUint64(&sess.lastMsgID, 1), "id": detail.ID, "uuid": detail.UUID, "object_uuid": detail.ObjectUUID, "object_owner_uuid": detail.ObjectOwnerUUID, + "object_kind": kind, "event_type": detail.EventType, + "event_at": detail.EventAt, } if detail.Properties != nil && detail.Properties["text"] != nil { msg["properties"] = detail.Properties