message

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 3 Imported by: 17

Documentation

Index

Constants

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

Variables

This section is empty.

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) GetMessageId added in v1.1.0

func (m *Message) GetMessageId() string

func (*Message) GetName

func (m *Message) GetName() string

func (*Message) GetParentMessageId added in v1.1.0

func (m *Message) GetParentMessageId() string

func (*Message) GetRootMessageId added in v1.1.0

func (m *Message) GetRootMessageId() 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()
	GetRootMessageId() string
	GetParentMessageId() string
	GetMessageId() string
}

type Metric

type Metric struct {
	Message
}

func NewMetric

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

func (*Metric) Complete

func (e *Metric) Complete()

type NullMessage

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

func (*NullMessage) AddData

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

func (*NullMessage) Complete

func (m *NullMessage) Complete()

func (*NullMessage) GetData

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

func (*NullMessage) GetMessageId added in v1.1.0

func (m *NullMessage) GetMessageId() string

func (*NullMessage) GetName

func (m *NullMessage) GetName() string

func (*NullMessage) GetParentMessageId added in v1.1.0

func (m *NullMessage) GetParentMessageId() string

func (*NullMessage) GetRootMessageId added in v1.1.0

func (m *NullMessage) GetRootMessageId() string

func (*NullMessage) GetStatus

func (m *NullMessage) GetStatus() string

func (*NullMessage) GetTime

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

func (*NullMessage) GetType

func (m *NullMessage) GetType() string

func (*NullMessage) SetData

func (m *NullMessage) SetData(v string)

func (*NullMessage) SetStatus

func (m *NullMessage) SetStatus(status string)

func (*NullMessage) SetTime

func (m *NullMessage) SetTime(time time.Time)

func (*NullMessage) SetTimestamp

func (m *NullMessage) SetTimestamp(timestampMs int64)

type NullTransaction

type NullTransaction struct {
	NullMessage
}

func (*NullTransaction) AddChild added in v1.0.1

func (t *NullTransaction) AddChild(m Messager)

func (*NullTransaction) GetChildren

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

func (*NullTransaction) GetDuration

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

func (*NullTransaction) LogEvent

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

func (*NullTransaction) NewEvent

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

func (*NullTransaction) SetDuration

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

func (*NullTransaction) SetDurationStart

func (t *NullTransaction) SetDurationStart(duration time.Time)

func (*NullTransaction) SetMessageId added in v1.1.0

func (t *NullTransaction) SetMessageId(messageId string)

func (*NullTransaction) SetParentMessageId added in v1.1.0

func (t *NullTransaction) SetParentMessageId(parentMessageId string)

func (*NullTransaction) SetRootMessageId added in v1.1.0

func (t *NullTransaction) SetRootMessageId(rootMessageId string)

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)

func (*Transaction) SetMessageId added in v1.1.0

func (t *Transaction) SetMessageId(messageId string)

func (*Transaction) SetParentMessageId added in v1.1.0

func (t *Transaction) SetParentMessageId(parentMessageId string)

func (*Transaction) SetRootMessageId added in v1.1.0

func (t *Transaction) SetRootMessageId(rootMessageId string)

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)
	AddChild(m Messager)
	GetChildren() []Messager
	SetRootMessageId(rootMessageId string)
	SetParentMessageId(parentMessageId string)
	SetMessageId(messageId string)
}

Jump to

Keyboard shortcuts

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