Ejemplo n.º 1
0
// String formats transaction into human readable string.
func (t Transaction) String() string {
	// Compute priority as a floating point number from 0-100 for readability.
	floatPri := 100 * float64(t.Priority) / float64(math.MaxInt32)
	if len(t.Name) > 0 {
		return fmt.Sprintf("%q id=%s key=%s pri=%.8f iso=%s stat=%s epo=%d ts=%s orig=%s max=%s",
			t.Name, util.UUID(t.ID).Short(), t.Key, floatPri, t.Isolation, t.Status, t.Epoch, t.Timestamp, t.OrigTimestamp, t.MaxTimestamp)
	}
	return fmt.Sprintf("id=%s key=%s pri=%.8f iso=%s stat=%s epo=%d ts=%s orig=%s max=%s",
		util.UUID(t.ID).Short(), t.Key, floatPri, t.Isolation, t.Status, t.Epoch, t.Timestamp, t.OrigTimestamp, t.MaxTimestamp)
}
Ejemplo n.º 2
0
// TraceID implements tracer.Traceable. For a nontrivial Transaction, it
// returns 't', followed by the transaction ID. Otherwise, the empty string is
// returned.
func (t *Transaction) TraceID() string {
	if t == nil || len(t.ID) == 0 {
		return ""
	}
	s := util.UUID(t.ID).String()
	return "t" + s
}
Ejemplo n.º 3
0
// Short returns the short form of the Transaction's UUID.
func (t *Transaction) Short() string {
	return util.UUID(t.GetID()).Short()
}
Ejemplo n.º 4
0
// Short returns the short form of the Transaction's UUID.
func (t Transaction) Short() string {
	return util.UUID(t.ID).Short()
}