message

package
v2.0.4+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2022 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CatSuccess = "0"
	CatError   = "-1"
)
View Source
const (
	ReadableProtocol = "PT1"
	BinaryProtocol   = "NT1"
)

Variables

View Source
var NullMessage = &nullMessage{}
View Source
var NullTransaction = &nullTransaction{}

Functions

This section is empty.

Types

type BinaryEncoder

type BinaryEncoder struct {
	// contains filtered or unexported fields
}

func NewBinaryEncoder

func NewBinaryEncoder() *BinaryEncoder

func (*BinaryEncoder) EncodeEvent

func (e *BinaryEncoder) EncodeEvent(buf *bytes.Buffer, m *Event) (err error)

func (*BinaryEncoder) EncodeHeader

func (e *BinaryEncoder) EncodeHeader(buf *bytes.Buffer, header *Header) (err error)

func (*BinaryEncoder) EncodeHeartbeat

func (e *BinaryEncoder) EncodeHeartbeat(buf *bytes.Buffer, m *Heartbeat) (err error)

func (*BinaryEncoder) EncodeMessage

func (e *BinaryEncoder) EncodeMessage(buf *bytes.Buffer, message Messager) (err error)

func (*BinaryEncoder) EncodeMetric

func (e *BinaryEncoder) EncodeMetric(buf *bytes.Buffer, m *Metric) (err error)

func (*BinaryEncoder) EncodeTransaction

func (e *BinaryEncoder) EncodeTransaction(buf *bytes.Buffer, trans *Transaction) (err error)

type Encoder

type Encoder interface {
	EncodeHeader(*bytes.Buffer, *Header) error
	EncodeMessage(*bytes.Buffer, Messager) error
	EncodeTransaction(*bytes.Buffer, *Transaction) error
	EncodeEvent(*bytes.Buffer, *Event) error
	EncodeHeartbeat(*bytes.Buffer, *Heartbeat) error
	EncodeMetric(*bytes.Buffer, *Metric) error
}

type Event

type Event struct {
	Message
}

func NewEvent

func NewEvent(mtype, name string, flush Flush) *Event

func (*Event) Complete

func (e *Event) Complete()

type Flush

type Flush func(m Messager)
type Header struct {
	Domain   string
	Hostname string
	Ip       string

	MessageId       string
	ParentMessageId string
	RootMessageId   string
}

type Heartbeat

type Heartbeat struct {
	Message
}

func NewHeartbeat

func NewHeartbeat(mtype, name string, flush Flush) *Heartbeat

func (*Heartbeat) Complete

func (e *Heartbeat) Complete()

type Message

type Message struct {
	Type   string
	Name   string
	Status string
	// contains filtered or unexported fields
}

func NewMessage

func NewMessage(mtype, name string, flush Flush) Message

func (*Message) AddData

func (m *Message) AddData(k string, v ...string)

func (*Message) Complete

func (m *Message) Complete()

func (*Message) GetData

func (m *Message) GetData() *bytes.Buffer

func (*Message) GetName

func (m *Message) GetName() string

func (*Message) GetStatus

func (m *Message) GetStatus() string

func (*Message) GetTime

func (m *Message) GetTime() time.Time

func (*Message) GetType

func (m *Message) GetType() string

func (*Message) SetData

func (m *Message) SetData(v string)

func (*Message) SetStatus

func (m *Message) SetStatus(status string)

func (*Message) SetSuccessStatus

func (m *Message) SetSuccessStatus()

func (*Message) SetTime

func (m *Message) SetTime(t time.Time)

type MessageGetter

type MessageGetter interface {
	GetType() string
	GetName() string
	GetStatus() string
	GetData() *bytes.Buffer
	GetTime() time.Time
}

noinspection GoNameStartsWithPackageName

type Messager

type Messager interface {
	MessageGetter
	AddData(k string, v ...string)
	SetData(v string)
	SetStatus(status string)
	SetTime(time time.Time)
	Complete()
}

type Metric

type Metric struct {
	Message
}

func NewMetric

func NewMetric(mtype, name string, flush Flush) *Metric

func (*Metric) Complete

func (e *Metric) Complete()

type Transaction

type Transaction struct {
	Message
	// contains filtered or unexported fields
}

func NewTransaction

func NewTransaction(mtype, name string, flush Flush) *Transaction

func (*Transaction) AddChild

func (t *Transaction) AddChild(m Messager)

func (*Transaction) Complete

func (t *Transaction) Complete()

func (*Transaction) GetChildren

func (t *Transaction) GetChildren() []Messager

func (*Transaction) GetDuration

func (t *Transaction) GetDuration() time.Duration

func (*Transaction) LogEvent

func (t *Transaction) LogEvent(mtype, name string, args ...string)

func (*Transaction) NewEvent

func (t *Transaction) NewEvent(mtype, name string) Messager

func (*Transaction) SetDuration

func (t *Transaction) SetDuration(duration time.Duration)

func (*Transaction) SetDurationStart

func (t *Transaction) SetDurationStart(time time.Time)

type TransactionGetter

type TransactionGetter interface {
	GetDuration() time.Duration
}

type Transactor

type Transactor interface {
	Messager
	TransactionGetter
	SetDuration(duration time.Duration)
	SetDurationStart(time time.Time)
	NewEvent(mtype, name string) Messager
	LogEvent(mtype, name string, args ...string)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL