1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
12 "git.curoverse.com/arvados.git/sdk/go/arvados"
13 "github.com/ghodss/yaml"
16 type eventSink interface {
17 Channel() <-chan *event
21 type eventSource interface {
39 // Detail returns the database row corresponding to the event. It can
40 // be called safely from multiple goroutines. Only one attempt will be
41 // made. If the database row cannot be retrieved, Detail returns nil.
42 func (e *event) Detail() *arvados.Log {
45 if e.logRow != nil || e.err != nil {
48 var logRow arvados.Log
50 e.err = e.db.QueryRow(`SELECT id, uuid, object_uuid, COALESCE(object_owner_uuid,''), COALESCE(event_type,''), event_at, created_at, properties FROM logs WHERE id = $1`, e.LogID).Scan(
54 &logRow.ObjectOwnerUUID,
60 logger(nil).WithField("LogID", e.LogID).WithError(e.err).Error("QueryRow failed")
63 e.err = yaml.Unmarshal(propYAML, &logRow.Properties)
65 logger(nil).WithField("LogID", e.LogID).WithError(e.err).Error("yaml decode failed")