// id cannot be set // timestamp cannot be set func (a *rethinkAPIServer) CreateJobStatus(ctx context.Context, request *persist.JobStatus) (response *persist.JobStatus, err error) { defer func(start time.Time) { a.Log(request, response, err, time.Since(start)) }(time.Now()) if request.Id != "" { return nil, ErrIDSet } if request.Timestamp != nil { return nil, ErrTimestampSet } request.Id = uuid.New() request.Timestamp = a.now() if err := a.insertMessage(jobStatusesTable, request); err != nil { return nil, err } return request, nil }
// id cannot be set // timestamp cannot be set func (a *rethinkAPIServer) CreateJobLog(ctx context.Context, request *persist.JobLog) (response *persist.JobLog, err error) { defer func(start time.Time) { a.Log(request, response, err, time.Since(start)) }(time.Now()) if request.Id != "" { return nil, ErrIDSet } // TODO: do we want to set the timestamp here, or have it be based on the actual log time? // actual log time (which we do not propogate yet) seems like a better option, but to be consistent // while the persist API is not well documented, setting it here for now if request.Timestamp != nil { return nil, ErrTimestampSet } request.Id = uuid.New() request.Timestamp = a.now() if err := a.insertMessage(jobLogsTable, request); err != nil { return nil, err } return request, nil }
func testNamespace() string { return fmt.Sprintf("test-%s", uuid.New()) }